Example #1
0
    public void loadAllItemsFromSerial(string serial)
    {
        if (serial != string.Empty)
        {
            string[] strArrays      = Packer.unpack(serial, ';');
            int      backpackWidth  = int.Parse(strArrays[0]);
            int      backpackHeight = int.Parse(strArrays[1]);
            int      backpackWeight = int.Parse(strArrays[2]);

            if (backpackWidth > 5)
            {
                backpackWidth = 5;
            }

            if (backpackHeight > 5)
            {
                backpackHeight = 5;
            }

            if (backpackWeight > 20000)
            {
                backpackWeight = 20000;
            }

            int backpackItems = (int)strArrays.Length - 3;

            this.resize(backpackWidth, backpackHeight, backpackWeight);

            for (int i = 0; i < backpackItems; i++)
            {
                int      bagX       = i % this.width;
                int      bagY       = i / this.width;
                string[] clientItem = Packer.unpack(strArrays[3 + i], ':');
                this.items[bagX, bagY] = new ClientItem(int.Parse(clientItem[0]), int.Parse(clientItem[1]), clientItem[2]);
            }

            UpdateItems();

            this.syncWeight();
        }
        else
        {
            if (base.GetComponent <Clothes>().backpack == -1)  // Not died, respawn with no sync!
            {
                this.resize(BagSize.getWidth(-1), BagSize.getHeight(-1), BagSize.getCapacity(-1));
                if (ServerSettings.mode == 1)
                {
                    this.tryAddItem(8008, 1);
                    this.tryAddItem(14021, 1);
                    this.tryAddItem(15002, 1);
                }
                this.syncWeight();
            }
        }
        this.loaded = true;
        if (!base.networkView.isMine)
        {
            base.networkView.RPC("tellLoadedInventory", base.networkView.owner, new object[] { true });
        }
    }
Example #2
0
 public void changeBackpack(int backpack)
 {
     if (backpack != -1 || this.backpack != -1)
     {
         if (Equipment.equipped.x != -1 && (Equipment.equipped.x >= BagSize.getWidth(backpack) || Equipment.equipped.y >= BagSize.getHeight(backpack)) && Equipment.id != backpack)
         {
             Equipment.dequip();
         }
         base.networkView.RPC("tellBackpack", RPCMode.All, new object[] { backpack });
         PlayerPrefs.SetInt(string.Concat("lastBackpack_", PlayerSettings.id), Sneaky.sneak(backpack));
         NetworkSounds.askSound("Sounds/Clothes/zipper", base.transform.position, 0.5f, UnityEngine.Random.Range(0.9f, 1.1f), 1f);
     }
 }
Example #3
0
        public List <BagSize> GetAllBagSize()
        {
            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                var     list = db.BagSize.ToList();
                BagSize b    = new BagSize();
                b.BagSizeName = "";
                b.BagSizeId   = 0;
                list.Insert(0, b);

                return(list);
            }
        }
Example #4
0
    public void tellBackpack(int setBackpack, NetworkMessageInfo info)
    {
        /*if (HackCheck(info))
         *  return;*/

        if (Network.isServer && this.backpack != -1 && ItemType.getType(this.backpack) == 2)
        {
            SpawnItems.dropItem(this.backpack, base.transform.position);
        }
        this.backpack = setBackpack;
        if (this.character != null)
        {
            this.character.backpack = this.backpack;
            this.character.wear();
        }
        if (Network.isServer)
        {
            base.GetComponent <Inventory>().resize(BagSize.getWidth(this.backpack), BagSize.getHeight(this.backpack), BagSize.getCapacity(this.backpack));
        }
    }
Example #5
0
        public bool InsertBagSize(string BagSize)
        {
            bool isSaved = true;

            using (WTCCeresEntities db = new WTCCeresEntities())
            {
                try
                {
                    var bz = new BagSize();
                    bz.BagSizeName = BagSize;

                    db.BagSize.Add(bz);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    isSaved = false;
                }
            }

            return(isSaved);
        }
Example #6
0
    /// <summary>
    /// 界面显示
    /// </summary>
    protected override void OnShow(INotification notification)
    {
        if (bagMediator == null)
        {
            bagMediator = Facade.RetrieveMediator("BagMediator") as BagMediator;
        }
        foreach (Item item in ItemList.Values)
        {
            bagList.Add(item);
        }
        UpdateBagSize();
        bagList.Sort(CompareItem);
        currentType           = ItemType.Equip;
        panel.BagGrid.enabled = true;
        bagSizeInfo           = BagSizeConfig.GetBagSize(1);
        panel.BagGrid.BindCustomCallBack(UpdateBagGridItem);
        panel.BagGrid.StartCustom();
        panel.BagGrid.AddCustomDataList(AddListGrid(bagList));

        panel.SellGrid.enabled = true;
        panel.SellGrid.BindCustomCallBack(UpdateBatchSellGrid);
        panel.SellGrid.StartCustom();
    }
Example #7
0
 private void OnReadRow(BagSize row)
 {
     list[row.ID] = row;
 }