public void ShowPage(BAG_TAB_PAGE page = BAG_TAB_PAGE.PageBase) { var nPage = (int)page; bagPage = page; var e = new ShowPackPageEvent { PackPage = nPage }; EventDispatcher.Instance.DispatchEvent(e); var data = PlayerDataManager.Instance.PlayerDataModel.Bags.Bags[nPage]; BagInfoBind.SetBindDataSource(data); }
private void ShowTradingPage(BAG_TAB_PAGE page, bool repeat = true) { var nPage = (int)page; bagPage = page; var e = new ShowPackPageEvent { PackPage = nPage }; EventDispatcher.Instance.DispatchEvent(e); var data = PlayerDataManager.Instance.PlayerDataModel.Bags.Bags[nPage]; var bag = new BagBaseDataModel(); bag.BagId = data.BagId; bag.Capacity = data.Capacity; bag.MaxCapacity = data.MaxCapacity; bag.Size = data.Size; bag.UnlockTime = data.UnlockTime; var count = data.Items.Count; BagItemDataModel selectItem = null; var equipPage = -1; for (var i = 0; i < count; i++) { var item = data.Items[i]; if (data.Items[i].ItemId != -1) { var tb = Table.GetItemBase(item.ItemId); if (tb == null) { continue; } //TradingSellPage == 0 && if (BitFlag.GetLow(tb.CanTrade, 0)) { if (selectItem == null) { selectItem = item; equipPage = 0; } bag.Items.Add(item); } //TradingSellPage == 1 && if (BitFlag.GetLow(tb.CanTrade, 1)) { if (bagPage == BAG_TAB_PAGE.PageEquip && item.Exdata.Binding == 1) { continue; } if (selectItem == null) { selectItem = item; equipPage = 1; } bag.Items.Add(item); } } } BagInfoBind.SetBindDataSource(bag); if (selectItem == null) { selectItem = new BagItemDataModel(); } if (repeat && equipPage != -1) { EventDispatcher.Instance.DispatchEvent(new UIEvent_TradingEquipTabPage(equipPage)); } EventDispatcher.Instance.DispatchEvent(new UIEvent_TradingBagItemClick(selectItem)); }