예제 #1
0
 public static void viewItem(int newItem, ushort newQuantity, ulong newInstance)
 {
     MenuSurvivorsClothingItemUI.item     = newItem;
     MenuSurvivorsClothingItemUI.quantity = newQuantity;
     MenuSurvivorsClothingItemUI.instance = newInstance;
     MenuSurvivorsClothingItemUI.packageBox.updateInventory(MenuSurvivorsClothingItemUI.instance, MenuSurvivorsClothingItemUI.item, newQuantity, false, true);
     if (MenuSurvivorsClothingItemUI.packageBox.itemAsset != null)
     {
         if (MenuSurvivorsClothingItemUI.packageBox.itemAsset.type == EItemType.KEY)
         {
             MenuSurvivorsClothingItemUI.useButton.isVisible     = false;
             MenuSurvivorsClothingItemUI.inspectButton.isVisible = false;
         }
         else if (MenuSurvivorsClothingItemUI.packageBox.itemAsset.type == EItemType.BOX)
         {
             MenuSurvivorsClothingItemUI.useButton.isVisible     = true;
             MenuSurvivorsClothingItemUI.inspectButton.isVisible = false;
             MenuSurvivorsClothingItemUI.useButton.text          = MenuSurvivorsClothingItemUI.localization.format("Contents_Text");
             MenuSurvivorsClothingItemUI.useButton.tooltip       = MenuSurvivorsClothingItemUI.localization.format("Contents_Tooltip");
         }
         else
         {
             MenuSurvivorsClothingItemUI.useButton.isVisible     = true;
             MenuSurvivorsClothingItemUI.inspectButton.isVisible = true;
             bool flag;
             if (MenuSurvivorsClothingItemUI.packageBox.itemAsset.proPath == null || MenuSurvivorsClothingItemUI.packageBox.itemAsset.proPath.Length == 0)
             {
                 flag = Characters.isSkinEquipped(MenuSurvivorsClothingItemUI.instance);
             }
             else
             {
                 flag = Characters.isCosmeticEquipped(MenuSurvivorsClothingItemUI.instance);
             }
             MenuSurvivorsClothingItemUI.useButton.text    = MenuSurvivorsClothingItemUI.localization.format((!flag) ? "Equip_Text" : "Dequip_Text");
             MenuSurvivorsClothingItemUI.useButton.tooltip = MenuSurvivorsClothingItemUI.localization.format((!flag) ? "Equip_Tooltip" : "Dequip_Tooltip");
         }
         MenuSurvivorsClothingItemUI.marketButton.isVisible      = Provider.provider.economyService.getInventoryMarketable(MenuSurvivorsClothingItemUI.item);
         MenuSurvivorsClothingItemUI.descriptionBox.sizeOffset_Y = 0;
         if (MenuSurvivorsClothingItemUI.useButton.isVisible || MenuSurvivorsClothingItemUI.inspectButton.isVisible)
         {
             MenuSurvivorsClothingItemUI.descriptionBox.sizeOffset_Y   -= 60;
             MenuSurvivorsClothingItemUI.useButton.positionOffset_Y     = -MenuSurvivorsClothingItemUI.descriptionBox.sizeOffset_Y - 50;
             MenuSurvivorsClothingItemUI.inspectButton.positionOffset_Y = -MenuSurvivorsClothingItemUI.descriptionBox.sizeOffset_Y - 50;
         }
         if (MenuSurvivorsClothingItemUI.marketButton.isVisible || MenuSurvivorsClothingItemUI.deleteButton.isVisible)
         {
             MenuSurvivorsClothingItemUI.descriptionBox.sizeOffset_Y  -= 60;
             MenuSurvivorsClothingItemUI.marketButton.positionOffset_Y = -MenuSurvivorsClothingItemUI.descriptionBox.sizeOffset_Y - 50;
             MenuSurvivorsClothingItemUI.deleteButton.positionOffset_Y = -MenuSurvivorsClothingItemUI.descriptionBox.sizeOffset_Y - 50;
         }
         MenuSurvivorsClothingItemUI.infoLabel.text = string.Concat(new string[]
         {
             "<color=",
             Palette.hex(Provider.provider.economyService.getInventoryColor(MenuSurvivorsClothingItemUI.item)),
             ">",
             Provider.provider.economyService.getInventoryType(MenuSurvivorsClothingItemUI.item),
             "</color>\n\n",
             Provider.provider.economyService.getInventoryDescription(MenuSurvivorsClothingItemUI.item)
         });
     }
     else
     {
         MenuSurvivorsClothingItemUI.useButton.isVisible           = false;
         MenuSurvivorsClothingItemUI.inspectButton.isVisible       = false;
         MenuSurvivorsClothingItemUI.marketButton.isVisible        = false;
         MenuSurvivorsClothingItemUI.deleteButton.isVisible        = true;
         MenuSurvivorsClothingItemUI.descriptionBox.sizeOffset_Y   = -60;
         MenuSurvivorsClothingItemUI.deleteButton.positionOffset_Y = -MenuSurvivorsClothingItemUI.descriptionBox.sizeOffset_Y - 50;
         MenuSurvivorsClothingItemUI.infoLabel.text = MenuSurvivorsClothingItemUI.localization.format("Unknown");
     }
 }
