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);
    }
Пример #2
0
        //修改
        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));
        }
Пример #3
0
    public void LoadCatalog(ShopTab shopTab)
    {
        ClearCatalog();

        foreach (ShopItem item in shopTab.catalog.items)
        {
            Instantiate(button, shopMenuContent.transform);
            button.InitializeButton(item);
        }

        currentSelectedTab = shopTab;
    }
Пример #4
0
 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();
         }
     }
 }
Пример #5
0
        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]);
                    }
                }
            }
        }
Пример #6
0
    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);
        }
    }
Пример #7
0
    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();
    }
Пример #8
0
 //添加商品价格信息
 public int AddSaxFens([FromBody] ShopTab s)
 {
     return(bll.AddSaxFens(s));
 }
Пример #9
0
 public void Refresh(ShopTab selectedShopTab)
 {
     GetComponent <Image>().color = selectedShopTab == shopTab ? new Color(0.86f, 0.84f, 0.52f) : Color.white;
 }
Пример #10
0
 public ClickedShopTabEvent(ShopTab clickedShopTab)
 {
     ClickedShopTab = clickedShopTab;
 }
Пример #11
0
 //添加商品信息
 public int AddShops([FromBody] ShopTab t)
 {
     return(bll.AddShops(t));
 }
Пример #12
0
        //添加商品信息
        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));
        }
Пример #13
0
 public void ChangeShopTab(ShopTab clickedShopTab)
 {
     SelectedTab = clickedShopTab;
     observer.OnChanged(this);
 }
Пример #14
0
 public void ChangedShopTab(ShopTab clickedShopTab)
 {
     SelectedTab = clickedShopTab;
     SendMessage(new EventPayload(new ChangedShopModelEvent()));
 }
Пример #15
0
 //添加商品价格信息
 public int AddSaxFens(ShopTab s)
 {
     return(dal.AddSaxFens(s));
 }
Пример #16
0
 //添加商品信息
 public int AddShops(ShopTab t)
 {
     return(dal.AddShops(t));
 }
Пример #17
0
 //修改
 public int UptSaxFens(ShopTab s)
 {
     return(dal.UptSaxFens(s));
 }
 public void SetButtonEvent(ButtonDelegate buttonDelegate, ShopTab tab, int idPage)
 {
     button.onClick.AddListener(() => buttonDelegate(tab, idPage));
 }
Пример #19
0
 //修改
 public int UptSaxFens([FromBody] ShopTab s)
 {
     return(bll.UptSaxFens(s));
 }
Пример #20
0
 private void TabChanger(ShopTab tab)
 {
     iapTab.SetActive(ShopTab.IAP == tab);
     shopTab.SetActive(ShopTab.SHOP == tab);
 }
Пример #21
0
        //添加商品价格信息
        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));
        }