示例#1
0
    private void GameFSM_SceneInitialized(UserInfo _userInfo)
    {
        base.gameObject.SetActive(true);
        this.currentCityLevel         = CityManager.GetCityLevel() + 1;
        this.cityLevelSlider.value    = (float)this.currentCityLevel;
        this.citylevel.text           = this.currentCityLevel.ToString();
        this.saveGameToggle.isOn      = (!PlayerPrefs.HasKey("EnableSaveGame") || PlayerPrefs.GetInt("EnableSaveGame") == 1);
        this.tutorialtoggle.isOn      = (!PlayerPrefs.HasKey("EnableTutorial") || PlayerPrefs.GetInt("EnableTutorial") == 1);
        DeveloperMenu.SaveGameEnabled = this.saveGameToggle.isOn;
        DeveloperMenu.TutorialEnabled = this.tutorialtoggle.isOn;
        ThumbnailManager.Instance.Initialize();
        foreach (FighterData fighterData in GameFSM.gameData.fighters)
        {
            if (fighterData.type != FighterTypes.HERO)
            {
                this.CreateFighterInfo(fighterData);
            }
        }
        OrbManager.OrbColor value  = (OrbManager.OrbColor) this.orbColor.value;
        OrbManager.OrbSize  value2 = (OrbManager.OrbSize) this.orbSize.value;
        string key = OrbManager.GetKey(value, value2);

        if (GameFSM.gameData.orbs.ContainsKey(key))
        {
            this.orbQuantity.text = GameFSM.gameData.orbs[key].ToString();
        }
        SaveGameManager.Instance.ToggleSaving(true);
        this.fameInputField.text   = GameFSM.userSaveGame.GetUserInfo().GetFame(false).ToString();
        this.cityXPInputField.text = GameFSM.userSaveGame.GetUserInfo().GetXp(false).ToString();
        this.InitializeVipPlayer();
    }
