public static void SetItemMask(Transform parent, string txt) { Transform item = UIItem.GetChild(parent, "fg_mask"); if (txt == null) { item.gameObject.SetActiveNew(false); } else { item.gameObject.SetActiveNew(true); UIItem.SetText(item, "txt", txt); } }
public void SetName(Transform head, string name, Vector3 offsetPos) { Transform item = head.FindChild("name"); if (null == item) { item = (GameObject.Instantiate(m_nameObj)).GetComponent <RectTransform>(); item.gameObject.SetActiveNew(true); item.SetParent(head); item.name = "name"; item.localRotation = Quaternion.identity; item.localScale = Vector3.one; } item.localPosition = offsetPos; UIItem.SetText(item, "txt", name); }
private void Update() { if (m_Start) { m_curTime += Time.deltaTime; if (m_curTime > m_maxTime) { HUDInfo hudInfo = m_tempList[0]; //Debug.Log("hud:" + hudInfo.txt); Transform item; if (m_cacheList.First != null) { item = m_cacheList.First.Value.transform; m_cacheList.RemoveFirst(); } else { item = GameObject.Instantiate(m_item).transform; } item.SetParent(m_parent); item.gameObject.SetActiveNew(true); item.localPosition = hudInfo.pos; item.SetParent(GUIManager.m_PanelRoot); string text = hudInfo.txt; GameObject txtObj = UIItem.SetText(item, UIItemTitle.txt, text); UIAnimationHelp help = UIAnimationHelp.Get(txtObj); help.m_param = item.gameObject; help.Init(); help.Play(OnAnimaEnd); m_curTime = 0; m_tempList.RemoveAt(0); if (m_tempList.Count == 0) { m_Start = false; } } } }
public void Open(string okTxt, string cancelTxt, string text, System.Action <bool, object> clickEvent) { Client.Inst().m_uiResInitDialog.OpenPanel(true); m_recheck.SetActiveNew(true); UIItem.SetText(m_btnOk, "txt", okTxt); if (!string.IsNullOrEmpty(cancelTxt)) { m_btnExit.SetActiveNew(true); UIItem.SetText(m_btnExit, "txt", cancelTxt); } else { m_btnExit.SetActiveNew(false); } UIItem.SetItemAlign(UIItem.eItemAlignType.Center, m_btnOk.transform.parent); if (m_txtInfo != null) { m_txtInfo.text = text; } m_event = clickEvent; }
public void SetTabTxtOnIndex(int index, string value) { UIItem.SetText(m_btnParent, index + "/txt", value); }
/// <summary> /// 设置道具,返回icon对象 /// </summary> public static GameObject SetGoodsItem(Transform item, GoodsItem itemVal) { if (null == item || null == itemVal) { return(null); } UIItem.SetText(item, UIItemTitle.txtName, itemVal.name); //物品描述 if (itemVal.describe != "") { UIItem.SetText(item, UIItemTitle.txtDescribe, itemVal.describe); } // 图标 //GameObject iconObject = UIItem.SetImage(item, UIItemTitle.imgIcon, itemVal.iconId, itemVal.icon, true); GameObject iconObject = UIItem.GetChild(item, UIItemTitle.imgIcon).gameObject; if (String.IsNullOrEmpty(itemVal.icon)) { iconObject.SetActiveNew(false); } else { UnityEngine.Profiling.Profiler.BeginSample("LoadImage"); UIItem.SetImage(item, UIItemTitle.imgIcon, int.Parse(itemVal.icon)); if (!iconObject.ActiveSelfNew()) { iconObject.SetActiveNew(true); } UnityEngine.Profiling.Profiler.EndSample(); //UIButton.Get(iconObject); } // 强化等级 //if (itemVal.level != "" && IsInt(itemVal.level) && int.Parse(itemVal.level) > 0) UIItem.SetText(item, UIItemTitle.txtLevel, itemVal.level); GameObject tmpBgLevel = UIItem.GetBtn(item, "bg_level"); if (tmpBgLevel != null) { if (itemVal.rate == null) { tmpBgLevel.SetActiveNew(false); } else { tmpBgLevel.SetActiveNew(true); } } //else // UIItem.SetText(item, UIItemTitle.txtLevel, ""); // 数量 if (itemVal.count != "" && IsInt(itemVal.count) && int.Parse(itemVal.count) >= 0) { UIItem.SetText(item, UIItemTitle.txtCount, itemVal.count); } else { UIItem.SetText(item, UIItemTitle.txtCount, ""); } if (itemVal.price >= 0) { UIItem.SetText(item, UIItemTitle.txtPrice, itemVal.price.ToString()); } // 品质 if (itemVal.rank != "") { UIItem.SetText(item, UIItemTitle.txtRank, itemVal.rank); } //星级 if (itemVal.starLevel >= 0) { UIItem.SetStarLevel(item, UIItemTitle.txtStarLevel, itemVal.starLevel); } // 宝石孔 UIItem.SetText(item, "gem_count", itemVal.gemHoleNum + "/6"); if (itemVal.currency > 0) { } // 还有一个类型,用于特效预留 return(iconObject); }
//备用,如果策划加了零时需求,可以拿来用 public static void SetItemLevel(Transform parent, string level) { UIItem.SetText(parent, UIItemTitle.txtLevel, level); }
public void SetPorp(int index, string text) { UIItem.SetText(m_propParent, index.ToString(), text); }