{"id":21358843,"url":"https://github.com/gameframex/com.gameframex.unity.event","last_synced_at":"2026-03-09T15:31:12.658Z","repository":{"id":232531384,"uuid":"784562527","full_name":"GameFrameX/com.gameframex.unity.event","owner":"GameFrameX","description":null,"archived":false,"fork":false,"pushed_at":"2025-12-23T14:56:42.000Z","size":49,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-25T04:43:56.623Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GameFrameX.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-04-10T05:08:33.000Z","updated_at":"2025-12-23T14:56:45.000Z","dependencies_parsed_at":"2024-04-10T06:27:43.509Z","dependency_job_id":"82337084-1451-42a9-b914-095295d3b4c9","html_url":"https://github.com/GameFrameX/com.gameframex.unity.event","commit_stats":null,"previous_names":["alianblank/com.alianblank.gameframex.unity.event","alianblank/com.gameframex.unity.event","gameframex/com.gameframex.unity.event"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/GameFrameX/com.gameframex.unity.event","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GameFrameX%2Fcom.gameframex.unity.event","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GameFrameX%2Fcom.gameframex.unity.event/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GameFrameX%2Fcom.gameframex.unity.event/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GameFrameX%2Fcom.gameframex.unity.event/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GameFrameX","download_url":"https://codeload.github.com/GameFrameX/com.gameframex.unity.event/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GameFrameX%2Fcom.gameframex.unity.event/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30301109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T14:33:48.460Z","status":"ssl_error","status_checked_at":"2026-03-09T14:33:48.027Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T05:22:36.954Z","updated_at":"2026-03-09T15:31:12.342Z","avatar_url":"https://github.com/GameFrameX.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿## HOMEPAGE\n\nGameFrameX 的 Event 游戏事件系统的组件\n\n**Event 游戏事件系统的组件 (Event Component)** - 提供游戏事件系统的组件相关的接口。\n\n# 使用文档(文档编写于GPT4)\n\nEventComponent 类是一个游戏事件系统的组件，用于管理游戏事件的订阅与派发。\n\n## 功能\n\n- **事件订阅与取消订阅：** 允许你根据事件ID来订阅或取消订阅事件处理回调函数。\n- **事件派发：** 提供了线程安全的事件派发方法 `Fire`，即使在非主线程也能保证在主线程回调事件处理函数，以及立即派发的方法 `FireNow`。\n- **处理函数统计：** 可以获取当前已订阅的事件处理函数数量和事件数量。\n- **默认事件处理函数设置：** 允许设置默认事件处理函数来捕获未明确订阅的事件。\n\n## 使用方法\n\n1. **获取事件数量和事件处理函数的数量：**\n\n   ```csharp\n   int eventHandlerCount = eventComponent.EventHandlerCount;\n   int eventCount = eventComponent.EventCount;\n   ```\n\n2. **订阅事件：**\n\n   ```csharp\n   eventComponent.Subscribe(\"game_start\", OnGameStart);\n   ```\n\n   其中 `OnGameStart` 是遵循 `EventHandler\u003cGameEventArgs\u003e` 委托的方法。\n\n3. **取消订阅事件：**\n\n   ```csharp\n   eventComponent.Unsubscribe(\"game_start\", OnGameStart);\n   ```\n\n4. **抛出事件：**\n\n    - 线程安全的方式（在下一帧分发）:\n\n      ```csharp\n      eventComponent.Fire(this, new GameEventArgs());\n      ```\n\n    - 立即模式（立刻分发）:\n\n      ```csharp\n      eventComponent.FireNow(this, new GameEventArgs());\n      ```\n\n5. **设置默认事件处理函数：**\n\n   ```csharp\n   eventComponent.SetDefaultHandler(OnDefaultEvent);\n   ```\n\n   其中 `OnDefaultEvent` 是遵循 `EventHandler\u003cGameEventArgs\u003e` 委托的方法。\n\n通过上述步骤，可以在游戏中有效地使用事件组件进行事件的订阅、取消订阅和派发，从而实现游戏中的事件驱动编程。\n\n# 使用方式(任选其一)\n\n1. 直接在 `manifest.json` 的文件中的 `dependencies` 节点下添加以下内容\n   ```json\n      {\"com.gameframex.unity.event\": \"https://github.com/AlianBlank/com.gameframex.unity.event.git\"}\n    ```\n2. 在Unity 的`Packages Manager` 中使用`Git URL` 的方式添加库,地址为：https://github.com/AlianBlank/com.gameframex.unity.event.git\n\n3. 直接下载仓库放置到Unity 项目的`Packages` 目录下。会自动加载识别","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgameframex%2Fcom.gameframex.unity.event","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgameframex%2Fcom.gameframex.unity.event","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgameframex%2Fcom.gameframex.unity.event/lists"}