//更新奖品信息
        private void UpdateRewardsInfo()
        {
            //先统一处理为空格子
            for (int i = 0, length = itemList.Count; i < length; i++)
            {
                UIWidgetContainer item = itemList[i];
                Singleton <ItemManager> .Instance.InitItem(item, 1, 0);

                item.onClick = null;
            }

            //显示奖品图标
            if (RewardType.RewardPreview == rewardType)
            {
                labCurTitle.text = LanguageManager.GetWord("LotteryView.RewardPreview");
                for (int i = 0; i < Singleton <LotteryMode> .Instance.LotteryData[lotteryId].RewardList.Count; i++)
                {
                    RewardItem item = Singleton <LotteryMode> .Instance.LotteryData[lotteryId].RewardList[i];
                    Singleton <ItemManager> .Instance.InitItem(itemList[i], (uint)item.RewardId, 0);

                    itemList[i].onClick = ShowRewardTips;
                }
            }
            else
            {
                labCurTitle.text = LanguageManager.GetWord("LotteryView.GetReward");
                for (int i = 0; i < Singleton <LotteryMode> .Instance.LotteryData[lotteryId].CurRewardList.Count; i++)
                {
                    uint goodsId = Singleton <LotteryMode> .Instance.LotteryData[lotteryId].CurRewardList[i];
                    Singleton <ItemManager> .Instance.InitItem(itemList[i], goodsId, 0);

                    itemList[i].onClick = ShowRewardTips;
                }
            }
        }
示例#2
0
        private RewardItem GetRewardItem(string str)
        {
            string[] resultArr;
            str = str.Replace(" ", "");            //去除字符串中的空格
            str = str.TrimStart('{');
            str = str.TrimEnd('}');

            resultArr = str.Split(',');

            RewardItem item = new RewardItem();

            item.RewardId = Convert.ToInt32(resultArr[0]);
            item.Count    = Convert.ToInt32(resultArr[1]);
            item.Chance   = Convert.ToInt32(resultArr[2]);

            return(item);
        }
        //显示奖品说明
        private void ShowRewardTips(GameObject go)
        {
            UIWidgetContainer currentItem = go.GetComponent <UIWidgetContainer>();

            int itemIndex;

            for (itemIndex = 0; itemIndex < itemList.Count; itemIndex++)
            {
                if (itemList[itemIndex].Equals(currentItem))
                {
                    break;
                }
            }

            if (itemIndex >= itemList.Count)
            {
                return;
            }

            RewardItem item    = Singleton <LotteryMode> .Instance.LotteryData[lotteryId].RewardList[itemIndex];
            SysItemVo  goodsVo = BaseDataMgr.instance.getGoodsVo((uint)item.RewardId);

            Singleton <TipsManager> .Instance.OpenTipsByGoodsId((uint)item.RewardId, null, null, string.Empty, string.Empty);
        }