Beispiel #1
0
 private void InitHostileFuncList()
 {
     DebugHelper.Assert(this.m_panelObj != null);
     if (this.m_panelObj != null)
     {
         Transform          transform = this.m_panelObj.transform.FindChild("HostileFuncList");
         CUIMiniEventScript component = transform.GetChild(0).GetComponent <CUIMiniEventScript>();
         ECheatAct[]        inList    = new ECheatAct[3];
         inList[1] = ECheatAct.FullHp;
         inList[2] = ECheatAct.FullEp;
         component.m_onClickEventParams.tag = this.CheatActListToMask(inList);
         EActTarget[] targetArray1 = new EActTarget[] { EActTarget.Hostile };
         component.m_onClickEventParams.tag2 = this.ActTarListToMask(targetArray1);
         CUIMiniEventScript script2   = transform.GetChild(1).GetComponent <CUIMiniEventScript>();
         ECheatAct[]        actArray2 = new ECheatAct[] { ECheatAct.SetLevel, ECheatAct.FullHp, ECheatAct.FullEp };
         script2.m_onClickEventParams.tag = this.CheatActListToMask(actArray2);
         EActTarget[] targetArray2 = new EActTarget[] { EActTarget.Hostile };
         script2.m_onClickEventParams.tag2 = this.ActTarListToMask(targetArray2);
         script2.m_onClickEventParams.tag3 = 1;
         CUIMiniEventScript script3   = transform.GetChild(2).GetComponent <CUIMiniEventScript>();
         ECheatAct[]        actArray3 = new ECheatAct[] { ECheatAct.ToggleAi };
         script3.m_onClickEventParams.tag = this.CheatActListToMask(actArray3);
         EActTarget[] targetArray3 = new EActTarget[] { EActTarget.Hostile };
         script3.m_onClickEventParams.tag2 = this.ActTarListToMask(targetArray3);
         this.m_aiBtnToggle = script3.gameObject;
     }
 }
Beispiel #2
0
        private int ActTarListToMask(List <EActTarget> inList)
        {
            int num = 0;

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

            List <ECheatAct> .Enumerator enumerator = list.GetEnumerator();
            while (enumerator.MoveNext())
            {
                ECheatAct current = enumerator.Current;
                List <EActTarget> .Enumerator enumerator2 = list2.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    EActTarget inTar = enumerator2.Current;
                    this.DoCheatAction(current, inTar, inParam);
                }
            }
        }
Beispiel #4
0
        private void DoCheatAction(ECheatAct inAct, EActTarget inTar, int inParam)
        {
            COM_PLAYERCAMP playerCamp = Singleton <GamePlayerCenter> .instance.GetHostPlayer().PlayerCamp;

            COM_PLAYERCAMP com_playercamp2 = (playerCamp != COM_PLAYERCAMP.COM_PLAYERCAMP_1) ? COM_PLAYERCAMP.COM_PLAYERCAMP_1 : COM_PLAYERCAMP.COM_PLAYERCAMP_2;
            COM_PLAYERCAMP inCamp          = (inTar != EActTarget.Hostile) ? playerCamp : com_playercamp2;

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

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

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

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

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

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

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

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

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

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

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

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

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

                OrganVisiter(COM_PLAYERCAMP.COM_PLAYERCAMP_1, inParam, new Action <ActorRoot, int>(CTrainingHelper.ReviveTower));
                OrganVisiter(COM_PLAYERCAMP.COM_PLAYERCAMP_2, inParam, new Action <ActorRoot, int>(CTrainingHelper.ReviveTower));
                break;

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

                bool   flag2   = (context2 != null) && context2.IsMobaMode();
                Player player3 = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer();

                if (((player3 != null) && (player3.Captain != 0)) && (player3.Captain.handle.ValueComponent != null))
                {
                    player3.Captain.handle.ValueComponent.ChangeGoldCoinInBattle(0x3e8, true, true, new Vector3(), false);
                }
                break;
            }

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