public List <KStruct> GetAwardDataByID(int awardID) { List <KStruct> list = new List <KStruct>(); DAward db = ReadCfgAward.GetDataById(awardID); if (db == null) { return(null); } switch (db.DropType) { case EDropType.MULFIX: CalcMulFixItem(ref list, db.DropItems); break; case EDropType.ONERAN: CalcOneRanItem(ref list, db.DropItems); break; case EDropType.MULRAN: CalcMulFixItem(ref list, db.DropItems); break; } return(list); }
public void TryReceiveReward(ECopyType copyType, int chapter, int awardIndex) { if (awardIndex < 0 || awardIndex > 2) { GTItemHelper.ShowTip("非法AwardIndex" + awardIndex); return; } int rewardState = RaidModule.Instance.GetChapterRewardStateByAwardIndex(chapter, awardIndex); switch (rewardState) { case ERewardState.NOT_RECEIVE: GTItemHelper.ShowTip("未达成条件"); return; case ERewardState.HAS_RECEIVE: GTItemHelper.ShowTip("奖励已领取"); return; } DWorld chapterDB = ReadCfgWorld.GetDataById(chapter); DAward awardDB = ReadCfgAward.GetDataById(chapterDB.Awards[awardIndex]); if (GTItemHelper.CheckBagFull(awardDB.MaxDropNum)) { return; } ReqGetChapterAward req = new ReqGetChapterAward(); req.CopyType = (int)copyType; req.Chapter = chapter; req.Index = awardIndex; NetworkManager.Instance.Send <ReqGetChapterAward>(MessageID.MSG_REQ_GET_CHAPTERAWARD, req); }
public void ShowAwardById(int award, int rewardState, UIEventListener.VoidDelegate doReceive) { List <KStruct> list = AwardModule.Instance.GetAwardDataByID(award); DAward db = ReadCfgAward.GetDataById(award); for (int i = 0; i < items.Count; i++) { Item it = items[i]; if (i < list.Count) { KStruct vo = list[i]; it.itemBtn.SetActive(true); it.itemNum.text = vo.Num > 1 ? vo.Num.ToString() : string.Empty; GTItemHelper.ShowItemTexture(it.itemTexture, vo.Id); GTItemHelper.ShowItemQuality(it.itemQuality, vo.Id); GTItemHelper.ShowItemName(it.itemName, vo.Id); DItem itemDB = ReadCfgItem.GetDataById(vo.Id); it.chip.SetActive(itemDB.ItemType == EItemType.CHIP); } else { it.itemBtn.SetActive(false); } } switch (rewardState) { case ERewardState.NOT_RECEIVE: btnReceive.GetComponent <UISprite>().color = Color.black; btnReceive.transform.Find("Label").GetComponent <UILabel>().text = "领取"; break; case ERewardState.CAN_RECEIVE: btnReceive.GetComponent <UISprite>().color = Color.white; btnReceive.transform.Find("Label").GetComponent <UILabel>().text = "领取"; break; case ERewardState.HAS_RECEIVE: btnReceive.GetComponent <UISprite>().color = Color.black; btnReceive.transform.Find("Label").GetComponent <UILabel>().text = "已领取"; break; } labTitle.text = db.Name; DoReceive = doReceive; }
public void TryMainCopyReceiveReward(int chapter, int index) { ERewardState rewardState = MLRaid.Instance.GetChapterRewardStateByAwardIndex(chapter, index); switch (rewardState) { case ERewardState.NOT_RECEIVE: GTItemHelper.ShowTip("未达成条件"); return; case ERewardState.HAS_RECEIVE: GTItemHelper.ShowTip("奖励已领取"); return; } DCopyMainChapter chapterDB = ReadCfgCopyMainChapter.GetDataById(chapter); DAward awardDB = ReadCfgAward.GetDataById(chapterDB.Awards[index]); if (GTItemHelper.CheckBagFull(awardDB.MaxDropNum)) { return; } }
public void TryUseItemByPos(int pos, int num) { XItem item = DataDBSBagItem.GetDataById(pos); if (item.Num < num) { GTItemHelper.ShowTip("物品不足"); return; } DItem itemDB = ReadCfgItem.GetDataById(item.Id); if (itemDB.ItemType == EItemType.BOX) { if (itemDB.Data1 != 0) { if (GTDataManager.Instance.GetItemCountById(itemDB.Data1) < num) { GTItemHelper.ShowTip("需要足够的钥匙"); return; } } DAward awardDB = ReadCfgAward.GetDataById(itemDB.Data2); if (GTItemHelper.CheckBagFull(awardDB.MaxDropNum)) { return; } } ReqUseItem req = new ReqUseItem(); req.Pos = pos; req.Num = num; req.PosType = (int)EPosType.BagItem; req.ID = item.Id; NetworkManager.Instance.Send <ReqUseItem>(MessageID.MSG_REQ_USEITEM, req); }