コード例 #1
0
        public void Enter(object param)
        {
            this._hudManager = new HUDManager();
            GRoot.inst.AddChild(this._hudManager.root);

            this._root = UIPackage.CreateObject("battle", "Main").asCom;
            this._root.displayObject.name = "battle";
            this._root.eventGraphicOnly   = true;
            GRoot.inst.AddChild(this._root);

            this._skillPanel  = new SkillPanel(this._root["skillPanel"].asCom);
            this._statesPanel = new StatesPanel(this._root["statsPanel"].asCom);
            this._rollingText = new RollingText(this._root["tips"].asCom);

            GTextInput lagInput = this._root["lag"].asTextInput;

            lagInput.onChanged.Add(this.OnLagInputChanged);

            GTextInput jitterInput = this._root["jitter"].asTextInput;

            jitterInput.onChanged.Add(this.OnJitterInputChanged);

            GButton exitBtn = this._root["exitBtn"].asButton;

            exitBtn.onClick.Add(this.OnQuitBtnClick);

            EventCenter.AddListener(UIEventType.ENTITY_CREATED, this.HandleEntityCreated);
            EventCenter.AddListener(UIEventType.ENTITY_DESTROIED, this.HandleEntityDestroied);
            EventCenter.AddListener(UIEventType.PICK_SKILL, this.HandlePickSkill);
            EventCenter.AddListener(UIEventType.DROP_SKILL, this.HandleDropSkill);
            EventCenter.AddListener(UIEventType.SKILL_ATTR_CHANGED, this.HandleSkillAttrChanged);
            EventCenter.AddListener(UIEventType.ATTR_CHANGED, this.HandleEntityAttrChanged);
            EventCenter.AddListener(UIEventType.SKILL_USE_FAILED, this.HandleSkillUseFailed);
            EventCenter.AddListener(UIEventType.ENTITY_DIE, this.HandleEntityDie);
            EventCenter.AddListener(UIEventType.BATTLE_END, this.HandleBattleEnd);
            EventCenter.AddListener(UIEventType.HURT, this.HandleEntityHurt);

            NetModule.instance.AddQCMDListener(Module.BATTLE, Command.QCMD_LEAVE_BATTLE, this.HandleLeaveBattle);

            BattleManager.Init(( BattleParams )param);
        }
コード例 #2
0
        public void Leave()
        {
            this.showNavMesh = false;
            TaskManager.instance.UnregisterTimer(this.OnReliveTimer);

            EventCenter.RemoveListener(UIEventType.ENTITY_CREATED, this.HandleEntityCreated);
            EventCenter.RemoveListener(UIEventType.ENTITY_DESTROIED, this.HandleEntityDestroied);
            EventCenter.RemoveListener(UIEventType.PICK_SKILL, this.HandlePickSkill);
            EventCenter.RemoveListener(UIEventType.DROP_SKILL, this.HandleDropSkill);
            EventCenter.RemoveListener(UIEventType.SKILL_ATTR_CHANGED, this.HandleSkillAttrChanged);
            EventCenter.RemoveListener(UIEventType.ATTR_CHANGED, this.HandleEntityAttrChanged);
            EventCenter.RemoveListener(UIEventType.SKILL_USE_FAILED, this.HandleSkillUseFailed);
            EventCenter.RemoveListener(UIEventType.ENTITY_DIE, this.HandleEntityDie);
            EventCenter.RemoveListener(UIEventType.BATTLE_END, this.HandleBattleEnd);
            EventCenter.RemoveListener(UIEventType.HURT, this.HandleEntityHurt);

            this._skillPanel.Dispose();
            this._skillPanel = null;

            this._statesPanel.Dispose();
            this._statesPanel = null;

            this._rollingText.Dispose();
            this._rollingText = null;

            this._hudManager.Dispose();
            this._hudManager = null;

            BattleManager.Dispose();

            if (this._root != null)
            {
                this._root.Dispose();
                this._root = null;
            }

            SceneLoader loader = new SceneLoader(string.Empty, "Empty", LoadSceneMode.Single);

            loader.Load(null, null, null, false, true, true);
        }