示例#1
0
		public static LevelInfo getLevel(string name)
		{
			if (ReadWrite.folderExists("/Maps/" + name))
			{
				return Level.getLevel("/Maps/" + name, true);
			}
			if (Provider.provider.workshopService.ugc != null)
			{
				for (int i = 0; i < Provider.provider.workshopService.ugc.Count; i++)
				{
					SteamContent steamContent = Provider.provider.workshopService.ugc[i];
					if (steamContent.type == ESteamUGCType.MAP && ReadWrite.folderExists(steamContent.path + "/" + name, false))
					{
						return Level.getLevel(steamContent.path + "/" + name, false);
					}
				}
			}
			else
			{
				string[] folders = ReadWrite.getFolders("/Bundles/Workshop/Maps");
				for (int j = 0; j < folders.Length; j++)
				{
					if (ReadWrite.folderExists(folders[j] + "/" + name, false))
					{
						return Level.getLevel(folders[j] + "/" + name, false);
					}
				}
				string[] folders2 = ReadWrite.getFolders(ServerSavedata.directory + "/" + Provider.serverID + "/Workshop/Maps");
				for (int k = 0; k < folders2.Length; k++)
				{
					if (ReadWrite.folderExists(folders2[k] + "/" + name, false))
					{
						return Level.getLevel(folders2[k] + "/" + name, false);
					}
				}
				if (ReadWrite.folderExists(string.Concat(new string[]
				{
					ServerSavedata.directory,
					"/",
					Provider.serverID,
					"/Maps/",
					name
				})))
				{
					return Level.getLevel(string.Concat(new string[]
					{
						ServerSavedata.directory,
						"/",
						Provider.serverID,
						"/Maps/",
						name
					}), true);
				}
			}
			return null;
		}
        private static void updateSelection()
        {
            if (PlaySettings.editorMap == null || PlaySettings.editorMap.Length == 0)
            {
                return;
            }
            LevelInfo level = Level.getLevel(PlaySettings.editorMap);

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

            if (local != null)
            {
                MenuWorkshopEditorUI.descriptionBox.text = local.format("Description");
            }
            if (local != null && local.has("Name"))
            {
                MenuWorkshopEditorUI.selectedBox.text = local.format("Name");
            }
            else
            {
                MenuWorkshopEditorUI.selectedBox.text = PlaySettings.editorMap;
            }
            if (MenuWorkshopEditorUI.previewImage.texture != null && MenuWorkshopEditorUI.previewImage.shouldDestroyTexture)
            {
                Object.Destroy(MenuWorkshopEditorUI.previewImage.texture);
                MenuWorkshopEditorUI.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.editorMap + "_Selected_Icon";
                texture2D.filterMode = 2;
                texture2D.hideFlags  = 61;
                texture2D.LoadImage(array);
                MenuWorkshopEditorUI.previewImage.texture = texture2D;
            }
        }
示例#3
0
        // Token: 0x060036B2 RID: 14002 RVA: 0x001772A0 File Offset: 0x001756A0
        private static void updateSelection()
        {
            if (PlaySettings.matchmakingMap == null || PlaySettings.matchmakingMap.Length == 0)
            {
                return;
            }
            LevelInfo level = Level.getLevel(PlaySettings.matchmakingMap);

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

            if (local != null && local.has("Name"))
            {
                MenuPlayMatchmakingUI.selectedBox.text = local.format("Name");
            }
            else
            {
                MenuPlayMatchmakingUI.selectedBox.text = PlaySettings.matchmakingMap;
            }
        }