示例#2
0
    private void Awake()
    {
        this.cityLevelSlider.onValueChanged.AddListener(delegate(float arg0)
        {
            this.currentCityLevel = (int)this.cityLevelSlider.value;
            this.citylevel.text   = this.currentCityLevel.ToString();
        });
        this.writeTextWindow = Object.Instantiate <WriteTextWindow>(this.writeTextWindow);
        this.writeTextWindow.transform.SetParent(base.transform, false);
        this.saveGameToggle.onValueChanged.AddListener(delegate(bool arg0)
        {
            DeveloperMenu.SaveGameEnabled = arg0;
            if (arg0)
            {
                PlayerPrefs.SetInt("EnableSaveGame", 1);
                return;
            }
            PlayerPrefs.SetInt("EnableSaveGame", 0);
        });
        this.tutorialtoggle.onValueChanged.AddListener(delegate(bool arg0)
        {
            DeveloperMenu.TutorialEnabled = arg0;
            if (arg0)
            {
                PlayerPrefs.SetInt("EnableTutorial", 1);
                return;
            }
            PlayerPrefs.SetInt("EnableTutorial", 0);
        });
        this.fillResourcesToMax.onClick.AddListener(new UnityAction(this.FillResourcesToMax));
        this.FighterToggle(this.swordButton, FighterTypes.SWORD_SHIELD);
        this.FighterToggle(this.twoHandedButton, FighterTypes.TWO_HANDED);
        this.FighterToggle(this.dualButton, FighterTypes.DUAL_WEAPON);
        this.FighterToggle(this.spearButton, FighterTypes.SPEAR);
        this.pathSelection.options.Clear();
        if (this.mapManager != null)
        {
            MissionPath[] paths = this.mapManager.paths;
            for (int i = 0; i < paths.Length; i++)
            {
                Dropdown.OptionData item = new Dropdown.OptionData(paths[i].id);
                this.pathSelection.options.Add(item);
                this.selectedPath = 0;
            }
        }
        this.pathSelection.value = this.selectedPath;
        this.pathSelection.RefreshShownValue();
        this.RefreshMissionDropdown();
        this.pathSelection.onValueChanged.AddListener(delegate(int arg0)
        {
            this.selectedPath = arg0;
            this.RefreshMissionDropdown();
        });
        this.missionSelection.onValueChanged.AddListener(delegate(int arg0)
        {
            this.selectedMission = arg0;
        });
        this.unlockPaths.onClick.AddListener(delegate()
        {
            if (this.mapManager != null)
            {
                MapManager.UnlockPaths(this.selectedPath, this.selectedMission, this.mapManager, false);
            }
        });
        this.addArmorySlots.onClick.AddListener(delegate()
        {
            GameFSM.gameData.AddArmorySlots(SlotType.Generic, 5);
        });
        this.addRandomWeapons.onClick.AddListener(delegate()
        {
            List <EquipableItemPrefab> allWeaponsAndItems = GFFEquipableItemManager.Instance.GetAllWeaponsAndItems();
            for (int l = 0; l < 5; l++)
            {
                int index = Random.Range(0, allWeaponsAndItems.Count);
                GameFSM.gameData.armory.AddItem(new EquipableItemData(allWeaponsAndItems[index].infoPrefabPath), true);
            }
        });
        this.addOrbsButton.onClick.AddListener(delegate()
        {
            OrbManager.OrbColor value = (OrbManager.OrbColor) this.orbColor.value;
            OrbManager.OrbSize value2 = (OrbManager.OrbSize) this.orbSize.value;
            string key = OrbManager.GetKey(value, value2);
            OrbManager.Instance.Add(key, 1, null);
            this.orbQuantity.text = OrbManager.Instance.GetOrbQuantity(key).ToString();
        });
        this.clearOrbsButton.onClick.AddListener(delegate()
        {
            OrbManager.OrbColor value = (OrbManager.OrbColor) this.orbColor.value;
            OrbManager.OrbSize value2 = (OrbManager.OrbSize) this.orbSize.value;
            string key = OrbManager.GetKey(value, value2);
            OrbManager.Instance.Substract(key, 999999999, null);
            this.orbQuantity.text = OrbManager.Instance.GetOrbQuantity(key).ToString();
        });
        this.orbSize.onValueChanged.AddListener(delegate(int arg0)
        {
            OrbManager.OrbColor value = (OrbManager.OrbColor) this.orbColor.value;
            OrbManager.OrbSize value2 = (OrbManager.OrbSize) this.orbSize.value;
            string key            = OrbManager.GetKey(value, value2);
            this.orbQuantity.text = OrbManager.Instance.GetOrbQuantity(key).ToString();
        });
        this.orbColor.onValueChanged.AddListener(delegate(int arg0)
        {
            OrbManager.OrbColor value = (OrbManager.OrbColor) this.orbColor.value;
            OrbManager.OrbSize value2 = (OrbManager.OrbSize) this.orbSize.value;
            string key            = OrbManager.GetKey(value, value2);
            this.orbQuantity.text = OrbManager.Instance.GetOrbQuantity(key).ToString();
        });
        DeveloperMenu.DeveloperMenuEnabled = true;
        this.addFighterButton.onClick.AddListener(delegate()
        {
            if (this.swordButton.isOn)
            {
                this.AddFighter(FighterTypes.SWORD_SHIELD);
                return;
            }
            if (this.dualButton.isOn)
            {
                this.AddFighter(FighterTypes.DUAL_WEAPON);
                return;
            }
            if (this.spearButton.isOn)
            {
                this.AddFighter(FighterTypes.SPEAR);
                return;
            }
            if (this.twoHandedButton.isOn)
            {
                this.AddFighter(FighterTypes.TWO_HANDED);
            }
        });
        FighterManager.GladiatorClass fighterClass = FighterManager.Instance.GetFighterClass(FighterTypes.SWORD_SHIELD);
        List <string> list = new List <string>();

        foreach (FighterManager.CharacterInfo characterInfo in fighterClass.prefabsCollection)
        {
            list.Add(characterInfo.visualPrefab);
        }
        this.visualAspects.options.Clear();
        this.visualAspects.AddOptions(list);
        this.openAdminDBMenuButton.onClick.AddListener(delegate()
        {
            this.adminDBMenu.Open();
        });
        this.cityNameButton.onClick.AddListener(delegate()
        {
            this.writeTextWindow.Open("Your city name here", "City Name", 60, null, new Text[]
            {
                this.cityName
            });
        });
        this.writeTextWindow.OnWriteNameEnd += delegate(string _newName)
        {
            GameFSM.userSaveGame.GetUserInfo().SetUserName(_newName);
            this.cityName.text = _newName;
            string text = GFFOnlineManager.Instance.UserMaintenanceID;
            if (string.IsNullOrEmpty(text))
            {
                text = GameFSM.userSaveGame.GetUserInfo().GetUserId(false);
            }
            if (!string.IsNullOrEmpty(text))
            {
                GFFOnlineManager.Instance.ChangeUserName(text, _newName, null);
            }
        };
        this.fameInputField.onEndEdit.AddListener(delegate(string arg0)
        {
            GameFSM.userSaveGame.GetUserInfo().OverrideFame(int.Parse(arg0));
        });
        this.cityXPInputField.onEndEdit.AddListener(delegate(string arg0)
        {
            this.ModifyCityLevelByXp(int.Parse(arg0));
        });
        this.dummyBattleButton.onClick.AddListener(delegate()
        {
            this.dummyBattleWindow.Open();
        });
        this.addConsumables.onClick.AddListener(delegate()
        {
            this.consumablesPanel.gameObject.SetActive(true);
            this.consumablesPanel.Open();
        });
        this.pathSelection.onValueChanged.AddListener(delegate(int arg0)
        {
            this.selectedPath = arg0;
            this.RefreshMissionDropdown();
        });
        List <string> list2 = new List <string>();

        for (int k = 0; k < this.tutorialsList.Count; k++)
        {
            list2.Add(this.tutorialsList[k].name);
        }
        this.tutorials.ClearOptions();
        this.tutorials.AddOptions(list2);
        this.tutorials.onValueChanged.AddListener(delegate(int _dropdownIndex)
        {
            this.selectedTutorial = _dropdownIndex;
            this.SetTutorialToggle(this.selectedTutorial);
        });
        this.tutorialConsumed.onValueChanged.AddListener(delegate(bool _consumed)
        {
            this.SetTutorialState(_consumed);
        });
        CrashControl.Instance.debugButtons = this.forceCrashEnable.isOn;
        this.forceCrashEnable.onValueChanged.AddListener(delegate(bool enabled)
        {
            CrashControl.Instance.debugButtons = enabled;
        });
        this.consumeAllTutorials.onClick.AddListener(delegate()
        {
            this.ConsumeAllTutorials();
        });
        this.restartAllTutorials.onClick.AddListener(delegate()
        {
            this.RestarAllTutorials();
        });
        this.resetPendingSkills.onClick.AddListener(delegate()
        {
            this.ResetPendingSkillPoints();
        });
        this.reconfigureCityXP.onClick.AddListener(delegate()
        {
            this.ReconfigureCityXP();
        });
        if (GameFSM.Instance.IsInitializationDone)
        {
            this.GameFSM_SceneInitialized(GameFSM.userSaveGame.GetUserInfo());
        }
        else
        {
            GameFSM.SceneInitialized += this.GameFSM_SceneInitialized;
            base.gameObject.SetActive(false);
        }
        this.videoMode.onClick.AddListener(delegate()
        {
            DeveloperMenu.VideoMode            = true;
            DeveloperMenu.DeveloperMenuEnabled = false;
            this.ToSplash();
        });
        this.regenerateChallenges.onClick.AddListener(delegate()
        {
            GameProgress.CampaignProgress campaignProgress = GameFSM.gameData.progress.GetCampaignProgress(MapManager.DEFAULT_CAMPAIGN_ID);
            if (campaignProgress != null)
            {
                campaignProgress.randonMatchs.Clear();
                campaignProgress.generateRandomMatchsDate = DateTime.MinValue;
            }
        });
        this.healAllGladsButton.onClick.AddListener(delegate()
        {
            this.MaxHealthToAllTheGlads();
        });
        this.trainingAllGladsButton.onClick.AddListener(delegate()
        {
            this.MaxTrainingToAllTheGlads();
        });
        this.addOneMonthVipPlayer.onClick.AddListener(delegate()
        {
            this.OnAddOneMonthVipPlayerClicked();
        });
        this.timersResetButton.onClick.AddListener(delegate()
        {
            foreach (KeyValuePair <string, Task <TaskTypes> > keyValuePair in GameFSM.gameData.taskSaveGame.activeTasks)
            {
                if (keyValuePair.Value.type == TaskTypes.PRODUCTION)
                {
                    keyValuePair.Value.status = Status.CANCELLED;
                }
            }
            GameFSM.gameData.merchantChestOpeningTime = new Dictionary <string, DateTime>();
            if (GameFSM.gameData.progress != null)
            {
                GameFSM.gameData.progress.GetCampaignProgress(MapManager.DEFAULT_CAMPAIGN_ID).generateRandomMatchsDate = DateTime.MinValue;
                GameFSM.gameData.progress.GetCampaignProgress(MapManager.DEFAULT_CAMPAIGN_ID).lastPicked = DateTime.MinValue;
            }
            GameFSM.gameData.clanDonationsBonuses.Clear();
            this.ConfirmationMessage("Todos los Timers Reseteados");
        });
        this.newPayments.onClick.AddListener(delegate()
        {
            this.newPaymentsPanel.Open();
        });
        this.HeroesBtn.onClick.AddListener(delegate()
        {
            this.heroesPanel.Initialize();
        });
        this.cityObstaclesButton.onClick.AddListener(new UnityAction(this.CityObstaclesClicked));
        this.ClanLevelForced(this.forceLevelCheck.isOn);
        this.ClanLevelToForce(this.clanLevelSlider.value);
        this.forceLevelCheck.onValueChanged.AddListener(new UnityAction <bool>(this.ClanLevelForced));
        this.clanLevelSlider.onValueChanged.AddListener(new UnityAction <float>(this.ClanLevelToForce));
    }