예제 #2
0
 public void updateInventory(ulong instance, int item, ushort quantity, bool isClickable, bool isLarge)
 {
     this.button.isClickable = isClickable;
     if (isLarge)
     {
         this.icon.sizeOffset_Y          = -70;
         this.nameLabel.fontSize         = 18;
         this.nameLabel.positionOffset_Y = -70;
         this.nameLabel.sizeOffset_Y     = 70;
         this.equippedIcon.sizeOffset_X  = 20;
         this.equippedIcon.sizeOffset_Y  = 20;
     }
     else
     {
         this.icon.sizeOffset_Y          = -50;
         this.nameLabel.fontSize         = 12;
         this.nameLabel.positionOffset_Y = -50;
         this.nameLabel.sizeOffset_Y     = 50;
         this.equippedIcon.sizeOffset_X  = 10;
         this.equippedIcon.sizeOffset_Y  = 10;
     }
     if (item != 0)
     {
         if (item < 0)
         {
             this._itemAsset             = null;
             this.icon.texture           = (Texture2D)Resources.Load("Economy/Mystery" + ((!isLarge) ? "/Icon_Small" : "/Icon_Large"));
             this.icon.isVisible         = true;
             this.nameLabel.text         = MenuSurvivorsClothingUI.localization.format("Mystery_" + item + "_Text");
             this.button.tooltip         = MenuSurvivorsClothingUI.localization.format("Mystery_Tooltip");
             this.button.backgroundColor = Palette.MYTHICAL;
             this.equippedIcon.isVisible = false;
         }
         else
         {
             ushort inventoryItemID = Provider.provider.economyService.getInventoryItemID(item);
             if (inventoryItemID != 0)
             {
                 this._itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, inventoryItemID);
                 if (this.itemAsset != null)
                 {
                     if (this.itemAsset.proPath == null || this.itemAsset.proPath.Length == 0)
                     {
                         ushort    inventorySkinID = Provider.provider.economyService.getInventorySkinID(item);
                         SkinAsset skinAsset       = (SkinAsset)Assets.find(EAssetType.SKIN, inventorySkinID);
                         if (skinAsset != null)
                         {
                             this.icon.texture = (Texture2D)Resources.Load(string.Concat(new string[]
                             {
                                 "Economy/Skins/",
                                 this.itemAsset.name,
                                 "/",
                                 skinAsset.name,
                                 (!isLarge) ? "/Icon_Small" : "/Icon_Large"
                             }));
                             this.icon.isVisible = true;
                         }
                         else
                         {
                             this.icon.isVisible = false;
                         }
                     }
                     else
                     {
                         this.icon.texture   = (Texture2D)Resources.Load("Economy" + this.itemAsset.proPath + ((!isLarge) ? "/Icon_Small" : "/Icon_Large"));
                         this.icon.isVisible = true;
                     }
                 }
                 else
                 {
                     this.icon.texture   = null;
                     this.icon.isVisible = true;
                 }
                 this.nameLabel.text = Provider.provider.economyService.getInventoryName(item);
                 if (quantity > 1)
                 {
                     SleekLabel sleekLabel = this.nameLabel;
                     sleekLabel.text = sleekLabel.text + " x" + quantity;
                 }
                 this.button.tooltip         = Provider.provider.economyService.getInventoryType(item);
                 this.button.backgroundColor = Provider.provider.economyService.getInventoryColor(item);
                 bool flag;
                 if (this.itemAsset.proPath == null || this.itemAsset.proPath.Length == 0)
                 {
                     flag = Characters.isSkinEquipped(instance);
                 }
                 else
                 {
                     flag = Characters.isCosmeticEquipped(instance);
                 }
                 this.equippedIcon.isVisible = flag;
                 if (flag && this.equippedIcon.texture == null)
                 {
                     this.equippedIcon.texture = (Texture2D)MenuSurvivorsClothingUI.icons.load("Equip");
                 }
             }
             else
             {
                 this._itemAsset             = null;
                 this.icon.texture           = null;
                 this.icon.isVisible         = true;
                 this.nameLabel.text         = "itemdefid: " + item;
                 this.button.tooltip         = "itemdefid: " + item;
                 this.button.backgroundColor = Color.white;
                 this.equippedIcon.isVisible = false;
             }
         }
         this.nameLabel.isVisible = true;
     }
     else
     {
         this._itemAsset             = null;
         this.button.tooltip         = string.Empty;
         this.button.backgroundColor = Color.white;
         this.icon.isVisible         = false;
         this.nameLabel.isVisible    = false;
         this.equippedIcon.isVisible = false;
     }
     this.button.foregroundColor    = this.button.backgroundColor;
     this.nameLabel.foregroundColor = this.button.backgroundColor;
     this.nameLabel.backgroundColor = this.button.backgroundColor;
 }