示例#1
0
        // Token: 0x060036F8 RID: 14072 RVA: 0x0017C770 File Offset: 0x0017AB70
        private static void updateSelection()
        {
            if (PlaySettings.singleplayerMap == null || PlaySettings.singleplayerMap.Length == 0)
            {
                return;
            }
            LevelInfo level = Level.getLevel(PlaySettings.singleplayerMap);

            if (level == null)
            {
                return;
            }
            Local local = Localization.tryRead(level.path, false);

            if (local != null)
            {
                MenuPlaySingleplayerUI.descriptionBox.text = local.format("Description");
            }
            if (local != null && local.has("Name"))
            {
                MenuPlaySingleplayerUI.selectedBox.text = local.format("Name");
            }
            else
            {
                MenuPlaySingleplayerUI.selectedBox.text = PlaySettings.singleplayerMap;
            }
            if (MenuPlaySingleplayerUI.previewImage.texture != null && MenuPlaySingleplayerUI.previewImage.shouldDestroyTexture)
            {
                UnityEngine.Object.Destroy(MenuPlaySingleplayerUI.previewImage.texture);
                MenuPlaySingleplayerUI.previewImage.texture = null;
            }
            string path = level.path + "/Preview.png";

            if (!ReadWrite.fileExists(path, false, false))
            {
                path = level.path + "/Level.png";
            }
            if (ReadWrite.fileExists(path, false, false))
            {
                byte[]    data      = ReadWrite.readBytes(path, false, false);
                Texture2D texture2D = new Texture2D(320, 180, TextureFormat.ARGB32, false, true);
                texture2D.name       = "Preview_" + PlaySettings.singleplayerMap + "_Selected_Icon";
                texture2D.filterMode = FilterMode.Trilinear;
                texture2D.hideFlags  = HideFlags.HideAndDontSave;
                texture2D.LoadImage(data);
                MenuPlaySingleplayerUI.previewImage.texture = texture2D;
            }
            int num = MenuPlaySingleplayerUI.creditsBox.positionOffset_Y;

            if (level.configData.Creators.Length > 0 || level.configData.Collaborators.Length > 0 || level.configData.Thanks.Length > 0)
            {
                int    num2 = 0;
                string text = string.Empty;
                if (level.configData.Creators.Length > 0)
                {
                    text += MenuPlaySingleplayerUI.localization.format("Creators");
                    num2 += 15;
                    for (int i = 0; i < level.configData.Creators.Length; i++)
                    {
                        text  = text + "\n" + level.configData.Creators[i];
                        num2 += 15;
                    }
                }
                if (level.configData.Collaborators.Length > 0)
                {
                    if (text.Length > 0)
                    {
                        text += "\n\n";
                        num2 += 30;
                    }
                    text += MenuPlaySingleplayerUI.localization.format("Collaborators");
                    num2 += 15;
                    for (int j = 0; j < level.configData.Collaborators.Length; j++)
                    {
                        text  = text + "\n" + level.configData.Collaborators[j];
                        num2 += 15;
                    }
                }
                if (level.configData.Thanks.Length > 0)
                {
                    if (text.Length > 0)
                    {
                        text += "\n\n";
                        num2 += 30;
                    }
                    text += MenuPlaySingleplayerUI.localization.format("Thanks");
                    num2 += 15;
                    for (int k = 0; k < level.configData.Thanks.Length; k++)
                    {
                        text  = text + "\n" + level.configData.Thanks[k];
                        num2 += 15;
                    }
                }
                num2 = Mathf.Max(num2, 40);
                MenuPlaySingleplayerUI.creditsBox.sizeOffset_Y = num2;
                MenuPlaySingleplayerUI.creditsBox.text         = text;
                MenuPlaySingleplayerUI.creditsBox.isVisible    = true;
                num += num2 + 10;
            }
            else
            {
                MenuPlaySingleplayerUI.creditsBox.isVisible = false;
            }
            if (level.configData.Item != 0)
            {
                MenuPlaySingleplayerUI.itemButton.positionOffset_Y = num;
                MenuPlaySingleplayerUI.itemButton.text             = MenuPlaySingleplayerUI.localization.format("Credits_Text", new object[]
                {
                    MenuPlaySingleplayerUI.selectedBox.text,
                    string.Concat(new string[]
                    {
                        "<color=",
                        Palette.hex(Provider.provider.economyService.getInventoryColor(level.configData.Item)),
                        ">",
                        Provider.provider.economyService.getInventoryName(level.configData.Item),
                        "</color>"
                    })
                });
                MenuPlaySingleplayerUI.itemButton.tooltip   = MenuPlaySingleplayerUI.localization.format("Credits_Tooltip");
                MenuPlaySingleplayerUI.itemButton.isVisible = true;
                num += MenuPlaySingleplayerUI.itemButton.sizeOffset_Y + 10;
            }
            else
            {
                MenuPlaySingleplayerUI.itemButton.isVisible = false;
            }
            if (!string.IsNullOrEmpty(level.configData.Feedback))
            {
                MenuPlaySingleplayerUI.feedbackButton.positionOffset_Y = num;
                MenuPlaySingleplayerUI.feedbackButton.isVisible        = true;
                num += MenuPlaySingleplayerUI.feedbackButton.sizeOffset_Y + 10;
            }
            else
            {
                MenuPlaySingleplayerUI.feedbackButton.isVisible = false;
            }
            if (level.configData.Category == ESingleplayerMapCategory.CURATED && level.configData.CuratedMapMode == ECuratedMapMode.TIMED)
            {
                MenuPlaySingleplayerUI.timedBox.positionOffset_Y = num;
                MenuPlaySingleplayerUI.timedBox.text             = MenuPlaySingleplayerUI.localization.format("Timed_Text", new object[]
                {
                    MenuPlaySingleplayerUI.localization.format("Curated_Map_Timestamp", new object[]
                    {
                        level.configData.getCuratedMapTimestamp().ToString(MenuPlaySingleplayerUI.localization.format("Curated_Map_Timestamp_Format"))
                    })
                });
                MenuPlaySingleplayerUI.timedBox.isVisible = true;
                num += MenuPlaySingleplayerUI.timedBox.sizeOffset_Y + 10;
            }
            else
            {
                MenuPlaySingleplayerUI.timedBox.isVisible = false;
            }
        }
 // Token: 0x06003739 RID: 14137 RVA: 0x00180E98 File Offset: 0x0017F298
 public static void viewItem(int newItem, ulong newInstance, EDeleteMode newMode, ulong newInstigator)
 {
     MenuSurvivorsClothingDeleteUI.item              = newItem;
     MenuSurvivorsClothingDeleteUI.instance          = newInstance;
     MenuSurvivorsClothingDeleteUI.mode              = newMode;
     MenuSurvivorsClothingDeleteUI.instigator        = newInstigator;
     MenuSurvivorsClothingDeleteUI.yesButton.tooltip = MenuSurvivorsClothingDeleteUI.localization.format((MenuSurvivorsClothingDeleteUI.mode != EDeleteMode.SALVAGE) ? ((MenuSurvivorsClothingDeleteUI.mode != EDeleteMode.TAG_TOOL) ? "Yes_Delete_Tooltip" : "Yes_Tag_Tool_Tooltip") : "Yes_Salvage_Tooltip");
     if (MenuSurvivorsClothingDeleteUI.mode == EDeleteMode.TAG_TOOL)
     {
         int inventoryItem = Provider.provider.economyService.getInventoryItem(MenuSurvivorsClothingDeleteUI.instigator);
         MenuSurvivorsClothingDeleteUI.intentLabel.text = MenuSurvivorsClothingDeleteUI.localization.format("Intent_Tag_Tool", new object[]
         {
             string.Concat(new string[]
             {
                 "<color=",
                 Palette.hex(Provider.provider.economyService.getInventoryColor(inventoryItem)),
                 ">",
                 Provider.provider.economyService.getInventoryName(inventoryItem),
                 "</color>"
             }),
             string.Concat(new string[]
             {
                 "<color=",
                 Palette.hex(Provider.provider.economyService.getInventoryColor(MenuSurvivorsClothingDeleteUI.item)),
                 ">",
                 Provider.provider.economyService.getInventoryName(MenuSurvivorsClothingDeleteUI.item),
                 "</color>"
             })
         });
     }
     else
     {
         MenuSurvivorsClothingDeleteUI.intentLabel.text = MenuSurvivorsClothingDeleteUI.localization.format((MenuSurvivorsClothingDeleteUI.mode != EDeleteMode.SALVAGE) ? "Intent_Delete" : "Intent_Salvage", new object[]
         {
             string.Concat(new string[]
             {
                 "<color=",
                 Palette.hex(Provider.provider.economyService.getInventoryColor(MenuSurvivorsClothingDeleteUI.item)),
                 ">",
                 Provider.provider.economyService.getInventoryName(MenuSurvivorsClothingDeleteUI.item),
                 "</color>"
             })
         });
     }
     MenuSurvivorsClothingDeleteUI.confirmLabel.text = MenuSurvivorsClothingDeleteUI.localization.format("Confirm", new object[]
     {
         MenuSurvivorsClothingDeleteUI.localization.format((MenuSurvivorsClothingDeleteUI.mode != EDeleteMode.SALVAGE) ? "Delete" : "Salvage")
     });
     MenuSurvivorsClothingDeleteUI.confirmLabel.isVisible = (MenuSurvivorsClothingDeleteUI.mode != EDeleteMode.TAG_TOOL);
     MenuSurvivorsClothingDeleteUI.confirmField.hint      = MenuSurvivorsClothingDeleteUI.localization.format((MenuSurvivorsClothingDeleteUI.mode != EDeleteMode.SALVAGE) ? "Delete" : "Salvage");
     MenuSurvivorsClothingDeleteUI.confirmField.text      = string.Empty;
     MenuSurvivorsClothingDeleteUI.confirmField.isVisible = (MenuSurvivorsClothingDeleteUI.mode != EDeleteMode.TAG_TOOL);
     if (MenuSurvivorsClothingDeleteUI.mode == EDeleteMode.TAG_TOOL)
     {
         MenuSurvivorsClothingDeleteUI.yesButton.positionOffset_X = -65;
         MenuSurvivorsClothingDeleteUI.yesButton.positionScale_X  = 0.5f;
         MenuSurvivorsClothingDeleteUI.noButton.positionOffset_X  = 5;
         MenuSurvivorsClothingDeleteUI.noButton.positionScale_X   = 0.5f;
     }
     else
     {
         MenuSurvivorsClothingDeleteUI.yesButton.positionOffset_X = -135;
         MenuSurvivorsClothingDeleteUI.yesButton.positionScale_X  = 1f;
         MenuSurvivorsClothingDeleteUI.noButton.positionOffset_X  = -65;
         MenuSurvivorsClothingDeleteUI.noButton.positionScale_X   = 1f;
     }
 }
        private static void updateSelection()
        {
            if (PlaySettings.singleplayerMap == null || PlaySettings.singleplayerMap.Length == 0)
            {
                return;
            }
            LevelInfo level = Level.getLevel(PlaySettings.singleplayerMap);

            if (level == null)
            {
                return;
            }
            Local local = Localization.tryRead(level.path, false);

            if (local != null)
            {
                MenuPlaySingleplayerUI.descriptionBox.text = local.format("Description");
            }
            if (local != null && local.has("Name"))
            {
                MenuPlaySingleplayerUI.selectedBox.text = local.format("Name");
            }
            else
            {
                MenuPlaySingleplayerUI.selectedBox.text = PlaySettings.singleplayerMap;
            }
            if (MenuPlaySingleplayerUI.previewImage.texture != null && MenuPlaySingleplayerUI.previewImage.shouldDestroyTexture)
            {
                Object.Destroy(MenuPlaySingleplayerUI.previewImage.texture);
                MenuPlaySingleplayerUI.previewImage.texture = null;
            }
            string path = level.path + "/Preview.png";

            if (!ReadWrite.fileExists(path, false, false))
            {
                path = level.path + "/Level.png";
            }
            if (ReadWrite.fileExists(path, false, false))
            {
                byte[]    array     = ReadWrite.readBytes(path, false, false);
                Texture2D texture2D = new Texture2D(320, 180, 5, false, true);
                texture2D.name       = "Preview_" + PlaySettings.singleplayerMap + "_Selected_Icon";
                texture2D.filterMode = 2;
                texture2D.hideFlags  = 61;
                texture2D.LoadImage(array);
                MenuPlaySingleplayerUI.previewImage.texture = texture2D;
            }
            if (level.configData.Creators.Length > 0 || level.configData.Collaborators.Length > 0 || level.configData.Thanks.Length > 0)
            {
                int    num  = 0;
                string text = string.Empty;
                if (level.configData.Creators.Length > 0)
                {
                    text += MenuPlaySingleplayerUI.localization.format("Creators");
                    num  += 15;
                    for (int i = 0; i < level.configData.Creators.Length; i++)
                    {
                        text = text + "\n" + level.configData.Creators[i];
                        num += 15;
                    }
                }
                if (level.configData.Collaborators.Length > 0)
                {
                    if (text.Length > 0)
                    {
                        text += "\n\n";
                        num  += 30;
                    }
                    text += MenuPlaySingleplayerUI.localization.format("Collaborators");
                    num  += 15;
                    for (int j = 0; j < level.configData.Collaborators.Length; j++)
                    {
                        text = text + "\n" + level.configData.Collaborators[j];
                        num += 15;
                    }
                }
                if (level.configData.Thanks.Length > 0)
                {
                    if (text.Length > 0)
                    {
                        text += "\n\n";
                        num  += 30;
                    }
                    text += MenuPlaySingleplayerUI.localization.format("Thanks");
                    num  += 15;
                    for (int k = 0; k < level.configData.Thanks.Length; k++)
                    {
                        text = text + "\n" + level.configData.Thanks[k];
                        num += 15;
                    }
                }
                MenuPlaySingleplayerUI.creditsBox.sizeOffset_Y = num;
                MenuPlaySingleplayerUI.creditsBox.text         = text;
                MenuPlaySingleplayerUI.creditsBox.isVisible    = true;
            }
            else
            {
                MenuPlaySingleplayerUI.creditsBox.isVisible = false;
            }
            if (level.configData.Item != 0)
            {
                MenuPlaySingleplayerUI.itemButton.positionOffset_Y = MenuPlaySingleplayerUI.creditsBox.positionOffset_Y;
                if (MenuPlaySingleplayerUI.creditsBox.isVisible)
                {
                    MenuPlaySingleplayerUI.itemButton.positionOffset_Y += MenuPlaySingleplayerUI.creditsBox.sizeOffset_Y + 10;
                }
                MenuPlaySingleplayerUI.itemButton.text = MenuPlaySingleplayerUI.localization.format("Credits_Text", new object[]
                {
                    MenuPlaySingleplayerUI.selectedBox.text,
                    string.Concat(new string[]
                    {
                        "<color=",
                        Palette.hex(Provider.provider.economyService.getInventoryColor(level.configData.Item)),
                        ">",
                        Provider.provider.economyService.getInventoryName(level.configData.Item),
                        "</color>"
                    })
                });
                MenuPlaySingleplayerUI.itemButton.tooltip   = MenuPlaySingleplayerUI.localization.format("Credits_Tooltip");
                MenuPlaySingleplayerUI.itemButton.isVisible = true;
            }
            else
            {
                MenuPlaySingleplayerUI.itemButton.isVisible = false;
            }
            if (!string.IsNullOrEmpty(level.configData.Feedback))
            {
                MenuPlaySingleplayerUI.feedbackButton.positionOffset_Y = MenuPlaySingleplayerUI.creditsBox.positionOffset_Y;
                if (MenuPlaySingleplayerUI.creditsBox.isVisible)
                {
                    MenuPlaySingleplayerUI.feedbackButton.positionOffset_Y += MenuPlaySingleplayerUI.creditsBox.sizeOffset_Y + 10;
                }
                if (MenuPlaySingleplayerUI.itemButton.isVisible)
                {
                    MenuPlaySingleplayerUI.feedbackButton.positionOffset_Y += MenuPlaySingleplayerUI.itemButton.sizeOffset_Y + 10;
                }
                MenuPlaySingleplayerUI.feedbackButton.isVisible = true;
            }
            else
            {
                MenuPlaySingleplayerUI.feedbackButton.isVisible = false;
            }
        }
 // Token: 0x06003747 RID: 14151 RVA: 0x0018202C File Offset: 0x0018042C
 public static void viewItem(int newItem, ushort newQuantity, ulong newInstance)
 {
     Debug.Log(string.Concat(new object[]
     {
         "View: ",
         newItem,
         " x",
         newQuantity,
         " [",
         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 && MenuSurvivorsClothingItemUI.packageBox.vehicleAsset == null)
     {
         MenuSurvivorsClothingItemUI.useButton.isVisible           = false;
         MenuSurvivorsClothingItemUI.inspectButton.isVisible       = false;
         MenuSurvivorsClothingItemUI.marketButton.isVisible        = false;
         MenuSurvivorsClothingItemUI.scrapButton.isVisible         = false;
         MenuSurvivorsClothingItemUI.deleteButton.isVisible        = true;
         MenuSurvivorsClothingItemUI.descriptionBox.sizeOffset_Y   = -60;
         MenuSurvivorsClothingItemUI.deleteButton.positionOffset_Y = -MenuSurvivorsClothingItemUI.descriptionBox.sizeOffset_Y - 50;
         MenuSurvivorsClothingItemUI.deleteButton.sizeScale_X      = 0.5f;
         MenuSurvivorsClothingItemUI.infoLabel.text = MenuSurvivorsClothingItemUI.localization.format("Unknown");
     }
     else
     {
         if (MenuSurvivorsClothingItemUI.packageBox.itemAsset != null && MenuSurvivorsClothingItemUI.packageBox.itemAsset.type == EItemType.KEY)
         {
             if ((MenuSurvivorsClothingItemUI.packageBox.itemAsset as ItemKeyAsset).exchangeWithTargetItem)
             {
                 MenuSurvivorsClothingItemUI.useButton.isVisible = true;
                 MenuSurvivorsClothingItemUI.useButton.text      = MenuSurvivorsClothingItemUI.localization.format("Target_Item_Text");
                 MenuSurvivorsClothingItemUI.useButton.tooltip   = MenuSurvivorsClothingItemUI.localization.format("Target_Item_Tooltip");
             }
             else
             {
                 MenuSurvivorsClothingItemUI.useButton.isVisible = false;
             }
             MenuSurvivorsClothingItemUI.inspectButton.isVisible = false;
         }
         else if (MenuSurvivorsClothingItemUI.packageBox.itemAsset != null && 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 == null || 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.scrapButton.isVisible       = Provider.provider.economyService.getInventoryScrapable(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.scrapButton.isVisible)
         {
             MenuSurvivorsClothingItemUI.deleteButton.sizeScale_X = 0.25f;
         }
         else
         {
             MenuSurvivorsClothingItemUI.deleteButton.sizeScale_X = 0.5f;
         }
         if (MenuSurvivorsClothingItemUI.marketButton.isVisible || MenuSurvivorsClothingItemUI.deleteButton.isVisible || MenuSurvivorsClothingItemUI.scrapButton.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.scrapButton.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)
         });
     }
 }