123456789101112131415161718192021222324252627282930313233343536 |
- using FairyGUI;
- namespace ET.Client
- {
- [Event(SceneType.Client)]
- public class SceneChangeFinishEvent_CreateUIHelp : AEvent<EventType.SceneLoadFinish>
- {
- protected override async ETTask Run(Scene scene, EventType.SceneLoadFinish args)
- {
- Log.Debug("loading HUD");
- var view = await UIHelper.Create("HUD");
- InitView(scene, view);
- }
- private void InitView(Scene scene, GComponent view)
- {
- var img = view.GetChild("img_direction");
- view.GetChild("btn_skill1").onClick.Add(() => {
- Scene currentScene = scene.GetComponent<CurrentScenesComponent>().Scene;
- var actor = currentScene.GetComponent<UnitComponent>().GetActor();
- if(actor != null)
- {
- actor.GetComponent<AnimatorComponent>().AppendCommand(AnimatorComponent.CommandType.Skill0);
- }
- });
- view.GetChild("btn_skill2").onClick.Add(() => {
- Scene currentScene = scene.GetComponent<CurrentScenesComponent>().Scene;
- var actor = currentScene.GetComponent<UnitComponent>().GetActor();
- if (actor != null)
- {
- actor.GetComponent<AnimatorComponent>().AppendCommand(AnimatorComponent.CommandType.Skill1);
- }
- });
- }
- }
- }
|