public IEnumerator RefreshCoroutine() { rootPanel.gameObject.SetActive(false); yield return(null); int strengthenAddShow = RoleUtil.GetStrengthenAddShowValue(_roleInfo.strengthenLevel); textTitle.text = Localization.Get(_roleInfo.heroData.name) + (strengthenAddShow == 0 ? "" : string.Format("+{0}", strengthenAddShow.ToString())); textTitle.color = UIUtil.GetRoleNameColor(_roleInfo); textStory.text = Localization.Get(_roleInfo.heroData.description); DropMessageData data = DropMessageData.GetDropMsgDataByResData((int)BaseResType.Hero, _roleInfo.modelDataId, 0, _roleInfo.advanceLevel); if (data == null) { data = DropMessageData.GetDropMsgDataByResData((int)BaseResType.Hero, _roleInfo.modelDataId); } textFrom.text = data == null ? "" : Localization.Get(data.des); TransformUtil.ClearChildren(iconRoot, true); CommonHeroIcon.View.CommonHeroIcon icon = CommonHeroIcon.View.CommonHeroIcon.Create(iconRoot); icon.SetRoleInfo(_roleInfo); icon.HideLevel(); RefreshAttr(); RefreshSkill(); RefreshSize(); }
public IEnumerator RefreshCoroutine() { rootPanel.gameObject.SetActive(false); yield return(null); yield return(null); textTitle.text = Localization.Get(_equipInfo.equipmentData.name); textStory.text = Localization.Get(_equipInfo.equipmentData.description); DropMessageData data = DropMessageData.GetDropMsgDataByResData((int)BaseResType.Equipment, _equipInfo.equipmentData.id); textFrom.text = data == null ? "" : Localization.Get(data.des); TransformUtil.ClearChildren(iconRoot, true); CommonEquipmentIcon icon = CommonEquipmentIcon.Create(iconRoot); icon.SetEquipmentInfo(_equipInfo); icon.GetEquipmentDesButton().enabled = false; RefreshAttr(); RefreshSpecialUse(); float UseDeltaHeight = (string.IsNullOrEmpty(textUse.text) ? 0 : textUse.preferredHeight) - _defaultContentLineHeight; float fromDeltaHeight = (string.IsNullOrEmpty(textFrom.text) ? 0 : textFrom.preferredHeight) - _defaultContentLineHeight; float storyDeltaHeight = textStory.preferredHeight - _defaultContentLineHeight; storyBottomLineTran.localPosition += new Vector3(0, -storyDeltaHeight); textFrom.transform.localPosition += new Vector3(0, UseDeltaHeight, 0); rootPanel.sizeDelta = new Vector2(_originSizeDelta.x, _originSizeDelta.y + UseDeltaHeight + storyDeltaHeight + fromDeltaHeight); float screenHalfHeight = UIMgr.instance.designResolution.y / 2; Vector3 localPosition = transform.InverseTransformPoint(_worldPos); float x = 0f; float y = localPosition.y; if (localPosition.x > 0) { x = localPosition.x - _sizeDelta.x / 2 - rootPanel.sizeDelta.x / 2 - _defaultBorderX; } else { x = localPosition.x + _sizeDelta.x / 2 + rootPanel.sizeDelta.x / 2 + _defaultBorderX; } if (localPosition.y < rootPanel.sizeDelta.y / 2 - screenHalfHeight) { y = rootPanel.sizeDelta.y / 2 - screenHalfHeight; } if (localPosition.y > screenHalfHeight - rootPanel.sizeDelta.y / 2) { y = screenHalfHeight - rootPanel.sizeDelta.y / 2; } localPosition = new Vector3(x, y); rootPanel.anchoredPosition3D = localPosition; rootPanel.gameObject.SetActive(true); }
public IEnumerator RefreshCoroutine() { rootPanel.gameObject.SetActive(false); yield return(null); textTitle.text = Localization.Get(_itemInfo.itemData.name); textDes.text = Localization.Get(_itemInfo.itemData.des); DropMessageData data = DropMessageData.GetDropMsgDataByResData((int)BaseResType.Item, _itemInfo.itemData.id); textFrom.text = data == null ? "" : Localization.Get(data.des); CommonItemIcon icon = CommonItemIcon.Create(iconRoot); icon.SetItemInfo(new ItemInfo(0, _itemInfo.itemData.id, 0)); icon.GetComponent <ItemDesButton>().enabled = false; RefreshSpecialUse(); float useDeltaHeight = (string.IsNullOrEmpty(textUse.text) ? 0 : textUse.preferredHeight) - _defaultContentLineHeight; float fromDeltaHeight = (string.IsNullOrEmpty(textFrom.text) ? 0 : textFrom.preferredHeight) - _defaultContentLineHeight; float deltaHeight = useDeltaHeight + fromDeltaHeight; textFrom.transform.localPosition += new Vector3(0, useDeltaHeight); rootPanel.sizeDelta = new Vector2(_originSizeDelta.x, _originSizeDelta.y + deltaHeight); float screenHalfHeight = UIMgr.instance.designResolution.y / 2; Vector3 localPosition = transform.InverseTransformPoint(_worldPos); float x = 0f; float y = localPosition.y + rootPanel.sizeDelta.y / 2; if (localPosition.x > 0) { x = localPosition.x - _sizeDelta.x / 2 - rootPanel.sizeDelta.x / 2 - _defaultBorderX; } else { x = localPosition.x + _sizeDelta.x / 2 + rootPanel.sizeDelta.x / 2 + _defaultBorderX; } if (y < rootPanel.sizeDelta.y - screenHalfHeight) { y = rootPanel.sizeDelta.y - screenHalfHeight; } if (y > screenHalfHeight) { y = screenHalfHeight; } localPosition = new Vector3(x, y); rootPanel.localPosition = localPosition; rootPanel.gameObject.SetActive(true); }
private void RefreshPath() { List <PathData> pathDataList = DropMessageData.GetPathDatas(_gameResData, pathButton.Length); if (pathDataList == null) { for (int i = 0; i < pathButton.Length; i++) { pathButton[i].gameObject.SetActive(false); } noPathGO.SetActive(true); noPathGO.GetComponent <Text>().text = "无"; } else if (pathDataList.Count == 0) { for (int i = 0; i < pathButton.Length; i++) { pathButton[i].gameObject.SetActive(false); } noPathGO.SetActive(true); DropMessageData data = DropMessageData.GetDropMsgDataByResData(_gameResData, true); if (data != null) { noPathGO.GetComponent <Text>().text = Localization.Get(data.des); } } else { for (int i = 0; i < pathButton.Length; i++) { if (i < pathDataList.Count) { pathButton[i].Set(pathDataList[i].type, pathDataList[i].id); } pathButton[i].gameObject.SetActive(i < pathDataList.Count); } noPathGO.SetActive(false); } }
private string GetDesString() { string expend = string.Empty; string path = string.Empty; string use = string.Empty; string recoverCoolDown = string.Empty; string recover = string.Empty; string owner = string.Empty; string limit = string.Empty; ItemData itemData = ItemData.GetBasicResItemByType(baseType); string name = Localization.Get(itemData.name); //int oneHundredBillion = 100000000;//1亿 switch (baseType) { case BaseResType.PveAction: { expend = string.Format(Localization.Get("ui.common_des_view.expend_pveAction"), DungeonProxy.instance.DungeonInfoDictionary.First().Value.dungeonData.actionNeed); recover = GetRecoverTimeString(GlobalData.GetGlobalData().pveActionRecoverTime); if (GameProxy.instance.PveAction < GameProxy.instance.PveActionMax) { recoverCoolDown = string.Format(Localization.Get("ui.common_des_view.recover_time"), TimeUtil.FormatSecondToMinute((int)GameProxy.instance.PveActionNextRecoverTime)); } owner = string.Format(Localization.Get("ui.common_des_view.owner2"), GameProxy.instance.PveAction, name); limit = string.Format(Localization.Get("ui.common_des_view.limit"), GameProxy.instance.PveActionMax, name); } break; case BaseResType.TowerAction: { expend = string.Format(Localization.Get("ui.common_des_view.expend_TowerAction"), 1); recover = GetRecoverTimeString(GlobalData.GetGlobalData().worldTreeFruitRecoverTime); if (WorldTreeProxy.instance.WorldTreeFruit < WorldTreeProxy.instance.WorldTreeFruitUpperLimit) { int second = (int)TimeController.instance.GetDiffTimeWithServerTimeInSecond(WorldTreeProxy.instance.WorldTreeNextRecoverTime); recoverCoolDown = string.Format(Localization.Get("ui.common_des_view.recover_time"), TimeUtil.FormatSecondToMinute(second)); } owner = string.Format(Localization.Get("ui.common_des_view.owner2"), WorldTreeProxy.instance.WorldTreeFruit, name); limit = string.Format(Localization.Get("ui.common_des_view.limit"), WorldTreeProxy.instance.WorldTreeFruitUpperLimit, name); } break; case BaseResType.PvpAction: { expend = string.Format(Localization.Get("ui.common_des_view.expend_pvpAction"), 1); //recover = GetRecoverTimeString(GlobalData.GetGlobalData().challengeTimesRecoverTime); // if(GameProxy.instance.PvpAction<GameProxy.instance.PvpActionMax) // { // recoverCoolDown = string.Format(Localization.Get("ui.common_des_view.recover_time"),TimeUtil.FormatSecondToHour((int)GameProxy.instance.PvpActionNextRecoverTime/1000)); // } owner = string.Format(Localization.Get("ui.common_des_view.owner2"), GameProxy.instance.PvpAction, name); limit = string.Format(Localization.Get("ui.common_des_view.limit"), GameProxy.instance.PvpActionMax, name); } break; default: //limit = string.Format(Localization.Get("ui.common_des_view.limit"),GetNumberLimitString(oneHundredBillion),name); owner = string.Format(Localization.Get("ui.common_des_view.owner2"), GetNumberLimitString(GameProxy.instance.BaseResourceDictionary.GetValue(baseType)), name); break; } DropMessageData data = DropMessageData.GetDropMsgDataByResData((int)BaseResType.Item, itemData.id); path = data == null ? "" : Localization.Get(data.des); return(string.Format("{0}{1}{2}{3}{4}{5}{6}", expend, use, recover, recoverCoolDown, owner, limit, path)); }