示例#4
0
        // Token: 0x06003706 RID: 14086 RVA: 0x0017D144 File Offset: 0x0017B544
        private static void onClickedFeedbackButton(SleekButton button)
        {
            if (PlaySettings.singleplayerMap == null || PlaySettings.singleplayerMap.Length == 0)
            {
                return;
            }
            LevelInfo level = Level.getLevel(PlaySettings.singleplayerMap);

            if (level == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(level.configData.Feedback))
            {
                return;
            }
            if (!Provider.provider.browserService.canOpenBrowser)
            {
                MenuUI.alert(MenuPlaySingleplayerUI.localization.format("Overlay"));
                return;
            }
            Provider.provider.browserService.open(level.configData.Feedback);
        }
示例#5
0
        // Token: 0x06003705 RID: 14085 RVA: 0x0017D0AC File Offset: 0x0017B4AC
        private static void onClickedCreditsButton(SleekButton button)
        {
            if (PlaySettings.singleplayerMap == null || PlaySettings.singleplayerMap.Length == 0)
            {
                return;
            }
            LevelInfo level = Level.getLevel(PlaySettings.singleplayerMap);

            if (level == null)
            {
                return;
            }
            if (level.configData.Item == 0)
            {
                return;
            }
            if (!Provider.provider.storeService.canOpenStore)
            {
                MenuUI.alert(MenuPlaySingleplayerUI.localization.format("Overlay"));
                return;
            }
            Provider.provider.storeService.open(new SteamworksEconomyItemDefinition((SteamItemDef_t)level.configData.Item));
        }
示例#6
0
		public static LevelInfo[] getLevels(ESingleplayerMapCategory categoryFilter)
		{
			List<LevelInfo> list = new List<LevelInfo>();
			string[] folders = ReadWrite.getFolders("/Maps");
			for (int i = 0; i < folders.Length; i++)
			{
				LevelInfo level = Level.getLevel(folders[i], false);
				if (level != null && !(level.name.ToLower() == "tutorial"))
				{
					if (Level.doesLevelPassFilter(level, categoryFilter))
					{
						list.Add(level);
					}
				}
			}
			if (Provider.provider.workshopService.ugc != null)
			{
				for (int j = 0; j < Provider.provider.workshopService.ugc.Count; j++)
				{
					SteamContent steamContent = Provider.provider.workshopService.ugc[j];
					if (steamContent.type == ESteamUGCType.MAP)
					{
						LevelInfo level2 = Level.getLevel(ReadWrite.folderFound(steamContent.path, false), false);
						if (level2 != null)
						{
							level2.isFromWorkshop = true;
							if (Level.doesLevelPassFilter(level2, categoryFilter))
							{
								list.Add(level2);
							}
						}
					}
				}
			}
			else
			{
				string[] folders2 = ReadWrite.getFolders("/Bundles/Workshop/Maps");
				for (int k = 0; k < folders2.Length; k++)
				{
					LevelInfo level3 = Level.getLevel(folders2[k], false);
					if (level3 != null)
					{
						level3.isFromWorkshop = true;
						if (Level.doesLevelPassFilter(level3, categoryFilter))
						{
							list.Add(level3);
						}
					}
				}
				string[] folders3 = ReadWrite.getFolders(ServerSavedata.directory + "/" + Provider.serverID + "/Workshop/Maps");
				for (int l = 0; l < folders3.Length; l++)
				{
					LevelInfo level4 = Level.getLevel(folders3[l], false);
					if (level4 != null)
					{
						level4.isFromWorkshop = true;
						if (Level.doesLevelPassFilter(level4, categoryFilter))
						{
							list.Add(level4);
						}
					}
				}
				folders = ReadWrite.getFolders(ServerSavedata.directory + "/" + Provider.serverID + "/Maps");
				for (int m = 0; m < folders.Length; m++)
				{
					LevelInfo level5 = Level.getLevel(folders[m], false);
					if (level5 != null && !(level5.name.ToLower() == "tutorial"))
					{
						level5.isFromWorkshop = true;
						if (Level.doesLevelPassFilter(level5, categoryFilter))
						{
							list.Add(level5);
						}
					}
				}
			}
			return list.ToArray();
		}
示例#7
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;
            }
        }
        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;
            }
        }