public void Init(GameObject cameraObj) { GameObject obj = ResourceSystem.Instance.NewObject("UI/SkillBar") as GameObject; Canvas canvas = obj.GetComponent<Canvas>(); if (null != canvas && null != cameraObj) { canvas.renderMode = RenderMode.ScreenSpaceCamera; canvas.worldCamera = cameraObj.GetComponent<Camera>(); uiCamera = canvas.worldCamera; } skillBar = obj.GetComponent<SkillBar>(); skillBar.Clear(); //订阅 subscribes.Add(Utility.EventSystem.Subscribe<int, int, int>("ui_add_skill_button", "ui", AddSkillButton)); subscribes.Add(Utility.EventSystem.Subscribe("ui_remove_skill_buttons", "ui", RemoveAllSkillButtons)); subscribes.Add(Utility.EventSystem.Subscribe<int, float, int>("ui_actor_mp", "ui", ChangeMp)); subscribes.Add(Utility.EventSystem.Subscribe<int, float>("ui_actor_hp", "ui", ChangeHp)); subscribes.Add(Utility.EventSystem.Subscribe<int, int, float>("ui_skill_cooldown", "ui", OnSkillCooldown)); subscribes.Add(Utility.EventSystem.Subscribe("ui_show", "ui", Show)); subscribes.Add(Utility.EventSystem.Subscribe("ui_hide", "ui", Hide)); //发布 //队员技能 skillBar.onSelectSkill = (int objID,int skillID) => { Utility.SendMessage("GameRoot", "OnCastSkill", new object[] { objID, skillID }); }; }