public List <sdGameItem> GetGemInBag(int gemLevel) { List <sdGameItem> table = new List <sdGameItem>(); foreach (DictionaryEntry item in itemDB) { sdGameItem info = (sdGameItem)item.Value; if (info.bagIndex == (int)PanelType.Panel_Bag && info.itemClass == 51 && info.subClass == 1 && (gemLevel == 0 || gemLevel == info.level)) { table.Add(info.Clone()); } } return(table); }
public List <sdGameItem> GetGemOnInBag() { List <sdGameItem> table = new List <sdGameItem>(); foreach (DictionaryEntry item in itemDB) { sdGameItem info = (sdGameItem)item.Value; Hashtable gemInfo = sdConfDataMgr.Instance().GetItemById(info.templateID.ToString()); if (info.bagIndex == (int)PanelType.Panel_Bag && info.itemClass == 51 && info.subClass == 1) { int[] equipPos = new int[] { int.Parse(gemInfo["HolePos"].ToString()) }; BitArray ary = new BitArray(equipPos); if (ary[upItem.equipPos]) { table.Add(info.Clone()); } } } return(table); }
public void SetInfo(string id, Hashtable info) { isSelected = false; if (gameObject.transform.FindChild("active") != null) { gameObject.transform.FindChild("active").GetComponent <UISprite>().spriteName = ""; } itemInfo = info; itemid = id; if (panel == PanelType.Panel_ItemSelect) { if (!isSelected) { if (gameObject.transform.FindChild("bgselect") != null) { gameObject.transform.FindChild("bgselect").GetComponent <UISprite>().spriteName = ""; } } else { if (gameObject.transform.FindChild("bgselect") != null) { gameObject.transform.FindChild("bgselect").GetComponent <UISprite>().spriteName = "g"; } } } if (info != null) { if (info.ContainsKey("Class") && int.Parse(info["Class"].ToString()) == (int)HeaderProto.EItemClass.ItemClass_Pet_Item) { Hashtable petInfo = sdConfDataMgr.Instance().GetPetTemplate(info["Expend"].ToString()); gameObject.transform.FindChild("icon").GetComponent <UISprite>().spriteName = petInfo["Icon"].ToString(); if (sdConfDataMgr.Instance().PetAtlas != null) { gameObject.transform.FindChild("icon").GetComponent <UISprite>().atlas = sdConfDataMgr.Instance().PetAtlas; } else { sdConfDataMgr.Instance().LoadPetAtlas(new EventDelegate(OnSetPetAtlas)); } if (int.Parse(info["SubClass"].ToString()) == 2 && GetComponent <UISprite>() != null) { GetComponent <UISprite>().spriteName = "IconFrame0-cp"; } return; } if (panel == PanelType.Panel_Equip) { if (gameObject.transform.FindChild("canequip") != null) { gameObject.transform.FindChild("canequip").GetComponent <UILabel>().text = ""; } } if (panel == PanelType.Panel_Skill_Active || panel == PanelType.Panel_Skill_Passive) { gameObject.transform.FindChild("icon").GetComponent <UISprite>().spriteName = info["icon"].ToString(); // if(pointBack != null) // { // pointBack.transform.FindChild("point").GetComponent<UILabel>().text = info["CostSkillPoint"].ToString(); // } } else if (panel == PanelType.Panel_ItemMake) { string tid = info["ID"].ToString(); tempId = tid; gameObject.transform.FindChild("icon").GetComponent <UISprite>().spriteName = info["IconPath"].ToString(); iconId = int.Parse(info["IconID"].ToString()); sdConfDataMgr.Instance().LoadItemAtlas(iconId.ToString(), OnSetAtlas); if (gameObject.transform.FindChild("name") != null) { gameObject.transform.FindChild("name").GetComponent <UILabel>().text = info["ShowName"].ToString(); } if (gameObject.transform.FindChild("count") != null) { gameObject.transform.FindChild("count").GetComponent <UILabel>().text = info["TempCount"].ToString(); } } else if (panel == PanelType.Panel_Jiesuan || panel == PanelType.Panel_Treasure || (panel == PanelType.Panel_ItemUp && index != -1)) { string tid = info["ID"].ToString(); tempId = tid; //if(panel != PanelType.Panel_ItemUp)GetComponent<UISprite>().spriteName = "bg_icon2"; if (gameObject.transform.FindChild("iconbg") != null) { gameObject.transform.FindChild("iconbg").GetComponent <UISprite>().spriteName = sdConfDataMgr.Instance().GetItemQuilityBorder(int.Parse(info["Quility"].ToString())); } if (jiesuanType == JiesuanSlotType.Pet) { Hashtable petInfo = sdConfDataMgr.Instance().GetPetTemplate(info["Expend"].ToString()); gameObject.transform.FindChild("icon").GetComponent <UISprite>().spriteName = petInfo["Icon"].ToString(); if (sdConfDataMgr.Instance().PetAtlas != null) { gameObject.transform.FindChild("icon").GetComponent <UISprite>().atlas = sdConfDataMgr.Instance().PetAtlas; } else { sdConfDataMgr.Instance().LoadPetAtlas(new EventDelegate(OnSetPetAtlas)); } if (int.Parse(info["SubClass"].ToString()) == 2) { GetComponent <UISprite>().spriteName = "IconFrame0-cp"; } } else { gameObject.transform.FindChild("icon").GetComponent <UISprite>().spriteName = info["IconPath"].ToString(); iconId = int.Parse(info["IconID"].ToString()); sdConfDataMgr.Instance().LoadItemAtlas(iconId.ToString(), OnSetAtlas); } } else { if (gameObject.transform.FindChild("bg") != null) { gameObject.transform.FindChild("bg").GetComponent <UISprite>().spriteName = "List_bg"; } string tid = info["ID"].ToString(); tempId = tid; if (id == "100") //½ð±Òaa { gameObject.transform.FindChild("icon").GetComponent <UISprite>().spriteName = "icon_money"; gameObject.transform.FindChild("icon").GetComponent <UISprite>().atlas = sdConfDataMgr.Instance().commonAtlas; } else if (id == "101") //Ñ«ÕÂaa { gameObject.transform.FindChild("icon").GetComponent <UISprite>().spriteName = "icon_noncash"; gameObject.transform.FindChild("icon").GetComponent <UISprite>().atlas = sdConfDataMgr.Instance().commonAtlas; } else if (id == "200") //ÌåÁ¦aaa { gameObject.transform.FindChild("icon").GetComponent <UISprite>().spriteName = "xin"; gameObject.transform.FindChild("icon").GetComponent <UISprite>().atlas = sdConfDataMgr.Instance().commonAtlas; } else { Hashtable target = sdConfDataMgr.Instance().GetItemById(tid); if (target != null) { if (panel == PanelType.Panel_GemSet || (panel == PanelType.Panel_ItemUp && index == -1)) { if (gameObject.transform.FindChild("bgx") != null) { gameObject.transform.FindChild("bgx").GetComponent <UISprite>().spriteName = "bg-xq"; } if (gameObject.transform.FindChild("name") != null) { string name = target["ShowName"].ToString(); gameObject.transform.FindChild("name").GetComponent <UILabel>().text = name; } if (gameObject.transform.FindChild("att") != null) { Hashtable pro = sdConfDataMgr.Instance().GetProperty(tid); foreach (DictionaryEntry gemInfo in pro) { gameObject.transform.FindChild("att").GetComponent <UILabel>().text = string.Format("{0} +{1}", gemInfo.Key.ToString(), gemInfo.Value.ToString()); } } } bool isGem = false; if (target["Class"].ToString() == "51" && target["SubClass"].ToString() == "1") { isGem = true; } if (gameObject.transform.FindChild("icon") != null) { gameObject.transform.FindChild("icon").GetComponent <UISprite>().spriteName = target["IconPath"].ToString(); iconId = int.Parse(target["IconID"].ToString()); sdConfDataMgr.Instance().LoadItemAtlas(iconId.ToString(), OnSetAtlas); } if (gameObject.transform.FindChild("active") != null) { gameObject.transform.FindChild("active").GetComponent <UISprite>().spriteName = ""; } if (gameObject.transform.FindChild("bg") != null) { gameObject.transform.FindChild("bg").GetComponent <UISprite>().spriteName = "List_bg"; } if (gameObject.transform.FindChild("lb_price") != null) { string jobnam = string.Format("{0}:{1}", sdConfDataMgr.Instance().GetShowStr("Price"), target["Value"].ToString()); gameObject.transform.FindChild("lb_price").GetComponent <UILabel>().text = jobnam; } sdGameItem tempItem = sdGameItemMgr.Instance.getItem(ulong.Parse(id)); if (tempItem != null) { SetNew(tempItem.isNew); if (gameObject.transform.FindChild("count") != null) { gameObject.transform.FindChild("count").GetComponent <UILabel>().text = sdGameItemMgr.Instance.GetItemCount(int.Parse(tempId)).ToString(); } } if (gameObject.transform.FindChild("lb_lv") != null) { int itemLevel = 0; if (tempItem != null) { itemLevel = tempItem.level; } else { itemLevel = int.Parse(target["NeedLevel"].ToString()); } if (sdGameLevel.instance.mainChar["Level"] < itemLevel && !isGem) { gameObject.transform.FindChild("lb_lv").GetComponent <UILabel>().color = Color.red; } else { gameObject.transform.FindChild("lb_lv").GetComponent <UILabel>().color = new Color(128, 128, 128, 255); } string level = string.Format("{0}:{1}", sdConfDataMgr.Instance().GetShowStr("Level"), itemLevel); gameObject.transform.FindChild("lb_lv").GetComponent <UILabel>().text = level; } if (gameObject.transform.FindChild("lb_name") != null) { string strName = target["ShowName"].ToString(); if (tempItem != null) { if (tempItem.upLevel > 0) { strName += string.Format("[{0}]+{1}", sdConfDataMgr.Instance().GetColorHex(Color.yellow), tempItem.upLevel); } } gameObject.transform.FindChild("lb_name").GetComponent <UILabel>().color = sdConfDataMgr.Instance().GetItemQuilityColor(int.Parse(target["Quility"].ToString())); gameObject.transform.FindChild("lb_name").GetComponent <UILabel>().text = strName; } if (gameObject.transform.FindChild("iconbg") != null) { gameObject.transform.FindChild("iconbg").GetComponent <UISprite>().spriteName = sdConfDataMgr.Instance().GetItemQuilityBorder(int.Parse(target["Quility"].ToString())); } if (gameObject.transform.FindChild("lb_type") != null) { if (target["Class"].ToString() == "51" && target["SubClass"].ToString() == "1") { string partname = sdConfDataMgr.Instance().GetGemEquipPosName(target["HolePos"].ToString()); gameObject.transform.FindChild("lb_type").GetComponent <UILabel>().text = string.Format("{0}:{1}", sdConfDataMgr.Instance().GetShowStr("GemPart"), partname); } else { string partname = sdConfDataMgr.Instance().GetItemClassName(target["Class"].ToString(), target["SubClass"].ToString()); if (partname != "") { gameObject.transform.FindChild("lb_type").GetComponent <UILabel>().text = string.Format("{0}:{1}", sdConfDataMgr.Instance().GetShowStr("Part"), partname); } else { gameObject.transform.FindChild("lb_type").GetComponent <UILabel>().text = ""; } } } if (tempItem != null && transform.FindChild("lb_count") != null) { sdGameItem gi = tempItem.Clone(); if (panel == PanelType.Panel_ItemSelect) { IEnumerator itr = sdGameItemMgr.Instance.selGemList.GetEnumerator(); while (itr.MoveNext()) { KeyValuePair <string, int> key = (KeyValuePair <string, int>)itr.Current; int num = key.Value; for (int i = 0; i < num; ++i) { if (gi.instanceID.ToString() == key.Key) { if (gi.count > 0) { gi.count--; } } } } } if (gi.count <= 1) { transform.FindChild("lb_count").GetComponent <UILabel>().text = ""; } else { transform.FindChild("lb_count").GetComponent <UILabel>().text = gi.count.ToString(); } } int score = 0; if (tempItem == null) { score = sdConfDataMgr.Instance().GetItemScore(tid, 0); } else { score = sdConfDataMgr.Instance().GetItemScore(tempItem.instanceID); } if (gameObject.transform.FindChild("lb_point") != null) { string txt = string.Format("{0} {1}", sdConfDataMgr.Instance().GetShowStr("Score"), score.ToString()); if (isGem || score == 0) { gameObject.transform.FindChild("lb_point").GetComponent <UILabel>().text = ""; } else { gameObject.transform.FindChild("lb_point").GetComponent <UILabel>().text = txt; } } sdGameItem item = sdGameItemMgr.Instance.getEquipItemByPos(int.Parse(target["Character"].ToString())); Transform itemChangeFlag = gameObject.transform.FindChild("Lb_defence_row"); Transform itemChangNum = gameObject.transform.FindChild("Lb_defence_diff"); if (itemChangeFlag == null || itemChangNum == null) { return; } if (isGem || score == 0) { itemChangeFlag.GetComponent <UISprite>().spriteName = ""; itemChangNum.GetComponent <UILabel>().text = ""; } else { if (item == null) { itemChangeFlag.GetComponent <UISprite>().spriteName = "up2"; itemChangNum.GetComponent <UILabel>().color = Color.green; itemChangNum.GetComponent <UILabel>().text = score.ToString(); } else { int comScore = sdConfDataMgr.Instance().GetItemScore(item.instanceID); int changeValue = score - comScore; if (changeValue != 0) { if (changeValue > 0) { itemChangeFlag.GetComponent <UISprite>().spriteName = "up2"; itemChangNum.GetComponent <UILabel>().color = Color.green; } else { itemChangeFlag.GetComponent <UISprite>().spriteName = "down2"; itemChangNum.GetComponent <UILabel>().color = Color.red; } itemChangNum.GetComponent <UILabel>().text = Math.Abs(changeValue).ToString(); } else { itemChangNum.GetComponent <UILabel>().text = ""; itemChangeFlag.GetComponent <UISprite>().spriteName = ""; } } } } } } return; } else { gameObject.transform.FindChild("icon").GetComponent <UISprite>().spriteName = ""; if (panel == PanelType.Panel_Jiesuan || panel == PanelType.Panel_Treasure) { GetComponent <UISprite>().spriteName = ""; } if (gameObject.transform.FindChild("iconbg") != null) { if (panel == PanelType.Panel_Equip || panel == PanelType.Panel_Jiesuan) { gameObject.transform.FindChild("iconbg").GetComponent <UISprite>().spriteName = ""; } } if (gameObject.transform.FindChild("count") != null) { gameObject.transform.FindChild("count").GetComponent <UILabel>().text = ""; } if (gameObject.transform.FindChild("name") != null) { gameObject.transform.FindChild("name").GetComponent <UILabel>().text = ""; } if (panel == PanelType.Panel_GemSet || (panel == PanelType.Panel_ItemUp && index == -1)) { if (gameObject.transform.FindChild("bgx") != null) { gameObject.transform.FindChild("bgx").GetComponent <UISprite>().spriteName = ""; } if (gameObject.transform.FindChild("name") != null) { gameObject.transform.FindChild("name").GetComponent <UILabel>().text = ""; } if (gameObject.transform.FindChild("att") != null) { gameObject.transform.FindChild("att").GetComponent <UILabel>().text = ""; } } } }