//9个位置icon的创建 void creatrveicon(int id) { Dictionary <int, hallowsData> dic = A3_HallowsModel.getInstance().now_hallows(); GameObject iconf = lsts_nine_region[id - 1].transform.FindChild("icon/icon").gameObject; GameObject icon = IconImageMgr.getInstance().createA3ItemIcon((uint)dic[id].item_id, true, -1, 1, true); icon.transform.SetParent(iconf.transform, false); Text name = lsts_nine_region[id - 1].transform.FindChild("name").GetComponent <Text>(); string item_name = XMLMgr.instance.GetSXML("item.item", "id==" + (uint)dic[id].item_id).getString("item_name"); name.text = Globle.getColorStrByQuality(item_name, dic[id].h_s_d.quality); a3_BagItemData data = new a3_BagItemData(); data.tpid = (uint)dic[id].item_id; data.num = 1; a3_ItemData da = new a3_ItemData(); da = a3_BagModel.getInstance().getItemDataById(data.tpid); data.confdata = da; data.ishallows = true; new BaseButton(icon.transform).onClick = delegate(GameObject go) { this.itemOnclick(icon, data, 3); ShoworHideModel(false); }; }
void CreateItemIcon_chushou(a3_BagItemData data, int i) { uint id = data.id; GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(data, false, data.num); icon.transform.SetParent(item_Parent_chushou.transform.GetChild(i), false); itemcon_chushou[data.id] = icon; if (data.num <= 1) { icon.transform.FindChild("num").gameObject.SetActive(false); } BaseButton bs_bt = new BaseButton(icon.transform); bs_bt.onClick = delegate(GameObject go) { if (data.isEquip) { ArrayList data1 = new ArrayList(); a3_BagItemData one = a3_BagModel.getInstance().getItems()[id]; data1.Add(one); data1.Add(equip_tip_type.tip_forchushou); InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_EQUIPTIP, data1); } else { if (dic_BagItem_shll.ContainsKey(id)) { ArrayList data1 = new ArrayList(); a3_BagItemData one = dic_BagItem_shll[id]; data1.Add(one); data1.Add(equip_tip_type.tip_forchushou); InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_ITEMTIP, data1); } } }; }
void creatrve(int thisday) { for (int j = 0; j < objs.Length; j++) { objs[j].SetActive(j == thisday - 1 ? true : false); } SXML x = XMLMgr.instance.GetSXML("welfare.daily_gift"); des.text = x.GetNode("gift", "id==" + thisday).getString("note"); price.text = x.GetNode("gift", "id==" + thisday).getString("yb"); List <SXML> lst = XMLMgr.instance.GetSXML("welfare.daily_gift").GetNode("gift", "id==" + thisday).GetNodeList("item"); foreach (SXML s in lst) { GameObject clone = GameObject.Instantiate(image) as GameObject; clone.SetActive(true); clone.transform.SetParent(contain.transform, false); uint item_id = s.getUint("id"); GameObject go = IconImageMgr.getInstance().createA3ItemIcon(item_id, false, -1, 1, true); go.transform.SetParent(clone.transform.FindChild("icon").transform, false); clone.transform.FindChild("name/Text").GetComponent <Text>().text = s.getString("name"); new BaseButton(go.transform).onClick = (GameObject gos) => { showtip(item_id); }; } a3_runestone.commonScroview(contain, lst.Count); }
void initItemInfo() { Transform info = transform.FindChild("info"); info.FindChild("name").GetComponent <Text>().text = item_data.confdata.item_name; info.FindChild("name").GetComponent <Text>().color = Globle.getColorByQuality(item_data.confdata.quality); info.FindChild("desc").GetComponent <Text>().text = item_data.confdata.desc; if (item_data.confdata.use_limit > 0) { info.FindChild("lv").GetComponent <Text>().text = item_data.confdata.use_limit + ContMgr.getCont("zhuan") + item_data.confdata.use_lv + ContMgr.getCont("ji"); } else { info.FindChild("lv").GetComponent <Text>().text = ContMgr.getCont("a3_active_wuxianzhi"); } Transform Image = info.FindChild("icon"); if (Image.childCount > 0) { Destroy(Image.GetChild(0).gameObject); } GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(item_data); icon.transform.SetParent(Image, false); transform.FindChild("info/donum").GetComponent <Text>().text = item_data.num.ToString(); }
/// <summary> /// 根据配置表来显示 /// </summary> /// <param name="itemId">物品的id</param> /// <param name="rewardDescText">物品的文本信息</param> public void ShowXMLCustomizedEquipTip(uint itemId, RewardDescText?rewardDescText) { if (!rewardDescText.HasValue) { return; } if (itemIcon.transform.childCount > 0) { for (int i = itemIcon.transform.childCount - 1; i >= 0; i--) { GameObject.Destroy(itemIcon.transform.GetChild(i).gameObject); } } IconImageMgr.getInstance().createA3ItemIcon(itemId, ignoreLimit: true).transform.SetParent(itemIcon.transform, false); RewardDescText valRewardDescText = rewardDescText.Value; textItemName.text = valRewardDescText.strItemName; //道具名称 textTipDesc.text = valRewardDescText.strTipDesc; //Tip描述 textCarrLimit.text = valRewardDescText.strCarrLimit; //职业限制 textBaseHead.gameObject.SetActive(true); textBaseAttr.text = valRewardDescText.strBaseAttr; //基本属性 textAddAttr.text = valRewardDescText.strAddAttr; //追加属性 textExtraDesc1.text = valRewardDescText.strExtraDesc1; //附加描述1 textExtraDesc2.text = valRewardDescText.strExtraDesc2; //附加描述2 textExtraDesc3.text = valRewardDescText.strExtraDesc3; //附加描述3 }
private void infos() { bool flag = this.icon_obj.transform.childCount > 0; if (flag) { for (int i = 0; i < this.icon_obj.transform.childCount; i++) { UnityEngine.Object.Destroy(this.icon_obj.transform.GetChild(i).gameObject); } } GameObject gameObject = IconImageMgr.getInstance().createA3ItemIcon(this.itemdata, false, -1, 1f, false); gameObject.transform.FindChild("iconborder/ismark").gameObject.SetActive(false); gameObject.transform.SetParent(this.icon_obj.transform); gameObject.GetComponent <RectTransform>().localPosition = new Vector3(0f, 0f, 0f); this.name_txt.text = ModelBase <a3_BagModel> .getInstance().getRunestoneDataByid((int)this.itemdata.tpid).item_name; Dictionary <int, int> runeston_att = this.itemdata.runestonedata.runeston_att; foreach (int current in runeston_att.Keys) { GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.image); gameObject2.SetActive(true); gameObject2.transform.SetParent(this.contain.transform); gameObject2.GetComponent <Text>().text = Globle.getAttrNameById(current) + ":" + runeston_att[current]; } RectTransform component = this.contain.GetComponent <RectTransform>(); RectTransform component2 = this.image.GetComponent <RectTransform>(); component.sizeDelta = new Vector2(component.sizeDelta.x, component2.sizeDelta.y * (float)runeston_att.Count); this.nomask.SetActive(!this.itemdata.ismark); this.mask.SetActive(this.itemdata.ismark); }
public PayPanel(Transform trans) : base(trans) { this.root = trans; this.consumptionAwardsDic = new Dictionary <uint, awardCenterItem4Consumption>(); this.itemsParent = this.root.FindChild("awardItems/content"); List <WelfareModel.itemWelfareData> cumulateConsumption = ModelBase <WelfareModel> .getInstance().getCumulateConsumption(); foreach (WelfareModel.itemWelfareData current in cumulateConsumption) { WelfareModel.itemWelfareData iwd = current; iwd.desc = this.strDesc; a3_ItemData itemDataById = ModelBase <a3_BagModel> .getInstance().getItemDataById(current.itemId); iwd.awardName = itemDataById.item_name; GameObject gameObject = IconImageMgr.getInstance().creatItemAwardCenterIcon(itemDataById); gameObject.name = "itemWelfare"; gameObject.transform.SetParent(this.itemsParent); gameObject.transform.localScale = Vector3.one; uint id = current.itemId; new BaseButton(gameObject.transform.FindChild("icon"), 1, 1).onClick = delegate(GameObject oo) { bool flag = a3_awardCenter.instan; if (flag) { a3_awardCenter.instan.showtip(id); } }; awardCenterItem4Consumption value = new awardCenterItem4Consumption(gameObject.transform, iwd); this.consumptionAwardsDic.Add(current.id, value); } this.itemsParent.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (float)(100 * (this.consumptionAwardsDic.Count + 2))); BaseProxy <welfareProxy> .getInstance().addEventListener(welfareProxy.ACCUMULATECONSUMPTION, new Action <GameEvent>(this.onAccumulateConsumption)); }
void createItem() { Dictionary <a3_ItemData, uint> itemDataList = WelfareModel.getInstance().getFirstChargeDataList(); foreach (KeyValuePair <a3_ItemData, uint> item in itemDataList) { a3_ItemData itemData = item.Key; if (item.Value == 0) { GameObject con = this.transform.FindChild("body/awardItems/item").gameObject; GameObject clon = (GameObject)Instantiate(con); clon.SetActive(true); clon.transform.SetParent(content2d, false); GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(itemData, true, -1, 0.9f); icon.transform.SetParent(clon.transform, false); new BaseButton(icon.transform).onClick = (GameObject go) => { setTip(item.Key); }; //LayoutElement le = icon.AddComponent<LayoutElement>(); //le.minHeight = 100.0f; //le.minWidth = 100.0f; //le.preferredHeight = 100.0f; //le.preferredWidth = 100.0f; icon.gameObject.SetActive(true); //icon.transform.localScale = Vector3.one; } } }
//void oninfo(GameEvent e) //{ // Variant data = e.data; // if (data.ContainsKey("mapid") && data["mapid"].Count > 0) // open = true; // else // { // open = false; // } //} public void intoUI() { GameObject item = this.transform.FindChild("body/itemView/item").gameObject; //RectTransform con = this.transform.FindChild("body/awardItems/content").GetComponent<RectTransform>(); SXML xml = XMLMgr.instance.GetSXML("treasure_reward"); List <SXML> stagelist = xml.GetNodeList("reward"); for (int i = 0; i < stagelist.Count; i++) { GameObject clon = (GameObject)Instantiate(item); clon.SetActive(true); clon.transform.SetParent(itemViewCon, false); clon.transform.FindChild("name").GetComponent <Text>().text = stagelist[i].getString("name"); clon.transform.FindChild("count").GetComponent <Text>().text = "x" + stagelist[i].getInt("cost").ToString(); clon.transform.FindChild("num").GetComponent <Text>().text = stagelist[i].getInt("nums").ToString(); int id = stagelist[i].getInt("item_id"); GameObject con_item = clon.transform.FindChild("icon").gameObject; GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(a3_BagModel.getInstance().getItemDataById((uint)id), false, -1, 0.8f); icon.transform.SetParent(con_item.transform, false); new BaseButton(con_item.transform).onClick = (GameObject go) => { tip.SetActive(true); SXML x = XMLMgr.instance.GetSXML("item.item", "id==" + id); tip.transform.FindChild("text_bg/name/namebg").GetComponent <Text>().text = x.getString("item_name"); tip.transform.FindChild("text_bg/name/hasnum").GetComponent <Text>().text = a3_BagModel.getInstance().getItemNumByTpid((uint)id) + ContMgr.getCont("ge"); tip.transform.FindChild("text_bg/name/namebg").GetComponent <Text>().color = Globle.getColorByQuality(x.getInt("quality")); if (x.getInt("use_limit") == 0) { tip.transform.FindChild("text_bg/name/dengji").GetComponent <Text>().text = "无限制"; } else { tip.transform.FindChild("text_bg/name/dengji").GetComponent <Text>().text = x.getString("use_limit") + "转"; } tip.transform.FindChild("text_bg/text").GetComponent <Text>().text = StringUtils.formatText(x.getString("desc")); tip.transform.FindChild("text_bg/iconbg/icon").GetComponent <Image>().sprite = GAMEAPI.ABUI_LoadSprite("icon_item_" + x.getInt("icon_file")); new BaseButton(tip.transform.FindChild("close_btn")).onClick = (GameObject oo) => { tip.SetActive(false); }; }; clon.name = stagelist[i].getInt("id").ToString(); new BaseButton(clon.transform).onClick = (GameObject go) => { count = int.Parse(go.name); isthis.gameObject.SetActive(true); isthis.transform.SetParent(go.transform); isthis.transform.localPosition = Vector2.zero; }; } //for (int j = 0;j < 2;j++) //{ // GameObject clon = (GameObject)Instantiate(item); // clon.SetActive(true); // clon.transform.SetParent(itemViewCon,false); //} //float childSizeY = con.GetComponent<GridLayoutGroup>().cellSize.y; //Vector2 newSize = new Vector2(con.sizeDelta.x,count * childSizeY); //con.sizeDelta = newSize; }
public LvlUpAwardPanel(Transform trans) : base(trans) { this.root = trans; this.lvlUpAwardsDic = new Dictionary <uint, awardCenterItem4zhuan>(); this.itemsParent = this.root.FindChild("awardItems/content"); List <WelfareModel.itemWelfareData> levelReward = ModelBase <WelfareModel> .getInstance().getLevelReward(); foreach (WelfareModel.itemWelfareData current in levelReward) { WelfareModel.itemWelfareData iwd = current; iwd.desc = this.strDesc; a3_ItemData itemDataById = ModelBase <a3_BagModel> .getInstance().getItemDataById(current.itemId); GameObject gameObject = IconImageMgr.getInstance().creatItemAwardCenterIcon(itemDataById); gameObject.name = "itemWelfare"; gameObject.transform.SetParent(this.itemsParent); gameObject.transform.localScale = Vector3.one; awardCenterItem4zhuan value = new awardCenterItem4zhuan(gameObject.transform, iwd); uint id = current.itemId; new BaseButton(gameObject.transform.FindChild("icon"), 1, 1).onClick = delegate(GameObject oo) { bool flag = a3_awardCenter.instan; if (flag) { a3_awardCenter.instan.showtip(id); } }; this.lvlUpAwardsDic.Add(current.id, value); } this.itemsParent.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (float)(100 * (this.lvlUpAwardsDic.Count + 2))); BaseProxy <welfareProxy> .getInstance().addEventListener(welfareProxy.UPLEVELAWARD, new Action <GameEvent>(this.onUpLevelAward)); }
void infos() { if (icon_obj.transform.childCount > 0) { for (int i = 0; i < icon_obj.transform.childCount; i++) { Destroy(icon_obj.transform.GetChild(i).gameObject); } } GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(itemdata, false, -1, 1); icon.transform.FindChild("iconborder/ismark").gameObject.SetActive(false); icon.transform.SetParent(icon_obj.transform); icon.GetComponent <RectTransform>().localPosition = new Vector3(0, 0, 0); name_txt.text = a3_BagModel.getInstance().getRunestoneDataByid((int)itemdata.tpid).item_name; Dictionary <int, int> dic = itemdata.runestonedata.runeston_att; foreach (int i in dic.Keys) { GameObject image_clone = GameObject.Instantiate(image) as GameObject; image_clone.SetActive(true); image_clone.transform.SetParent(contain.transform); image_clone.GetComponent <Text>().text = Globle.getAttrNameById(i) + ":" + dic[i]; } RectTransform tsm = contain.GetComponent <RectTransform>(); RectTransform ts = image.GetComponent <RectTransform>(); tsm.sizeDelta = new Vector2(tsm.sizeDelta.x, ts.sizeDelta.y * dic.Count); nomask.SetActive(itemdata.ismark ? false : true); mask.SetActive(itemdata.ismark ? true : false); }
//获得服务器反馈 void doGetExp(GameEvent e) { if (off_line_exp.instance?.offline == true) { if (off_line_exp.instance.offline_item != null) { foreach (var v in off_line_exp.instance.offline_item) { a3_ItemData item1 = a3_BagModel.getInstance().getItemDataById((uint)v.tpid); GameObject go = IconImageMgr.getInstance().createA3ItemIconTip(itemid: (uint)v.tpid, num: v.num); flytxt.instance.fly(null, 6, showIcon: go); } } off_line_exp.instance.offline = false; off_line_exp.instance.offline_item.Clear(); } Variant data = e.data; int res = data["res"]; offLineModel.OffLineTime = 0; offLineModel.BaseExp = 0; debug.Log("离线经验的服务器反馈" + e.data.dump()); InterfaceMgr.getInstance().close(InterfaceMgr.OFFLINEEXP); }
private void doGetExp(GameEvent e) { off_line_exp expr_06 = off_line_exp.instance; bool flag = expr_06 != null && expr_06.offline; if (flag) { bool flag2 = off_line_exp.instance.offline_item != null; if (flag2) { foreach (a3_BagItemData current in off_line_exp.instance.offline_item) { a3_ItemData itemDataById = ModelBase <a3_BagModel> .getInstance().getItemDataById(current.tpid); GameObject showIcon = IconImageMgr.getInstance().createA3ItemIconTip(current.tpid, false, current.num, 1f, false, -1, 0, false, false, false); flytxt.instance.fly(null, 6, default(Color), showIcon); } } off_line_exp.instance.offline = false; off_line_exp.instance.offline_item.Clear(); } Variant data = e.data; int num = data["res"]; this.offLineModel.OffLineTime = 0; this.offLineModel.BaseExp = 0; debug.Log("离线经验的服务器反馈" + e.data.dump()); InterfaceMgr.getInstance().close(InterfaceMgr.OFFLINEEXP); }
private void CreateIconGo(Transform parent) { a3_BagItemData data = _rollItemdata.eqpData == null ? _rollItemdata.itemData : _rollItemdata.eqpData; _iconGo = IconImageMgr.getInstance().createA3ItemIcon(data, true, data.num, 0.75f); _iconGo.transform.SetParent(parent); _iconGo.transform.localPosition = Vector3.zero; _iconGo.transform.localScale = new Vector3(0.65f, 0.65f, 0.65f); if (data.num <= 1) { _iconGo.transform.FindChild("num").gameObject.SetActive(false); } BaseButton bs_bt = new BaseButton(_iconGo.transform); bs_bt.onClick = delegate(GameObject go) { if (data.isEquip) { ArrayList uidata = new ArrayList(); uidata.Add(data); uidata.Add(equip_tip_type.Comon_tip); InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_EQUIPTIP, uidata); } else { ArrayList uidata = new ArrayList(); uidata.Add(data); uidata.Add(equip_tip_type.Comon_tip); InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_ITEMTIP, uidata); } }; }
private void createItem() { Dictionary <a3_ItemData, uint> firstChargeDataList = ModelBase <WelfareModel> .getInstance().getFirstChargeDataList(); using (Dictionary <a3_ItemData, uint> .Enumerator enumerator = firstChargeDataList.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <a3_ItemData, uint> item = enumerator.Current; a3_ItemData key = item.Key; bool flag = item.Value == 0u; if (flag) { GameObject gameObject = base.transform.FindChild("body/awardItems/item").gameObject; GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(gameObject); gameObject2.SetActive(true); gameObject2.transform.SetParent(this.content2d, false); GameObject gameObject3 = IconImageMgr.getInstance().createA3ItemIcon(key, true, -1, 0.9f, false, -1, 0, false, false, false, -1, false, false); gameObject3.transform.SetParent(gameObject2.transform, false); new BaseButton(gameObject3.transform, 1, 1).onClick = delegate(GameObject go) { this.setTip(item.Key, false); }; gameObject3.gameObject.SetActive(true); } } } }
/*动画显示获得的奖励*/ void getItems() { DesitemObj(); roll_in.SetActive(false); roll_over.SetActive(true); for (int i = 0; i < lst_lottery_obj.Count; i++) { GameObject icons = IconImageMgr.getInstance().createA3ItemIcon( (uint)a3_ActiveOnlineModel.getInstance().GetActivelotteryItems(ids)[i + 1].item_id, false, (int)a3_ActiveOnlineModel.getInstance().GetActivelotteryItems(ids)[i + 1].num); icons.name = a3_ActiveOnlineModel.getInstance().GetActivelotteryItems(ids)[i + 1].item_id.ToString(); if ((i + 1) == getid) { icons.transform.SetParent(lst_lottery_obj[0].transform, false); } else if (i + 1 > getid) { int num = i + 1 - getid; icons.transform.SetParent(lst_lottery_obj[num].transform, false); } else { int num = getid - (i + 1); icons.transform.SetParent(lst_lottery_obj[8 - num].transform, false); } } flytxt.instance.fly(ContMgr.getCont("a3_bag_get") + a3_BagModel.getInstance().getItemDataById((uint)a3_ActiveOnlineModel.getInstance().GetActivelotteryItems(ids)[getid].item_id).item_name + "*" + (int)a3_ActiveOnlineModel.getInstance().GetActivelotteryItems(ids)[getid].num); InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.NEWBIE); ischoujiang = true; a3_activeOnlineProxy.getInstance().SendProxy(1); bigbg.SetActive(false); }
void SetView() { Transform Con = tranObj.transform.FindChild("View/scroll/content"); shouhunObj.Clear(); for (int i = 0; i < Con.childCount; i++) { GameObject.Destroy(Con.GetChild(i).gameObject); } GameObject item = tranObj.transform.FindChild("View/scroll/0").gameObject; List <SXML> SoulList = sumXml.GetNodeList("mon_soul"); foreach (SXML Soul in SoulList) { GameObject clon = GameObject.Instantiate(item) as GameObject; clon.SetActive(true); clon.transform.SetParent(Con, false); clon.transform.FindChild("name").GetComponent <Text>().text = Soul.getString("name"); int soulid = Soul.getInt("soul_id"); new BaseButton(clon.transform.FindChild("todo")).onClick = (GameObject go) => { A3_SummonProxy.getInstance().sendshouhun(CurSummonID, (uint)soulid, 1); }; int itemid = Soul.getInt("item_id"); a3_ItemData data = a3_BagModel.getInstance().getItemDataById((uint)itemid); GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(data); icon.SetActive(true); icon.transform.SetParent(clon.transform.FindChild("todo/icon"), false); shouhunObj[soulid] = clon; } }
private void initItemInfo() { Transform transform = base.transform.FindChild("info"); transform.FindChild("name").GetComponent <Text>().text = this.item_data.confdata.item_name; transform.FindChild("name").GetComponent <Text>().color = Globle.getColorByQuality(this.item_data.confdata.quality); transform.FindChild("desc").GetComponent <Text>().text = this.item_data.confdata.desc; transform.FindChild("value").GetComponent <Text>().text = this.item_data.confdata.value.ToString(); Transform transform2 = transform.FindChild("icon"); bool flag = transform2.childCount > 0; if (flag) { UnityEngine.Object.Destroy(transform2.GetChild(0).gameObject); } GameObject gameObject = IconImageMgr.getInstance().createA3ItemIcon(this.item_data, false, -1, 1f, false); gameObject.transform.SetParent(transform2, false); this.cur_num = 1; string arg_12F_0 = this.item_data.summondata.isSpecial ? "变异*" : ""; transform.FindChild("grade").GetComponent <Text>().text = ModelBase <A3_SummonModel> .getInstance().IntGradeToStr(this.item_data.summondata.grade); transform.FindChild("type").GetComponent <Text>().text = ModelBase <A3_SummonModel> .getInstance().IntNaturalToStr(this.item_data.summondata.naturaltype); }
public override void onShowed() { base.onShowed(); bool flag = this.uiData != null && this.uiData.Count > 0; if (flag) { this.giftdata = (GiftCardData)this.uiData[0]; } bool flag2 = this.giftdata == null; if (!flag2) { base.transform.FindChild("name").GetComponent <Text>().text = this.giftdata.cardType.name; base.transform.FindChild("desc").GetComponent <Text>().text = this.giftdata.cardType.desc; Transform transform = base.transform.FindChild("itemMask/items"); for (int i = 0; i < transform.childCount; i++) { UnityEngine.Object.Destroy(transform.GetChild(i).gameObject); } foreach (BaseItemData current in this.giftdata.cardType.lItem) { GameObject gameObject = IconImageMgr.getInstance().createA3ItemIcon(uint.Parse(current.id), true, current.num, 1f, false, -1, 0, false, false, false, false); gameObject.transform.FindChild("bicon").gameObject.SetActive(true); gameObject.transform.SetParent(transform, false); } } }
void creatrveAward() { for (int i = 0; i < reward_parent.childCount; i++) { away[i + 1] = reward_parent.GetChild(i).gameObject; int nub = i; new BaseButton(reward_parent.GetChild(i).FindChild("this").transform).onClick = (GameObject go) => { getAwardBtnOnClick(nub + 1); }; } SXML x = XMLMgr.instance.GetSXML("clan"); List <SXML> xmls = XMLMgr.instance.GetSXMLList("clan.donate_awd"); foreach (SXML xx in xmls) { build_award ba = new build_award(); ba.id = xx.getInt("id"); ba.limit_donate = xx.getInt("limit_donate"); ba.item_id = xx.GetNode("RewardItem").getInt("item_id"); ba.item_num = xx.GetNode("RewardItem").getInt("value"); dic_away[ba.id] = ba; GameObject icon = IconImageMgr.getInstance().createA3ItemIcon((uint)ba.item_id, true, ba.item_num, 1); icon.transform.FindChild("iconbor").gameObject.SetActive(false); icon.transform.FindChild("wk").gameObject.SetActive(false); icon.transform.SetParent(away[ba.id].transform, false); icon.transform.SetAsFirstSibling(); away[ba.id].transform.FindChild("num").GetComponent <Text>().text = ba.limit_donate.ToString(); new BaseButton(icon.transform).onClick = (GameObject go) => { itemtipOnclick(go, (uint)ba.item_id, ba.item_num); }; } }
void createEquip() { Dictionary <a3_ItemData, uint> itemDataList = WelfareModel.getInstance().getFirstChargeDataList(); foreach (KeyValuePair <a3_ItemData, uint> item in itemDataList) { a3_ItemData itemData = item.Key; if (item.Value != 0) { if (item.Value == (uint)PlayerModel.getInstance().profession) { GameObject con = this.transform.FindChild("body/awardItems/equip").gameObject; GameObject clon = (GameObject)Instantiate(con); clon.SetActive(true); clon.transform.SetParent(content2d, false); GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(itemData, true); icon.transform.FindChild("iconborder").gameObject.SetActive(false); icon.transform.SetParent(clon.transform, false); icon.gameObject.SetActive(true); new BaseButton(icon.transform).onClick = (GameObject go) => { setTip(item.Key, true); }; } } } }
public override void onShowed() { base.onShowed(); if (uiData != null && uiData.Count > 0) { giftdata = (GiftCardData)uiData[0]; } if (giftdata == null) { return; } transform.FindChild("name").GetComponent <Text>().text = giftdata.cardType.name; transform.FindChild("desc").GetComponent <Text>().text = giftdata.cardType.desc; Transform con = transform.FindChild("itemMask/items"); for (int i = 0; i < con.childCount; i++) { GameObject.Destroy(con.GetChild(i).gameObject); } foreach (BaseItemData one in giftdata.cardType.lItem) { GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(uint.Parse(one.id), true, one.num); icon.transform.FindChild("bicon").gameObject.SetActive(true); icon.transform.SetParent(con, false); } }
private void ShowObj(Dictionary <uint, a3_BagItemData> dic, Dictionary <uint, GameObject> dic_obj, GameObject contain) { foreach (uint current in this.dic_change.Keys) { GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(dic[current], true, -1, 1f, false); bool flag = dic == this.dic_left; if (flag) { icon.transform.SetParent(contain.transform.GetChild(this.left_count).transform, false); this.left_count++; } else { icon.transform.SetParent(contain.transform.GetChild(this.right_count).transform, false); this.right_count++; } icon.name = dic[current].id.ToString(); BaseButton baseButton = new BaseButton(icon.transform, 1, 1); baseButton.onClick = delegate(GameObject go) { bool flag2 = dic == this.dic_left; if (flag2) { this.onEquipClickShowTips(icon, uint.Parse(icon.name), true); } else { this.onEquipClickShowTips(icon, uint.Parse(icon.name), false); } }; dic_obj[current] = icon; } this.dic_change.Clear(); }
//private void initItemInfo() //{ // Transform info = transform.FindChild("info"); // info.FindChild("name").GetComponent<Text>().text = item_data.confdata.item_name; // info.FindChild("name").GetComponent<Text>().color = Globle.getColorByQuality(item_data.confdata.quality); // info.FindChild("desc").GetComponent<Text>().text = item_data.confdata.desc; // info.FindChild("value").GetComponent<Text>().text = item_data.confdata.value.ToString(); // Transform Image = info.FindChild("icon"); // if (Image.childCount > 0) // { // Destroy(Image.GetChild(0).gameObject); // } // GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(item_data); // icon.transform.SetParent(Image, false); // cur_num = 1; // var spestr = item_data.summondata.isSpecial ? ContMgr.getCont("a3_summon16") +"*" : ""; // info.FindChild("grade").GetComponent<Text>().text = A3_SummonModel.getInstance().IntGradeToStr(item_data.summondata.grade); // info.FindChild("type").GetComponent<Text>().text = A3_SummonModel.getInstance().IntNaturalToStr(item_data.summondata.naturaltype); //} private void initItemDetail() { Transform info = transform.FindChild("details/info"); info.FindChild("name").GetComponent <Text>().text = item_data.summondata.name; info.FindChild("name").GetComponent <Text>().color = Globle.getColorByQuality(item_data.summondata.grade + 1); info.FindChild("basic/left/lv").GetComponent <Text>().text = ContMgr.getCont("a3_summon12") + item_data.summondata.level; //info.FindChild("basic/left/blood").GetComponent<Text>().text = ContMgr.getCont("a3_summon13") + (item_data.summondata.blood > 1 ? ContMgr.getCont("a3_summon14") : ContMgr.getCont("a3_summon15")); var spestr = item_data.summondata.isSpecial ? ContMgr.getCont("a3_summon16") + "*" : ""; // info.FindChild("basic/left/grade").GetComponent<Text>().text = ContMgr.getCont("a3_summon25") + A3_SummonModel.getInstance().IntGradeToStr(item_data.summondata.grade); info.FindChild("basic/right/lifespan").GetComponent <Text>().text = ContMgr.getCont("a3_summon7") + ":" + item_data.summondata.lifespan; info.FindChild("basic/right/luck").GetComponent <Text>().text = ContMgr.getCont("a3_summon27") + item_data.summondata.luck; //info.FindChild("basic/right/type").GetComponent<Text>().text = ContMgr.getCont("a3_summon17") + A3_SummonModel.getInstance().IntNaturalToStr(item_data.summondata.naturaltype); info.FindChild("natural/values/1").GetComponent <Text>().text = ContMgr.getCont("a3tips_summon0") + item_data.summondata.attNatural; info.FindChild("natural/values/2").GetComponent <Text>().text = ContMgr.getCont("a3tips_summon1") + item_data.summondata.defNatural; info.FindChild("natural/values/3").GetComponent <Text>().text = ContMgr.getCont("a3tips_summon2") + item_data.summondata.agiNatural; info.FindChild("natural/values/4").GetComponent <Text>().text = ContMgr.getCont("a3tips_summon3") + item_data.summondata.conNatural; info.FindChild("att/values/1").GetComponent <Text>().text = ContMgr.getCont("a3tips_summon4") + item_data.summondata.maxhp; info.FindChild("att/values/2").GetComponent <Text>().text = ContMgr.getCont("a3tips_summon5") + item_data.summondata.min_attack + " ~ " + item_data.summondata.max_attack; info.FindChild("att/values/3").GetComponent <Text>().text = ContMgr.getCont("a3tips_summon6") + item_data.summondata.physics_def; info.FindChild("att/values/4").GetComponent <Text>().text = ContMgr.getCont("a3tips_summon7") + item_data.summondata.magic_def; info.FindChild("att/values/5").GetComponent <Text>().text = ContMgr.getCont("a3tips_summon8") + (float)item_data.summondata.physics_dmg_red / 10 + "%"; info.FindChild("att/values/6").GetComponent <Text>().text = ContMgr.getCont("a3tips_summon9") + (float)item_data.summondata.magic_dmg_red / 10 + "%"; info.FindChild("att/values/7").GetComponent <Text>().text = ContMgr.getCont("a3tips_summon10") + item_data.summondata.double_damage_rate; info.FindChild("att/values/8").GetComponent <Text>().text = ContMgr.getCont("a3tips_summon11") + item_data.summondata.reflect_crit_rate; var starRoot = info.FindChild("stars"); SetStar(starRoot, item_data.summondata.star); Transform Image = info.FindChild("icon"); if (Image.childCount > 0) { Destroy(Image.GetChild(0).gameObject); } GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(item_data); icon.transform.SetParent(Image, false); var SkillCon = this.transform.FindChild("skills"); for (int i = 0; i < SkillCon.childCount; i++) { SkillCon.GetChild(i).FindChild("icon/icon").gameObject.SetActive(false); SkillCon.GetChild(i).FindChild("lock").gameObject.SetActive(true); } int idner = 1; foreach (summonskill skill in item_data.summondata.skills.Values) { Transform skillCell = SkillCon.FindChild(idner.ToString()); skillCell.FindChild("icon/icon").gameObject.SetActive(true); skillCell.FindChild("lock").gameObject.SetActive(false); SXML xx = XMLMgr.instance.GetSXML("skill.skill", "id==" + skill.skillid); skillCell.FindChild("icon/icon").GetComponent <Image>().sprite = GAMEAPI.ABUI_LoadSprite("icon_smskill_" + xx.getInt("icon")); idner++; } }
//背包里面icon的创建 void creatrveicon_bag(int i, a3_BagItemData data) { GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(data, true, data.num); dic_havehallows[data.confdata.tpid] = icon; icon.transform.SetParent(contain_h_bag.transform.GetChild(i).transform, false); new BaseButton(icon.transform).onClick = delegate(GameObject go) { this.itemOnclick(icon, data, 2); ShoworHideModel(false); }; }
void initItemBuy() { var objsurebuy = transform.FindChild("buy"); var surebuy_name = objsurebuy.transform.FindChild("bg/contain/name").GetComponent <Text>(); var surebuy_des = objsurebuy.transform.FindChild("bg/contain/des_bg/Text").GetComponent <Text>(); GameObject icon = objsurebuy.transform.FindChild("bg/contain/icon").gameObject; if (icon.transform.childCount > 0) { for (int i = 0; i < icon.transform.childCount; i++) { Destroy(icon.transform.GetChild(i).gameObject); } } GameObject item = IconImageMgr.getInstance().createA3ItemIcon(item_data); item.transform.SetParent(icon.transform, false); surebuy_name.text = a3_BagModel.getInstance().getItemDataById((uint)item_data.confdata.tpid).item_name; int color = a3_BagModel.getInstance().getItemDataById((uint)item_data.confdata.tpid).quality; surebuy_name.color = Globle.getColorByQuality(color); surebuy_des.text = a3_BagModel.getInstance().getItemDataById((uint)item_data.confdata.tpid).desc; foreach (var v in Shop_a3Model.getInstance().itemsdic.Values) { if (v.itemid == (int)item_data.confdata.tpid) { sd = v; } } bar.numberOfSteps = (int)PlayerModel.getInstance().gold / sd.value; maxnum = bar.numberOfSteps; if (maxnum <= 0) { bs_bt1.interactable = false; bs_bt2.interactable = false; bs_buy.interactable = false; bs_buy.onClick = (GameObject go) => flytxt.instance.fly(ContMgr.getCont("a3_dyetip")); return; } else { buynum = 1; totalMoney.text = (buynum * sd.value).ToString(); bar.value = (float)buynum / (float)maxnum; } bs_buy.onClick = delegate(GameObject goo) { if (sd == null) { return; } if (buynum >= 1) { Shop_a3Proxy.getInstance().sendinfo(2, sd.id, buynum); } }; }
void refreshShow(a3_BagItemData data) { Transform Image = this.transform.FindChild("bg/icon"); if (Image.childCount > 0) { for (int i = 0; i < Image.childCount; i++) { Destroy(Image.GetChild(i).gameObject); } } GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(data); icon.transform.SetParent(Image, false); new BaseButton(this.transform.FindChild("bg/do")).onClick = (GameObject go) => { if (data.isEquip) { EquipProxy.getInstance().sendChangeEquip(data.id); } else if (data.confdata.use_type == 13) { a3_BagModel.getInstance().useItemByTpid(data.confdata.tpid, 1); } else if (data.confdata.use_type == 20)//宠物在开启功能之前获得 { if (FunctionOpenMgr.instance.Check(FunctionOpenMgr.PET)) { a3_BagModel.getInstance().useItemByTpid(data.confdata.tpid, 1); } else { flytxt.instance.fly(ContMgr.getCont("func_limit_8")); } } else if (data.isSummon) { A3_SummonProxy.getInstance().sendUseSummon((uint)data.id); } }; new BaseButton(this.transform.FindChild("bg/close")).onClick = (GameObject go) => { if (data.isEquip) { a3_BagModel.getInstance().neweqp.Remove(data.id); } else if (data.confdata.use_type == 13 || data.confdata.use_type == 20) { a3_BagModel.getInstance().newshow_item.Remove(data.id); } else if (data.isSummon) { a3_BagModel.getInstance().newshow_summon.Remove(data.id); } showUse(); }; }
void CreatrveIcons(a3_BagItemData data, int i) { GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(data, true, -1, 0.8f); icon.transform.SetParent(contain_haveRunestones.transform.GetChild(i).transform, false); icon.name = data.id.ToString(); dic_runestones_obj[data.id] = icon; BaseButton bs_bt = new BaseButton(icon.transform); bs_bt.onClick = delegate(GameObject go) { this.onItemClick(data, icon, data.id, 1); }; }
void SetNeedItem() { if (!A3_SummonModel.getInstance().GetSummons().ContainsKey(CurSummonID)) { return; } a3_BagItemData data = A3_SummonModel.getInstance().GetSummons()[CurSummonID]; List <SXML> reset = sumXml.GetNodeList("reset"); int itemid = 0; int num = 0; foreach (SXML it in reset) { if (data.summondata.star == it.getInt("star")) { itemid = it.getInt("need_item_id"); NeedItemId = itemid; num = it.getInt("need_item_sum"); break; } } if (itemid > 0 && num != 0) { for (int i = 0; i < tranObj.transform.FindChild("needitem/icon").childCount; i++) { GameObject.Destroy(tranObj.transform.FindChild("needitem/icon").GetChild(i).gameObject); } a3_ItemData itemdata = a3_BagModel.getInstance().getItemDataById((uint)itemid); GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(itemdata); icon.transform.SetParent(tranObj.transform.FindChild("needitem/icon"), false); new BaseButton(icon.transform).onClick = (GameObject go) => { ArrayList arr = new ArrayList(); arr.Add((uint)itemid); arr.Add(1); InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_MINITIP, arr); }; int haveCount = a3_BagModel.getInstance().getItemNumByTpid((uint)itemid); if (num <= haveCount) { tranObj.transform.FindChild("needitem/count").GetComponent <Text>().text = "<color=#00FF56FF>" + haveCount + "/" + num + "</color>"; //tranObj.transform.FindChild("todo").GetComponent<Button>().interactable = true; CanDo_change = true; } else { tranObj.transform.FindChild("needitem/count").GetComponent <Text>().text = "<color=#f90e0e>" + haveCount + "/" + num + "</color>"; //tranObj.transform.FindChild("todo").GetComponent<Button>().interactable = false; CanDo_change = false; } } }
void SetCurSumInfo() { if (!A3_SummonModel.getInstance().GetSummons().ContainsKey(CurSummonID)) { return; } a3_BagItemData data = A3_SummonModel.getInstance().GetSummons()[CurSummonID]; tranObj.transform.FindChild("zhu/lv").GetComponent <Text>().text = data.summondata.level.ToString(); tranObj.transform.FindChild("zhu/name").GetComponent <Text>().text = data.summondata.name; tranObj.transform.FindChild("zhu/zhanlimun").GetComponent <Text>().text = data.summondata.power.ToString(); for (int m = 0; m < tranObj.transform.FindChild("zhu/icon").childCount; m++) { GameObject.Destroy(tranObj.transform.FindChild("zhu/icon").GetChild(m).gameObject); } GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(data.confdata); icon.transform.SetParent(tranObj.transform.FindChild("zhu/icon"), false); Transform SkillCon = tranObj.transform.FindChild("zhu/skills"); for (int i = 0; i < SkillCon.childCount; i++) { SkillCon.GetChild(i).FindChild("icon/icon").gameObject.SetActive(false); SkillCon.GetChild(i).FindChild("lock").gameObject.SetActive(true); } int idner = 1; foreach (summonskill skill in data.summondata.skills.Values) { Transform skillCell = SkillCon.FindChild(idner.ToString()); skillCell.FindChild("icon/icon").gameObject.SetActive(true); skillCell.FindChild("lock").gameObject.SetActive(false); SXML xx = XMLMgr.instance.GetSXML("skill.skill", "id==" + skill.skillid); skillCell.FindChild("icon/icon").GetComponent <Image>().sprite = GAMEAPI.ABUI_LoadSprite("icon_smskill_" + xx.getInt("icon")); new BaseButton(skillCell).onClick = (GameObject go) => { if (getSummonWin() == null) { return; } if (skillCell.FindChild("icon/icon").gameObject.activeSelf == false) { return; } GameObject tip = getSummonWin().GetSmallWin("uilayer_skilltip_summon"); tip.transform.FindChild("Text").GetComponent <Text>().text = ContMgr.getCont("skilltip_summon_0"); tip.transform.FindChild("black/Text").GetComponent <Text>().text = ContMgr.getCont("ToSure_summon_1"); tip.SetActive(true); setskilltip(tip, skill); }; idner++; } }