private ItemBar AddItem(BagItem item, string key, string eventKey, string count) { ItemBar bar = new ItemBar(); SimpleProto model = SingletonManager.Get <FreeUiManager>().GetUIData(key); if (model == null) { Debug.LogWarningFormat("item '{0}' is not defined.", key); return(null); } FreePrefabComponent ff = new FreePrefabComponent(); ff.parentObject = parentBag; int realCount = 1; if (!string.IsNullOrEmpty(count)) { realCount = int.Parse(count); } TipUtil.AddTip(eventKey, new TipData(item.cat, item.id, realCount)); ff.Initial(model.Ss[2], model.Ss[3]); ff.SetValues("TEXT_ItemNumber" + FreeMessageConstant.SpilterField + count); ff.SetEvents(""); ff.SetAllEventKey(eventKey); bar.prefab = ff; bar.value = model.Ss[2].Split(FreeMessageConstant.SpliterStyle)[1]; return(bar); }
private ItemBar AddChild(int cat, int id, int count, int entityId) { ItemBar bar = new ItemBar(); string key = (cat * 10000 + id) + "_itemUI"; SimpleProto model = SingletonManager.Get <FreeUiManager>().GetUIData(key); if (model == null) { Debug.LogWarningFormat("item '{0}' is not defined.", key); return(null); } FreePrefabComponent ff = new FreePrefabComponent(); ff.parentObject = parentGround; TipUtil.AddTip("ground,0," + entityId, new TipData(cat, id, count)); ff.Initial(model.Ss[2], model.Ss[3]); if (count > 0) { ff.SetValues("TEXT_ItemNumber" + FreeMessageConstant.SpilterField + count); } else { ff.SetValues("TEXT_ItemNumber" + FreeMessageConstant.SpilterField + " "); } ff.SetEvents(""); ff.SetAllEventKey("ground,0," + entityId); bar.prefab = ff; bar.value = model.Ss[2].Split(FreeMessageConstant.SpliterStyle)[1]; return(bar); }