Beispiel #1
0
        private int ActTarListToMask(List <CTrainingHelper.EActTarget> inList)
        {
            int num = 0;

            List <CTrainingHelper.EActTarget> .Enumerator enumerator = inList.GetEnumerator();
            while (enumerator.MoveNext())
            {
                CTrainingHelper.EActTarget current = enumerator.get_Current();
                num |= 1 << (int)current;
            }
            return(num);
        }
Beispiel #2
0
        private void OnTrainingHelperCheat(CUIEvent uiEvent)
        {
            int tag  = uiEvent.m_eventParams.tag;
            int tag2 = uiEvent.m_eventParams.tag2;
            int tag3 = uiEvent.m_eventParams.tag3;
            List <CTrainingHelper.ECheatAct>  list  = this.CheatActMaskToList(tag);
            List <CTrainingHelper.EActTarget> list2 = this.ActTarMaskToList(tag2);

            List <CTrainingHelper.ECheatAct> .Enumerator enumerator = list.GetEnumerator();
            while (enumerator.MoveNext())
            {
                CTrainingHelper.ECheatAct current = enumerator.get_Current();
                List <CTrainingHelper.EActTarget> .Enumerator enumerator2 = list2.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    CTrainingHelper.EActTarget current2 = enumerator2.get_Current();
                    this.DoCheatAction(current, current2, tag3);
                }
            }
        }
Beispiel #3
0
        private void DoCheatAction(CTrainingHelper.ECheatAct inAct, CTrainingHelper.EActTarget inTar, int inParam)
        {
            Player hostPlayer = Singleton <GamePlayerCenter> .instance.GetHostPlayer();

            COM_PLAYERCAMP playerCamp     = hostPlayer.PlayerCamp;
            COM_PLAYERCAMP cOM_PLAYERCAMP = (playerCamp == COM_PLAYERCAMP.COM_PLAYERCAMP_1) ? COM_PLAYERCAMP.COM_PLAYERCAMP_2 : COM_PLAYERCAMP.COM_PLAYERCAMP_1;
            COM_PLAYERCAMP inCamp         = (inTar == CTrainingHelper.EActTarget.Hostile) ? cOM_PLAYERCAMP : playerCamp;

            switch (inAct)
            {
            case CTrainingHelper.ECheatAct.LevelUp:
                CTrainingHelper.HeroVisiter(inCamp, inParam, new Action <ActorRoot, int>(CTrainingHelper.LevelUp));
                break;

            case CTrainingHelper.ECheatAct.SetLevel:
                CTrainingHelper.HeroVisiter(inCamp, inParam, new Action <ActorRoot, int>(CTrainingHelper.ResetSkillLevel));
                CTrainingHelper.HeroVisiter(inCamp, inParam, new Action <ActorRoot, int>(CTrainingHelper.SetLevel));
                break;

            case CTrainingHelper.ECheatAct.FullHp:
                CTrainingHelper.HeroVisiter(inCamp, inParam, new Action <ActorRoot, int>(CTrainingHelper.FullHp));
                break;

            case CTrainingHelper.ECheatAct.FullEp:
                CTrainingHelper.HeroVisiter(inCamp, inParam, new Action <ActorRoot, int>(CTrainingHelper.FullEp));
                break;

            case CTrainingHelper.ECheatAct.ToggleInvincible:
            {
                SLevelContext curLvelContext = Singleton <BattleLogic> .instance.GetCurLvelContext();

                bool   arg_F7_0    = curLvelContext != null && curLvelContext.IsMobaMode();
                Player hostPlayer2 = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer();

                if (hostPlayer2 != null && hostPlayer2.Captain && hostPlayer2.Captain.handle.ActorControl is HeroWrapper)
                {
                    HeroWrapper heroWrapper = (HeroWrapper)hostPlayer2.Captain.handle.ActorControl;
                    heroWrapper.bGodMode = !heroWrapper.bGodMode;
                }
                this.m_invincibleToggleFlag = !this.m_invincibleToggleFlag;
                this.RefreshBtnToggleInvincible();
                break;
            }

            case CTrainingHelper.ECheatAct.ToggleAi:
                CTrainingHelper.HeroVisiter(inCamp, inParam, new Action <ActorRoot, int>(CTrainingHelper.ToggleAi));
                this.m_aiToggleFlag = !this.m_aiToggleFlag;
                this.RefreshBtnToggleAi();
                break;

            case CTrainingHelper.ECheatAct.ToggleSoldier:
                Singleton <BattleLogic> .GetInstance().mapLogic.EnableSoldierRegion(this.m_soldierToggleFlag);

                this.m_soldierToggleFlag = !this.m_soldierToggleFlag;
                this.RefreshBtnToggleSoldier();
                break;

            case CTrainingHelper.ECheatAct.ResetSoldier:
            {
                Singleton <BattleLogic> .instance.mapLogic.ResetSoldierRegion();

                Singleton <BattleLogic> .instance.dynamicProperty.ResetTimer();

                Singleton <GameObjMgr> .GetInstance().KillSoldiers();

                CTrainingHelper.OrganVisiter(COM_PLAYERCAMP.COM_PLAYERCAMP_1, inParam, new Action <ActorRoot, int>(CTrainingHelper.ReviveTower));
                CTrainingHelper.OrganVisiter(COM_PLAYERCAMP.COM_PLAYERCAMP_2, inParam, new Action <ActorRoot, int>(CTrainingHelper.ReviveTower));
                AttackOrder attackOrder = Singleton <BattleLogic> .instance.attackOrder;
                if (attackOrder != null)
                {
                    attackOrder.FightOver();
                    attackOrder.FightStart();
                }
                break;
            }

            case CTrainingHelper.ECheatAct.AddGold:
            {
                SLevelContext curLvelContext2 = Singleton <BattleLogic> .instance.GetCurLvelContext();

                bool   arg_268_0   = curLvelContext2 != null && curLvelContext2.IsMobaMode();
                Player hostPlayer3 = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer();

                if (hostPlayer3 != null && hostPlayer3.Captain)
                {
                    if (hostPlayer3.Captain.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Call)
                    {
                        CallActorWrapper callActorWrapper = hostPlayer3.Captain.handle.ActorControl as CallActorWrapper;
                        if (callActorWrapper != null && callActorWrapper.hostActor)
                        {
                            callActorWrapper.hostActor.handle.ValueComponent.ChangeGoldCoinInBattle(1000, true, true, default(Vector3), false, default(PoolObjHandle <ActorRoot>));
                        }
                    }
                    else if (hostPlayer3.Captain.handle.ValueComponent != null)
                    {
                        hostPlayer3.Captain.handle.ValueComponent.ChangeGoldCoinInBattle(1000, true, true, default(Vector3), false, default(PoolObjHandle <ActorRoot>));
                    }
                }
                break;
            }

            case CTrainingHelper.ECheatAct.ToggleZeroCd:
                CTrainingHelper.HeroVisiter(inCamp, inParam, new Action <ActorRoot, int>(CTrainingHelper.ToggleZeroCd));
                this.m_cdToggleFlag = !this.m_cdToggleFlag;
                this.RefreshBtnToggleCd();
                break;
            }
        }