public AttributeSlotInfo(MtNationAttribute attribute, short learningLevel, bool isLearning, DateTime learningEndTime, DateTime learningStartTime) { this.attributeInfo = attribute; this.learningLevel = learningLevel; this.isLearning = isLearning; this.learningEndTime = learningEndTime; this.learningStartTime = learningStartTime; }
public void OnClickSlot(MtNationAttributeTypes type) { MtNationAttribute attributeInfo = null; MtNationAttribute nextAttributeInfo = null; int nextLevelCostGold = 0; int nextLevelCostStone = 0; int nextLevelCostWood = 0; int nextLevelLearningDurationTime = 0; int requiredMageTowerLevel = 0; bool researchAvailableFlag = true; //습득한 특성이면 if (AccountInfo.instance.HasAttribute(type)) { //0레벨 예외처리 int curLevel = AccountInfo.instance.GetMyNationAttributeLevel(type); attributeInfo = MtDataManager.GetAttributeData(type, AccountInfo.instance.GetMyNationAttributeLevel(type) == 0 ? 1 : AccountInfo.instance.GetMyNationAttributeLevel(type)); //MaxLevel이 아닐시 if (attributeInfo.CurLevel < attributeInfo.MaxLevel) { nextAttributeInfo = MtDataManager.GetAttributeData(type, curLevel + 1); levelInfoPanel.gameObject.SetActive(true); maxLevelLabel.gameObject.SetActive(false); curSelectedAttributeCurLevelText.text = curLevel.ToString(); curSelectedAttributeNextLevelText.text = nextAttributeInfo.CurLevel.ToString(); addValueTextPanel.gameObject.SetActive(true); maxValueLabel.gameObject.SetActive(false); curSelectedAttributeCurValueText.text = (curLevel == 0 ? 0 : attributeInfo.AffectValue).ToString() + GetSignFromAttributeType(attributeInfo.AttributeType); curSelectedAttributeCurValueText.GetComponent <RectTransform>().sizeDelta = new Vector2(curSelectedAttributeCurValueText.preferredWidth, curSelectedAttributeCurValueText.preferredHeight); curSelectedAttributeNextValueText.text = nextAttributeInfo.AffectValue.ToString() + GetSignFromAttributeType(attributeInfo.AttributeType); curSelectedAttributeNextValueText.GetComponent <RectTransform>().sizeDelta = new Vector2(curSelectedAttributeNextValueText.preferredWidth, curSelectedAttributeNextLevelText.preferredHeight); nextLevelCostGold = nextAttributeInfo.Cost_Gold; nextLevelCostStone = nextAttributeInfo.Cost_Stone; nextLevelCostWood = nextAttributeInfo.Cost_Wood; nextLevelLearningDurationTime = nextAttributeInfo.LearningDuration; requiredMageTowerLevel = nextAttributeInfo.RequiredMageTowerLevel; } else { levelInfoPanel.gameObject.SetActive(false); maxLevelLabel.gameObject.SetActive(true); addValueTextPanel.gameObject.SetActive(false); maxValueLabel.gameObject.SetActive(true); string str = attributeInfo.AffectValue.ToString() + GetSignFromAttributeType(attributeInfo.AttributeType); maxValueLabel.text = string.Format("(<color=#57FF4F> +{0}</color> )", str); researchAvailableFlag = false; } curSelectedAttributeNameText.text = attributeInfo.AttributeName; curSelectedAttributeDescriptionText.text = attributeInfo.AttributeDescription; } //습득하지 않은경우 else { attributeInfo = MtDataManager.GetAttributeData(type, 1); levelInfoPanel.gameObject.SetActive(true); maxLevelLabel.gameObject.SetActive(false); curSelectedAttributeCurLevelText.text = "0"; curSelectedAttributeNextLevelText.text = attributeInfo.CurLevel.ToString(); maxValueLabel.gameObject.SetActive(true); addValueTextPanel.gameObject.SetActive(false); string str = attributeInfo.AffectValue.ToString() + GetSignFromAttributeType(attributeInfo.AttributeType); maxValueLabel.text = string.Format("(<color=#57FF4F> +{0}</color> )", str); curSelectedAttributeNameText.text = attributeInfo.AttributeName; curSelectedAttributeDescriptionText.text = attributeInfo.AttributeDescription; nextLevelCostGold = attributeInfo.Cost_Gold; nextLevelCostStone = attributeInfo.Cost_Stone; nextLevelCostWood = attributeInfo.Cost_Wood; nextLevelLearningDurationTime = attributeInfo.LearningDuration; requiredMageTowerLevel = attributeInfo.RequiredMageTowerLevel; } curSelectedAttributeInfo = attributeInfo; detailViewButton.interactable = true; MtTileInfo mageTowerTileInfo = ZoneTilesSet.GetMyTileInfo(MtTileTypes.BuildingMageTower); if (mageTowerTileInfo != null) { nextLevelLearningDurationTime -= (int)Math.Floor((float)nextLevelLearningDurationTime * (MtStatic.GetResearchAttributeSpeedBonus(mageTowerTileInfo.TileLevel) / 100.0f)); } float att_value = AccountInfo.instance.GetNationAttributeValue(MtNationAttributeTypes.Magic); if (att_value > 0) { nextLevelLearningDurationTime -= (int)Math.Floor((float)nextLevelLearningDurationTime * (att_value / 100.0f)); } att_value = AccountInfo.instance.GetNationAttributeValue(MtNationAttributeTypes.Enchanting); if (att_value > 0) { nextLevelLearningDurationTime -= (int)Math.Floor((float)nextLevelLearningDurationTime * (att_value / 100.0f)); } MtWorldAffect aff = AccountInfo.instance.GetAffect(MtWorldAffectTypes.UnitResearchUp); if (aff != null) { nextLevelLearningDurationTime -= (int)Math.Floor((float)nextLevelLearningDurationTime * ((float)aff.AffectValue / 100.0f)); } //소요시간 텍스트 learnDurationTimeText.text = ConverTimeToString(nextLevelLearningDurationTime); costGemText.text = string.Format("{0:n0}", MtStatic.GetJustNowCompleteGemCost(nextLevelLearningDurationTime)); goldCost = nextLevelCostGold; stoneCost = nextLevelCostStone; woodCost = nextLevelCostWood; #region 자원조건확인 //자원충족여부 RefreshCost(nextLevelCostGold, nextLevelCostStone, nextLevelCostWood); #endregion #region 마법사의탑 조건확인 //마법사의탑 레벨확인 if (requiredMageTowerLevel > 0) { requredMageTowerLevel.SetActive(true); } else { requredMageTowerLevel.SetActive(false); } MtBuilding data = MtDataManager.GetBuildingData(MtTileTypes.BuildingMageTower, 1); requredMageTowerLevelText.text = string.Format(data.BuildingName + " Lv{0}", requiredMageTowerLevel.ToString()); if (requiredMageTowerLevel > mageTowerTileInfo.TileLevel) { requredMageTowerLevelText.color = new Color(230.0f / 255.0f, 69.0f / 255.0f, 69.0f / 255.0f); researchAvailableFlag = false; } else { requredMageTowerLevelText.color = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f); } #endregion #region 행스킬 조건확인 int[] prevAttributeIDXs = { attributeInfo.PrevAttributeIDX1, attributeInfo.PrevAttributeIDX2, attributeInfo.PrevAttributeIDX3, attributeInfo.PrevAttributeIDX4 }; foreach (int idx in prevAttributeIDXs) { if (idx == 0) { continue; } MtNationAttribute attribute = MtDataManager.GetAttributeData(idx); if (AccountInfo.instance.HasAttribute(attribute.AttributeType)) { if (attribute.CurLevel > AccountInfo.instance.GetMyNationAttributeLevel(attribute.AttributeType)) { researchAvailableFlag = false; } } else { researchAvailableFlag = false; } } #endregion if (researchInProgressAttribute != null) { researchAvailableFlag = false; if (researchInProgressAttribute.AttributeType == curSelectedAttributeInfo.AttributeType) { researchButton.GetComponentInChildren <Text>().text = MWText.instance.GetText(MWText.EText.E_948); researchProgressPanel.gameObject.SetActive(true); researchCostPanel.gameObject.SetActive(false); researchButton.gameObject.SetActive(false); justNowButton.gameObject.SetActive(false); accelationButton.gameObject.SetActive(true); } else { researchProgressPanel.gameObject.SetActive(false); researchCostPanel.gameObject.SetActive(true); researchButton.gameObject.SetActive(true); justNowButton.gameObject.SetActive(true); accelationButton.gameObject.SetActive(false); } } else { researchProgressPanel.gameObject.SetActive(false); researchCostPanel.gameObject.SetActive(true); researchButton.gameObject.SetActive(true); justNowButton.gameObject.SetActive(true); accelationButton.gameObject.SetActive(false); } if (researchAvailableFlag) { researchButton.interactable = true; researchButton.GetComponent <Image>().color = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f); learnDurationTimeText.color = new Color(234f / 255.0f, 234f / 255.0f, 234f / 255.0f); justNowButton.interactable = true; justNowButton.GetComponent <Image>().color = new Color(1f, 1f, 1f); costGemText.color = new Color(234f / 255.0f, 234f / 255.0f, 234f / 255.0f); } else { researchButton.interactable = false; researchButton.GetComponent <Image>().color = new Color(0.75f, 0.75f, 0.75f); learnDurationTimeText.color = new Color(234f / 255.0f, 234f / 255.0f, 234f / 255.0f, 0.5f); justNowButton.interactable = false; justNowButton.GetComponent <Image>().color = new Color(0.75f, 0.75f, 0.75f); costGemText.color = new Color(234f / 255.0f, 234f / 255.0f, 234f / 255.0f, 0.5f); } attributeInfoWindow.SetActive(true); currentResearchPanel.SetActive(false); levelSlider.maxValue = attributeInfo.MaxLevel; levelSlider.value = AccountInfo.instance.GetMyNationAttributeLevel(attributeInfo.AttributeType); levelSliderText.text = string.Format("{0}/{1}", (int)levelSlider.value, attributeInfo.MaxLevel); attributeImage.sprite = UIUtility.LoadResearchAttributeImage(attributeInfo.AttributeType); }
public void OnClickDetailViewButton() { if (curSelectedAttributeInfo == null) { return; } detailAttributeNameText.text = curSelectedAttributeInfo.AttributeName; affectValueContentText.text = GetSimpleAttributeDescriptionText(curSelectedAttributeInfo.AttributeType); int level = AccountInfo.instance.GetMyNationAttributeLevel(curSelectedAttributeInfo.AttributeType); for (int i = 0; i < curSelectedAttributeInfo.MaxLevel; i++) { MtNationAttribute attribute = MtDataManager.GetAttributeData(curSelectedAttributeInfo.AttributeType, i + 1); GameObject go = Instantiate(detailElementPrefab); go.transform.SetParent(detailElementGridTrs); Text thisText1 = go.transform.GetChild(0).GetComponent <Text>(); Text thisText2 = go.transform.GetChild(1).GetComponent <Text>(); Text thisText3 = go.transform.GetChild(2).GetComponent <Text>(); if (level == i + 1) { thisText1.color = new Color(254f / 255f, 222f / 255f, 135f / 255f); thisText2.color = new Color(254f / 255f, 222f / 255f, 135f / 255f); thisText3.color = new Color(254f / 255f, 222f / 255f, 135f / 255f); go.GetComponent <Image>().sprite = backgroundImg1; } else if (detailElementGridTrs.childCount % 2 != 0) { go.GetComponent <Image>().sprite = backgroundImg2; } go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; thisText1.text = attribute.CurLevel.ToString(); //기능추가인 특성은 설명으로 affectValue설정 if (curSelectedAttributeInfo.AttributeType == MtNationAttributeTypes.BlackHand || curSelectedAttributeInfo.AttributeType == MtNationAttributeTypes.AssembleAttack) { thisText2.text = curSelectedAttributeInfo.AttributeDescription; } else { thisText2.text = attribute.AffectValue.ToString(); } //AffectValue 표기설정 if (curSelectedAttributeInfo.AttributeType == MtNationAttributeTypes.EndlessConquer || curSelectedAttributeInfo.AttributeType == MtNationAttributeTypes.EndlessMarch || curSelectedAttributeInfo.AttributeType == MtNationAttributeTypes.RemnantOfPower) { //초 thisText2.text = go.transform.GetChild(1).GetComponent <Text>().text + MWText.instance.GetText(MWText.EText.E_1800); } else if (curSelectedAttributeInfo.AttributeType == MtNationAttributeTypes.AssembleCommand) { //명 thisText2.text = go.transform.GetChild(1).GetComponent <Text>().text + MWText.instance.GetText(MWText.EText.E_1799); } else if (curSelectedAttributeInfo.AttributeType == MtNationAttributeTypes.BreakAtLimit || curSelectedAttributeInfo.AttributeType == MtNationAttributeTypes.BlackHand || curSelectedAttributeInfo.AttributeType == MtNationAttributeTypes.AssembleAttack) { //무표기 } else { //% thisText2.text = go.transform.GetChild(1).GetComponent <Text>().text + "%"; } } detailPanel.gameObject.SetActive(true); }
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); } }