Ejemplo n.º 1
0
        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));
                }
            });
        }
        void OnGUI()
        {
            if (!IsReady())
            {
                EditorGUILayout.HelpBox("DaggerfallUnity instance not ready. Have you set your Arena2 path?", MessageType.Info);
                return;
            }

            currentSaveTree = saveTrees[selectedSave];
            if (currentSaveTree == null)
            {
                return;
            }

            if (saveTrees != null && saveTrees.Length > 0)
            {
                DisplaySaveSelectGUI();
                DisplaySaveImageGUI();
                DisplaySaveStatsGUI();
                DisplaySaveCharacterGUI();

                EditorGUILayout.Space();
                EditorGUILayout.HelpBox("Temporarily Filtering out records of type UnknownTownLink and UnknownItemRecord to keep list manageable.", MessageType.Info);
                scrollPos = GUILayoutHelper.ScrollView(scrollPos, () =>
                {
                    DisplaySaveTree(currentSaveTree.RootRecord);
                });
            }
        }
Ejemplo n.º 3
0
        void OnGUI()
        {
            if (!IsReady())
            {
                EditorGUILayout.HelpBox("DaggerfallUnity instance not ready. Have you set your Arena2 path?", MessageType.Info);
                return;
            }

            // Select class source
            EditorGUILayout.Space();
            careerSource = (CareerSource)EditorGUILayout.EnumPopup(new GUIContent("Source"), (CareerSource)careerSource);

            // Select class from specified source
            selectedCareer = null;
            if (careerSource == CareerSource.PlayerClasses && classNames != null && classNames.Length > 0)
            {
                if (selectedTemplate > classNames.Length)
                {
                    selectedTemplate = 0;
                }
                selectedTemplate = EditorGUILayout.Popup(new GUIContent("Class"), selectedTemplate, classNames);
                selectedCareer   = classTemplates[selectedTemplate];
            }
            else if (careerSource == CareerSource.Monsters && monsterNames != null && monsterNames.Length > 0)
            {
                if (selectedTemplate > monsterNames.Length)
                {
                    selectedTemplate = 0;
                }
                selectedTemplate = EditorGUILayout.Popup(new GUIContent("Class"), selectedTemplate, monsterNames);
                selectedCareer   = monsterTemplates[selectedTemplate];
            }
            else
            {
                return;
            }

            // Show foldouts
            if (selectedCareer != null)
            {
                scrollPos = GUILayoutHelper.ScrollView(scrollPos, () =>
                {
                    ShowAdvancementGUI();
                    ShowAttributesGUI();
                    ShowSecondaryAttributesGUI();
                    ShowSkillsGUI();
                    ShowTolerancesGUI();
                    ShowProficienciesGUI();
                    ShowForbiddenMaterialsGUI();
                    ShowForbiddenArmorGUI();
                    ShowForbiddenShieldsGUI();
                    ShowMagickaGUI();
                    ShowMiscellaneousGUI();
                    //ShowUnknownGUI();
                });
            }
        }
        void OnGUI()
        {
            if (!IsReady())
            {
                EditorGUILayout.HelpBox("DaggerfallUnity instance not ready. Have you set your Arena2 path?", MessageType.Info);
                return;
            }

            if (selectedSave != lastSelectedSave || currentSaveTree == null)
            {
                currentSaveTree = saveTrees[selectedSave];
                currentSaveVars = saveVars[selectedSave];
                if (currentSaveTree == null || currentSaveVars == null)
                {
                    return;
                }

                currentItems = currentSaveTree.FindRecords(RecordTypes.Item).ToArray();

                // Merge savetree faction data
                factionDict = factionFile.Merge(currentSaveVars);

                lastSelectedSave = selectedSave;
            }

            if (saveTrees != null && saveTrees.Length > 0)
            {
                DisplaySaveSelectGUI();
                DisplaySaveImageGUI();
                DisplaySaveStatsGUI();
                DisplaySaveCharacterGUI();

                scrollPos = GUILayoutHelper.ScrollView(scrollPos, () =>
                {
                    EditorGUILayout.Space();
                    showFactionsFoldout = GUILayoutHelper.Foldout(showFactionsFoldout, new GUIContent("Factions"), () =>
                    {
                        GUILayoutHelper.Indent(() =>
                        {
                            DisplayFactionsFoldout();
                        });
                    });

                    EditorGUILayout.Space();
                    showItemsFoldout = GUILayoutHelper.Foldout(showItemsFoldout, new GUIContent("Items"), () =>
                    {
                        GUILayoutHelper.Indent(() =>
                        {
                            DisplayItemsFoldout();
                        });
                    });

                    EditorGUILayout.Space();
                    showSaveTreeFoldout = GUILayoutHelper.Foldout(showSaveTreeFoldout, new GUIContent("SaveTree"), () =>
                    {
                        EditorGUILayout.HelpBox("Temporarily Filtering out records of type Door and UnknownItemRecord to keep list manageable.", MessageType.Info);

                        DisplaySaveTree(currentSaveTree.RootRecord);
                    });
                });
            }
        }
        void OnGUI()
        {
            if (!IsReady())
            {
                EditorGUILayout.HelpBox("DaggerfallUnity instance not ready. Have you set your Arena2 path?", MessageType.Info);
                return;
            }

            EditorGUILayout.Space();
            selectedRegion = EditorGUILayout.Popup(selectedRegion, regionNames);
            if (selectedRegion != lastSelectedRegion)
            {
                locationNames.Clear();
                ReloadCurrentRegion();
            }

            // Search bar
            GUILayout.BeginHorizontal(GUI.skin.FindStyle("Toolbar"));
            searchString = GUILayout.TextField(searchString, GUI.skin.FindStyle("ToolbarSeachTextField"));
            if (GUILayout.Button("", GUI.skin.FindStyle("ToolbarSeachCancelButton")))
            {
                // Remove focus if cleared
                searchString = "";
                GUI.FocusControl(null);
            }
            GUILayout.EndHorizontal();

            bool search = false;

            if (string.IsNullOrEmpty(searchString))
            {
                if (locationNames.Count == regionData.LocationCount)
                {
                    locationNames.Clear();
                }

                GUILayoutHelper.Horizontal(() =>
                {
                    if (GUILayout.Button("Cities"))
                    {
                        EnumerateLocationsByType(SearchPatterns.Cities);
                    }
                    if (GUILayout.Button("Dungeons"))
                    {
                        EnumerateLocationsByType(SearchPatterns.Dungeons);
                    }
                    if (GUILayout.Button("Graveyards"))
                    {
                        EnumerateLocationsByType(SearchPatterns.Graveyards);
                    }
                    if (GUILayout.Button("Homes"))
                    {
                        EnumerateLocationsByType(SearchPatterns.Homes);
                    }
                    if (GUILayout.Button("Taverns"))
                    {
                        EnumerateLocationsByType(SearchPatterns.Taverns);
                    }
                    if (GUILayout.Button("Temples"))
                    {
                        EnumerateLocationsByType(SearchPatterns.Temples);
                    }
                });
            }
            else
            {
                if (locationNames.Count != regionData.LocationCount)
                {
                    EnumerateLocationsByType(SearchPatterns.All);
                }
                search = true;
            }

            int    totalLocations = 0;
            string regionSlash    = regionNames[selectedRegion] + "/";

            scrollPos = GUILayoutHelper.ScrollView(scrollPos, () =>
            {
                for (int i = 0; i < locationNames.Count; i++)
                {
                    string multiName = regionSlash + locationNames[i];
                    if (search)
                    {
                        int index = locationNames[i].IndexOf(searchString, StringComparison.InvariantCultureIgnoreCase);
                        if (index != -1)
                        {
                            ShowLocationItem(multiName);
                            totalLocations++;
                        }
                    }
                    else
                    {
                        ShowLocationItem(multiName);
                        totalLocations++;
                    }
                }
            });

            EditorGUILayout.LabelField("Total locations found: " + totalLocations);
        }