コード例 #1
0
        public Api_Result <object> Buy(int mst_id, int buyNum)
        {
            Api_Result <object> api_Result  = new Api_Result <object>();
            Mst_payitem         mst_payitem = null;

            if (!this.mst_payitem.TryGetValue(mst_id, ref mst_payitem))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            using (List <PayItemEffectInfo> .Enumerator enumerator = mst_payitem.Items.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    PayItemEffectInfo current = enumerator.get_Current();
                    if (current.Type == 1)
                    {
                        Comm_UserDatas.Instance.Add_Useitem(current.MstId, current.Count);
                    }
                    else if (current.Type == 2)
                    {
                        IEnumerable <int> enumerable = Enumerable.Repeat <int>(current.MstId, current.Count);
                        Comm_UserDatas.Instance.Add_Slot(Enumerable.ToList <int>(enumerable));
                    }
                    else if (current.Type == 3)
                    {
                        enumMaterialCategory mstId = (enumMaterialCategory)current.MstId;
                        Comm_UserDatas.Instance.User_material.get_Item(mstId).Add_Material(current.Count);
                    }
                }
            }
            Comm_UserDatas.Instance.User_basic.SubPoint(mst_payitem.Price * buyNum);
            return(api_Result);
        }
コード例 #2
0
        public Api_Result <object> Buy(int mst_id, int buyNum)
        {
            Api_Result <object> api_Result = new Api_Result <object>();
            Mst_payitem         value      = null;

            if (!mst_payitem.TryGetValue(mst_id, out value))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            foreach (PayItemEffectInfo item in value.Items)
            {
                if (item.Type == 1)
                {
                    Comm_UserDatas.Instance.Add_Useitem(item.MstId, item.Count);
                }
                else if (item.Type == 2)
                {
                    IEnumerable <int> source = Enumerable.Repeat(item.MstId, item.Count);
                    Comm_UserDatas.Instance.Add_Slot(source.ToList());
                }
                else if (item.Type == 3)
                {
                    enumMaterialCategory mstId = (enumMaterialCategory)item.MstId;
                    Comm_UserDatas.Instance.User_material[mstId].Add_Material(item.Count);
                }
            }
            Comm_UserDatas.Instance.User_basic.SubPoint(value.Price * buyNum);
            return(api_Result);
        }
コード例 #3
0
        protected void _Init(bool all_item)
        {
            if (this._req_store == null)
            {
                this._req_store = new Api_req_store();
            }
            Dictionary <int, Mst_payitem> storeList = this._req_store.GetStoreList();

            this._items = new List <ItemStoreModel>();
            if (this._mst_cabinets == null)
            {
                this._mst_cabinets = Mst_DataManager.Instance.GetMstCabinet();
            }
            List <Mst_item_shop> list = this._mst_cabinets.get_Item(1);

            list = list.GetRange(0, list.get_Count());
            if (all_item)
            {
                using (Dictionary <int, Mst_payitem> .ValueCollection.Enumerator enumerator = storeList.get_Values().GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Mst_payitem current = enumerator.get_Current();
                        if (!(current.Name == string.Empty))
                        {
                            ItemStoreModel itemStoreModel = new ItemStoreModel(current);
                            this._items.Add(itemStoreModel);
                        }
                    }
                }
                this._items.Sort((ItemStoreModel a, ItemStoreModel b) => (a.MstId <= b.MstId) ? -1 : 1);
            }
            else
            {
                using (List <Mst_item_shop> .Enumerator enumerator2 = list.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        Mst_item_shop current2 = enumerator2.get_Current();
                        Mst_payitem   mst_payitem;
                        storeList.TryGetValue(current2.Item1_id, ref mst_payitem);
                        if (mst_payitem == null)
                        {
                            this._items.Add(null);
                        }
                        else
                        {
                            ItemStoreModel itemStoreModel2 = new ItemStoreModel(mst_payitem);
                            this._items.Add(itemStoreModel2);
                        }
                    }
                }
            }
        }
コード例 #4
0
 public ItemStoreModel(Mst_payitem mst_data)
 {
     _mst_data = mst_data;
 }