private void OnBuy(ItemStoreModel itemStoreModel, int count) { if (mOnBuyCallBack != null) { mOnBuyCallBack(itemStoreModel, count); } }
public bool IsValidBuy(ItemStoreModel item, int count) { if (item == null) { return(false); } if (item.Count == 0) { return(false); } if (count <= 0) { return(false); } if (item.Count > 0 && count > item.Count) { return(false); } if (item.Price * count > base.UserInfo.SPoint) { return(false); } if (!_req_store.IsBuy(item.MstId, count)) { return(false); } return(true); }
private void OnBuy(ItemStoreModel itemStoreModel, int count) { if (this.mOnBuyCallBack != null) { this.mOnBuyCallBack.Invoke(itemStoreModel, count); } }
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); } } } } }
public bool BuyItem(int paymentitem_mst_id, int count) { ItemStoreModel itemStoreModel = this.Items.Find((ItemStoreModel i) => i != null && i.MstId == paymentitem_mst_id); if (!this.IsValidBuy(itemStoreModel, count)) { return(false); } Api_Result <object> api_Result = this._req_store.Buy(itemStoreModel.MstId, count); return(api_Result.state == Api_Result_State.Success); }
public void Initialize(ItemStoreModel itemStoreModel, ItemStoreManager checkUtils) { if (itemStoreModel != null) { this.mModel = itemStoreModel; this.mItemStoreCheckUtils = checkUtils; this.mLabel_Name.text = this.mModel.Name; this.mLabel_Price.text = this.mModel.Price.ToString(); this.mTexture_Icon.mainTexture = UserInterfaceItemManager.RequestItemStoreIcon(this.mModel.MstId); this.ChangeFocus(this.mButton_Positive, false); this.mAkashi.SetKeyController(null); } }
public bool BuyItem(int paymentitem_mst_id, int count) { ItemStoreModel itemStoreModel = Items.Find((ItemStoreModel i) => i != null && i.MstId == paymentitem_mst_id); if (!IsValidBuy(itemStoreModel, count)) { return(false); } Api_Result <object> api_Result = _req_store.Buy(itemStoreModel.MstId, count); if (api_Result.state != 0) { return(false); } return(true); }
protected void _Init(bool all_item) { if (_req_store == null) { _req_store = new Api_req_store(); } Dictionary <int, Mst_payitem> storeList = _req_store.GetStoreList(); _items = new List <ItemStoreModel>(); if (_mst_cabinets == null) { _mst_cabinets = Mst_DataManager.Instance.GetMstCabinet(); } List <Mst_item_shop> list = _mst_cabinets[1]; list = list.GetRange(0, list.Count); if (all_item) { foreach (Mst_payitem value2 in storeList.Values) { if (!(value2.Name == string.Empty)) { ItemStoreModel item = new ItemStoreModel(value2); _items.Add(item); } } _items.Sort((ItemStoreModel a, ItemStoreModel b) => (a.MstId > b.MstId) ? 1 : (-1)); } else { foreach (Mst_item_shop item3 in list) { storeList.TryGetValue(item3.Item1_id, out Mst_payitem value); if (value == null) { _items.Add(null); } else { ItemStoreModel item2 = new ItemStoreModel(value); _items.Add(item2); } } } }
public static void log(ItemStoreModel[] items) { string text = string.Empty; for (int i = 0; i < items.Length; i++) { ItemStoreModel itemStoreModel = items[i]; if (itemStoreModel != null) { text += string.Format("{0}\n", itemStoreModel); } else { text += " - \n"; } } Logging.log(new object[] { text }); }
private void OnBuyStart(ItemStoreModel itemStoreModel, int count) { if (CurrentState != State.ItemStoreBuyConfirm) { return; } if (mItemStoreManager.IsValidBuy(itemStoreModel.MstId, count)) { int fuel = mItemStoreManager.Material.Fuel; int ammo = mItemStoreManager.Material.Ammo; int baux = mItemStoreManager.Material.Baux; int steel = mItemStoreManager.Material.Steel; if (mItemStoreManager.BuyItem(itemStoreModel.MstId, count)) { int fuel2 = mItemStoreManager.Material.Fuel; int ammo2 = mItemStoreManager.Material.Ammo; int baux2 = mItemStoreManager.Material.Baux; int steel2 = mItemStoreManager.Material.Steel; if (fuel != fuel2 || ammo != ammo2 || baux != baux2 || steel != steel2) { TrophyUtil.Unlock_Material(); } TrophyUtil.Unlock_AlbumSlotNum(); } mUIItemStoreChildren.Refresh(mItemStoreManager.Items.ToArray()); if (SingletonMonoBehaviour <UIPortFrame> .exist()) { SingletonMonoBehaviour <UIPortFrame> .Instance.UpdateHeaderInfo(mItemStoreManager); } } else if (mItemStoreManager.UserInfo.SPoint >= itemStoreModel.Price) { CommonPopupDialog.Instance.StartPopup("保有上限に達しています"); } mUIItemStoreBuyConfirm.Close(null); mUIItemStoreBuyConfirm.SetKeyController(null); PopState(); }
public bool IsValidBuy(int paymentitem_mst_id, int count) { ItemStoreModel item = Items.Find((ItemStoreModel i) => i != null && i.MstId == paymentitem_mst_id); return(IsValidBuy(item, count)); }
public void Release() { this.mModel = null; this.mItemStoreCheckUtils = null; this.mFocusButton = null; }
public bool IsValidBuy(ItemStoreModel item, int count) { return(item != null && item.Count != 0 && count > 0 && (item.Count <= 0 || count <= item.Count) && item.Price * count <= base.UserInfo.SPoint && this._req_store.IsBuy(item.MstId, count)); }
public void Release() { mModel = null; mItemStoreCheckUtils = null; mFocusButton = null; }