void OnGUI() { if (!IsReady()) { EditorGUILayout.HelpBox("DaggerfallUnity instance not ready. Have you set your Arena2 path?", MessageType.Info); return; } EditorGUILayout.Space(); bankType = (NameHelper.BankTypes)EditorGUILayout.EnumPopup(new GUIContent("Type"), bankType); gender = (Genders)EditorGUILayout.EnumPopup(new GUIContent("Gender"), gender); seed = EditorGUILayout.IntField(new GUIContent("Seed"), seed); count = EditorGUILayout.IntField(new GUIContent("Count"), count); if (GUILayout.Button("Generate Names")) { if (seed != -1) { DFRandom.srand(seed); } generatedNames.Clear(); for (int i = 0; i < count; i++) { generatedNames.Add(nameHelper.FullName(bankType, gender)); } } scrollPos = GUILayoutHelper.ScrollView(scrollPos, () => { for (int i = 0; i < generatedNames.Count; i++) { EditorGUILayout.SelectableLabel(generatedNames[i], EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); } }); }
public static int[] RandomTextureTableClassic(int seed, int randomDungeonTextures = 0) { byte[] climateTextureArchiveIndices = { 0, 0, 1, 4, 4, 0, 3, 3, 3, 0 }; short[] climateTextureArchives; if (randomDungeonTextures == 0) { climateTextureArchives = new short[] { 19, 119, 319, 419, 119 } } ; // Values from classic, used in classic algorithm else { climateTextureArchives = new short[] { 19, 119, 119, 319, 419 } }; // Values for climate-based algorithm. Index 2 (unused) is a dummy value. int climate = Game.GameManager.Instance.PlayerGPS.CurrentClimateIndex; if (climate == (int)MapsFile.Climates.Ocean) { climate = (int)MapsFile.Climates.Swamp; } int classicIndexValue = Game.Utility.TravelTimeCalculator.climateIndices[climate - (int)MapsFile.Climates.Ocean]; int climateBasedIndexValue = climate - (int)MapsFile.Climates.Desert; int climateTextureArchiveIndex; if (randomDungeonTextures == 0) // classic algorithm { climateTextureArchiveIndex = climateTextureArchiveIndices[classicIndexValue]; } else // climate-based algorithm { climateTextureArchiveIndex = climateTextureArchiveIndices[climateBasedIndexValue]; } int textureArchiveOffset; DFRandom.srand(seed); int[] textureTable = new int[TableLength]; // In classic, if climateTextureArchiveIndex is 1 here (only happens with rainforest climate), the following loop is skipped and // a dungeon in that climate will have the texture table of the last visited dungeon or, if no dungeons // had been visited since starting the program, the default dungeon textures. This seems like it must just be a bug, so the // recreation of the classic algorithm here assigns textures even if climateTextureArchiveIndex is 1. for (int i = 0; i < 5; ++i) { textureArchiveOffset = DFRandom.random_range_inclusive(0, 4); if (textureArchiveOffset == 2) // invalid { textureArchiveOffset = 4; } textureTable[i] = climateTextureArchives[climateTextureArchiveIndex] + textureArchiveOffset; } textureTable[5] = (int)DFLocation.ClimateTextureSet.Interior_Sewer + 100 * climateTextureArchiveIndices[climateBasedIndexValue]; return(textureTable); }