Example #1
0
    public void OnClickResearchButton()
    {
        if (bAdvisorDoIt && shortageTypes.Count > 0)
        {
            ZoneTile tile = ZoneTerrain.Get().zoneTiles.GetMyTile(MtTileTypes.BuildingMageTower);

            if (tile != null)
            {
                UIAdvisorTalkPop.Create(tile.transform, MWText.instance.GetText(MWText.EText.E_2175), true);

                int tutorialStep = PlayerPrefs.GetInt("TutorialStep32", 0);

                if (tutorialStep == 0 && !UITutorial.IsLoaded())
                {
                    UITutorial.Create(32);
                }
            }

            Close();
            return;
        }

        if (shortageTypes.Count > 0)
        {
            UIShortageResources.Create(shortageTypes.ToArray(), shortageValue.ToArray(), delegate { RefreshCost(goldCost, stoneCost, woodCost); }, false);
        }
        else
        {
            LobbyScene.Get().RequestLearnNationAttribute(curSelectedAttributeInfo.AttributeType, false, OnResponseLearnNationAttribute);
        }
    }
Example #2
0
    private void OnResponseNationAttributeList(MtPacket_NationAttributes_Response typed_pk)
    {
        //패킷 특성리스트 작성
        AccountInfo.instance.RefreshAttributeList(typed_pk.NationAttributes);

        MtMyNationAttribute researchInProgressAttribute = AccountInfo.instance.GetResearchInProgressAttribute();

        if (researchInProgressAttribute != null)
        {
            researchButton.interactable = false;

            this.researchInProgressAttribute = researchInProgressAttribute;

            currentResearchPanel.SetActive(true);
            currentAttributeImage.sprite = UIUtility.LoadResearchAttributeImage(researchInProgressAttribute.AttributeType);
        }

        if (bAdvisorDoIt)
        {
            ZoneTile tile = ZoneTerrain.Get().zoneTiles.GetMyTile(MtTileTypes.BuildingMageTower);

            int duration = 999999999;
            for (MtNationAttributeTypes attType = MtNationAttributeTypes.Architecture; attType <= MtNationAttributeTypes.Diplomacy; ++attType)
            {
                int level = AccountInfo.instance.GetMyNationAttributeLevel(attType);
                MtNationAttribute minAtt = MtDataManager.GetAttributeData(attType, 1);

                if (minAtt.MaxLevel > level)
                {
                    MtNationAttribute att = MtDataManager.GetAttributeData(attType, level + 1);

                    if (att != null && att.LearningDuration < duration && tile.tileInfo.TileLevel >= att.RequiredMageTowerLevel)
                    {
                        duration = att.LearningDuration;
                        curSelectedAttributeInfo = att;
                    }
                }
            }

            for (MtNationAttributeTypes attType = MtNationAttributeTypes.StrengtheningResearch; attType <= MtNationAttributeTypes.Machlessness; ++attType)
            {
                int level = AccountInfo.instance.GetMyNationAttributeLevel(attType);
                MtNationAttribute minAtt = MtDataManager.GetAttributeData(attType, 1);

                if (minAtt.MaxLevel > level)
                {
                    MtNationAttribute att = MtDataManager.GetAttributeData(attType, level + 1);

                    if (att != null && att.LearningDuration < duration && tile.tileInfo.TileLevel >= att.RequiredMageTowerLevel)
                    {
                        duration = att.LearningDuration;
                        curSelectedAttributeInfo = att;
                    }
                }
            }

            if (curSelectedAttributeInfo == null)
            {
                UIAdvisorTalkPop.Create(tile.transform, MWText.instance.GetText(MWText.EText.E_2398), true);
            }
            else
            {
                OnClickResearchButton();
            }
        }

        if (PlayerPrefs.HasKey("LastResearchTab"))
        {
            if ((MtNationAttributeUseTypes)PlayerPrefs.GetInt("LastResearchTab", 0) == MtNationAttributeUseTypes.InternalAffairs)
            {
                OnClickInternalAffairsTab();
            }
            else
            {
                OnClickCombatTab();
            }
        }
        else
        {
            OnClickInternalAffairsTab();
        }

        int tutorialStep = PlayerPrefs.GetInt("TutorialStep26", 0);

        if (tutorialStep == 0 && !bAdvisorDoIt)
        {
            UITutorial.Create(26);
        }
    }