Example #1
0
 private void OnLanguageChange(int _)
 {
     CardSelectPanel.OnLanguageChange(_);
     Row_ShopItems.OnLanguageChange();
     Row_BonusGroups.OnLanguageChange();
     LevelEditorPanel_CardComboList.OnLanguageChange();
     LevelEditorPanel_CardPriority.OnLanguageChange();
 }
Example #2
0
    public bool SetLevel(Level level)
    {
        if (level == null)
        {
            SetLevelType(LevelTypes.Shop.ToString(), false);
            SetLevelType(LevelTypes.Enemy.ToString(), false);
        }
        else
        {
            resetLevelBackup        = level.Clone();
            Cur_Level               = level;
            LastLevelEnglishName    = Cur_Level.LevelNames["en"];
            OnChangeLevelTypeByEdit = false;
            SetLevelType(Cur_Level.LevelType.ToString(), false);
            OnChangeLevelTypeByEdit = true;
            SetLevelName_en(Cur_Level.LevelNames["en"], false);
            SetLevelName_zh(Cur_Level.LevelNames["zh"], false);
            SetLevelPicID(Cur_Level.LevelPicID.ToString(), false);
            SetLevelDifficultyLevel(Cur_Level.DifficultyLevel.ToString(), false);
            switch (Cur_Level)
            {
            case Enemy enemy:
            {
                SetEnemyType(enemy.EnemyType.ToString(), false);
                SetEnemyBeginMetal(enemy.BuildInfo.BeginMetal.ToString(), false);
                SetEnemyDrawCardNum(enemy.BuildInfo.DrawCardNum.ToString(), false);
                SetEnemyEnergy(enemy.BuildInfo.Energy.ToString(), false);
                SetEnemyLife(enemy.BuildInfo.Life.ToString(), false);
                Row_BonusGroups.Initialize(
                    enemy.BonusGroups,
                    ClientUtils.UpdateLayout(UIManager.Instance.GetBaseUIForm <LevelEditorPanel>().RightPanel),
                    addAction: delegate
                    {
                        enemy.BonusGroups.Add(new BonusGroup(false, new List <Bonus>(), 1, false));
                        Row_BonusGroups.Refresh();
                        StartCoroutine(ClientUtils.UpdateLayout((RectTransform)LevelPropertiesContainer));
                    }, clearAction: delegate
                    {
                        ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>();
                        cp.Initialize(
                            descText: LanguageManager.Instance.GetText("LevelEditorPanel_ClearConfirm"),
                            leftButtonText: LanguageManager.Instance.GetText("Common_Yes"),
                            rightButtonText: LanguageManager.Instance.GetText("Common_No"),
                            leftButtonClick: delegate
                        {
                            cp.CloseUIForm();
                            enemy.BonusGroups.Clear();
                            Row_BonusGroups.Refresh();
                            StartCoroutine(ClientUtils.UpdateLayout((RectTransform)LevelPropertiesContainer));
                        },
                            rightButtonClick: delegate { cp.CloseUIForm(); });
                    }, onStartSelectCard: OnStartSelectCard);
                CardSelectPanel.SetBuildCards(enemy.BuildInfo.M_BuildCards, gotoAction: delegate
                    {
                        M_SelectCardContents = SelectCardContents.SelectDeckCards;
                        CardSelectPanel.SetCardLibraryPanelEnable(true);
                    });

                M_SelectCardContents = SelectCardContents.SelectDeckCards;
                CardSelectPanel.SetCardLibraryPanelEnable(true);
                CardSelectPanel.SwitchSingleSelect(false);
                CardSelectPanel.SelectCardsByBuildCards(CardStatTypes.Total);

                LevelEditorPanel_CardPriority.Initialize(enemy.CardPriority);
                LevelEditorPanel_CardComboList.Initialize(enemy.CardComboList, Initialize_Right);
                break;
            }

            case Shop shop:
            {
                CardSelectPanel.UnselectAllCards();
                CardSelectPanel.SetCardLibraryPanelEnable(false);
                Row_ShopItems.Initialize(shop.ShopItems, ClientUtils.UpdateLayout((RectTransform)LevelPropertiesContainer));
                SetShopItemCardCount(shop.ShopItemCardCount.ToString(), false);
                SetShopItemOthersCount(shop.ShopItemOthersCount.ToString(), false);
                Row_ShopItems.SetButtonActions(
                    gotoAction: delegate { }, clearAction: delegate
                    {
                        ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>();
                        cp.Initialize(
                            descText: LanguageManager.Instance.GetText("LevelEditorPanel_ClearConfirm"),
                            leftButtonText: LanguageManager.Instance.GetText("Common_Yes"),
                            rightButtonText: LanguageManager.Instance.GetText("Common_No"),
                            leftButtonClick: delegate
                        {
                            cp.CloseUIForm();
                            shop.ShopItems.Clear();
                            Row_ShopItems.Refresh();
                            StartCoroutine(ClientUtils.UpdateLayout((RectTransform)LevelPropertiesContainer));
                        },
                            rightButtonClick: delegate { cp.CloseUIForm(); });
                    });
                break;
            }
            }
        }

        return(false);
    }
Example #3
0
    private void OnLevelTypeChange(string value_str)
    {
        LevelTypes type = (LevelTypes)Enum.Parse(typeof(LevelTypes), value_str);

        foreach (PropertyFormRow lpfr in LevelPropertiesCommon)
        {
            lpfr.gameObject.SetActive(true);
        }

        List <PropertyFormRow> targets = LevelTypePropertiesDict[type];

        foreach (PropertyFormRow lpfr in MyPropertiesRows)
        {
            if (!LevelPropertiesCommon.Contains(lpfr))
            {
                lpfr.gameObject.SetActive(targets.Contains(lpfr));
            }
        }

        if (OnChangeLevelTypeByEdit)
        {
            OnChangeLevelTypeByEdit = false;
            LevelEditorPanel_CardComboList.gameObject.SetActive(type == LevelTypes.Enemy);

            switch (type)
            {
            case LevelTypes.Enemy:
            {
                Cur_Level = new Enemy(
                    levelPicID: 0,
                    levelNames: new SortedDictionary <string, string> {
                        { "zh", "新敌人" }, { "en", "newEnemy" }
                    },
                    difficultyLevel: 1,
                    buildInfo: new BuildInfo(
                        buildID: -1,
                        buildName: "TempDeck",
                        buildCards: new BuildCards(BuildCards.DefaultCardLimitNumTypes.BasedOnCardBaseInfoLimitNum),
                        drawCardNum: 1,
                        life: 20,
                        energy: 10,
                        beginMetal: 1,
                        gamePlaySettings: null),
                    enemyType: EnemyType.Soldier,
                    bonusGroups: new List <BonusGroup>(),
                    cardComboList: new List <CardCombo>(),
                    cardPriority: new CardPriority(new List <int>())
                    );
                LevelEditorPanel_CardPriority.Initialize(((Enemy)Cur_Level).CardPriority);
                LevelEditorPanel_CardComboList.Initialize(((Enemy)Cur_Level).CardComboList, Initialize_Right);
                break;
            }

            case LevelTypes.Shop:
            {
                Cur_Level = new Shop(
                    levelPicId: 0,
                    levelNames: new SortedDictionary <string, string> {
                        { "zh", "新商店" }, { "en", "newShop" }
                    },
                    difficultyLevel: 1,
                    shopItems: new List <ShopItem>(),
                    5,
                    0);

                break;
            }
            }

            SetLevel(Cur_Level);
            OnChangeLevelTypeByEdit = true;
        }
    }