Beispiel #1
0
        private void CheckBattleResetButton()
        {
            TowerParam tower = MonoSingleton <GameManager> .Instance.FindTower(GlobalVars.SelectedTowerID);

            if (tower == null)
            {
                return;
            }
            TowerResuponse towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;

            if (towerResuponse == null)
            {
                return;
            }
            TowerFloorParam currentFloor = towerResuponse.GetCurrentFloor();

            if (currentFloor == null)
            {
                return;
            }
            if (MonoSingleton <GameManager> .Instance.Player.Coin > (int)tower.floor_reset_coin && GlobalVars.SelectedQuestID == currentFloor.iname && towerResuponse.CheckEnemyDeck())
            {
                ((Selectable)this.BattleResetButton).set_interactable(true);
            }
            else
            {
                ((Selectable)this.BattleResetButton).set_interactable(false);
            }
        }
Beispiel #2
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 0)
            {
                return;
            }
            TowerRecoverData dataOfClass    = DataSource.FindDataOfClass <TowerRecoverData>(((Component)this).get_gameObject(), (TowerRecoverData)null);
            TowerResuponse   towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;

            if (Network.Mode != Network.EConnectMode.Online)
            {
                return;
            }
            if (dataOfClass != null)
            {
                byte floor = towerResuponse.GetCurrentFloor().floor;
                this.usedCoin = dataOfClass.useCoin;
                this.ExecRequest((WebAPI) new ReqTowerRecover(dataOfClass.towerID, dataOfClass.useCoin, (int)towerResuponse.round, floor, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                ((Behaviour)this).set_enabled(true);
            }
            else
            {
                ((Behaviour)this).set_enabled(false);
            }
        }
Beispiel #3
0
        private void SetEnemies(JSON_MapEnemyUnit[] json)
        {
            for (int index = 0; index < this.UnknownEnemyList.Count; ++index)
            {
                ((Component)this.UnknownEnemyList[index]).get_gameObject().SetActive(false);
            }
            List <JSON_MapEnemyUnit> list            = ((IEnumerable <JSON_MapEnemyUnit>)json).ToList <JSON_MapEnemyUnit>();
            TowerResuponse           towerResuponse  = MonoSingleton <GameManager> .Instance.TowerResuponse;
            TowerFloorParam          towerFloorParam = (TowerFloorParam)null;

            if (towerResuponse != null)
            {
                towerFloorParam = towerResuponse.GetCurrentFloor();
            }
            this.EnemyUnits.Clear();
            int index1 = 0;

            for (int index2 = 0; index2 < list.Count; ++index2)
            {
                NPCSetting npcSetting = new NPCSetting(list[index2]);
                Unit       data       = new Unit();
                data.Setup((UnitData)null, (UnitSetting)npcSetting, (Unit.DropItem)null, (Unit.DropItem)null);
                if (!data.IsGimmick)
                {
                    TowerEnemyListItem towerEnemyListItem;
                    if (this.EnemyList.Count <= index1)
                    {
                        towerEnemyListItem = (TowerEnemyListItem)((GameObject)Object.Instantiate <GameObject>((M0)this.EnemyTemplate)).GetComponent <TowerEnemyListItem>();
                        ((Component)towerEnemyListItem).get_transform().SetParent(this.EnemiesRoot.get_transform(), false);
                        this.EnemyList.Add(towerEnemyListItem);
                    }
                    else
                    {
                        towerEnemyListItem = this.EnemyList[index1];
                    }
                    if (towerFloorParam != null && towerFloorParam.iname == GlobalVars.SelectedQuestID && MonoSingleton <GameManager> .Instance.TowerEnemyUnit != null)
                    {
                        TowerResuponse.EnemyUnit enemyUnit = MonoSingleton <GameManager> .Instance.TowerEnemyUnit[index2];
                        data.Damage((int)data.MaximumStatus.param.hp - enemyUnit.hp, false);
                    }
                    DataSource.Bind <Unit>(((Component)towerEnemyListItem).get_gameObject(), data);
                    this.EnemyUnits.Add(data);
                    ++index1;
                }
            }
            for (int index2 = 0; index2 < this.EnemyList.Count; ++index2)
            {
                bool flag = index2 < list.Count && index2 < 10;
                ((Component)this.EnemyList[index2]).get_gameObject().SetActive(flag);
                this.EnemyList[index2].UpdateValue();
            }
        }
Beispiel #4
0
        private void SetEnemies(JSON_MapEnemyUnit[] json)
        {
            for (int index = 0; index < this.UnknownEnemyList.Count; ++index)
            {
                ((Component)this.UnknownEnemyList[index]).get_gameObject().SetActive(false);
            }
            List <JSON_MapEnemyUnit> list = ((IEnumerable <JSON_MapEnemyUnit>)json).Where <JSON_MapEnemyUnit>((Func <JSON_MapEnemyUnit, bool>)(enemy =>
            {
                if (enemy.elem != 0)
                {
                    return(enemy.side == 1);
                }
                return(false);
            })).ToList <JSON_MapEnemyUnit>();
            TowerResuponse  towerResuponse  = MonoSingleton <GameManager> .Instance.TowerResuponse;
            TowerFloorParam towerFloorParam = (TowerFloorParam)null;

            if (towerResuponse != null)
            {
                towerFloorParam = towerResuponse.GetCurrentFloor();
            }
            this.EnemyUnits.Clear();
            for (int index = 0; index < list.Count; ++index)
            {
                TowerEnemyListItem towerEnemyListItem;
                if (this.EnemyList.Count <= index)
                {
                    towerEnemyListItem = (TowerEnemyListItem)((GameObject)Object.Instantiate <GameObject>((M0)this.EnemyTemplate)).GetComponent <TowerEnemyListItem>();
                    ((Component)towerEnemyListItem).get_transform().SetParent(this.EnemiesRoot.get_transform(), false);
                    this.EnemyList.Add(towerEnemyListItem);
                }
                else
                {
                    towerEnemyListItem = this.EnemyList[index];
                }
                NPCSetting npcSetting = new NPCSetting(list[index]);
                Unit       data       = new Unit();
                data.Setup((UnitData)null, (UnitSetting)npcSetting, (Unit.DropItem)null, (Unit.DropItem)null);
                DataSource.Bind <Unit>(((Component)towerEnemyListItem).get_gameObject(), data);
                this.EnemyUnits.Add(data);
            }
            if (towerFloorParam != null && towerFloorParam.iname == GlobalVars.SelectedQuestID)
            {
                MonoSingleton <GameManager> .Instance.TowerResuponse.CalcEnemyDamage(this.EnemyUnits);
            }
            for (int index = 0; index < this.EnemyList.Count; ++index)
            {
                bool flag = index < list.Count && index < 10;
                ((Component)this.EnemyList[index]).get_gameObject().SetActive(flag);
                this.EnemyList[index].UpdateValue();
            }
        }
Beispiel #5
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 1)
            {
                return;
            }
            TowerResuponse towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;

            if (towerResuponse == null)
            {
                return;
            }
            TowerFloorParam currentFloor = towerResuponse.GetCurrentFloor();

            if (currentFloor == null)
            {
                return;
            }
            ((Behaviour)this).set_enabled(true);
            this.ExecRequest((WebAPI) new ReqTowerFloorReset(GlobalVars.SelectedTowerID, currentFloor.iname, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
        }
Beispiel #6
0
        public void OnClickDetail()
        {
            QuestParam dataOfClass = DataSource.FindDataOfClass <QuestParam>(((Component)this).get_gameObject(), (QuestParam)null);

            if (!Object.op_Equality((Object)this.Detail, (Object)null) || dataOfClass == null)
            {
                return;
            }
            this.Detail = (GameObject)Object.Instantiate <GameObject>((M0)this.DetailtTmplate);
            DataSource.Bind <QuestParam>(this.Detail, dataOfClass);
            QuestCampaignData[] questCampaigns = MonoSingleton <GameManager> .Instance.FindQuestCampaigns(dataOfClass);

            DataSource.Bind <QuestCampaignData[]>(this.Detail, questCampaigns.Length != 0 ? questCampaigns : (QuestCampaignData[])null);
            TowerResuponse  towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;
            TowerFloorParam data           = (TowerFloorParam)null;

            if (towerResuponse != null)
            {
                data = towerResuponse.GetCurrentFloor();
            }
            DataSource.Bind <TowerFloorParam>(this.Detail, data);
            this.Detail.SetActive(true);
        }