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); } }
public void OnResponseLearnNationAttribute(MtPacket_LearnNationAttribute_Response typed_pk) { //클라이언트에서 조건 확인후 Request하기때문에 (-1, 0)값은 오면 안됨. if (typed_pk.Result == -1) //다른 연구 진행중 { return; } else if (typed_pk.Result == -2) { return; //선행특성조건 불만족 } else if (typed_pk.Result == -3) { return; //Max레벨 } else if (typed_pk.Result == 0) //자원부족 { return; } else { researchButton.GetComponentInChildren <Text>().text = MWText.instance.GetText(MWText.EText.E_948); researchButton.GetComponent <Image>().color = new Color(0.75f, 0.75f, 0.75f); researchButton.interactable = false; //시작성공했으면 AccountInfo 값변경 AccountInfo.instance.RefreshAttribute(typed_pk.MyNationAttribute); researchInProgressAttribute = AccountInfo.instance.GetResearchInProgressAttribute(); if (researchInProgressAttribute != null) { if (curSelectedAttributeInfo.AttributeType == researchInProgressAttribute.AttributeType) { TimeSpan ts = researchInProgressAttribute.LearningEndTime - DateTime.Now; progressBarTimeText.text = ConverTimeToString((int)ts.TotalSeconds); } } AccountInfo.instance.gold -= typed_pk.CostGold; AccountInfo.instance.stone -= typed_pk.CostStone; AccountInfo.instance.wood -= typed_pk.CostWood; AccountInfo.instance.gem -= typed_pk.CostGem; UIKingdomInfo.Get().ResetAccountData(); if (researchInProgressAttribute != null) { OnClickSlot(researchInProgressAttribute.AttributeType); } PlayerPrefs.SetInt("LastResearchTab", (int)curSelectedAttributeInfo.AttributeUseType); if (bAdvisorDoIt) { ZoneTile tile = ZoneTerrain.Get().zoneTiles.GetMyTile(MtTileTypes.BuildingMageTower); if (tile != null) { string msg = string.Format(MWText.instance.GetText(MWText.EText.E_2174), curSelectedAttributeInfo.AttributeName + " " + UIUtility.GetLevelString(curSelectedAttributeInfo.CurLevel)); UIAdvisorTalkPop.Create(tile.transform, msg); } } AudioPlayer.Get().PlaySituationSound(SituationSoundType.ResearchAttribute); Close(); } }
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); } }