Dictionary <int, List <CGoodsInfo> > GetReward(string strReward) { if (strReward == "0") { return(null); } Dictionary <int, List <CGoodsInfo> > rewardList = new Dictionary <int, List <CGoodsInfo> > (); string[] strArray = strReward.Split('|'); for (int i = 0; i < strArray.Length; i++) { string[] reArray = strArray[i].Split('+'); if (reArray.Length != 3) { continue; } int classVal = int.Parse(reArray[0]); if (!rewardList.ContainsKey(classVal)) { List <CGoodsInfo> reward = new List <CGoodsInfo>(); rewardList.Add(classVal, reward); } CGoodsInfo temp = new CGoodsInfo(); temp.itemID = int.Parse(reArray[1]); temp.itemCount = int.Parse(reArray[2]); rewardList[classVal].Add(temp); } return(rewardList); }
private void ShowIcon(CGoodsInfo reward, bool isFirst, bool isShow, bool isOnlyOne) { GameObject icon = firstItemObj; Vector3 pos = prefabIcon.transform.localPosition; ItemIconInfo info; if (!isFirst) { icon = secondItemObj; } if (!isShow && icon == null) { return; } if (icon == null) { prefabIcon.SetActive(true); icon = UI.CreatObjectToNGUI.InstantiateObj(prefabIcon, rewardObj); info = icon.GetComponent <ItemIconInfo>(); if (reward != null) { ItemData getItem = ItemDataManager.Instance.GetItemData(reward.itemID); info.Init(getItem, reward.itemCount.ToString()); } prefabIcon.SetActive(false); } if (isShow) { info = icon.GetComponent <ItemIconInfo>(); if (reward != null) { ItemData getItem = ItemDataManager.Instance.GetItemData(reward.itemID); info.Show(getItem, reward.itemCount.ToString()); } if (isOnlyOne) { pos = Vector3.zero; } else { if (!isFirst) { pos = new Vector3(-1 * pos.x, pos.y, pos.z); } } icon.transform.localPosition = pos; icon.SetActive(true); } else { icon.SetActive(false); } }
//点击补签// public void OnRepairSignBtnClick(SignWeekInfo weekInfo) { SoundManager.Instance.PlaySoundEffect("Sound_Button_SignInRegist"); selectRepairIndex = weekInfo.weekIndex; CGoodsInfo goodsInfo = signConfigData.dailyRewardList [weekInfo.weekIndex] [0]; ItemData getItem = ItemDataManager.Instance.GetItemData(goodsInfo.itemID); string goodName = NGUIColor.SetTxtColor(LanguageTextManager.GetString(getItem._szGoodsName), (TextColor)getItem._ColorLevel); string tipStr = string.Format(LanguageTextManager.GetString("IDS_I26_20"), goodName, goodsInfo.itemCount, CommonDefineManager.Instance.CommonDefine.SignInConsumption); UI.MessageBox.Instance.Show(4, "", tipStr, LanguageTextManager.GetString("IDS_H2_55"), LanguageTextManager.GetString("IDS_H2_28"), OnBuySureClick, OnBuyCancelClick); }
//签到成功 void OnSignResponseSuccess(object obj) { SMsgActionDaySign_SC sMsgActionDaySign_SC = (SMsgActionDaySign_SC)obj; CGoodsInfo goodsInfo = signConfigData.dailyRewardList [sMsgActionDaySign_SC.SignID] [0]; List <VipLevelUpReward> listGoods = new List <VipLevelUpReward> (); VipLevelUpReward reward = new VipLevelUpReward(); reward.m_itemID = goodsInfo.itemID; reward.m_itemCount = goodsInfo.itemCount; listGoods.Add(reward); ShowContent(curSelectIndex); PopupObjManager.Instance.OpenVipUpgradePanel(ERewardPopType.EDailySignSingleReward, listGoods); }
public void GetReward() { string[] strArray = Reward.Split('|'); for (int i = 0; i < strArray.Length; i++) { string[] reArray = strArray[i].Split('+'); if (reArray.Length != 2) { continue; } CGoodsInfo temp = new CGoodsInfo(); temp.itemID = int.Parse(reArray[0]); temp.itemCount = int.Parse(reArray[1]); rewardList.Add(temp); } }
//获取当前波数及其以前所有奖励总和 public List <CGoodsInfo> GetAllRewardByLoopNum(int loopNum) { if (loopNum == 0) { return(null); } bool isHave = false; List <CGoodsInfo> getReward = new List <CGoodsInfo> (); for (int i = 1; i <= loopNum; i++) { List <CGoodsInfo> thisReward = GetRewardByLoopNum(i); //本波奖励 foreach (CGoodsInfo thisTemp in thisReward) { isHave = false; //总记录奖励 for (int j = 0; j < getReward.Count; j++) { if (thisTemp.itemID == getReward[j].itemID) { getReward[j].itemCount = getReward[j].itemCount + thisTemp.itemCount; isHave = true; } } if (!isHave) { CGoodsInfo temp = new CGoodsInfo(); temp.itemID = thisTemp.itemID; temp.itemCount = thisTemp.itemCount; getReward.Add(temp); } } } /*Debug.Log ("GetAllRewardByLoopNum=="+loopNum+" RewardCount="+getReward.Count); * if (getReward.Count == 1) { * Debug.Log ("ID==" + getReward [0].itemID + " value=" + getReward [0].itemCount); * } else { * Debug.Log ("ID1==" + getReward [0].itemID + " value=" + getReward [0].itemCount+"ID2==" + getReward [1].itemID + " value=" + getReward [1].itemCount); * }*/ return(getReward); }
List <CGoodsInfo> GetReward(string reward) { List <CGoodsInfo> rewardList = new List <CGoodsInfo> (); string[] strArray = reward.Split('|'); for (int i = 0; i < strArray.Length; i++) { string[] reArray = strArray[i].Split('+'); if (reArray.Length != 2) { continue; } CGoodsInfo temp = new CGoodsInfo(); temp.itemID = int.Parse(reArray[0]); temp.itemCount = int.Parse(reArray[1]); rewardList.Add(temp); } return(rewardList); }
private void ShowInfo(DailySignInConfigData signData) { gameObject.SetActive(true); this.dailySignData = signData; string weekStr = ""; switch (weekIndex) { case 1: weekStr = "IDS_I26_7"; break; case 2: weekStr = "IDS_I26_8"; break; case 3: weekStr = "IDS_I26_9"; break; case 4: weekStr = "IDS_I26_10"; break; case 5: weekStr = "IDS_I26_11"; break; case 6: weekStr = "IDS_I26_12"; break; case 7: weekStr = "IDS_I26_13"; break; } DiscountLabel.text = LanguageTextManager.GetString(weekStr); CGoodsInfo goodsInfo = dailySignData.dailyRewardList [weekIndex] [0]; ItemData getItem = ItemDataManager.Instance.GetItemData(goodsInfo.itemID); itemIconInfo.Init(getItem, "x" + goodsInfo.itemCount); }
private void CreateIcon(Transform pointParent, CGoodsInfo goodItem) { GameObject go = UI.CreatObjectToNGUI.InstantiateObj(rewardItemPrefab, pointParent); go.GetComponent <AwardItemIcon>().Show(goodItem.itemID, goodItem.itemCount); }