public override void Process() { if (result == END_ERROR) { return; } GameEventDispatcher.Inst.dispatchEvent(GameEventID.UI_ChapterBoxGot, boxnum); List <int> _temp = dropidlist.ToList <int>(); for (int i = 0; i < _temp.Count; i++) { InnerdropTemplate _it = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(_temp[i]); if (_it == null) { continue; } //新手引导先关 if (_it.getInnerdropid() == 1211010001) { if (_it.getObjectid() == 1400000009) { //新手引导相关 介绍经验结晶用途(强制) if (GuideManager.GetInstance().IsContentGuideID(200501) == false) { GuideManager.GetInstance().ShowGuideWithIndex(200501, ShowNewGuide); } } } } }
private void OnClickReceiveBtn() { int HeroNum = 0; int DaoJuNum = 0; for (int i = 0; i < SelectItemMail.m_innerdropidlist.Count; i++) { InnerdropTemplate item = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(SelectItemMail.m_innerdropidlist[i]); int _goid = item.getObjectid();//掉落物ID int itemid = item.getObjectid() / 1000000; switch (itemid) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: //英雄 HeroNum++; break; default: DaoJuNum++; break; } } for (int i = 0; i < SelectItemMail.m_items.Count; i++) { int itemid = SelectItemMail.m_items[i].m_objectid / 1000000; switch (itemid) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: //英雄 HeroNum++; break; default: DaoJuNum++; break; } } if (ObjectSelf.GetInstance().GetBagSurplus() < DaoJuNum && DaoJuNum != 0) { InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("mail_content15"), this.gameObject.transform); return; } if (ObjectSelf.GetInstance().GetHeroBagSurplus() < HeroNum && HeroNum != 0) { InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("mail_content14"), this.gameObject.transform); return; } CReceiveMail _CReceiveMail = new CReceiveMail(); _CReceiveMail.mailkey = SelectItemMail.m_key; _CReceiveMail.isget = 1; IOControler.GetInstance().SendProtocol(_CReceiveMail); IsReceive = true; }
public void FallItemShow() { if (m_FallItemList.Count>1) { m_Rewards.SetActive(true); } else { InnerdropTemplate inner = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(m_FallItemList[0]); int itemid = inner.getObjectid() / 1000000; ShowItemPreviewUIHandler(itemid); } }
public void SetData(int[] innerDropIds) { ClearItems(); //for (int i = 0, j = innerDropIds.Length; i < j; i++) //{ // InnerdropTemplate value = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(innerDropIds[i]); // if (value == null) continue; // Sprite icon = DynamicItem.GetSprite(value.getObjectid()); // RewardViewItemUI ui = GenerateItemUI(value.getDropnum(), icon); // if (ui != null) // { // mItemsList.Add(ui); // } //} for (int i = 0, j = innerDropIds.Length; i < j; i++) { foreach (int k in DataTemplate.GetInstance().m_InnerdropTable.GetDataKeys()) { InnerdropTemplate _it = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(k); if (_it == null) { continue; } if (_it.getInnerdropid() == innerDropIds[i]) { //Sprite icon = DynamicItem.GetSprite(_it.getObjectid()); //RewardBoxItemUI ui = GenerateItemUI(_it.getDropnum(), icon); //if (ui != null) //{ // mItemsList.Add(ui); //} UniversalItemCell cell = UniversalItemCell.GenerateItem(mListTrans); cell.InitByID(_it.getObjectid(), _it.getDropnum()); if (cell != null) { mItemsList.Add(cell); } } } } }
public void SetData(int[] innerDropIds, int starNum) { ClearItems(); for (int i = 0, j = innerDropIds.Length; i < j; i++) { foreach (int k in DataTemplate.GetInstance().m_InnerdropTable.GetDataKeys()) { InnerdropTemplate _it = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(k); if (_it == null) { continue; } if (_it.getInnerdropid() == innerDropIds[i]) { //Sprite icon = DynamicItem.GetSprite(_it.getObjectid()); //RewardBoxItemUI ui = GenerateItemUI(_it.getDropnum(), icon); //if (ui != null) //{ // mItemsList.Add(ui); //} UniversalItemCell cell = UniversalItemCell.GenerateItem(mListTrans); cell.InitByID(_it.getObjectid(), _it.getDropnum()); if (cell != null) { mItemsList.Add(cell); } } } } mDetailTxt.ShowRichText(string.Format(GameUtils.getString("maoxianguanka7"), starNum)); }
/// <summary> /// 打开礼包物品显示窗口 /// </summary> public void OnOpenLbItemWindow() { m_AwardWindow.SetActive(true); foreach (Transform child in m_itemParent.transform) { if (child.gameObject.name == "item(Clone)") { Destroy(child.gameObject); } } for (int j = 0; j < ObjectSelf.GetInstance().GetSettingData().m_innerdropidlist.Count; j++) { m_Cell = UniversalItemCell.GenerateItem(m_itemParent.transform); InnerdropTemplate value = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(ObjectSelf.GetInstance().GetSettingData().m_innerdropidlist[j]); if (value == null) { return; } int itemid = value.getObjectid(); //掉落物ID int type = value.getObjectid() / 1000000; switch (type) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES: ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid); if (_temp_res != null) { m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(_temp_res.getName()), "", ""); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: //符文 { ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid); if (itemTable != null) { m_Cell.InitByID(itemid, -1); m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", ""); } } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: { ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid); if (itemTable != null) { m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", ""); } } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: { HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(itemid); if (hero != null) { m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(hero.getTitleID()), "", ""); } } break; default: break; } } }
public void Init(int ID, int isReceive) { //int itemid = ID / 1000000; if (isReceive == 0) { ReceiveGo.SetActive(false); } else { ReceiveGo.SetActive(true); } InnerdropTemplate item = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(ID); NumText.text = "x" + item.getDropnum().ToString(); int _goid = item.getObjectid();//掉落物ID int itemid = item.getObjectid() / 1000000; switch (itemid) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES: //资源 ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(_goid); if (_temp_res != null) { GoName.text = GameUtils.getString(_temp_res.getName()); string _tempIconNam_1 = _temp_res.getIcon3(); SpriteImage.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_1); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: //符文 ItemTemplate _temp_rune = (ItemTemplate)DataTemplate.GetInstance().GetItemTemplateById(_goid); if (_temp_rune != null) { GoName.text = GameUtils.getString(_temp_rune.getName()); SpriteImage.gameObject.SetActive(false); RuneIcon.SetActive(true); ShowRune(_temp_rune); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: //道具 ItemTemplate _temp_common = (ItemTemplate)DataTemplate.GetInstance().GetItemTemplateById(_goid); if (_temp_common != null) { GoName.text = GameUtils.getString(_temp_common.getName()); string _tempIconNam_3 = _temp_common.getIcon_s(); SpriteImage.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_3); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: //英雄 HeroTemplate _temp_hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(_goid); if (_temp_hero != null) { GoName.text = GameUtils.getString(_temp_hero.getNameID()); int _tempIconNam_4 = _temp_hero.getArtresources(); ArtresourceTemplate _temp_Art = (ArtresourceTemplate)DataTemplate.GetInstance().GetArtResourceTemplate(_tempIconNam_4); string _tempIconNam_5 = _temp_Art.getHeadiconresource(); SpriteImage.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_5); NumText.transform.parent.gameObject.SetActive(false); this.star.gameObject.SetActive(true); int star = _temp_hero.getQuality(); int maxStar = _temp_hero.getMaxQuality(); this.star.Set(star, maxStar); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_SKIN: //皮肤 ArtresourceTemplate _temp_Art_2 = (ArtresourceTemplate)DataTemplate.GetInstance().GetArtResourceTemplate(_goid); if (_temp_Art_2 != null) { GoName.text = GameUtils.getString(_temp_Art_2.getNameID()); string _tempIconNam_6 = _temp_Art_2.getHeadiconresource(); SpriteImage.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_6); } break; } }
/// <summary> /// 填充数据 /// </summary> /// <param name="id">掉落包小包id</param> public void FillData(int id) { //通过id 区分出是资源 物品 英雄 还是其他 //1400000001 - 1400999999 资源 对应数据表53 //1401000001 - 1401999999 符文 对应数据表26 //1402000001 - 1402999999 道具 对应数据表26 //1403000001 - 1403999999 英雄 对应数据表01 InnerdropTemplate innerTemplate = DataTemplate.GetInstance().GetInnerdropTemplateById(id); if (innerTemplate == null) { Debug.LogError("Innerdrop表中没有对应的id:" + id); return; } int ItemId = innerTemplate.getObjectid(); if (ItemId >= 1400000001 && ItemId <= 1400999999)//资源 { ResourceindexTemplate template = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(ItemId); if (template != null) { m_Icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + template.getIcon1()); name.text = GameUtils.getString(template.getName()); count.text = "x" + innerTemplate.getDropnum().ToString(); m_Stars[0].transform.parent.gameObject.SetActive(false); m_Rune.SetActive(false); m_Icon.gameObject.SetActive(true); } else { Debug.LogError(string.Format("找不到id{0}的为物品", ItemId)); } } else if (ItemId >= 1402000001 && ItemId <= 1402999999) //道具 { ItemTemplate template = DataTemplate.GetInstance().GetItemTemplateById(ItemId); if (template != null) { m_Icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + template.getIcon_s()); name.text = GameUtils.getString(template.getName()); count.text = "x" + innerTemplate.getDropnum().ToString(); m_Stars[0].transform.parent.gameObject.SetActive(false); m_Rune.SetActive(false); m_Icon.gameObject.SetActive(true); } else { Debug.LogError(string.Format("找不到id{0}的为物品", ItemId)); } } else if (ItemId >= 1401000001 && ItemId <= 1401999999) //符文 { ItemTemplate template = DataTemplate.GetInstance().GetItemTemplateById(ItemId); if (template != null) { name.text = GameUtils.getString(template.getName()); count.text = "x" + innerTemplate.getDropnum().ToString(); m_Stars[0].transform.parent.gameObject.SetActive(true); m_Rune.SetActive(true); m_Icon.gameObject.SetActive(false); //星级 for (int i = 0; i < m_Stars.Length; i++) { if (template.getRune_quality() >= i + 1) { m_Stars[i].SetActive(true); } else { m_Stars[i].SetActive(false); } } //设置普通符文的类型显示 for (int i = 0; i < m_RuneCommonType.Length; i++) { if (template.getRune_type() == i + 1) { m_RuneCommonType[i].SetActive(true); } else { m_RuneCommonType[i].SetActive(false); } } //普通符文 if (template.getRune_type() < 5) { m_Rune_Common.SetActive(true); m_Rune_Special.SetActive(false); m_Rune_Common_icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + template.getIcon_s()); } else //特殊符文 { m_Rune_Common.SetActive(false); m_Rune_Special.SetActive(true); m_Rune_Special_icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + template.getIcon_s()); } } else { Debug.LogError(string.Format("找不到id{0}的为物品", ItemId)); } } else if (ItemId >= 1403000001 && ItemId <= 1403999999) //英雄 { HeroTemplate template = DataTemplate.GetInstance().GetHeroTemplateById(ItemId); ArtresourceTemplate artTemplate = DataTemplate.GetInstance().GetArtResourceTemplate(template.getArtresources()); if (template != null) { m_Icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + artTemplate.getHeadiconresource()); name.text = GameUtils.getString(template.getTitleID()); count.text = "x" + innerTemplate.getDropnum().ToString(); m_Stars[0].transform.parent.gameObject.SetActive(true); m_Rune.SetActive(false); m_Icon.gameObject.SetActive(true); for (int i = 0; i < m_Stars.Length; i++) { if (template.getQuality() >= i + 1) { m_Stars[i].SetActive(true); } else { m_Stars[i].SetActive(false); } } } else { Debug.LogError(string.Format("找不到id{0}的为物品", ItemId)); } } }
private void GreatItem(int id, int isReceive) { m_Cell = UniversalItemCell.GenerateItem(EmailFuJianList.transform); InnerdropTemplate value = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(id); if (value == null) { return; } int itemid = value.getObjectid();//掉落物ID int type = value.getObjectid() / 1000000; switch (type) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES: ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid); if (_temp_res != null) { m_Cell.SetCheckClaim(isReceive == 1, ""); m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(_temp_res.getName()), "", ""); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: //符文 { ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid); if (itemTable != null) { m_Cell.SetCheckClaim(isReceive == 1, ""); m_Cell.InitByID(itemid, -1); m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", ""); } } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: { ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid); if (itemTable != null) { m_Cell.SetCheckClaim(isReceive == 1, ""); m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", ""); } } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: { HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(itemid); if (hero != null) { m_Cell.SetCheckClaim(isReceive == 1, ""); m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(hero.getTitleID()), "", ""); } } break; default: break; } }
public void Data(object data) { InnerdropTemplate value = data as InnerdropTemplate; if (value == null) { return; } int itemid = value.getObjectid(); int type = itemid / 1000000; switch (type) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES: ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid); if (_temp_res != null) { this.desc.text = GameUtils.getString(_temp_res.getName()); string _tempIconNam_1 = _temp_res.getIcon3(); this.icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_1); this.numText.text = "x" + value.getDropnum(); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: //符文 { ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(value.getObjectid()); this.desc.text = GameUtils.getString(itemTable.getName()); this.icon.gameObject.SetActive(false); RuneIcon.SetActive(true); ShowRune(itemTable); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: { ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(value.getObjectid()); //UI_RewardsItemManage uifigt = item.GetComponent<UI_RewardsItemManage>(); //uifigt.id = value.getObjectid(); //uifigt.typeNum = 2; this.desc.text = GameUtils.getString(itemTable.getName()); this.icon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + itemTable.getIcon()); this.numText.text = "x" + value.getDropnum().ToString(); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: { HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(value.getObjectid()); //UI_RewardsItemManage uihero = item.GetComponent<UI_RewardsItemManage>(); //uihero.id = inner.getObjectid(); //uihero.typeNum = 3; this.desc.text = GameUtils.getString(hero.getTitleID()); //"英雄"; ArtresourceTemplate art = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(hero.getArtresources()); this.icon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + art.getHeadiconresource()); int star = hero.getQuality(); int maxStar = hero.getMaxQuality(); this.star.Set(star, maxStar); } break; default: break; } }
public void Show(UI_LivenessBoxItem item) { if (item == null) { return; } itm = item; itemNum = heroNum = 0; if (item.canOpen()) { if (!item.isOpend()) { mHeader.text = "奖励确认"; mCloseImage.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "UI_xuanze"); mCloseText.text = GameUtils.getString("common_button_receive");//领 取 } else { InterfaceControler.GetInst().AddMsgBox("已领取过该奖励", this.gameObject.transform); return; } } else { mHeader.text = GameUtils.getString("activity_content1"); mCloseImage.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "UI_xuanze"); mCloseText.text = GameUtils.getString("common_button_close"); //关 闭 } int id = DataTemplate.GetInstance().m_GameConfig.getActivitymission_reward_drop()[item.Index]; int[] innerdropList = ((NormaldropTemplate)DataTemplate.GetInstance().m_NormaldropTable.getTableData(id)).getInnerdrop(); Dictionary <int, IExcelBean> innerIExcel = DataTemplate.GetInstance().m_InnerdropTable.getData(); mDropList.Clear(); //for (int i = 0; i < innerdropList.Length; i++) //{ // Debug.Log(111); // foreach (var value in innerIExcel.Values) // { // if (((InnerdropTemplate)value).getInnerdropid() == innerdropList[i]) // { // mDropList.Add((InnerdropTemplate)value); // int itemid = ((InnerdropTemplate)value).getObjectid(); // int type = itemid / 1000000; // if (type == (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE) // itemNum++; // if (type == (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO) // heroNum++; // } // } //} for (int i = 0, j = innerdropList.Length; i < j; i++) { foreach (int k in DataTemplate.GetInstance().m_InnerdropTable.GetDataKeys()) { InnerdropTemplate _it = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(k); if (_it == null) { continue; } if (_it.getInnerdropid() == innerdropList[i]) { mDropList.Add(_it); } } } CreatBoxItem(); }
private void UpdateAwardItem(int index, RectTransform cell) { m_Cell = cell.GetComponent <UniversalItemCell>(); InnerdropTemplate value = mDropList[index] as InnerdropTemplate; if (value == null) { return; } int itemid = value.getObjectid(); int type = itemid / 1000000; switch (type) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES: ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid); if (_temp_res != null) { m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(_temp_res.getName()), "", ""); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: //符文 { ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(value.getObjectid()); if (itemTable != null) { m_Cell.InitByID(itemid, -1); m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", ""); } } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: { ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(value.getObjectid()); if (itemTable != null) { m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", ""); } } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: { HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(value.getObjectid()); if (hero != null) { m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(hero.getTitleID()), "", ""); } } break; default: break; } //UI_LivenessDropItem _UI_LivenessDropItem = cell.GetComponent<UI_LivenessDropItem>(); //if (_UI_LivenessDropItem == null) //{ // _UI_LivenessDropItem = cell.gameObject.AddComponent<UI_LivenessDropItem>(); //} //_UI_LivenessDropItem.Data(mDropList[index]); }
public void ShowInnerDrop(List <int> innerdropIDList) { for (int i = 0; i < innerdropIDList.Count; i++) { UniversalItemCell m_Cell = UniversalItemCell.GenerateItem(listObj.transform); InnerdropTemplate value = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(innerdropIDList[i]); if (value == null) { return; } int itemid = value.getObjectid();//掉落物ID int type = value.getObjectid() / 1000000; m_Cell.AddClickListener(OnItemClick); switch (type) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES: ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid); if (_temp_res != null) { m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(_temp_res.getName()), "", ""); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: //符文 { ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid); if (itemTable != null) { m_Cell.InitByID(itemid, -1); m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", ""); } } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: { ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid); if (itemTable != null) { m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", ""); } } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: { HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(itemid); if (hero != null) { m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(hero.getTitleID()), "", ""); } } break; default: break; } } }
public void GiftShows() { // GameEventDispatcher.Inst.dispatchEvent(GameEventID.KE_KnapsackUpdateShow); for (int i = 0; i < itemList.Count; i++) { Destroy(itemList[i]); } itemList.Clear(); giftList = UI_ItemsManage._instance.giftIDList; for (int i = 0; i < giftList.Count; i++) { InnerdropTemplate inner = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(giftList[i]); int itemid = inner.getObjectid() / 1000000; switch (itemid) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES: if (itemid == 1400) { GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Bag/item"), transform.position, transform.rotation) as GameObject; item.transform.parent = mGrid; item.transform.localScale = Vector3.one; UI_RewardsItemManage uifigt = item.GetComponent <UI_RewardsItemManage>(); ResourceindexTemplate itemT = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(inner.getObjectid()); uifigt.mName.text = GameUtils.getString(itemT.getName()); itemT.getIcon3(); uifigt.mIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + itemT.getIcon3()); uifigt.mNum.text = "x" + inner.getDropnum(); itemList.Add(item); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: { GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Bag/rune"), transform.position, transform.rotation) as GameObject; item.transform.parent = mGrid; item.transform.localScale = Vector3.one; ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(inner.getObjectid()); UI_RewardsItemManage uifigt = item.GetComponent <UI_RewardsItemManage>(); uifigt.mName.text = GameUtils.getString(itemTable.getName()); uifigt.typeNum = 1; uifigt.id = inner.getObjectid(); uifigt.mIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + itemTable.getIcon()); uifigt.mNum.text = "x" + inner.getDropnum().ToString(); itemList.Add(item); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: { GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Bag/item"), transform.position, transform.rotation) as GameObject; item.transform.parent = mGrid; item.transform.localScale = Vector3.one; ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(inner.getObjectid()); UI_RewardsItemManage uifigt = item.GetComponent <UI_RewardsItemManage>(); uifigt.id = inner.getObjectid(); uifigt.typeNum = 2; uifigt.mName.text = GameUtils.getString(itemTable.getName()); uifigt.mIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + itemTable.getIcon()); uifigt.mNum.text = "x" + inner.getDropnum().ToString(); itemList.Add(item); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: { GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Bag/hero"), transform.position, transform.rotation) as GameObject; item.transform.parent = mGrid; item.transform.localScale = Vector3.one; HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(inner.getObjectid()); UI_RewardsItemManage uihero = item.GetComponent <UI_RewardsItemManage>(); uihero.id = inner.getObjectid(); uihero.typeNum = 3; uihero.mName.text = GameUtils.getString(hero.getTitleID()); //"英雄"; ArtresourceTemplate art = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(hero.getArtresources()); uihero.mIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + art.getHeadiconresource()); int star = hero.getQuality(); int maxStar = hero.getMaxQuality(); for (int j = 0; j < 5; j++) { uihero.starList[j].SetActive(j < star); uihero.starList[j + 5].SetActive(j < maxStar); } itemList.Add(item); } break; default: break; } } }
//public bool isReward(int difficulttype, int rewardnum) //{ // int reward = 0; // if (difficulttype == 1) // { // reward = rewardnum % 10; // } // else if (difficulttype == 2) // { // reward = rewardnum % 100 / 10; // } // else if (difficulttype == 3) // { // reward = rewardnum / 100; // } // return reward != 0; //} public void UpdateShow() { //Debug.Log(mGrid.transform.position); //mGrid.transform.position = new Vector3(-225.4f, -4.7f, -263.4f); //与服务器交互显示所得物品 //UI_SelectFightArea sfight = UI_SelectFightArea.Inst; int chapterId = ObjectSelf.GetInstance().GetCurChapterID(); int difficultLv = ObjectSelf.GetInstance().CurChapterLevel; ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(chapterId); if (chapterT != null) { int total = 0; int curstart = 0; StageModule.GetCurTotalStarsCount(chapterT, (EM_STAGE_DIFFICULTTYPE)difficultLv, out curstart, out total); if (curstart >= total) { //TODO 宝箱弹窗 //if (isReward(difficultLv, sfight.iTotalCharpter[sfight.iChapterID].m_bRewardGot)) if (StageModule.isReward(difficultLv, ObjectSelf.GetInstance().BattleStageData.GetRewardGot(chapterId))) { mHeader.text = GameUtils.getString("fight_bosbox_content"); mCloseImage.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "Ui_xuanze"); //mCloseText.text = "关 闭"; mCloseText.text = GameUtils.getString("common_button_close"); } else { mHeader.text = GameUtils.getString("sign_content5"); mCloseImage.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "Ui_xuanze"); //mCloseText.text = "领 取"; mCloseText.text = GameUtils.getString("common_button_receive"); } } else { mHeader.text = GameUtils.getString("fight_bosbox_content"); mCloseImage.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "Ui_xuanze"); //mCloseText.text = "关 闭"; mCloseText.text = GameUtils.getString("common_button_close"); } innerdropIDList.Clear(); //int[] chapterDropList = ((ChapterinfoTemplate)DataTemplate.GetInstance().m_ChapterTable.getTableData(sfight.iChapterID)).getChapterDrop(); //int chapterDropID = chapterDropList[difficultLv - 1]; //int[] innerdropList = ((NormaldropTemplate)DataTemplate.GetInstance().m_NormaldropTable.getTableData(chapterDropID)).getInnerdrop(); //Dictionary<int, IExcelBean> innerIExcel = DataTemplate.GetInstance().m_InnerdropTable.getData(); ////List<InnerdropTemplate> innerdropIDList = new List<InnerdropTemplate>(); //for (int i = 0; i < innerdropList.Length; i++) //{ // foreach (var item in innerIExcel.Values) // { // if (((InnerdropTemplate)item).getInnerdropid() == innerdropList[i]) // { // innerdropIDList.Add((InnerdropTemplate)item); // } // } //} //ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(ObjectSelf.GetInstance().GetCurChapterID()); //if (chapterT == null) //{ // LogSystem.LogManager.LogToFile("战斗奖励界面失败---ChapterinfoTemplate is NULL. id=" + chapterId); // return; //} int dropId = difficultLv - 1; if (chapterT.getChapterDrop().Length <= 0) { LogSystem.LogManager.LogToFile("战斗奖励界面失败---ChapterinfoTemplate 中章节掉落包数组是空的. id=" + chapterId); return; } int chapterDropId = chapterT.getChapterDrop()[dropId]; NormaldropTemplate normalT = DataTemplate.GetInstance().GetNormaldropTemplateById(chapterDropId); if (normalT == null) { LogSystem.LogManager.LogToFile("战斗奖励界面失败---ChapterinfoTemplate is NULL. id=" + chapterDropId); return; } int[] innerDropList = normalT.getInnerdrop(); for (int i = 0, j = innerDropList.Length; i < j; i++) { foreach (int k in DataTemplate.GetInstance().m_InnerdropTable.GetDataKeys()) { InnerdropTemplate _it = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(k); if (_it == null) { continue; } if (_it.getInnerdropid() == innerDropList[i]) { innerdropIDList.Add(k); } } } } //char[] sfightList = sfight.iTotalCharpter[sfight.iChapterID].m_bRewardGot.ToString().ToCharArray(); else { mCloseImage.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "Ui_xuanze"); //mCloseText.text = "关 闭"; mCloseText.text = GameUtils.getString("common_button_close"); for (int i = 0; i < UI_SacredAltar._instance.m_FallItemList.Count; i++) { //InnerdropTemplate item = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(UI_SacredAltar._instance.m_FallItemList[i]); //InnerdropTemplate item = DataTemplate.GetInstance().GetInnerdropTemplateById(UI_SacredAltar._instance.m_FallItemList[i]); innerdropIDList.Add(UI_SacredAltar._instance.m_FallItemList[i]); } } for (int i = 0; i < innerdropIDList.Count; i++) { m_Cell = UniversalItemCell.GenerateItem(mGrid.transform); InnerdropTemplate value = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(innerdropIDList[i]); if (value == null) { return; } int itemid = value.getObjectid();//掉落物ID int type = value.getObjectid() / 1000000; m_Cell.AddClickListener(ShowItemPreviewUIHandler); switch (type) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES: ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid); if (_temp_res != null) { m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(_temp_res.getName()), "", ""); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: //符文 { ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid); if (itemTable != null) { m_Cell.InitByID(itemid, -1); m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", ""); } } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: { ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid); if (itemTable != null) { m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", ""); } } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: { HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(itemid); if (hero != null) { m_Cell.InitByID(itemid, value.getDropnum()); m_Cell.SetText(GameUtils.getString(hero.getTitleID()), "", ""); } } break; default: break; } } }