Exemplo n.º 1
0
        protected void SetReward(object obj)
        {
            //{"id":"7","name":"\u8868\u60c5\u798f\u888b","img":null,"grade":"2","odds":"50","is_effect":"1"}
//            _rewardIndex = index;
//            {"getAward_yr":{"count":99997,"info":{"id":"11","name":"\u8c22\u8c22\u53c2\u4e0e","img":null,"num":"1","grade":"1","odds":"200","is_effect":"1","tot_q":null,"remain_q":null}},"success":true
            if (obj == null)
            {
                return;
            }
            var dict = obj as Dictionary <string, object>;

            if (dict == null)
            {
                return;
            }
            DealCost(dict);
            if (!dict.ContainsKey("info"))
            {
                return;
            }
            var dictObj = dict["info"];

            if (dictObj == null)
            {
                return;
            }
            var spDict = dictObj as Dictionary <string, object>;

            if (spDict == null)
            {
                return;
            }
            var sdata = new SpinningItemData(spDict);

            _msgShow = sdata.Msg;
            if (_spinningDatas.ContainsKey(sdata.Id))
            {
                _rewardIndex = _spinningDatas[sdata.Id];
            }
            else
            {
                YxMessageBox.Show("数据异常!!!", null, (box, btnName) =>
                {
                    _state = SpinningState.Normal;
                    Close();
                });
            }
        }
Exemplo n.º 2
0
        protected override void OnFreshView()
        {
            if (Data == null)
            {
                return;
            }
            var dict = Data as Dictionary <string, object>;

            if (dict == null)
            {
                return;
            }
            DealCost(dict);
            if (dict.ContainsKey("list"))
            {
                var objList = dict["list"];
                if (objList == null)
                {
                    return;
                }
                var list = objList as List <object>;
                if (list == null)
                {
                    return;
                }
                _spinningDatas.Clear();
                var minCount = Mathf.Min(list.Count, Items.Length);
                for (var i = 0; i < minCount; i++)
                {
                    var obj = list[i];
                    if (obj == null)
                    {
                        continue;
                    }
                    var dictData = obj as Dictionary <string, object>;
                    var item     = Items[i];
                    var sdata    = new SpinningItemData(dictData, i);
                    _spinningDatas[sdata.Id] = i;
                    item.UpdateView(sdata);
                }
            }
        }