void HandleShopTab(ref byte[] data, ref int conn) { int id = data[1] | (data[2] << 8); int shopTab = data[3] | data[4] << 8; if (!EntityExists(id) || entities[id].e == null) { //if doesn't exist or isn't an entity Debug.LogWarning("player " + points[conn].id + " asked for shop from entity id " + id + " but that entity does not exist"); return; } if (!entities[id].e.shopEntries.ContainsKey(shopTab)) { Debug.LogWarning("player " + points[conn].id + " asked for shopTab " + shopTab + " from entity " + id + " when it doesn't have it"); return; } if (Shop.GetSpendableShopTabsInt(entities[id].e, points[conn]).Contains(shopTab)) { Debug.LogWarning("player " + points[conn].id + " asked for shopTab " + shopTab + " from entity " + id + " when they don't have permission to spend on it"); return; } byte[] sends = new byte[1 + 4 + (8 * entities[id].e.shopEntries[shopTab].Count * 8)]; //1 byte for netcode, 2 bytes for id, 2 bytes for length if items, plus 8 bytes per item sends[0] = netcodes.singleShopTab; int index = 1; //where to start serializing ShopTab.SerializeTo(shopTab, entities[id].e, points[conn], ref sends, ref index); //serialize but start after netcode SendPlayer(sends, conn); }
//修改 public int UptSaxFens(ShopTab s) { string sql = $"Update ShopTab set ShopName='{s.ShopName}',Shop_Pid='{s.Shop_Pid}',Shop_Sid='" + $"{s.Shop_Sid}',Shop_Stock='{s.Shop_Stock}',Shop_Clear='{s.Shop_Clear}',Shop_Unit='{s.Shop_Unit}' where ShopId={s.ShopId}"; return(conn.Execute(sql)); }
public void LoadCatalog(ShopTab shopTab) { ClearCatalog(); foreach (ShopItem item in shopTab.catalog.items) { Instantiate(button, shopMenuContent.transform); button.InitializeButton(item); } currentSelectedTab = shopTab; }
protected override void OtherKeyPressed(ConsoleKey key) { if (key == ConsoleKey.A || key == ConsoleKey.D) { if (_shop.sellItemIDs.Count() > 0 && _shop.buyItemIDs.Count() > 0) { _shopTab = (_shopTab == ShopTab.Sell) ? ShopTab.Buy : ShopTab.Sell; SetUpItemShop(); ChangedSelection(); } } }
public ItemShopScreen(int id) : base() { _shop = Data._itemShops.Find(s => s.id == id); Clear(ClearType.Both); DrawScreenTitle(_shop.name); if (_shop.greeting.Length > 0) { TypeWrite(_shop.greeting, ConsoleColor.DarkYellow, false, false, false); } if (_shop.sellItemIDs.Count() == 0) { _shopTab = ShopTab.Buy; } else { _shopTab = ShopTab.Sell; } while (_selectIndex != -1) { SetUpItemShop(); GetSelection(true, _selectIndex); if (_selectIndex != -1) { if (_shopTab == ShopTab.Sell) { if (Data._itemInfo.items.Find(item => item.id == _shop.sellItemIDs [_selectIndex]).unlimited) { if (!GameFile._items.Exists(item => item.itemId == _shop.sellItemIDs [_selectIndex])) { Buy(_shop.sellItemIDs [_selectIndex]); } else { TypeWrite(BuildText(_shop.alreadyHaveItemText, Data._itemInfo.items.Find(item => item.id == _shop.sellItemIDs [_selectIndex]), ""), ConsoleColor.DarkYellow, false, false, true); } } else { Buy(_shop.sellItemIDs [_selectIndex]); } } else { Sell(_shop.buyItemIDs [_selectIndex]); } } } }
private void Awake() { _button = GetComponent <Button>(); _otherTabs = new List <ShopTab>(); foreach (Transform tabTransform in transform.parent) { ShopTab tab = tabTransform.GetComponent <ShopTab>(); if (tab == null || tab == this) { continue; } _otherTabs.Add(tab); } }
void OpenTab(ShopTab tab = null, int idPage = 1) { if (currentTab == tab) { return; } if (currentTab != null) { currentTab.ShopItemsGrid.SetActive(false); } if (tab != null) { tab.ShopItemsGrid.SetActive(true); } currentTab = tab; currentPage = idPage; CheckSliders(); }
//添加商品价格信息 public int AddSaxFens([FromBody] ShopTab s) { return(bll.AddSaxFens(s)); }
public void Refresh(ShopTab selectedShopTab) { GetComponent <Image>().color = selectedShopTab == shopTab ? new Color(0.86f, 0.84f, 0.52f) : Color.white; }
public ClickedShopTabEvent(ShopTab clickedShopTab) { ClickedShopTab = clickedShopTab; }
//添加商品信息 public int AddShops([FromBody] ShopTab t) { return(bll.AddShops(t)); }
//添加商品信息 public int AddShops(ShopTab t) { string sql = $"insert into ShopTab values ('{t.ShopCoutID}','{t.ShopName}','{0}','{t.Shop_Pid}','{t.Shop_Sid}','{t.ShopKuState}','{0}','{t.Shopdate}','{0}','{t.Shop_Clear}','{0}')"; return(conn.Execute(sql)); }
public void ChangeShopTab(ShopTab clickedShopTab) { SelectedTab = clickedShopTab; observer.OnChanged(this); }
public void ChangedShopTab(ShopTab clickedShopTab) { SelectedTab = clickedShopTab; SendMessage(new EventPayload(new ChangedShopModelEvent())); }
//添加商品价格信息 public int AddSaxFens(ShopTab s) { return(dal.AddSaxFens(s)); }
//添加商品信息 public int AddShops(ShopTab t) { return(dal.AddShops(t)); }
//修改 public int UptSaxFens(ShopTab s) { return(dal.UptSaxFens(s)); }
public void SetButtonEvent(ButtonDelegate buttonDelegate, ShopTab tab, int idPage) { button.onClick.AddListener(() => buttonDelegate(tab, idPage)); }
//修改 public int UptSaxFens([FromBody] ShopTab s) { return(bll.UptSaxFens(s)); }
private void TabChanger(ShopTab tab) { iapTab.SetActive(ShopTab.IAP == tab); shopTab.SetActive(ShopTab.SHOP == tab); }
//添加商品价格信息 public int AddSaxFens(ShopTab s) { string sql = $"insert into ShopTab values ('{0}','{s.ShopName}','{0}','{s.Shop_Pid}','{s.Shop_Sid}','{null}','{0}','{null}','{s.Shop_Stock}','{s.Shop_Clear}','{s.Shop_Unit}')"; return(conn.Execute(sql)); }