示例#1
0
		//TerraCustom.Interface.TerraCustomMenu(this, this.selectedMenu, clickableLabelText, clickableLabelScale, array4, ref num, ref num3, ref numberClickableLabels);
		internal static void TerraCustomMenu(Main main, int selectedMenu, bool[] array, string[] clickableLabelText, float[] clickableLabelScale, int[] array4, ref int num, ref int defaultLabelSpacing, ref int numberClickableLabels)
		{
			keyboardSliderAdjustment = 0;
			oldkeystate = keyState;
			keyState = Keyboard.GetState();
			if ((keyState.IsKeyDown(Keys.Left) && oldkeystate.IsKeyUp(Keys.Left)) || (keyState.IsKeyDown(Keys.A) && oldkeystate.IsKeyUp(Keys.A)))
			{
				if (keyState.IsKeyDown(Keys.LeftShift) || keyState.IsKeyDown(Keys.RightShift))
				{
					keyboardSliderAdjustment--;
				}
				else
				{
					keyboardSliderAdjustment -= 10;
				}
			}
			if ((keyState.IsKeyDown(Keys.Right) && oldkeystate.IsKeyUp(Keys.Right)) || (keyState.IsKeyDown(Keys.D) && oldkeystate.IsKeyUp(Keys.D)))
			{
				if (keyState.IsKeyDown(Keys.LeftShift) || keyState.IsKeyDown(Keys.RightShift))
				{
					keyboardSliderAdjustment++;
				}
				else
				{
					keyboardSliderAdjustment += 10;
				}
			}

			num = 200;
			if (Main.menuMode == (int)MenuModes.DownedFound)
			{
				GenericMenu(main, DownedFoundMenuItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
			}
			else if (Main.menuMode == (int)MenuModes.Downed)
			{
				GenericMenu(main, DownedMenuItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
			}
			else if (Main.menuMode == (int)MenuModes.Found)
			{
				GenericMenu(main, FoundMenuItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
			}
			else if (Main.menuMode == (int)MenuModes.Chests)
			{
				GenericMenu(main, ChestsMenuItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
			}
			else if (Main.menuMode == (int)MenuModes.Terrain)
			{
				GenericMenu(main, TerrainMenuItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
				// 0 to 10f : R: 10
				// .1 to .17: R: .07 +- .1
				// Each needs: Label, Ratio, property(get/set), method for string generation?
				//.07f,.15f,
				//() => Main.setting.SurfaceTerrainHeightMax - .1f,
				// .1 to .17
				//() => Main.setting.SurfaceTerrainHeightMin - .3f,  // .3 to .45?
				// % = get/ratio therfore, ratio must be range, get must return 0 to range
				//x => Main.setting.SurfaceTerrainHeightMax = x+.1f,
				//x => Main.setting.SurfaceTerrainHeightMin = x+.3f, // ration * % 
			}
			else if (Main.menuMode == (int)MenuModes.VariousSpawns)
			{
				WorldGen.SetupStatueList();
				GenericMenu(main, VariousSpawnsMenuItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
				/*	"Demon/Crimson Altars:", 95f
				//		() => (float)Main.setting.NumberGenerationPassSteps,
				//	x => Main.setting.NumberGenerationPassSteps = (int) x,
				//x => { Main.setting.TreeLowerBound = 1; Main.setting.TreeLowerBound = 2; },
				//x => Main.setting.AltarMultiplier = x,
				//	x => (int)x + " steps (Don't change this)",
				//x => Math.Round((double)(x * 100f)) + "%" + " -> " + (int)((Main.maxTilesX * Main.maxTilesY) * 2E-05 * x),
				*/
			}
			else if (Main.menuMode == (int)MenuModes.MicroBiomes1)
			{
				GenericMenu(main, MicroBiomesMenuItems1, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
			}
			else if (Main.menuMode == (int)MenuModes.MicroBiomes2)
			{
				GenericMenu(main, MicroBiomesMenuItems2, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
			}
			else if (Main.menuMode == (int)MenuModes.Traps)
			{
				GenericMenu(main, TrapsMenuItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
			}
			else if (Main.menuMode == (int)MenuModes.Backgrounds)
			{
				GenericMenu(main, BackgroundsMenuItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
			}
			else if (Main.menuMode == (int)MenuModes.Ores)
			{
				GenericMenu(main, OresMenuItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
			}
			//else if (Main.menuMode == (int)MenuModes.SavedSettings)
			//{
			//	//	SettingSaver settingSaver = new SettingSaver();
			//	Main.settingSaver.getSettings();

			//	TerraCustomMenuItem[] SavedSettingItems = new TerraCustomMenuItem[] {
			//		new ActionLabel("Load", Main.settingSaver.loadSetting2) { labelScale = 0.53f, additionalHorizontalSpacingPre = -5 },
			//		new ActionLabel("Save", Main.settingSaver.saveSetting2) { labelScale = 0.53f, additionalHorizontalSpacingPre = -5 },
			//		new ActionLabel(Lang.menu[5], ()=> { Main.menuMode = (int)MenuModes.Settings; }) { labelScale = 0.93f, additionalHorizontalSpacingPre = 10 },
			//	};


			//	GenericMenu(main, SavedSettingItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
			//}
			else if (Main.menuMode == (int)MenuModes.ChallengeOption)
			{
				GenericMenu(main, ChallengeOptionMenuItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
			}
			else if (Main.menuMode == (int)MenuModes.Debug)
			{
				GenericMenu(main, DebugMenuItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
			}
			else if (Main.menuMode == (int)MenuModes.UndergroundBackgrounds)
			{
				{
					string[][] optionStrings = { };
					if (WorldGen.worldSize == 0)
					{
						optionStrings = new string[][]
						{
							new string[] { "Ice Background: Random", "Ice Background: 1", "Ice Background: 2", "Ice Background: 3", "Ice Background: 4"},
							new string[] { "Hell Background: Random", "Hell Background: 1", "Hell Background: 2", "Hell Background: 3"},
							new string[] { "Jungle Background: Random", "Jungle Background: 1", "Jungle Background: 2"},
							new string[] { "Cave Background Left: Random", "Cave Background Left: 1", "Cave Background Left: 2", "Cave Background Left: 3", "Cave Background Left: 4", "Cave Background Left: 5", "Cave Background Left: 6", "Cave Background Left: 7", "Cave Background Left: 8"},
							new string[] { "Cave Background Right: Random", "Cave Background Right: 1", "Cave Background Right: 2", "Cave Background Right: 3", "Cave Background Right: 4", "Cave Background Right: 5", "Cave Background Right: 6", "Cave Background Right: 7", "Cave Background Right: 8"},
						};
					}
					if (WorldGen.worldSize == 1)
					{
						optionStrings = new string[][]
						{
							new string[] { "Ice Background: Random", "Ice Background: 1", "Ice Background: 2", "Ice Background: 3", "Ice Background: 4"},
							new string[] { "Hell Background: Random", "Hell Background: 1", "Hell Background: 2", "Hell Background: 3"},
							new string[] { "Jungle Background: Random", "Jungle Background: 1", "Jungle Background: 2"},
							new string[] { "Cave Background Left: Random", "Cave Background Left: 1", "Cave Background Left: 2", "Cave Background Left: 3", "Cave Background Left: 4", "Cave Background Left: 5", "Cave Background Left: 6", "Cave Background Left: 7", "Cave Background Left: 8"},
							new string[] { "Cave Background Middle: Random", "Cave Background Middle: 1", "Cave Background Middle: 2", "Cave Background Middle: 3", "Cave Background Middle: 4", "Cave Background Middle: 5", "Cave Background Middle: 6", "Cave Background Middle: 7", "Cave Background Middle: 8" },
							new string[] { "Cave Background Right: Random", "Cave Background Right: 1", "Cave Background Right: 2", "Cave Background Right: 3", "Cave Background Right: 4", "Cave Background Right: 5", "Cave Background Right: 6", "Cave Background Right: 7", "Cave Background Right: 8"},
						};
					}
					if (WorldGen.worldSize == 2)
					{
						optionStrings = new string[][]
						{
							new string[] { "Ice Background: Random", "Ice Background: 1", "Ice Background: 2", "Ice Background: 3", "Ice Background: 4"},
							new string[] { "Hell Background: Random", "Hell Background: 1", "Hell Background: 2", "Hell Background: 3"},
							new string[] { "Jungle Background: Random", "Jungle Background: 1", "Jungle Background: 2"},
							new string[] { "Cave Background Far Left: Random", "Cave Background Far Left: 1", "Cave Background Far Left: 2", "Cave Background Far Left: 3", "Cave Background Far Left: 4", "Cave Background Far Left: 5", "Cave Background Far Left: 6", "Cave Background Far Left: 7", "Cave Background Far Left: 8"},
							new string[] { "Cave Background Left: Random", "Cave Background Left: 1", "Cave Background Left: 2", "Cave Background Left: 3", "Cave Background Left: 4", "Cave Background Left: 5", "Cave Background Left: 6", "Cave Background Left: 7", "Cave Background Left: 8"},
							new string[] { "Cave Background Right: Random", "Cave Background Right: 1", "Cave Background Right: 2", "Cave Background Right: 3", "Cave Background Right: 4", "Cave Background Right: 5", "Cave Background Right: 6", "Cave Background Right: 7", "Cave Background Right: 8"},
							new string[] { "Cave Background Far Right: Random", "Cave Background Far Right: 1", "Cave Background Far Right: 2", "Cave Background Far Right: 3", "Cave Background Far Right: 4", "Cave Background Far Right: 5", "Cave Background Far Right: 6", "Cave Background Far Right: 7", "Cave Background Far Right: 8"},
						};
					}

					defaultLabelSpacing = 30; // virtical spacing?
					numberClickableLabels = 2 + optionStrings.GetLength(0); // = to reset + back + # options
					for (int num21 = 0; num21 < numberClickableLabels; num21++)
					{
						clickableLabelScale[num21] = 0.73f;
					}
					int buttonIndex = 0;
					clickableLabelText[buttonIndex] = "Reset Underground Background Settings";
					if (main.selectedMenu == 0)
					{
						Setting.initializeUGBGs();
					}
					clickableLabelScale[0] = 0.53f;
					array4[0] = -17;


					Func<int>[] getters = {
							() => Main.setting.IceBackStyle,
							() => Main.setting.HellBackStyle,
							() => Main.setting.JungleBackStyle,
							() => Main.setting.CaveBackStyle1,
							() => Main.setting.CaveBackStyle2,
							() => Main.setting.CaveBackStyle3,
							() => Main.setting.CaveBackStyle4,
						};
					Action<int>[] setters = {
							x => Main.setting.IceBackStyle = x,
							x =>  Main.setting.HellBackStyle = x,
							x => Main.setting.JungleBackStyle = x,
							x => Main.setting.CaveBackStyle1 = x,
							x => Main.setting.CaveBackStyle2 = x,
							x => Main.setting.CaveBackStyle3 = x,
							x => Main.setting.CaveBackStyle4 = x,

						};

					for (int i = 0; i < optionStrings.GetLength(0); i++)
					{
						buttonIndex++;
						clickableLabelText[buttonIndex] = optionStrings[i][getters[i]()];
						if (main.selectedMenu == buttonIndex)
						{
							setters[i]((getters[i]() + 1) % optionStrings[i].Length);
						}
						if (main.selectedMenu2 == buttonIndex)
						{
							setters[i]((getters[i]() + optionStrings[i].Length - 1) % optionStrings[i].Length);
						}
					}

					buttonIndex++;
					array4[buttonIndex] = 30;
					clickableLabelText[buttonIndex] = Lang.menu[5];
					if (main.selectedMenu == buttonIndex)
					{
						Main.menuMode = (int)MenuModes.Backgrounds;
					}



					if (main.selectedMenu != -1)
					{
						main.lastSelectedMenu = main.selectedMenu;
					}

					//IceBackStyle 
					if (main.lastSelectedMenu == 1)
					{
						int[][] backgrounds = new int[][] { new int[] { }, new int[] { 40, 33, 34, 32 }, new int[] { 160, 118, 161, 117 }, new int[] { 164, 165, 166, 167 }, new int[] { 162, 120, 163, 119 } };
						PreviewDrawAll(main, backgrounds[Main.setting.IceBackStyle]);
					}

					// Hell todo 3
					if (main.lastSelectedMenu == 2)
					{
						int[][] backgrounds = new int[][] { new int[] { }, new int[] { 125, 185 }, new int[] { 126, 186 }, new int[] { 127, 187 }, };
						PreviewDrawAll(main, backgrounds[Main.setting.HellBackStyle]);
					}

					// Jungle todo 2
					if (main.lastSelectedMenu == 3)
					{
						int[][] backgrounds = new int[][] { new int[] { },
									new int[] { 153, 147, 148, 149, 150+ (Main.setting.HellBackStyle > 0 ? Main.setting.HellBackStyle  -1:0) },
									new int[] { 146, 154, 155, 156, 157+ (Main.setting.HellBackStyle > 0 ? Main.setting.HellBackStyle  -1:0) } };
						PreviewDrawAll(main, backgrounds[Main.setting.JungleBackStyle]);
					}

					//Caves todo 8 for 4
					if (main.lastSelectedMenu >= 4 && main.lastSelectedMenu <= 5 + WorldGen.worldSize)
					{
						int[][] backgrounds = new int[][] { new int[] { },
								 new int[] {68,67,68,69,128+ (Main.setting.HellBackStyle > 0 ? Main.setting.HellBackStyle  -1:0) },
								 new int[] {70,71,68,72,128+ (Main.setting.HellBackStyle > 0 ? Main.setting.HellBackStyle  -1:0)},
								 new int[] {73,74,75,75,131+ (Main.setting.HellBackStyle > 0 ? Main.setting.HellBackStyle  -1:0)},
								 new int[] {77,78,79,80,134 + (Main.setting.HellBackStyle > 0 ? Main.setting.HellBackStyle  -1:0)},
								 new int[] {77,81,79,82,134 + (Main.setting.HellBackStyle > 0 ? Main.setting.HellBackStyle  -1:0)},
								 new int[] { 83,84,85,86,137+ (Main.setting.HellBackStyle > 0 ? Main.setting.HellBackStyle  -1:0)},
								 new int[] { 83,87,88,89,137+ (Main.setting.HellBackStyle > 0 ? Main.setting.HellBackStyle  -1:0)},
								 new int[] {121,122,123,124,140+ (Main.setting.HellBackStyle > 0 ? Main.setting.HellBackStyle  -1:0)},
								};
						if (main.lastSelectedMenu == 4)
							PreviewDrawAll(main, backgrounds[Main.setting.CaveBackStyle1]);
						if (main.lastSelectedMenu == 5)
							PreviewDrawAll(main, backgrounds[Main.setting.CaveBackStyle2]);
						if (main.lastSelectedMenu == 6)
							PreviewDrawAll(main, backgrounds[Main.setting.CaveBackStyle3]);
						if (main.lastSelectedMenu == 7)
							PreviewDrawAll(main, backgrounds[Main.setting.CaveBackStyle4]);
					}
				}
			}
			else if (Main.menuMode == (int)MenuModes.Miscellaneous)
			{
				GenericMenu(main, MiscellaneousMenuItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
			}
			else if (Main.menuMode == (int)MenuModes.Settings)
			{
				num = 100;
				GenericMenu(main, SettingsMenuItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
				//num3 = 35;
			}
			else if (Main.menuMode == (int)MenuModes.ResetAllSettings)
			{
				clickableLabelText[0] = "Are you sure you will reset all the settings?";
				array[0] = true;
				array4[1] = 20;
				array4[2] = 20;
				clickableLabelText[1] = Lang.menu[4];
				clickableLabelText[2] = Lang.menu[6];
				numberClickableLabels = 4;
				// click accept
				if (main.selectedMenu == 1)
				{
					Setting.initializeAll();
					Main.menuMode = (int)MenuModes.Settings;
				}
				// click cancel
				if (main.selectedMenu == 2)
				{
					Main.menuMode = (int)MenuModes.Settings;
				}
			}
			else if (Main.menuMode == (int)MenuModes.GraphicStyles)
			{
				Main.dayTime = false;
				defaultLabelSpacing = 30;
				numberClickableLabels = 12;
				for (int num47 = 0; num47 < numberClickableLabels; num47++)
				{
					clickableLabelScale[num47] = 0.73f;
				}
				int num48 = 0;
				clickableLabelText[num48] = "Reset Graphic Styles";
				if (main.selectedMenu == 0)
				{
					Setting.initializeGraphic();
				}
				clickableLabelScale[0] = 0.53f;
				array4[0] = -17;
				num48++;
				if (Main.setting.MoonStyle == 0)
				{
					clickableLabelText[num48] = "Moon Style: 1";
				}
				else if (Main.setting.MoonStyle == 1)
				{
					clickableLabelText[num48] = "Moon Style: 2";
				}
				else if (Main.setting.MoonStyle == 2)
				{
					clickableLabelText[num48] = "Moon Style: 3";
				}
				else if (Main.setting.MoonStyle == 3)
				{
					clickableLabelText[num48] = "Moon Style: Random";
				}
				if (main.selectedMenu == num48)
				{
					if (Main.setting.MoonStyle == 0)
					{
						Main.setting.MoonStyle = 1;
						Main.moonType = Main.setting.MoonStyle;
					}
					else if (Main.setting.MoonStyle == 1)
					{
						Main.setting.MoonStyle = 2;
						Main.moonType = Main.setting.MoonStyle;
					}
					else if (Main.setting.MoonStyle == 2)
					{
						Main.setting.MoonStyle = 3;
					}
					else if (Main.setting.MoonStyle == 3)
					{
						Main.setting.MoonStyle = 0;
						Main.moonType = Main.setting.MoonStyle;
					}
				}
				num48++;
				if (Main.setting.SelectTreeStyle[0] == 6)
				{
					clickableLabelText[num48] = "Tree Style " + (WorldGen.worldSize < 2 ? "Left" : "Far Left") + ":  Random";
				}
				else
				{
					clickableLabelText[num48] = "Tree Style " + (WorldGen.worldSize < 2 ? "Left" : "Far Left") + ": " + (Main.setting.SelectTreeStyle[0]);
				}
				if (main.selectedMenu == num48)
				{
					if (Main.setting.SelectTreeStyle[0] == 6)
					{
						Main.setting.SelectTreeStyle[0] = 0;
					}
					else
					{
						Main.setting.SelectTreeStyle[0]++;
					}
				}
				num48++;
				if (Main.setting.SelectTreeStyle[1] == 6)
				{
					clickableLabelText[num48] = "Tree Style " + (WorldGen.worldSize == 0 ? "Right" : WorldGen.worldSize == 1 ? "Middle" : "Left") + ":  Random";
				}
				else
				{
					clickableLabelText[num48] = "Tree Style " + (WorldGen.worldSize == 0 ? "Right" : WorldGen.worldSize == 1 ? "Middle" : "Left") + ": " + (Main.setting.SelectTreeStyle[1]);
				}
				if (main.selectedMenu == num48)
				{
					if (Main.setting.SelectTreeStyle[1] == 6)
					{
						Main.setting.SelectTreeStyle[1] = 0;
					}
					else
					{
						Main.setting.SelectTreeStyle[1]++;
					}
				}
				num48++;
				if (WorldGen.worldSize > 0)
				{
					if (Main.setting.SelectTreeStyle[2] == 6)
					{
						clickableLabelText[num48] = "Tree Style Right:  Random";
					}
					else
					{
						clickableLabelText[num48] = "Tree Style Right: " + (Main.setting.SelectTreeStyle[2]);
					}
					if (main.selectedMenu == num48)
					{
						if (Main.setting.SelectTreeStyle[2] == 6)
						{
							Main.setting.SelectTreeStyle[2] = 0;
						}
						else
						{
							Main.setting.SelectTreeStyle[2]++;
						}
					}
					num48++;
				}
				if (WorldGen.worldSize > 1)
				{
					if (Main.setting.SelectTreeStyle[3] == 6)
					{
						clickableLabelText[num48] = "Tree Style Far Right:  Random";
					}
					else
					{
						clickableLabelText[num48] = "Tree Style Far Right: " + (Main.setting.SelectTreeStyle[3]);
					}
					if (main.selectedMenu == num48)
					{
						if (Main.setting.SelectTreeStyle[3] == 6)
						{
							Main.setting.SelectTreeStyle[3] = 0;
						}
						else
						{
							Main.setting.SelectTreeStyle[3]++;
						}
					}
					num48++;
				}
				if (Main.setting.SelectDungeon == 0)
				{
					clickableLabelText[num48] = "Dungeon Color: Blue";
				}
				else if (Main.setting.SelectDungeon == 1)
				{
					clickableLabelText[num48] = "Dungeon Color: Green";
				}
				else if (Main.setting.SelectDungeon == 2)
				{
					clickableLabelText[num48] = "Dungeon Color: Pink";
				}
				else if (Main.setting.SelectDungeon == 3)
				{
					clickableLabelText[num48] = "Dungeon Color: Random";
				}
				if (main.selectedMenu == num48)
				{
					if (Main.setting.SelectDungeon == 3)
					{
						Main.setting.SelectDungeon = 0;
					}
					else
					{
						Main.setting.SelectDungeon++;
					}
				}
				num48++;
				string[] array22 = new string[]
				{
						"Green",
						"Yellow",
						"Red",
						"Blue",
						"Purple"
				};
				if (Main.setting.SelectMossType[0] == 5)
				{
					clickableLabelText[num48] = "Moss Color Left: Random";
				}
				else
				{
					clickableLabelText[num48] = "Moss Color Left: " + array22[Main.setting.SelectMossType[0]];
				}
				if (main.selectedMenu == num48)
				{
					if (Main.setting.SelectMossType[0] == 5)
					{
						Main.setting.SelectMossType[0] = 0;
					}
					else
					{
						Main.setting.SelectMossType[0]++;
					}
				}
				num48++;
				if (Main.setting.SelectMossType[1] == 5)
				{
					clickableLabelText[num48] = "Moss Color Middle: Random";
				}
				else
				{
					clickableLabelText[num48] = "Moss Color Middle: " + array22[Main.setting.SelectMossType[1]];
				}
				if (main.selectedMenu == num48)
				{
					if (Main.setting.SelectMossType[1] == 5)
					{
						Main.setting.SelectMossType[1] = 0;
					}
					else
					{
						Main.setting.SelectMossType[1]++;
					}
				}
				num48++;
				if (Main.setting.SelectMossType[2] == 5)
				{
					clickableLabelText[num48] = "Moss Color Right: Random";
				}
				else
				{
					clickableLabelText[num48] = "Moss Color Right: " + array22[Main.setting.SelectMossType[2]];
				}
				if (main.selectedMenu == num48)
				{
					if (Main.setting.SelectMossType[2] == 5)
					{
						Main.setting.SelectMossType[2] = 0;
					}
					else
					{
						Main.setting.SelectMossType[2]++;
					}
				}
				num48++;
				string[] array23 = new string[]
				{
						"Iridescent Bricks",
						"Mudstone Blocks",
						"Rich Mahogany",
						"Tin Brick",
						"Gold Brick"
				};
				if (Main.setting.ShrineType == 0)
				{
					clickableLabelText[num48] = "Jungle Shrines: Random";
				}
				else if (Main.setting.ShrineType == 6)
				{
					clickableLabelText[num48] = "Jungle Shrines: Mix";
				}
				else
				{
					clickableLabelText[num48] = "Jungle Shrines: " + array23[Main.setting.ShrineType - 1];
				}
				if (main.selectedMenu == num48)
				{
					if (Main.setting.ShrineType == 6)
					{
						Main.setting.ShrineType = 0;
					}
					else
					{
						Main.setting.ShrineType++;
					}
				}
				num48++;
				array4[num48] = 10;
				clickableLabelText[num48] = Lang.menu[5];
				if (main.selectedMenu == num48)
				{
					main.lastSelectedMenu = -1;
					Main.menuMode = (int)MenuModes.Settings;
				}

				if (main.selectedMenu != -1)
				{
					main.lastSelectedMenu = main.selectedMenu;
				}

				if (main.lastSelectedMenu == 1)
				{
					Main.spriteBatch.Draw(Main.moonTexture[Main.moonType], new Vector2(0, Main.screenHeight - Main.moonTexture[Main.moonType].Height), Color.White);
				}

				if (main.lastSelectedMenu == 2 || main.lastSelectedMenu == 3 || (WorldGen.worldSize > 0 && main.lastSelectedMenu == 4) || (WorldGen.worldSize > 1 && main.lastSelectedMenu == 5))
				{
					Main.spriteBatch.Draw(Main.TCTreeTops, new Vector2(0, Main.screenHeight - Main.TCTreeTops.Height), Color.White);
				}
				if (WorldGen.worldSize == 0)
				{
					if (main.lastSelectedMenu == 5 || main.lastSelectedMenu == 6 || main.lastSelectedMenu == 7)
					{
						Main.spriteBatch.Draw(Main.TCMossColors, new Vector2(0, Main.screenHeight - Main.TCMossColors.Height), Color.White);

					}
				}
				else if (WorldGen.worldSize == 1)
				{
					if (main.lastSelectedMenu == 6 || main.lastSelectedMenu == 7 || main.lastSelectedMenu == 8)
					{
						Main.spriteBatch.Draw(Main.TCMossColors, new Vector2(0, Main.screenHeight - Main.TCMossColors.Height), Color.White);

					}
				}
				else
				{
					if (main.lastSelectedMenu == 7 || main.lastSelectedMenu == 8 || main.lastSelectedMenu == 9)
					{
						Main.spriteBatch.Draw(Main.TCMossColors, new Vector2(0, Main.screenHeight - Main.TCMossColors.Height), Color.White);

					}
				}

				if (main.lastSelectedMenu == 4 + WorldGen.worldSize)
				{
					Main.spriteBatch.Draw(Main.TCDungeonColors, new Vector2(0, Main.screenHeight - Main.TCDungeonColors.Height), Color.White);
				}
			}
			else if (Main.menuMode == (int)MenuModes.SurfaceBackgrounds /*26*/)
			{
				{
					Main.dayTime = true;
					defaultLabelSpacing = 30;
					numberClickableLabels = 10;
					for (int num49 = 0; num49 < numberClickableLabels; num49++)
					{
						clickableLabelScale[num49] = 0.73f;
					}
					int num50 = 0;
					clickableLabelText[num50] = "Reset Background Settings";
					if (main.selectedMenu == 0)
					{
						Setting.initializeBGs();
					}
					clickableLabelScale[0] = 0.53f;
					array4[0] = -17;
					num50++;
					if (Main.setting.ForestStyle == 14)
					{
						clickableLabelText[num50] = "Forest Background: Random";
					}
					else
					{
						// 0 to 13?
						clickableLabelText[num50] = "Forest Background: " + (Main.setting.ForestStyle + 1);
					}
					if (main.selectedMenu == num50)
					{
						if (Main.setting.ForestStyle == 14)
						{
							Main.setting.ForestStyle = 0;
						}
						else
						{
							Main.setting.ForestStyle++;
						}
						TerraCustomUtils.findBackgrounds(0, Main.setting.ForestStyle);
						main.LoadBackground(Main.treeMntBG[0]);
						main.LoadBackground(Main.treeMntBG[1]);
						main.LoadBackground(Main.treeBG[0]);
						main.LoadBackground(Main.treeBG[1]);
						main.LoadBackground(Main.treeBG[2]);
					}
					if (main.selectedMenu2 == num50)
					{
						if (Main.setting.ForestStyle == 0)
						{
							Main.setting.ForestStyle = 14;
						}
						else
						{
							Main.setting.ForestStyle--;
						}
						TerraCustomUtils.findBackgrounds(0, Main.setting.ForestStyle);
						main.LoadBackground(Main.treeMntBG[0]);
						main.LoadBackground(Main.treeMntBG[1]);
						main.LoadBackground(Main.treeBG[0]);
						main.LoadBackground(Main.treeBG[1]);
						main.LoadBackground(Main.treeBG[2]);
					}
					num50++;
					if (Main.setting.CorruptStyle == 2)
					{
						clickableLabelText[num50] = "Corrupt Background: Random";
					}
					else
					{
						clickableLabelText[num50] = "Corrupt Background: " + (Main.setting.CorruptStyle + 1);
					}
					if (main.selectedMenu == num50)
					{
						if (Main.setting.CorruptStyle == 2)
						{
							Main.setting.CorruptStyle = 0;
						}
						else
						{
							Main.setting.CorruptStyle++;
						}
						TerraCustomUtils.findBackgrounds(1, Main.setting.CorruptStyle);
						main.LoadBackground(Main.treeMntBG[0]);
						main.LoadBackground(Main.treeMntBG[1]);
						main.LoadBackground(Main.treeBG[0] = Main.corruptBG[0]);
						main.LoadBackground(Main.treeBG[1] = Main.corruptBG[1]);
						main.LoadBackground(Main.treeBG[2] = Main.corruptBG[2]);
					}
					if (main.selectedMenu2 == num50)
					{
						if (Main.setting.CorruptStyle == 0)
						{
							Main.setting.CorruptStyle = 2;
						}
						else
						{
							Main.setting.CorruptStyle--;
						}
						TerraCustomUtils.findBackgrounds(1, Main.setting.CorruptStyle);
						main.LoadBackground(Main.treeMntBG[0]);
						main.LoadBackground(Main.treeMntBG[1]);
						main.LoadBackground(Main.treeBG[0] = Main.corruptBG[0]);
						main.LoadBackground(Main.treeBG[1] = Main.corruptBG[1]);
						main.LoadBackground(Main.treeBG[2] = Main.corruptBG[2]);
					}
					num50++;
					if (Main.setting.JungleStyle == 2)
					{
						clickableLabelText[num50] = "Jungle Background: Random";
					}
					else
					{
						clickableLabelText[num50] = "Jungle Background: " + (Main.setting.JungleStyle + 1);
					}
					if (main.selectedMenu == num50)
					{
						if (Main.setting.JungleStyle == 2)
						{
							Main.setting.JungleStyle = 0;
						}
						else
						{
							Main.setting.JungleStyle++;
						}
						TerraCustomUtils.findBackgrounds(2, Main.setting.JungleStyle);
						main.LoadBackground(Main.treeMntBG[0]);
						main.LoadBackground(Main.treeMntBG[1]);
						main.LoadBackground(Main.treeBG[0] = Main.jungleBG[0]);
						main.LoadBackground(Main.treeBG[1] = Main.jungleBG[1]);
						main.LoadBackground(Main.treeBG[2] = Main.jungleBG[2]);
					}
					if (main.selectedMenu2 == num50)
					{
						if (Main.setting.JungleStyle == 0)
						{
							Main.setting.JungleStyle = 2;
						}
						else
						{
							Main.setting.JungleStyle--;
						}
						TerraCustomUtils.findBackgrounds(2, Main.setting.JungleStyle);
						main.LoadBackground(Main.treeMntBG[0]);
						main.LoadBackground(Main.treeMntBG[1]);
						main.LoadBackground(Main.treeBG[0] = Main.jungleBG[0]);
						main.LoadBackground(Main.treeBG[1] = Main.jungleBG[1]);
						main.LoadBackground(Main.treeBG[2] = Main.jungleBG[2]);
					}
					num50++;
					if (Main.setting.SnowStyle == 11)
					{
						clickableLabelText[num50] = "Snow Background: Random";
					}
					else
					{
						clickableLabelText[num50] = "Snow Background: " + (Main.setting.SnowStyle + 1);
					}
					if (main.selectedMenu == num50)
					{
						if (Main.setting.SnowStyle == 11)
						{
							Main.setting.SnowStyle = 0;
						}
						else
						{
							Main.setting.SnowStyle++;
						}
						TerraCustomUtils.findBackgrounds(3, Main.setting.SnowStyle);
						main.LoadBackground(Main.treeMntBG[0] = Main.snowMntBG[0]);
						main.LoadBackground(Main.treeMntBG[1] = Main.snowMntBG[1]);
						main.LoadBackground(Main.treeBG[0] = Main.snowBG[0]);
						main.LoadBackground(Main.treeBG[1] = Main.snowBG[1]);
						main.LoadBackground(Main.treeBG[2] = Main.snowBG[2]);
					}
					if (main.selectedMenu2 == num50)
					{
						if (Main.setting.SnowStyle == 0)
						{
							Main.setting.SnowStyle = 11;
						}
						else
						{
							Main.setting.SnowStyle--;
						}
						TerraCustomUtils.findBackgrounds(3, Main.setting.SnowStyle);
						main.LoadBackground(Main.treeMntBG[0] = Main.snowMntBG[0]);
						main.LoadBackground(Main.treeMntBG[1] = Main.snowMntBG[1]);
						main.LoadBackground(Main.treeBG[0] = Main.snowBG[0]);
						main.LoadBackground(Main.treeBG[1] = Main.snowBG[1]);
						main.LoadBackground(Main.treeBG[2] = Main.snowBG[2]);
					}
					num50++;
					if (Main.setting.HallowStyle == 2)
					{
						clickableLabelText[num50] = "Hallow Background: Random";
					}
					else
					{
						clickableLabelText[num50] = "Hallow Background: " + (Main.setting.HallowStyle + 1);
					}
					if (main.selectedMenu == num50)
					{
						if (Main.setting.HallowStyle == 2)
						{
							Main.setting.HallowStyle = 0;
						}
						else
						{
							Main.setting.HallowStyle++;
						}
						TerraCustomUtils.findBackgrounds(4, Main.setting.HallowStyle);
						main.LoadBackground(Main.treeMntBG[0]);
						main.LoadBackground(Main.treeMntBG[1]);
						main.LoadBackground(Main.treeBG[0] = Main.hallowBG[0]);
						main.LoadBackground(Main.treeBG[1] = Main.hallowBG[1]);
						main.LoadBackground(Main.treeBG[2] = Main.hallowBG[2]);
					}
					if (main.selectedMenu2 == num50)
					{
						if (Main.setting.HallowStyle == 0)
						{
							Main.setting.HallowStyle = 2;
						}
						else
						{
							Main.setting.HallowStyle--;
						}
						TerraCustomUtils.findBackgrounds(4, Main.setting.HallowStyle);
						main.LoadBackground(Main.treeMntBG[0]);
						main.LoadBackground(Main.treeMntBG[1]);
						main.LoadBackground(Main.treeBG[0] = Main.hallowBG[0]);
						main.LoadBackground(Main.treeBG[1] = Main.hallowBG[1]);
						main.LoadBackground(Main.treeBG[2] = Main.hallowBG[2]);
					}
					num50++;
					if (Main.setting.CrimsonStyle == 3)
					{
						clickableLabelText[num50] = "Crimson Background: Random";
					}
					else
					{
						clickableLabelText[num50] = "Crimson Background: " + (Main.setting.CrimsonStyle + 1);
					}
					if (main.selectedMenu == num50)
					{
						if (Main.setting.CrimsonStyle == 3)
						{
							Main.setting.CrimsonStyle = 0;
						}
						else
						{
							Main.setting.CrimsonStyle++;
						}
						TerraCustomUtils.findBackgrounds(5, Main.setting.CrimsonStyle);
						main.LoadBackground(Main.treeMntBG[0]);
						main.LoadBackground(Main.treeMntBG[1]);
						main.LoadBackground(Main.treeBG[0] = Main.crimsonBG[0]);
						main.LoadBackground(Main.treeBG[1] = Main.crimsonBG[1]);
						main.LoadBackground(Main.treeBG[2] = Main.crimsonBG[2]);
					}
					if (main.selectedMenu2 == num50)
					{
						if (Main.setting.CrimsonStyle == 0)
						{
							Main.setting.CrimsonStyle = 3;
						}
						else
						{
							Main.setting.CrimsonStyle--;
						}
						TerraCustomUtils.findBackgrounds(5, Main.setting.CrimsonStyle);
						main.LoadBackground(Main.treeMntBG[0]);
						main.LoadBackground(Main.treeMntBG[1]);
						main.LoadBackground(Main.treeBG[0] = Main.crimsonBG[0]);
						main.LoadBackground(Main.treeBG[1] = Main.crimsonBG[1]);
						main.LoadBackground(Main.treeBG[2] = Main.crimsonBG[2]);
					}
					num50++;
					if (Main.setting.DesertStyle == 2)
					{
						clickableLabelText[num50] = "Desert Background: Random";
					}
					else
					{
						clickableLabelText[num50] = "Desert Background: " + (Main.setting.DesertStyle + 1);
					}
					if (main.selectedMenu == num50)
					{
						if (Main.setting.DesertStyle == 2)
						{
							Main.setting.DesertStyle = 0;
						}
						else
						{
							Main.setting.DesertStyle++;
						}
						TerraCustomUtils.findBackgrounds(6, Main.setting.DesertStyle);

						main.LoadBackground(Main.treeMntBG[0]);
						main.LoadBackground(Main.treeMntBG[1]);
						main.LoadBackground(Main.treeBG[0] = Main.desertBG[0]);
						main.LoadBackground(Main.treeBG[1] = Main.desertBG[1]);
						main.LoadBackground(Main.treeBG[2] = -1);
					}
					if (main.selectedMenu2 == num50)
					{
						if (Main.setting.DesertStyle == 0)
						{
							Main.setting.DesertStyle = 2;
						}
						else
						{
							Main.setting.DesertStyle--;
						}
						TerraCustomUtils.findBackgrounds(6, Main.setting.DesertStyle);

						main.LoadBackground(Main.treeMntBG[0]);
						main.LoadBackground(Main.treeMntBG[1]);
						main.LoadBackground(Main.treeBG[0] = Main.desertBG[0]);
						main.LoadBackground(Main.treeBG[1] = Main.desertBG[1]);
						main.LoadBackground(Main.treeBG[2] = -1);
					}
					num50++;
					if (Main.setting.OceanStyle == 3)
					{
						clickableLabelText[num50] = "Ocean Background: Random";
					}
					else
					{
						clickableLabelText[num50] = "Ocean Background: " + (Main.setting.OceanStyle + 1);
					}
					if (main.selectedMenu == num50)
					{
						if (Main.setting.OceanStyle == 3)
						{
							Main.setting.OceanStyle = 0;
						}
						else
						{
							Main.setting.OceanStyle++;
						}
						TerraCustomUtils.findBackgrounds(7, Main.setting.OceanStyle);
						main.LoadBackground(Main.treeMntBG[0] = Main.oceanBG);
						main.LoadBackground(Main.treeMntBG[1] = -1);
						main.LoadBackground(Main.treeBG[0] = -1);
						main.LoadBackground(Main.treeBG[1] = -1);
						main.LoadBackground(Main.treeBG[2] = -1);
					}
					if (main.selectedMenu2 == num50)
					{
						if (Main.setting.OceanStyle == 0)
						{
							Main.setting.OceanStyle = 3;
						}
						else
						{
							Main.setting.OceanStyle--;
						}
						TerraCustomUtils.findBackgrounds(7, Main.setting.OceanStyle);
						main.LoadBackground(Main.treeMntBG[0] = Main.oceanBG);
						main.LoadBackground(Main.treeMntBG[1] = -1);
						main.LoadBackground(Main.treeBG[0] = -1);
						main.LoadBackground(Main.treeBG[1] = -1);
						main.LoadBackground(Main.treeBG[2] = -1);
					}
					num50++;
					array4[num50] = 10;
					clickableLabelText[num50] = Lang.menu[5];
					if (main.selectedMenu == num50)
					{
						Main.menuMode = (int)MenuModes.Backgrounds;
					}
				}

				//flag2 = true;
				//num = 240;
				//num3 = 60;
				//num4 = 3;
				//array9[0] = "";
				//array9[1] = Lang.menu[65];
				//array[1] = true;
				//array4[2] = 170;
				//array4[1] = 10;
				//array9[2] = Lang.menu[5];
				//if (main.selectedMenu == 2)
				//{
				//    Main.menuMode = 11;
				//    Main.PlaySound(11, -1, -1, 1);
				//}
			}
			else if (Main.menuMode == (int)MenuModes.OreAmount)
			{
				GenericMenu(main, OreAmountMenuItems, array, clickableLabelText, clickableLabelScale, array4, ref num, ref defaultLabelSpacing, ref numberClickableLabels);
			}
			else if (Main.menuMode == (int)MenuModes.ChooseWorldSize)
			{
				num = 170;
				defaultLabelSpacing = 55;
				array4[1] = 20;
				array4[2] = 20;
				array4[3] = 20;
				array4[4] = 20;
				//array4[5] = 20;
				array4[5] = 20;
				array4[6] = 60;
				clickableLabelText[0] = Lang.menu[91];
				array[0] = true;
				clickableLabelText[1] = Lang.menu[92];
				clickableLabelText[2] = Lang.menu[93];
				clickableLabelText[3] = Lang.menu[94];
				//	clickableLabelText[4] = Lang.menu[5];
				clickableLabelText[4] = "Keep Previous Custom Size";
				clickableLabelText[5] = "Load Autosaved Config";
				clickableLabelText[6] = Lang.menu[15];
				numberClickableLabels = 7;
				if (main.selectedMenu == 6)
				{
					main.QuitGame();
				}
				else if (main.selectedMenu == 5)
				{
					if (Main.settingSaver.settingExists("Autosave-LastUsed"))
					{
						Main.settingSaver.loadSetting("Autosave-LastUsed");
						if (Main.maxTilesX <= 4200)
						{
							WorldGen.worldSize = 0;
						}
						else if (Main.maxTilesX <= 6400)
						{
							WorldGen.worldSize = 1;
						}
						else// (Main.maxTilesX <= 8400)
						{
							WorldGen.worldSize = 2;
						}
						Main.clrInput();
						Main.menuMode = (int)MenuModes.EnterWorldName;
						WorldGen.setWorldSize();
					}
				}
				else if (main.selectedMenu > 0)
				{
					if (main.selectedMenu == 1)
					{
						Main.maxTilesX = /*8400;// */4200;
						Main.maxTilesY = /*600;//*/1200;
						WorldGen.worldSize = 0;
					}
					else if (main.selectedMenu == 2)
					{
						Main.maxTilesX = 6400;
						Main.maxTilesY = 1800;
						WorldGen.worldSize = 1;
					}
					else if (main.selectedMenu == 3)
					{
						Main.maxTilesX = 8400;
						Main.maxTilesY = 2400;
						WorldGen.worldSize = 2;
					}
					else if (main.selectedMenu == 4)
					{
						if (Main.maxTilesX == 8401)
						{
							Main.maxTilesX = 4200;
							Main.maxTilesY = 1200;
							WorldGen.worldSize = 0;
						}
					}
					Main.clrInput();
					Main.menuMode = (int)MenuModes.SelectDifficulty;
					WorldGen.setWorldSize();
				}
			}
			else if (Main.menuMode == (int)MenuModes.SettingsView)
			{
				Main.MenuUI.SetState(settingsViewMenu);
				Main.menuMode = 888;
			}
		}
示例#2
0
		private static void PreviewDrawAll(Main main, int[] v)
		{
			for (int i = 0; i < v.GetLength(0); i++)
			{
				main.LoadBackground(v[i]);
				PreviewDraw(Main.backgroundTexture[v[i]], i);
			}
		}