예제 #1
0
        public void DrawLuaScript(string filePath)
        {
            FindLuaTableInfo(filePath);
            // 以上是初始化环节
            var luaName = filePath.Substring(filePath.LastIndexOf("/") + 1, filePath.Length - filePath.LastIndexOf("/") - 1).Replace(".lua", "");

            GL.BeginVertical("OL box");
            GL.Label(luaName, EditorStyles.boldLabel);
            if (mExecuteFunctionDirt == null || mExecuteFunctionDirt.Count() < 1)
            {
                EGL.HelpBox("没有可以被执行的方法", MessageType.Warning);
            }
            else
            {
                foreach (var m in mExecuteFunctionDirt)
                {
                    GL.BeginHorizontal("box");
                    var methodName = string.Format("{0}:{1}", luaName, m.Key);
                    GL.Label(methodName);
                    if (GL.Button("Execute", GUILayout.Width(100)))
                    {
                        UnityEngine.Debug.LogFormat("<color=#FFA80B>Execute {0}:{1}</color>", luaName, m.Key);
                        m.Value.Invoke();
                    }
                    GL.EndHorizontal();
                    GL.Space(2);
                }
            }
            GL.EndVertical();
        }
예제 #2
0
        private void DrawAssurer(VAssetManager Manager)
        {
            GL.BeginVertical("OL box");
            GL.Label(Manager.ManagerName);
            var list = Manager.GetAssurerList();

            if (list.Count == 0)
            {
                EGL.HelpBox("暂无资产", MessageType.Info);
            }
            else
            {
                list.ForEach(assurer =>
                {
                    GL.BeginVertical("GroupBox");
                    GL.BeginHorizontal();
                    GL.Label(String.Format("{0} : Ref {1}", assurer.Value.AssetPath, assurer.Value.UseCount));
                    if (GL.Button("Kill", GUILayout.Width(100)))
                    {
                        assurer.Value.ForceRecycle();
                    }
                    GL.EndHorizontal();
                    GL.EndVertical();
                    GL.Space(2);
                });
            }



            GL.EndVertical();
        }
예제 #3
0
        private void DrawDatas()
        {
            var packages = BaseData["Packages"];

            if (packages.Count > 0)
            {
                for (int i = 0; i < packages.Count; i++)
                {
                    var value = packages[i];
                    GL.BeginVertical("OL box");
                    GL.BeginHorizontal("box");
                    GL.Label(value["name"].ToString());
                    GL.Label(value["version"].ToString());

                    if (Directory.Exists(value["localpath"].ToString()))
                    {
                        if (GL.Button("pack", GUILayout.Width(100)))
                        {
                            Export(value["name"].ToString(), value["localpath"].ToString());
                        }
                    }
                    else if (ExistsLocalPackage(value["name"].ToString()))
                    {
                        if (GL.Button("Import", GUILayout.Width(100)))
                        {
                        }
                    }
                    GL.EndHorizontal();
                    GL.EndVertical();
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Draws a dummy GUI layout element and measures its rect.
        /// If the current event is not the repaint event, then use the backup rect reference.
        /// </summary>
        public static U.Rect FindLayoutAreaRect(ref U.Rect backupRect, int border = 0)
        {
            //DRAW DUMMY LAYOUT GROUP TO GET THE RECT FROM
            Gl.BeginVertical(Gl.MaxWidth(U.Screen.width), Gl.MaxHeight(U.Screen.height));
            Gl.Label("");             //<- layout dummy
            Gl.EndVertical();
            U.Rect _fieldRect = U.GUILayoutUtility.GetLastRect();

            //rect update handling (ignore dummy rect at layout event)
            if (U.Event.current.type != U.EventType.Repaint)
            {
                _fieldRect = backupRect;
            }
            else
            {
                backupRect = _fieldRect;
            }

            _fieldRect.x      += border;
            _fieldRect.y      += border;
            _fieldRect.width  -= border * 2;
            _fieldRect.height -= border * 2;

            return(_fieldRect);
        }
예제 #5
0
        /// <summary>
        /// Open auto property drawer indent
        /// </summary>
        private static void OpenIndent(int depth)
        {
            Gl.BeginHorizontal();
            for (int i = 0; i < depth; i++)
            {
                Gl.Space(8);
            }

            Gl.BeginVertical();
        }
예제 #6
0
        private void DrawScript(Type t)
        {
            var att = t.RTGetAttribute <QuickExecuteAttribute>(false);

            if (att == null)
            {
                return;
            }
            GL.BeginVertical("OL box");
            GL.Label(t.Name, EditorStyles.boldLabel);
            var methods = t.GetMethods().Where((i) => { return(i.RTGetAttribute <ExecuteMethodAttribute>(false) != null); });

            if (methods.Count() < 1)
            {
                EGL.HelpBox("没有可以被执行的方法(请检查是否添加了[ExecuteMethodAttribute])", MessageType.Warning);
            }
            else
            {
                foreach (var m in methods)
                {
                    GL.Space(2);
                    GL.BeginHorizontal();
                    var methodName = m.Name + ":(";
                    var param      = m.GetParameters();
                    for (int i = 0; i < param.Length; i++)
                    {
                        var p = param[i];
                        if (i != param.Length - 1)
                        {
                            methodName += string.Format("<b>{0}</b> , ", p.ToString());
                        }
                        else
                        {
                            methodName += string.Format("<b>{0}</b>", p.ToString());
                        }
                    }
                    methodName += ")";
                    GL.Label(methodName);
                    if (GL.Button("Execute", GUILayout.Width(100)))
                    {
                        var o = ReflectionTools.CreateObject(t);
                        //TODO 扩展编辑参数
                        if (param.Length == 0)
                        {
                            m.Invoke(o, null);
                        }
                        Log.I(string.Format("<color=#FFA80B>Execute {0}</color>", methodName));
                    }
                    GL.EndHorizontal();
                    GL.Space(2);
                }
            }
            GL.EndVertical();
        }
예제 #7
0
        private void OnGUI()
        {
            GUI.skin.label.richText = true;

            if (GL.Button("Search Can Execute Script"))
            {
                searchScript = true;
                DoSearch();
            }
            if (searchScript == true)
            {
                DrawSearchResult();
            }
            if (focusFileName.IsNullOrEmpty())
            {
                DrawDragSpace();
            }
            else
            {
                GL.Space(5);
                GL.BeginVertical("box");
                GL.Label(string.Format("FocusFileName : {0}", focusFileName), EditorStyles.boldLabel);
                GL.Label(string.Format("FocusFileType : {0}", focusFileType.ToString()), EditorStyles.boldLabel);
                GL.Label(string.Format("FocusFilePath : {0}", focusFilePath), EditorStyles.boldLabel);
                focusFileRect = GL.BeginScrollView(focusFileRect, "box");
                if (focusFileType == QEType.CSharp)
                {
                    DrawScript(GetFocusFileType(focusFileName));
                }
                if (focusFileType == QEType.Lua)
                {
                                        #if LUA_KIT
                    luaVeiwer.DrawLuaScript(focusFilePath);
                                        #else
                    EGL.HelpBox("没有LUA_KIT环境,请查看说明", MessageType.Warning);
                                        #endif
                }
                if (GL.Button("ClearFocus"))
                {
                    ClearFocusFile();
                }
                GL.EndScrollView();
                GL.EndVertical();
            }
        }
예제 #8
0
        public static void TabBar(ref int selected, Action header = null, params NamedAction[] actions)
        {
            if (selected >= actions.Count())
            {
                selected = 0;
            }
            int sel    = selected;
            var titles = actions.Select((a, i) => i == sel ? a.name.orange().bold() : a.name);

            selected = GL.Toolbar(selected, titles.ToArray());
            GL.BeginVertical("box");
            if (header != null)
            {
                header();
            }
            actions[selected].action();
            GL.EndVertical();
        }
예제 #9
0
        static void OnGUI(UnityModManager.ModEntry modEntry)
        {
            if (!enabled)
            {
                return;
            }

            GL.BeginVertical("box");

            if (testedGameVersion != GameVersion.GetVersion())
            {
                SingleLineLabel(string.Format(RES.testedGameVersion_warning, testedGameVersion, GameVersion.GetVersion()));
            }
            if (failedPatches.Count > 0)
            {
                SingleLineLabel(RES.failedPatches_error);
                foreach (var featureName in failedPatches)
                {
                    SingleLineLabel(string.Format(RES.featureName_error, featureName));
                }
            }
            if (failedLoading.Count > 0)
            {
                SingleLineLabel(RES.failedLoading_error);
                foreach (var featureName in failedLoading)
                {
                    SingleLineLabel(string.Format(RES.featureName_error, featureName));
                }
            }

            SingleLineToggle(ref settings.EldritchKnightFix, RES.EldritchKnightFix_info, RES.EldritchKnightFix_tip);
            SingleLineToggle(ref settings.DrawbackForextraTraits, RES.DrawbackForextraTraits_info);
            SingleLineToggle(ref settings.OracleHas3SkillPoints, RES.OracleHas3SkillPoints_info);
            OracleClass.MaybeUpdateSkillPoints();
            SingleLineToggle(ref settings.RelaxAncientLorekeeper, RES.RelaxAncientLorekeeper_info);
            SingleLineToggle(ref settings.RelaxTonguesCurse, RES.RelaxTonguesCurse_info, RES.RelaxTonguesCurse_tip);
            SingleLineToggle(ref settings.ShowCustomPortraits, RES.ShowCustomPortraits_info);
            SingleLineToggle(ref settings.CheatCustomTraits, RES.CheatCustomTraits_info);
            SingleLineToggle(ref settings.HighDCl, RES.HighDCl_info);

            GL.EndVertical();
            ShowTooltip();
        }
예제 #10
0
    void OnGUI()
    {
        // Settings
        bgColor = (Texture2D)Resources.Load("editorBgColor");
        GUI.DrawTexture(new Rect(0, 0, maxSize.x, maxSize.y), bgColor, ScaleMode.StretchToFill);
        GUI.skin = editorSkin;
        GL.Label(GDbanner);
        scrollPosition = GL.BeginScrollView(scrollPosition);

        #region Other Options
        // Start Block
        blockHeader("Other Options", "AdMob, Google Play Services and etc. options.", 0);

        GL.BeginVertical("GroupBox");

        //Admob
        if (GUILayout.Button("Download Admob SDK"))
        {
            Application.OpenURL("https://github.com/googleads/googleads-mobile-unity/releases");
        }
        GL.Label("AdMob Options", EditorStyles.boldLabel);
        vars.admobActive = EGL.Toggle("Use Admob Ads", vars.admobActive, "Toggle");
        if (vars.admobActive)
        {
            AssetDefineManager.AddCompileDefine("AdmobDef",
                                                new BuildTargetGroup[] { BuildTargetGroup.Android, BuildTargetGroup.iOS });

            //Banner
            vars.adMobBannerID = EGL.TextField("AdMob Banner ID", vars.adMobBannerID);
            GL.BeginHorizontal();
            GL.Label("Banner Position");
            vars.bannerAdPoisiton = GL.SelectionGrid(vars.bannerAdPoisiton, bannerPositionTexts, 3, "Radio");
            GL.EndHorizontal();
            separator();

            //Interstitial
            vars.adMobInterstitialID = EGL.TextField("AdMob Interstitial ID", vars.adMobInterstitialID);
            GL.BeginHorizontal();
            GL.Label("Show Interstitial After Death Times");
            vars.showInterstitialAfter = EGL.IntSlider(vars.showInterstitialAfter, 1, 25);
            GL.EndHorizontal();
        }
        else if (!vars.admobActive)
        {
            AssetDefineManager.RemoveCompileDefine("AdmobDef",
                                                   new BuildTargetGroup[] { BuildTargetGroup.Android, BuildTargetGroup.iOS });
        }
        separator();

        //Google Play Service
        if (GUILayout.Button("Download Google Play SDK"))
        {
            Application.OpenURL("https://github.com/playgameservices/play-games-plugin-for-unity");
        }
        GL.Label("Google Play Or Game Center", EditorStyles.boldLabel);
        vars.googlePlayActive = EGL.Toggle("Use Leaderboard", vars.googlePlayActive, "Toggle");

        if (vars.googlePlayActive)
        {
#if UNITY_ANDROID
            AssetDefineManager.AddCompileDefine("GooglePlayDef",
                                                new BuildTargetGroup[] { BuildTargetGroup.Android });
#endif

            vars.leaderBoardID = EGL.TextField("Leaderboard ID", vars.leaderBoardID);
        }
        else if (!vars.googlePlayActive)
        {
#if UNITY_ANDROID
            AssetDefineManager.RemoveCompileDefine("GooglePlayDef",
                                                   new BuildTargetGroup[] { BuildTargetGroup.Android });
#endif
        }

        separator();

        EditorUtility.SetDirty(vars);
        GL.EndVertical();

        GL.EndVertical();
        // End Block
        #endregion

        GL.EndScrollView();
        EditorUtility.SetDirty(vars);
    }
예제 #11
0
 void BV()
 {
     GL.BeginVertical();
 }
예제 #12
0
 void BVS(string style)
 {
     GL.BeginVertical(style);
 }
예제 #13
0
    void OnGUI()
    {
        // Settings
        bgColor = (Texture2D)Resources.Load("editorBgColor");
        GUI.DrawTexture(new Rect(0, 0, maxSize.x, maxSize.y), bgColor, ScaleMode.StretchToFill);
        GUI.skin = editorSkin;
        GL.Label(GDbanner);
        scrollPosition = GL.BeginScrollView(scrollPosition);

        #region UI Options
        blockHeader("UI Options", "All UI options.", 0);
        if (toggles[0])
        {
            buttons[0] = "Close";
            BVS("GroupBox"); //0

            // Content Start
            GL.Label("UI Images", "centerBoldLabel");
            GL.Space(10);

            BV(); //1

            BH();
            vars.buttonGui       = (Sprite)EGL.ObjectField("Button GUI", vars.buttonGui, typeof(Sprite), false);
            vars.leaderboardIcon = (Sprite)EGL.ObjectField("Leaderboard Icon", vars.leaderboardIcon, typeof(Sprite), false);
            EH();

            BH();
            vars.rateIcon     = (Sprite)EGL.ObjectField("Rate Icon", vars.rateIcon, typeof(Sprite), false);
            vars.facebookIcon = (Sprite)EGL.ObjectField("Facebook Icon", vars.facebookIcon, typeof(Sprite), false);
            EH();

            BH();
            vars.soundOnIcon  = (Sprite)EGL.ObjectField("Sound On Icon", vars.soundOnIcon, typeof(Sprite), false);
            vars.soundOffIcon = (Sprite)EGL.ObjectField("Sound Off Icon", vars.soundOffIcon, typeof(Sprite), false);
            EH();

            BH();
            vars.playButton  = (Sprite)EGL.ObjectField("Play Button", vars.playButton, typeof(Sprite), false);
            vars.bronzeMedal = (Sprite)EGL.ObjectField("Bronze", vars.bronzeMedal, typeof(Sprite), false);
            EH();

            BH();
            vars.silverMedal = (Sprite)EGL.ObjectField("Silver", vars.silverMedal, typeof(Sprite), false);
            vars.GoldMedal   = (Sprite)EGL.ObjectField("Gold", vars.GoldMedal, typeof(Sprite), false);
            EH();

            EV(); //1

            separator();
            GL.Label("UI Texts", "centerBoldLabel");
            GL.Space(10);

            BVS("GroupBox"); //2
            GL.Label("Main Menu");
            vars.shareBtnText         = EGL.TextField("ShareText", vars.shareBtnText);
            vars.shareTextColor       = EGL.ColorField("ShareTextColor", vars.shareTextColor);
            vars.bestTextColor        = EGL.ColorField("BestTextColor", vars.bestTextColor);
            vars.scoreTextColor       = EGL.ColorField("ScoreTextColor", vars.scoreTextColor);
            vars.inGameScoreTextColor = EGL.ColorField("InGameScoreTextColor", vars.inGameScoreTextColor);
            vars.gameTitleText        = EGL.TextField("GameTitleText", vars.gameTitleText);
            vars.gameTitleColor       = EGL.ColorField("GameTitleColor", vars.gameTitleColor);
            EV(); //2

            separator();
            GL.Label("UI Fonts", "centerBoldLabel");
            GL.Space(10);
            vars.gameFont = EGL.ObjectField("Game Font", vars.gameFont, typeof(Font), false) as Font;

            // Content End
            EditorUtility.SetDirty(vars);
            EV(); //0
        }
        else
        {
            buttons[0] = "Open";
        }
        EV();
        #endregion

        #region Sound Options
        blockHeader("Sound Options", "Sound & Music options.", 1);
        if (toggles[1])
        {
            buttons[1] = "Close";
            BVS("GroupBox");
            // Content Start
            vars.buttonSound   = EGL.ObjectField("Button Sound", vars.buttonSound, typeof(AudioClip), false) as AudioClip;
            vars.jumpSound     = EGL.ObjectField("Jump Sound", vars.jumpSound, typeof(AudioClip), false) as AudioClip;
            vars.gameOverSound = EGL.ObjectField("GameOver Sound", vars.gameOverSound, typeof(AudioClip), false) as AudioClip;
            vars.hiScore       = EGL.ObjectField("HiScore Sound", vars.hiScore, typeof(AudioClip), false) as AudioClip;
            // Content End
            EditorUtility.SetDirty(vars);
            EV();
        }
        else
        {
            buttons[1] = "Open";
        }
        EV();
        // End Block
        #endregion

        #region Other Options
        // Start Block
        blockHeader("Other Options", "AdMob, Google Play Services and etc. options.", 2);
        if (toggles[2])
        {
            buttons[2] = "Close";
            GL.BeginVertical("GroupBox");

            //Admob
            GL.Label("AdMob Options", EditorStyles.boldLabel);

            //Banner
            vars.adMobBannerID = EGL.TextField("AdMob Banner ID", vars.adMobBannerID);
            GL.BeginHorizontal();
            GL.Label("Banner Position");
            vars.bannerAdPoisiton = GL.SelectionGrid(vars.bannerAdPoisiton, bannerPositionTexts, 3, "Radio");
            GL.EndHorizontal();
            separator();

            //Interstitial
            vars.adMobInterstitialID = EGL.TextField("AdMob Interstitial ID", vars.adMobInterstitialID);
            GL.BeginHorizontal();
            GL.Label("Show Interstitial After Death Times");
            vars.showInterstitialAfter = EGL.IntSlider(vars.showInterstitialAfter, 1, 25);
            GL.EndHorizontal();
            separator();

            //Google Play Service
            GL.Label("Google Play Or Game Center", EditorStyles.boldLabel);
            vars.leaderBoardID = EGL.TextField("Leaderboard ID", vars.leaderBoardID);
            separator();

            GL.Label("Other Options", EditorStyles.boldLabel);
            //Rate Url
            GL.BeginHorizontal();
            GL.Label("Rate Button Url", GL.Width(100f));
            vars.rateButtonUrl = EGL.TextArea(vars.rateButtonUrl, GL.Height(50f));
            GL.EndHorizontal();
            GL.Space(15f);
            //Facebook Url
            GL.BeginHorizontal();
            GL.Label("FB Page Url", GL.Width(100f));
            vars.facebookBtnUrl = EGL.TextArea(vars.facebookBtnUrl, GL.Height(50f));
            GL.EndHorizontal();
            GL.Space(15f);
            separator();

            EditorUtility.SetDirty(vars);
            GL.EndVertical();
        }
        else
        {
            buttons[2] = "Open";
        }
        GL.EndVertical();
        // End Block
        #endregion
        GL.EndScrollView();
        EditorUtility.SetDirty(vars);
        try
        {
            liveUpdate();
        }
        catch (Exception e) { }
    }
        public static void ItemTypesMenu()
        {
            showItemTypes = GL.Toggle(showItemTypes, RichText.Bold(Strings.GetText("toggle_ShowItemTypes")));
            if (showItemTypes)
            {
                GL.Space(10);
                itemTypesGrid.Render();
                GL.Space(10);
                if (selectedItemTypeOld != itemTypesGrid.selected)
                {
                    selectedItemTypeOld = itemTypesGrid.selected;
                    refreshItemTypes    = true;
                }
                switch (itemTypesGrid.selected)
                {
                case 0:
                    List <BlueprintArmorType> blueprintArmorTypes = ResourcesLibrary.GetBlueprints <BlueprintArmorType>().ToList();
                    if (refreshItemTypes)
                    {
                        itemTypeEdit.Clear();
                        foreach (BlueprintArmorType b in blueprintArmorTypes)
                        {
                            itemTypeEdit.Add(false);
                        }
                        refreshItemTypes = false;
                    }

                    for (int i = 0; i < blueprintArmorTypes.Count(); i++)
                    {
                        itemTypeEdit[i] = GL.Toggle(itemTypeEdit[i], blueprintArmorTypes[i].name);
                        if (itemTypeEdit[i])
                        {
                            GL.BeginVertical("box");

                            GL.BeginHorizontal();
                            GL.Label("m_ArcaneSpellFailureChance: " + blueprintArmorTypes[i].ArcaneSpellFailureChance.ToString());
                            itemTypesTextFieldInt.RenderFieldNoGroup();
                            SetModifiedValueButton <ModifiedArmourType>(itemTypesTextFieldInt.finalAmount, "m_ArcaneSpellFailureChance", blueprintArmorTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_ArmorBonus: " + blueprintArmorTypes[i].ArmorBonus.ToString());
                            itemTypesTextFieldInt.RenderFieldNoGroup();
                            SetModifiedValueButton <ModifiedArmourType>(itemTypesTextFieldInt.finalAmount, "m_ArmorBonus", blueprintArmorTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_ArmorChecksPenalty: " + blueprintArmorTypes[i].ArmorChecksPenalty.ToString());
                            itemTypesTextFieldInt.RenderFieldNoGroup();
                            SetModifiedValueButton <ModifiedArmourType>(itemTypesTextFieldInt.finalAmount, "m_ArmorChecksPenalty", blueprintArmorTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_HasDexterityBonusLimit: " + blueprintArmorTypes[i].HasDexterityBonusLimit.ToString());
                            SetModifiedValueButtonBool <ModifiedArmourType>("m_HasDexterityBonusLimit", blueprintArmorTypes[i].AssetGuid);
                            GL.EndHorizontal();


                            GL.BeginHorizontal();
                            GL.Label("m_MaxDexterityBonus: " + blueprintArmorTypes[i].MaxDexterityBonus.ToString());
                            itemTypesTextFieldInt.RenderFieldNoGroup();
                            SetModifiedValueButton <ModifiedArmourType>(itemTypesTextFieldInt.finalAmount, "m_MaxDexterityBonus", blueprintArmorTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_Weight: " + blueprintArmorTypes[i].Weight.ToString());
                            itemTypesTextFieldFloat.RenderFieldNoGroup();
                            SetModifiedValueButton <ModifiedArmourType>(itemTypesTextFieldFloat.finalAmount, "m_Weight", blueprintArmorTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.EndVertical();
                        }
                    }
                    break;

                case 1:
                    List <BlueprintShieldType> blueprintShieldTypes = ResourcesLibrary.GetBlueprints <BlueprintShieldType>().ToList();
                    if (refreshItemTypes)
                    {
                        itemTypeEdit.Clear();
                        foreach (BlueprintShieldType b in blueprintShieldTypes)
                        {
                            itemTypeEdit.Add(false);
                        }
                        refreshItemTypes = false;
                    }

                    for (int i = 0; i < blueprintShieldTypes.Count(); i++)
                    {
                        itemTypeEdit[i] = GL.Toggle(itemTypeEdit[i], blueprintShieldTypes[i].name);
                        if (itemTypeEdit[i])
                        {
                            GL.BeginVertical("box");

                            GL.BeginHorizontal();
                            GL.Label("m_ArcaneSpellFailureChance: " + blueprintShieldTypes[i].ArcaneSpellFailureChance.ToString());
                            itemTypesTextFieldInt.RenderFieldNoGroup();
                            SetModifiedValueButton <ModifiedArmourType>(itemTypesTextFieldInt.finalAmount, "m_ArcaneSpellFailureChance", blueprintShieldTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_ArmorBonus: " + blueprintShieldTypes[i].ArmorBonus.ToString());
                            itemTypesTextFieldInt.RenderFieldNoGroup();
                            SetModifiedValueButton <ModifiedArmourType>(itemTypesTextFieldInt.finalAmount, "m_ArmorBonus", blueprintShieldTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_ArmorChecksPenalty: " + blueprintShieldTypes[i].ArmorChecksPenalty.ToString());
                            itemTypesTextFieldInt.RenderFieldNoGroup();
                            SetModifiedValueButton <ModifiedArmourType>(itemTypesTextFieldInt.finalAmount, "m_ArmorChecksPenalty", blueprintShieldTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_HasDexterityBonusLimit: " + blueprintShieldTypes[i].HasDexterityBonusLimit.ToString());
                            SetModifiedValueButtonBool <ModifiedArmourType>("m_HasDexterityBonusLimit", blueprintShieldTypes[i].AssetGuid);
                            GL.EndHorizontal();


                            GL.BeginHorizontal();
                            GL.Label("m_MaxDexterityBonus: " + blueprintShieldTypes[i].MaxDexterityBonus.ToString());
                            itemTypesTextFieldInt.RenderFieldNoGroup();
                            SetModifiedValueButton <ModifiedArmourType>(itemTypesTextFieldInt.finalAmount, "m_MaxDexterityBonus", blueprintShieldTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_Weight: " + blueprintShieldTypes[i].Weight.ToString());
                            itemTypesTextFieldFloat.RenderFieldNoGroup();
                            SetModifiedValueButton <ModifiedArmourType>(itemTypesTextFieldFloat.finalAmount, "m_Weight", blueprintShieldTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.EndVertical();
                        }
                    }
                    break;

                case 2:
                    List <BlueprintWeaponType> blueprintWeaponTypes = ResourcesLibrary.GetBlueprints <BlueprintWeaponType>().ToList();
                    if (refreshItemTypes)
                    {
                        itemTypeEdit.Clear();
                        foreach (BlueprintWeaponType b in blueprintWeaponTypes)
                        {
                            itemTypeEdit.Add(false);
                        }
                        refreshItemTypes = false;
                    }

                    for (int i = 0; i < blueprintWeaponTypes.Count(); i++)
                    {
                        itemTypeEdit[i] = GL.Toggle(itemTypeEdit[i], blueprintWeaponTypes[i].name);
                        if (itemTypeEdit[i])
                        {
                            GL.BeginVertical("box");

                            GL.BeginHorizontal();
                            GL.Label("m_AttackType: " + blueprintWeaponTypes[i].AttackType.ToString());
                            SetModifiedValueButtonAttackType <ModifiedWeaponType>("m_AttackType", blueprintWeaponTypes[i].AssetGuid);
                            GL.EndHorizontal();


                            GL.BeginHorizontal();
                            GL.Label("m_AttackRange: " + Traverse.Create(blueprintWeaponTypes[i]).Field("m_AttackRange").GetValue().ToString());
                            itemTypesTextFieldInt.RenderFieldNoGroup();
                            SetModifiedValueButton <ModifiedWeaponType>(itemTypesTextFieldInt.finalAmount.Feet(), "m_AttackRange", blueprintWeaponTypes[i].AssetGuid);
                            GL.EndHorizontal();
                            MenuTools.SingleLineLabel("AttackRange = (m_AttackRange > 10) ? m_AttackRange : Math.Max(2, m_AttackRange - 4)");

                            GL.BeginVertical("box");
                            GL.BeginHorizontal();
                            GL.Label("m_BaseDamage: " + blueprintWeaponTypes[i].BaseDamage.ToString());
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            itemTypesTextFieldInt.RenderFieldNoGroup("misc_NumberOfRolls");
                            GL.EndHorizontal();

                            diceTypesGrid.Render();

                            GL.BeginHorizontal();
                            GL.FlexibleSpace();
                            SetModifiedValueButtonDiceFormula <ModifiedWeaponType>(itemTypesTextFieldInt.finalAmount, Common.IntToDiceType(diceTypesGrid.selected), "m_BaseDamage", blueprintWeaponTypes[i].AssetGuid);
                            GL.EndHorizontal();
                            GL.EndVertical();

                            GL.BeginHorizontal();
                            GL.Label("m_CriticalRollEdge: " + blueprintWeaponTypes[i].CriticalRollEdge.ToString());
                            itemTypesTextFieldInt.RenderFieldNoGroup();
                            SetModifiedValueButton <ModifiedWeaponType>(itemTypesTextFieldInt.finalAmount, "m_CriticalRollEdge", blueprintWeaponTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_CriticalModifier: " + blueprintWeaponTypes[i].CriticalModifier.ToString());
                            SetModifiedValueDamageCriticalModifierType <ModifiedWeaponType>("m_CriticalModifier", blueprintWeaponTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_Weight: " + blueprintWeaponTypes[i].Weight.ToString());
                            itemTypesTextFieldFloat.RenderFieldNoGroup();
                            SetModifiedValueButton <ModifiedWeaponType>(itemTypesTextFieldFloat.finalAmount, "m_Weight", blueprintWeaponTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_IsTwoHanded: " + blueprintWeaponTypes[i].IsTwoHanded.ToString());
                            SetModifiedValueButtonBool <ModifiedWeaponType>("m_IsTwoHanded", blueprintWeaponTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_IsLight: " + blueprintWeaponTypes[i].IsLight.ToString());
                            SetModifiedValueButtonBool <ModifiedWeaponType>("m_IsLight", blueprintWeaponTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_IsMonk: " + blueprintWeaponTypes[i].IsMonk.ToString());
                            SetModifiedValueButtonBool <ModifiedWeaponType>("m_IsMonk", blueprintWeaponTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_IsNatural: " + blueprintWeaponTypes[i].IsNatural.ToString());
                            SetModifiedValueButtonBool <ModifiedWeaponType>("m_IsNatural", blueprintWeaponTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_IsUnarmed: " + blueprintWeaponTypes[i].IsUnarmed.ToString());
                            SetModifiedValueButtonBool <ModifiedWeaponType>("m_IsUnarmed", blueprintWeaponTypes[i].AssetGuid);
                            GL.EndHorizontal();

                            GL.BeginHorizontal();
                            GL.Label("m_OverrideAttackBonusStat: " + Traverse.Create(blueprintWeaponTypes[i]).Field("m_OverrideAttackBonusStat").GetValue().ToString());
                            SetModifiedValueButtonBool <ModifiedWeaponType>("m_OverrideAttackBonusStat", blueprintWeaponTypes[i].AssetGuid);
                            GL.EndHorizontal();


                            GL.BeginVertical("box");
                            GL.BeginHorizontal();
                            GL.Label("m_AttackBonusStatOverride: " + Traverse.Create(blueprintWeaponTypes[i]).Field("m_AttackBonusStatOverride").GetValue().ToString());
                            GL.EndHorizontal();
                            SetModifiedValueStatType <ModifiedWeaponType>("m_AttackBonusStatOverride", blueprintWeaponTypes[i].AssetGuid);
                            GL.EndVertical();


                            GL.EndVertical();
                        }
                    }
                    break;
                }
            }
        }
        public static void RenderMenu()
        {
            GL.BeginVertical("box");
            GL.BeginHorizontal();
            GL.Label(RichText.MainCategoryFormat(Strings.GetText("mainCategory_BlueprintModding")));
            GL.FlexibleSpace();
            MenuTools.AddFavouriteButton("BlueprintModdingRender");
            GL.EndHorizontal();


            GL.BeginHorizontal();
            if (GL.Button(MenuTools.TextWithTooltip("misc_Enable", "tooltip_BlueprintModding", $"{ settings.toggleItemModding}" + " ", "", false), GL.ExpandWidth(false)))
            {
                if (settings.toggleItemModding == Storage.isFalseString)
                {
                    settings.toggleItemModding = Storage.isTrueString;
                    ModifiedBlueprintTools.Patch();
                }
                else if (settings.toggleItemModding == Storage.isTrueString)
                {
                    settings.toggleItemModding = Storage.isFalseString;
                }
            }
            GL.EndHorizontal();

            if (Strings.ToBool(settings.toggleItemModding))
            {
                MenuTools.SingleLineLabel(Strings.GetText("label_ItemModdingInfo"));

                GL.BeginHorizontal();
                if (GL.Button(new GUIContent("spacehamster's JSON Blueprint Dump on github", "https://github.com/spacehamster/KingmakerCustomBlueprints/releases/tag/blueprints"), GL.ExpandWidth(false)))
                {
                    Application.OpenURL("https://github.com/spacehamster/KingmakerCustomBlueprints/releases/tag/blueprints");
                }
                GL.EndHorizontal();

                GL.Space(10);

                GL.BeginHorizontal();
                if (GL.Button(MenuTools.TextWithTooltip("button_PatchManually", "tooltip_PatchManually", true), GL.ExpandWidth(false)))
                {
                    Patch();
                }
                GL.EndHorizontal();


                GL.Space(10);

                ItemTypesMenu();

                GL.Space(10);

                showModifiedBlueprints = GL.Toggle(showModifiedBlueprints, RichText.Bold(Strings.GetText("toggle_ShowModifiedItems")));
                if (showModifiedBlueprints)
                {
                    GL.Space(10);

                    GL.BeginHorizontal();
                    if (GL.Button(RichText.Bold(Strings.GetText("button_LoadRefresh")), GL.ExpandWidth(false)))
                    {
                        blueprintLists = false;
                    }
                    GL.EndHorizontal();

                    GL.Space(10);

                    try
                    {
                        if (!blueprintLists)
                        {
                            blueprintsPaths.Clear();
                            blueprintsNames.Clear();
                            blueprintsTypes.Clear();
                            string        path      = Storage.modEntryPath + Storage.modifiedBlueprintsFolder;
                            DirectoryInfo directory = new DirectoryInfo(path);
                            if (directory.GetFiles("*.json").Any())
                            {
                                foreach (FileInfo file in directory.GetFiles("*.json"))
                                {
                                    string json = File.ReadAllText(file.FullName);
                                    string guid = Path.GetFileNameWithoutExtension(file.Name);

                                    if (guid == "Example" && directory.GetFiles("*.json").Count() == 1)
                                    {
                                        MenuTools.SingleLineLabel(Strings.GetText("message_NoModItems"));
                                        continue;
                                    }
                                    else if (guid == "Example" && directory.GetFiles("*.json").Count() > 1)
                                    {
                                        continue;
                                    }

                                    BlueprintScriptableObject blueprintScriptableObject = Utilities.GetBlueprintByGuid <BlueprintScriptableObject>(guid);

                                    if (blueprintScriptableObject != null)
                                    {
                                        if (blueprintItemCategory.Contains(blueprintScriptableObject.GetType()) || blueprintTypeArmourCategory.Contains(blueprintScriptableObject.GetType()) || blueprintScriptableObject.GetType() == blueprintWeaponType)
                                        {
                                            blueprintsPaths.Add(file.FullName);
                                            blueprintsNames.Add(blueprintScriptableObject.name);
                                            blueprintsTypes.Add(blueprintScriptableObject.GetType().ToString());
                                        }
                                    }
                                }
                            }
                            blueprintLists = true;
                        }

                        if (blueprintsPaths.Any())
                        {
                            for (int i = 0; i < blueprintsPaths.Count(); i++)
                            {
                                GL.BeginVertical("box");
                                GL.BeginHorizontal();
                                GL.Label(blueprintsNames[i] + $" ({blueprintsTypes[i]})");
                                GL.FlexibleSpace();
                                if (GL.Button(MenuTools.TextWithTooltip("button_RemoveItemModification", "misc_RequiresRestart", true), GL.ExpandWidth(false)))
                                {
                                    try
                                    {
                                        blueprintLists = false;
                                        File.Delete(blueprintsPaths[i]);
                                    }
                                    catch (Exception e)
                                    {
                                        modLogger.Log(e.ToString());
                                    }
                                }
                                GL.EndHorizontal();
                                GL.EndVertical();
                            }
                        }
                        else
                        {
                            MenuTools.SingleLineLabel(Strings.GetText("message_NoModItems"));
                        }
                    }
                    catch (Exception e)
                    {
                        modLogger.Log(e.ToString());
                    }
                }
            }
            GL.EndVertical();
        }
예제 #16
0
    void OnGUI()
    {
        // Settings
        bgColor = (Texture2D)Resources.Load("editorBgColor");
        GUI.DrawTexture(new Rect(0, 0, maxSize.x, maxSize.y), bgColor, ScaleMode.StretchToFill);
        GUI.skin = editorSkin;
        GL.Label(GDbanner);
        scrollPosition = GL.BeginScrollView(scrollPosition);

        #region Shop Options
        // Start Block
        blockHeader("Shop Options", "Shop items options.", 0);
        if (toggles [0])
        {
            buttons [0] = "Close";
            BVS("GroupBox");
            // Content Start
            shopItemCountController();
            updateShopItems();
            // Content End
            EditorUtility.SetDirty(vars);
            EV();
        }
        else
        {
            buttons[0] = "Open";
        }
        EV();
        // End Block
        #endregion

        #region UI Options
        // Start Block
        blockHeader("UI Options", "All UI options.", 1);
        if (toggles[1])
        {
            buttons[1] = "Close";
            BVS("GroupBox");
            // Content Start
            GL.Label("UI Images", "centerBoldLabel");
            GL.Space(10);
            BV();
            BH();
            vars.shopCloseImage = EGL.ObjectField("ShopClose Image", vars.shopCloseImage, typeof(Sprite), false) as Sprite;
            vars.playButton     = EGL.ObjectField("Play Button", vars.playButton, typeof(Sprite), false) as Sprite;
            EH();
            BH();
            vars.leaderboardButton = EGL.ObjectField("Leaderboard Button", vars.leaderboardButton, typeof(Sprite), false) as Sprite;
            vars.shopButton        = EGL.ObjectField("Shop Open Button", vars.shopButton, typeof(Sprite), false) as Sprite;
            EH();
            BH();
            vars.homeButton = EGL.ObjectField("Home Button", vars.homeButton, typeof(Sprite), false) as Sprite;
            vars.rateButton = EGL.ObjectField("Rate Button", vars.rateButton, typeof(Sprite), false) as Sprite;
            EH();
            BH();
            vars.soundOnButton  = EGL.ObjectField("Sound On Button", vars.soundOnButton, typeof(Sprite), false) as Sprite;
            vars.soundOffButton = EGL.ObjectField("Sound Off Button", vars.soundOffButton, typeof(Sprite), false) as Sprite;
            EH();

            BH();
            vars.retryBtnImg = EGL.ObjectField("Retry Button", vars.retryBtnImg, typeof(Sprite), false) as Sprite;
            vars.adsBtnImg   = EGL.ObjectField("Ads Btn", vars.adsBtnImg, typeof(Sprite), false) as Sprite;
            EH();
            BH();
            vars.titleImage = EGL.ObjectField("Title Image", vars.titleImage, typeof(Sprite), false) as Sprite;
            vars.noAdsImage = EGL.ObjectField("NoAds Image", vars.noAdsImage, typeof(Sprite), false) as Sprite;
            EH();
            BH();
            vars.gameOverImg = EGL.ObjectField("GameOver Title Img", vars.gameOverImg, typeof(Sprite), false) as Sprite;
            vars.shareImage  = EGL.ObjectField("Share Image", vars.shareImage, typeof(Sprite), false) as Sprite;
            EH();
            BH();
            vars.giftBtnImg = EGL.ObjectField("Gift Btn", vars.giftBtnImg, typeof(Sprite), false) as Sprite;
            vars.starImg    = EGL.ObjectField("Star Image", vars.starImg, typeof(Sprite), false) as Sprite;
            EH();
            BH();
            vars.cloudImg      = EGL.ObjectField("Cloud Image", vars.cloudImg, typeof(Texture), false) as Texture;
            vars.backgroundImg = EGL.ObjectField("Background Image", vars.backgroundImg, typeof(Texture), false) as Texture;
            EH();
            EV();
            separator();
            GL.Label("UI Texts", "centerBoldLabel");
            GL.Space(10);
            BVS("GroupBox");
            GL.Label("Game Over Score Text :");
            vars.gameOverScoreTextColor = EGL.ColorField("Color", vars.gameOverScoreTextColor);
            GL.Label("Game Over Best Score Text :");
            vars.gameOverBestScoreTextColor = EGL.ColorField("Color", vars.gameOverBestScoreTextColor);
            EV();
            GL.Space(10);
            BVS("GroupBox");
            GL.Label("GameMenu Star Text :");
            vars.gameMenuStarTextColor = EGL.ColorField("Color", vars.gameMenuStarTextColor);
            GL.Label("ShopMenu Star Text :");
            vars.shopMenuStarTextColor = EGL.ColorField("Color", vars.shopMenuStarTextColor);
            EV();
            GL.Space(5);
            BVS("GroupBox");
            GL.Label("In Game Score Text :");
            vars.inGameScoreTextColor = EGL.ColorField("Color", vars.inGameScoreTextColor);
            GL.Label("Gift Reward Text :");
            vars.giftRewardTextColor = EGL.ColorField("Color", vars.giftRewardTextColor);
            EV();
            separator();
            GL.Label("UI Fonts", "centerBoldLabel");
            GL.Space(10);
            vars.mainFont   = EGL.ObjectField("Main Font", vars.mainFont, typeof(Font), false) as Font;
            vars.secondFont = EGL.ObjectField("Second Font", vars.secondFont, typeof(Font), false) as Font;
            // Content End
            EditorUtility.SetDirty(vars);
            EV();
        }
        else
        {
            buttons[1] = "Open";
        }
        EV();
        // End Block
        #endregion

        #region Sound Options
        // Start Block
        blockHeader("Sound Options", "Sound & Music options.", 2);
        if (toggles [2])
        {
            buttons [2] = "Close";
            BVS("GroupBox");
            // Content Start
            vars.buttonSound     = EGL.ObjectField("Button Sound", vars.buttonSound, typeof(AudioClip), false) as AudioClip;
            vars.starSound       = EGL.ObjectField("Star Sound", vars.starSound, typeof(AudioClip), false) as AudioClip;
            vars.backgroundMusic = EGL.ObjectField("Background Music", vars.backgroundMusic, typeof(AudioClip), false) as AudioClip;
            vars.jumpSound       = EGL.ObjectField("Jump Sound", vars.jumpSound, typeof(AudioClip), false) as AudioClip;
            vars.deathSound      = EGL.ObjectField("Death Sound", vars.deathSound, typeof(AudioClip), false) as AudioClip;
            // Content End
            EditorUtility.SetDirty(vars);
            EV();
        }
        else
        {
            buttons[2] = "Open";
        }
        EV();
        // End Block
        #endregion

        #region Other Options
        // Start Block
        blockHeader("Other Options", "AdMob, Google Play Services and etc. options.", 4);
        if (toggles [4])
        {
            buttons[4] = "Close";
            GL.BeginVertical("GroupBox");
            //Admob
            if (GUILayout.Button("Download Admob SDK"))
            {
                Application.OpenURL("https://github.com/googleads/googleads-mobile-unity/releases");
            }
            GL.Label("AdMob Options", EditorStyles.boldLabel);
            GL.BeginHorizontal();
            GL.Label("Show Interstitial After Death Times");
            vars.showInterstitialAfter = EGL.IntSlider(vars.showInterstitialAfter, 1, 25);
            GL.EndHorizontal();
            vars.admobActive = EGL.Toggle("Use Admob Ads", vars.admobActive, "Toggle");
            if (vars.admobActive)
            {
                AssetDefineManager.AddCompileDefine("AdmobDef",
                                                    new BuildTargetGroup[] { BuildTargetGroup.Android, BuildTargetGroup.iOS });

                //Admob App ID
                vars.admobAppID = EGL.TextField("AdMob App ID", vars.admobAppID);
                separator();
                //Banner
                vars.adMobBannerID = EGL.TextField("AdMob Banner ID", vars.adMobBannerID);
                GL.BeginHorizontal();
                GL.Label("Banner Position");
                vars.bannerAdPoisiton = GL.SelectionGrid(vars.bannerAdPoisiton, bannerPositionTexts, 3, "Radio");
                GL.EndHorizontal();
                separator();

                //Interstitial
                vars.adMobInterstitialID = EGL.TextField("AdMob Interstitial ID", vars.adMobInterstitialID);
            }
            else if (!vars.admobActive)
            {
                AssetDefineManager.RemoveCompileDefine("AdmobDef",
                                                       new BuildTargetGroup[] { BuildTargetGroup.Android, BuildTargetGroup.iOS });
            }

            separator();

            //Google Play Service
            if (GUILayout.Button("Download Google Play SDK"))
            {
                Application.OpenURL("https://github.com/playgameservices/play-games-plugin-for-unity");
            }
            GL.Label("Google Play Or Game Center", EditorStyles.boldLabel);
            vars.googlePlayActive = EGL.Toggle("Use Leaderboard", vars.googlePlayActive, "Toggle");
            if (vars.googlePlayActive)
            {
#if UNITY_ANDROID
                AssetDefineManager.AddCompileDefine("GooglePlayDef",
                                                    new BuildTargetGroup[] { BuildTargetGroup.Android });
#endif

                vars.leaderBoardID = EGL.TextField("Leaderboard ID", vars.leaderBoardID);
            }
            else if (!vars.googlePlayActive)
            {
#if UNITY_ANDROID
                AssetDefineManager.RemoveCompileDefine("GooglePlayDef",
                                                       new BuildTargetGroup[] { BuildTargetGroup.Android });
#endif
            }

            separator();

            //Unity IAP
            GL.Label("Unity IAP", EditorStyles.boldLabel);
            GL.Label("Activate UnityIAP from Services Window", EditorStyles.label);
            vars.unityIAP = EGL.Toggle("Use UnityIAP", vars.unityIAP, "Toggle");
            if (vars.unityIAP)
            {
                AssetDefineManager.AddCompileDefine("UnityIAP",
                                                    new BuildTargetGroup[] { BuildTargetGroup.Android });
            }
            else if (!vars.unityIAP)
            {
                AssetDefineManager.RemoveCompileDefine("UnityIAP",
                                                       new BuildTargetGroup[] { BuildTargetGroup.Android });
            }

            separator();

            GL.Label("Other Options", EditorStyles.boldLabel);
            //facebook page
            GL.BeginHorizontal();
            GL.Label("Facebook Page", GL.Width(100f));
            vars.facebookPage = EGL.TextArea(vars.facebookPage, GL.Height(25f));
            GL.EndHorizontal();
            GL.Space(15f);
            //Rate Url
            GL.BeginHorizontal();
            GL.Label("Rate Button Url", GL.Width(100f));
            vars.rateButtonUrl = EGL.TextArea(vars.rateButtonUrl, GL.Height(25f));
            GL.EndHorizontal();
            GL.Space(15f);
            separator();
            //
            EditorUtility.SetDirty(vars);
            GL.EndVertical();
        }
        else
        {
            buttons[4] = "Open";
        }
        GL.EndVertical();
        // End Block
        #endregion

        GL.EndScrollView();
        EditorUtility.SetDirty(vars);
        try{
            liveUpdate();
        }catch (Exception e) {}
    }
예제 #17
0
    void showTerrainGUI()
    {
        // General Terrain Settings
        showTerrainUI = EGL.Foldout(showTerrainUI, terrainLabel, true);

        if (showTerrainUI)
        {
            GL.BeginHorizontal();
            GL.BeginVertical();
            GL.Label(new GUIContent("Terrain Size", "The width in units of the generated Terrain Object."));
            GL.Label(new GUIContent("Terrain Height Range", "The min and max height in units of the generated Terrain Object."));
            GL.Label("Water?");
            GL.EndVertical();

            GL.BeginVertical();
            CG.terrainSize = EGL.IntSlider(CG.terrainSize, 512, 2048);
            GL.BeginHorizontal();
            GL.TextField(CG.minHeight.ToString("F1"));
            EGL.MinMaxSlider(ref CG.minHeight, ref CG.maxHeight, CG.terrainSize * -CG.highwayMaxSlope, CG.terrainSize * CG.highwayMaxSlope);
            GL.TextField(CG.maxHeight.ToString("F1"));
            GL.EndHorizontal();
            EG.BeginDisabledGroup(CG.minHeight > 0);
            rWaterToggle.target = EGL.Toggle(rWaterToggle.target);
            EG.EndDisabledGroup();
            GL.EndVertical();
            GL.EndHorizontal();

            GL.BeginVertical();
            GL.Label("Height Map Generation", EditorStyles.centeredGreyMiniLabel);
            GL.BeginHorizontal("box");
            GL.BeginVertical();
            GL.Label("Octaves");
            GL.Label("Persistance");
            GL.Label("Zoom");
            GL.Label("Seed");
            GL.EndVertical();

            GL.BeginVertical();
            CG.terrainOctaves     = EGL.IntSlider(CG.terrainOctaves, 1, 6);
            CG.terrainPersistance = EGL.Slider(CG.terrainPersistance, 0, 0.7f);
            CG.terrainZoom        = EGL.Slider(CG.terrainZoom, 0.01f, 0.04f);
            GL.BeginHorizontal();
            EG.BeginDisabledGroup(rTerrainSeed.target == false);
            CG.terrainSeed = EGL.IntSlider(CG.terrainSeed, 0, int.MaxValue);
            EG.EndDisabledGroup();
            rTerrainSeed.target = EGL.Toggle(rTerrainSeed.target);
            GL.EndHorizontal();
            GL.Space(20);
            GL.BeginHorizontal();
            GL.Label("Or import your custom height map: ");
            CG.terrainMap = (Texture2D)EGL.ObjectField(CG.terrainMap, typeof(Texture2D), false);
            GL.EndHorizontal();
            GL.EndVertical();


            GL.EndHorizontal();
            GL.EndVertical();

            GL.BeginHorizontal();
            if (GL.Button("Generate New Terrain"))
            {
                if (rTerrainSeed.target == false && CG.terrainMap == null)
                {
                    CG.terrainSeed = Random.Range(0, int.MaxValue);
                }
                CG.rWater = rWaterToggle.target;
                generator.generateTerrain();
                isTerrain = true;
            }
            EG.BeginDisabledGroup(!isTerrain);
            if (GL.Button("Save and Proceed"))
            {
                terrainGenerated = true;
                terrainLabel     = "1. Terrain Generation - COMPLETED ✔";
                if (CityGeneratorUI.DebugMode)
                {
                    Debug.Log("Terrain Generated");
                }
                showTerrainUI = false;
                showPopUI     = true;
            }
            EG.EndDisabledGroup();

            GL.EndHorizontal();
        }
    }
예제 #18
0
        /// <summary>
        /// Field drawing utility used when a field of an object needs to be drawn
        /// </summary>
        private static object DrawPropertyObject(object property, Type type, int indent = 0)
        {
            var _val = property;

            // UnityEngine.Object
            if (typeof(U.Object).IsAssignableFrom(type))
            {
                U.Object _elementAsObject = null;
                _val.TryCast <U.Object>(out _elementAsObject);

#if UNITY_EDITOR
                _elementAsObject = EGl.ObjectField(_elementAsObject, type, true);
#else
                Gl.Label(_elementAsObject.ToString());
#endif

                _elementAsObject.TryCast <object>(out _val);

                return(_val);
            }

            // Initialize new if null (and newable).
            // Doing this after the Unity Object check will assure no GameObjects are spawned in the current scene
            if (_val == null)
            {
                var _constructorInfo = type.GetConstructor(Type.EmptyTypes);
                if (_constructorInfo != null)
                {
                    _val = _constructorInfo.Invoke(null);
                }
                else
                {
                    _val = default(object);
                }
            }

            // Implements the iDrawableProperty
            if (_val is iDrawableProperty)
            {
                iDrawableProperty _asDrawable = (iDrawableProperty)_val;
                _asDrawable.DrawAsProperty();
                return(_val);
            }

            // Bool
            if (_val is bool)
            {
                bool _elementAsBool = default(bool);

                if (_val.TryCast <bool>(out _elementAsBool))
                {
                    _elementAsBool = Gl.Toggle(_elementAsBool, "");
                }

                _elementAsBool.TryCast <object>(out _val);

                return(_val);
            }

            // Int
            if (_val is int)
            {
                int _elementAsInt = default(int);

                if (_val.TryCast <int>(out _elementAsInt))
                {
#if UNITY_EDITOR
                    _elementAsInt = EGl.IntField(_elementAsInt);
#else
                    int.TryParse(Gl.TextField(_elementAsInt.ToString()), out _elementAsInt);
#endif
                }

                _elementAsInt.TryCast <object>(out _val);

                return(_val);
            }

            // Float
            if (_val is float)
            {
                float _elementAsFloat = default(float);

                if (_val.TryCast <float>(out _elementAsFloat))
                {
#if UNITY_EDITOR
                    _elementAsFloat = EGl.FloatField(_elementAsFloat);
#else
                    float.TryParse(Gl.TextField(_elementAsFloat.ToString()), out _elementAsFloat);
#endif
                }

                _elementAsFloat.TryCast <object>(out _val);

                return(_val);
            }

            // String
            if (_val is string || typeof(string).IsAssignableFrom(type))
            {
                string _elementAsString = string.Empty;

                if (_val != null)
                {
                    if (_val.TryCast <string>(out _elementAsString))
                    {
                        _elementAsString = Gl.TextField(_elementAsString);
                    }
                }
                else
                {
                    Gl.Label("EMPTY STRING");
                }

                _elementAsString.TryCast <object>(out _val);

                return(_val);
            }

            // Try drawing using reflection,
            // expecting that it is a newable type that is already initialized in the code above
            if (_val != null)
            {
                var _valType = _val.GetType();
                if (indent == 0)
                {
                    Gl.Label(_valType.Name);
                }

                var _fieldInfo = _valType.GetFields(BindingFlags.Public | BindingFlags.Instance);

                if (indent < PROPERTY_DEPTH_LIMIT)
                {
                    indent++;

                    OpenIndent(indent);
                    foreach (var _field in _fieldInfo)
                    {
                        Gl.BeginHorizontal();
                        Gl.Label(StringUtil.WordSplit(_field.Name, true), Gl.ExpandWidth(false));
                        Gl.BeginVertical();
                        var _fieldValue = _field.GetValue(_val);
                        _field.SetValue(_val, DrawPropertyObject(_fieldValue, _field.FieldType, indent));
                        Gl.EndVertical();
                        Gl.EndHorizontal();
                    }

                    CloseIndent();
                }
                else
                {
                    Gl.Label(string.Format("[!] MAX DRAWING DEPTH ({0}) REACHED", PROPERTY_DEPTH_LIMIT));
                }

                return(_val);
            }

            Gl.Label("[ERROR] Unknown Type");
            return(null);
        }
예제 #19
0
    void showPopulationMapGUI()
    {
        EG.BeginDisabledGroup(!(terrainGenerated));
        showPopUI = EGL.Foldout(showPopUI, populationLabel, true);
        if (showPopUI)
        {
            GL.BeginVertical();
            GL.BeginHorizontal("box");
            GL.BeginVertical();
            GL.Label("Octaves");
            GL.Label("Persistance");
            GL.Label("Zoom");
            GL.Label("Seed");
            GL.EndVertical();

            GL.BeginVertical();
            CG.popOctaves     = EGL.IntSlider(CG.popOctaves, 1, 6);
            CG.popPersistance = EGL.Slider(CG.popPersistance, 0, 0.5f);
            CG.popZoom        = EGL.Slider(CG.popZoom, 0, 0.05f);
            GL.BeginHorizontal();
            EG.BeginDisabledGroup(rPopSeed.target == false);
            CG.popSeed = EGL.IntSlider(CG.popSeed, 0, int.MaxValue);
            EG.EndDisabledGroup();
            rPopSeed.target = EGL.Toggle(rPopSeed.target);
            GL.EndHorizontal();

            GL.Space(20);

            GL.BeginHorizontal();
            GL.Label("Or import your custom pop map: ");
            CG.popMapInput = (Texture2D)EGL.ObjectField(CG.popMapInput, typeof(Texture2D), false);
            GL.EndHorizontal();
            GL.EndVertical();

            GL.EndHorizontal();
            GL.EndVertical();

            GL.BeginHorizontal();
            if (GL.Button("Generate Population Map"))
            {
                if (rPopSeed.target == false && CG.popMapInput == null)
                {
                    CG.popSeed = Random.Range(0, int.MaxValue);
                }
                generator.generatePopulationMap();
                isPopMap   = true;
                CG.showPop = true;
            }

            EG.BeginDisabledGroup(!isPopMap);
            GL.BeginHorizontal();
            GL.FlexibleSpace();
            CG.showPop = EGL.ToggleLeft("Preview Pop Map", CG.showPop);
            GL.EndHorizontal();

            GL.EndHorizontal();
            if (GL.Button("Save and Proceed"))
            {
                populationGenerated = true;
                populationLabel     = "2. Population Map Generation - COMPLETED ✔";
                showPopUI           = false;
                CG.showPop          = false;
                showGrowthUI        = true;
            }
            EG.EndDisabledGroup();
        }
        EG.EndDisabledGroup();
    }
예제 #20
0
        public static void RenderMenu()
        {
            GL.BeginVertical("box");
            GL.BeginHorizontal();
            GL.Label(RichText.MainCategoryFormat(Strings.GetText("label_ActionKey")));
            GL.FlexibleSpace();
            MenuTools.AddFavouriteButton("ActionKeyRender");
            GL.EndHorizontal();

            GL.BeginHorizontal();
            if (GL.Button(
                    MenuTools.TextWithTooltip("misc_Enable", "tooltip_ActionKey", $"{settings.toggleEnableActionKey}" + " ",
                                              ""), GL.ExpandWidth(false)))
            {
                if (settings.toggleEnableActionKey == Storage.isFalseString)
                {
                    settings.toggleEnableActionKey = Storage.isTrueString;
                    settings.actionKeyIndex        = 0;
                    settings.actionKeyKillIndex    = 0;
                }
                else if (settings.toggleEnableActionKey == Storage.isTrueString)
                {
                    settings.toggleEnableActionKey = Storage.isFalseString;
                    settings.actionKeyIndex        = 0;
                    settings.actionKeyKillIndex    = 0;
                }
            }

            GL.EndHorizontal();

            if (settings.toggleEnableActionKey == Storage.isTrueString)
            {
                GL.Space(10);

                GL.BeginHorizontal();
                GL.Label(Strings.GetText("label_ActionKey") + ": ", GL.ExpandWidth(false));
                MenuTools.SetKeyBinding(ref settings.actionKey);
                GL.EndHorizontal();

                GL.Space(10);

                GL.BeginHorizontal();
                if (GL.Button(
                        MenuTools.TextWithTooltip("label_ActionKeyEnableExperimental",
                                                  "tooltip_ActionKeyEnableExperimental", $"{settings.toggleActionKeyExperimental}" + " ", ""),
                        GL.ExpandWidth(false)))
                {
                    if (settings.toggleActionKeyExperimental == Storage.isFalseString)
                    {
                        settings.toggleActionKeyExperimental = Storage.isTrueString;
                        settings.actionKeyIndex     = 0;
                        settings.actionKeyKillIndex = 0;
                    }
                    else if (settings.toggleActionKeyExperimental == Storage.isTrueString)
                    {
                        settings.toggleActionKeyExperimental = Storage.isFalseString;
                        settings.actionKeyIndex     = 0;
                        settings.actionKeyKillIndex = 0;
                    }
                }

                GL.EndHorizontal();

                MenuTools.SingleLineLabel(RichText.Bold(Strings.GetText("warning_ActionKeyExperimentalMode")));

                GL.BeginHorizontal();
                if (!Strings.ToBool(settings.toggleActionKeyExperimental))
                {
                    settings.actionKeyIndex = GL.SelectionGrid(settings.actionKeyIndex, mainArray, 3);
                }
                else
                {
                    settings.actionKeyIndex = GL.SelectionGrid(settings.actionKeyIndex, mainExperimentalArray, 3);
                }
                GL.EndHorizontal();

                GL.Space(10);

                switch (settings.actionKeyIndex)
                {
                case 1:
                    MenuTools.ToggleButton(ref settings.toggleActionKeyLogInfo, "buttonToggle_LogInfoToFile",
                                           "tooltip_LogInfoToFile");
                    MenuTools.ToggleButton(ref settings.toggleActionKeyShowUnitInfoBox,
                                           "buttonToggle_ShowUnitInfoBox", "tooltip_ShowUnitInfoBox");

                    break;

                case 2:
                    if (Strings.ToBool(settings.toggleActionKeyExperimental))
                    {
                        GL.Space(10);
                        GL.BeginHorizontal();
                        settings.actionKeyKillIndex =
                            GL.SelectionGrid(settings.actionKeyKillIndex, experimentalKillArray, 3);
                        GL.EndHorizontal();
                    }

                    break;

                case 4:
                    if (!Storage.buffFavourites.Any())
                    {
                        MenuTools.SingleLineLabel(Strings.GetText("message_NoFavourites"));
                    }
                    else
                    {
                        if (Storage.buffFavouritesLoad == true)
                        {
                            Main.RefreshBuffFavourites();
                            Storage.buffFavouritesLoad = false;
                        }

                        GL.Space(10);
                        GL.BeginHorizontal();
                        settings.actionKeyBuffIndex = GL.SelectionGrid(settings.actionKeyBuffIndex,
                                                                       Storage.buffFavouriteNames.ToArray(), 2);
                        GL.EndHorizontal();
                    }

                    if (Storage.buffFavourites != Storage.buffFavouritesGuids)
                    {
                        Storage.buffFavourites = Storage.buffFavouritesGuids;
                    }
                    break;

                case 5:
                    if (editUnit != null && editUnit.IsInGame && !editUnit.Descriptor.State.IsFinallyDead)
                    {
                        ActionKeyEditStatsGui(editUnit);
                    }
                    else
                    {
                        MenuTools.SingleLineLabel(Strings.GetText("message_NoUnitSelected"));
                    }
                    break;

                case 6:
                    if (teleportUnit != null && teleportUnit.IsInGame)
                    {
                        MenuTools.SingleLineLabel(Strings.GetText("label_TeleportUnit") +
                                                  $": {teleportUnit.CharacterName}");
                    }
                    else
                    {
                        MenuTools.SingleLineLabel(Strings.GetText("message_NoUnitSelected"));
                    }
                    break;

                case 7:
                    if (Strings.ToBool(settings.toggleActionKeyExperimental))
                    {
                        settings.actionKeySpawnRandomEnemy = GL.Toggle(settings.actionKeySpawnRandomEnemy,
                                                                       " " + Strings.GetText("toggle_SpawnRandomEnemy"), GL.ExpandWidth(false));
                    }

                    GL.Space(10);

                    MenuTools.SingleLineLabel(Strings.GetText("label_ChallengeRating") + " " +
                                              Strings.Parenthesis(Strings.GetText("misc_Bandit")));
                    GL.BeginHorizontal();
                    banidtCrIndex = GL.SelectionGrid(banidtCrIndex, numberArray0t7, 8);
                    GL.EndHorizontal();

                    break;

                case 8:
                    if (rotateUnit != null && rotateUnit.IsInGame)
                    {
                        MenuTools.SingleLineLabel(Strings.GetText("arrayItem_ActionKeyMain_RotateUnit") +
                                                  $": {rotateUnit.CharacterName}");
                    }
                    else
                    {
                        MenuTools.SingleLineLabel(Strings.GetText("message_NoUnitSelected"));
                    }
                    break;

                case 9:
                    if (load)
                    {
                        animationTypes.Clear();
                        animationTypesNames.Clear();
                        foreach (var animation in (UnitAnimationType[])Enum.GetValues(typeof(UnitAnimationType)))
                        {
                            animationTypes.Add(animation);
                            animationTypesNames.Add(animation.ToString());
                        }

                        load = false;
                    }

                    GL.BeginHorizontal();
                    animationTypesIndex = GL.SelectionGrid(animationTypesIndex, animationTypesNames.ToArray(), 3);
                    GL.EndHorizontal();
                    break;

                case 13:
                    MenuTools.SingleLineLabel(Strings.GetText("message_RecreateUnitDescriptor"));
                    break;
                }
            }

            GL.EndVertical();
        }
예제 #21
0
    void showPreviewGUI()
    {
        GL.BeginVertical("Box");
        GL.Label("Showing first: " + (int)PreviewRoads.NrRoads + " roads");

        GL.BeginHorizontal();
        {
            if (GL.Button("|<", GL.Height(30)))
            {
                m_PlaybackModifier   = 0f;
                PreviewRoads.NrRoads = 0;
                SceneView.RepaintAll();
            }

            if (GL.Button("<", GL.Height(30)))
            {
                m_PlaybackModifier    = 0f;
                PreviewRoads.NrRoads -= 1;
            }

            if (m_PlaybackModifier == 0)
            {
                if (GL.Button("< Play", GL.Height(30)))
                {
                    m_PlaybackModifier = -2f;
                }
                if (GL.Button("Play >", GL.Height(30)))
                {
                    m_PlaybackModifier = 2f;
                }
            }
            else
            {
                if (GL.Button("||", GL.Height(30)))
                {
                    m_PlaybackModifier = 0f;
                }
            }

            if (GL.Button(">", GL.Height(30)))
            {
                m_PlaybackModifier    = 0f;
                PreviewRoads.NrRoads += 1;
            }

            if (GL.Button(">|", GL.Height(30)))
            {
                m_PlaybackModifier   = 0f;
                PreviewRoads.NrRoads = CG.nrOfRoads;
                SceneView.RepaintAll();
            }
        }
        GL.EndHorizontal();
        if (m_PlaybackModifier == 0)
        {
            PreviewRoads.NrRoads = EGL.IntSlider((int)PreviewRoads.NrRoads, 0, CG.nrOfRoads);
        }
        else
        {
            EGL.IntSlider((int)PreviewRoads.NrRoads, 0, CG.nrOfRoads);
        }
        GL.EndHorizontal();
    }
예제 #22
0
    void showRoadMapGUI()
    {
        EG.BeginDisabledGroup(!(terrainGenerated && growthMapGenerated && populationGenerated));
        showRoadMapUI = EGL.Foldout(showRoadMapUI, roadmapLabel, true);
        if (showRoadMapUI)
        {
            GL.Label("Streets", EditorStyles.centeredGreyMiniLabel);
            GL.BeginHorizontal();
            GL.BeginVertical();
            GL.Label("Width");
            GL.Label("Min Length");
            GL.Label("LookAhead");
            GL.Label("Pop Threshold");
            GL.Label("Max Slope");
            GL.EndVertical();
            GL.BeginVertical();
            CG.streetWidth        = EGL.IntSlider(CG.streetWidth, 5, 20);
            CG.streetMinLength    = EGL.Slider(CG.streetMinLength, 5f, 100f);
            CG.streetLookAhead    = EGL.IntSlider(CG.streetLookAhead, 1, (int)(CG.terrainSize / CG.streetMinLength));
            CG.streetPopThreshold = EGL.Slider(CG.streetPopThreshold, 0f, 1f);
            CG.streetMaxSlope     = EGL.Slider(CG.streetMaxSlope, 0f, 1f);
            GL.EndVertical();
            GL.EndHorizontal();

            GL.Space(5);

            GL.Label("Highways", EditorStyles.centeredGreyMiniLabel);
            GL.BeginHorizontal();
            GL.BeginVertical();
            GL.Label("Width");
            GL.Label("Min Length");
            GL.Label("LookAhead");
            GL.Label("Pop Threshold");
            GL.Label("Max Slope");
            GL.EndVertical();
            GL.BeginVertical();
            CG.highwayWidth        = EGL.IntSlider(CG.highwayWidth, 10, 25);
            CG.highwayMinLength    = EGL.Slider(CG.highwayMinLength, 5f, 200f);
            CG.highwayLookAhead    = EGL.IntSlider(CG.highwayLookAhead, 1, (int)(CG.terrainSize / CG.highwayMinLength));
            CG.highwayPopThreshold = EGL.Slider(CG.highwayPopThreshold, 0f, 1f);
            CG.highwayMaxSlope     = EGL.Slider(CG.highwayMaxSlope, 0f, 1f);
            GL.EndVertical();
            GL.EndHorizontal();

            GL.Space(10);

            showRoadMapAdvanced = EGL.Foldout(showRoadMapAdvanced, "Advanced Settings", true);
            if (showRoadMapAdvanced)
            {
                EGL.HelpBox("Adjusting these settings might break the Editor or severely influence performance.", MessageType.Warning);
                GL.Label("General Advanced Settings", EditorStyles.centeredGreyMiniLabel);
                GL.BeginHorizontal();
                GL.BeginVertical();
                GL.Label("Legalization Attempts");
                GL.Label("Min Road Correction Angle");
                GL.Label("Node Check Radius");
                GL.Label("Road Connect Max Distance");
                GL.Label("Ray Count");
                GL.EndVertical();
                GL.BeginVertical();
                CG.legalizationAttempts = EGL.IntSlider(CG.legalizationAttempts, 1, 100);
                CG.minRoadAngle         = EGL.IntSlider(CG.minRoadAngle, 0, 90);
                CG.nodeCheckRadius      = EGL.Slider(CG.nodeCheckRadius, 0f, 100f);
                CG.roadConnectDistance  = EGL.Slider(CG.roadConnectDistance, 0f, 100f);
                CG.rayCount             = EGL.IntSlider(CG.rayCount, 1, 32);
                GL.EndVertical();
                GL.EndHorizontal();

                GL.Label("Advanced Settings for L-system Component", EditorStyles.centeredGreyMiniLabel);
                EGL.HelpBox("Low values correspond to higher priority.", MessageType.Info);
                GL.BeginHorizontal();
                GL.BeginVertical();
                GL.Label("Street - Priority");
                GL.Label("Highway - Priority");
                GL.EndVertical();
                GL.BeginVertical();
                CG.streetPriority  = EGL.IntSlider(CG.streetPriority, 1, 5);
                CG.highwayPriority = EGL.IntSlider(CG.highwayPriority, 1, 5);
                GL.EndVertical();
                GL.EndHorizontal();

                GL.Label("Advanced Settings for Growth Rules", EditorStyles.centeredGreyMiniLabel);
                GL.BeginHorizontal();
                GL.BeginVertical();
                GL.Label("Street - Straight Angle");
                GL.Label("Street - Branch  Angle");
                GL.Space(10);
                GL.Label("Highway - Branch Prob");
                GL.Label("Highway - Straight Angle");
                GL.Label("Highway - Branch Angle");
                GL.EndVertical();
                GL.BeginVertical();
                CG.streetStraightAngle = EGL.Slider(CG.streetStraightAngle, 0f, 90f);
                CG.streetBranchAngle   = EGL.Slider(CG.streetBranchAngle, 0f, 90f);
                GL.Space(10);
                CG.highwayBranchProb    = EGL.Slider(CG.highwayBranchProb, 0f, 1f);
                CG.highwayStraightAngle = EGL.Slider(CG.highwayStraightAngle, 0f, 90f);
                CG.highwayBranchAngle   = EGL.Slider(CG.highwayBranchAngle, 0f, 90f);
                GL.EndVertical();
                GL.EndHorizontal();
            }
            if (roadMapGenerated)
            {
                GL.BeginHorizontal("Box");
                GL.FlexibleSpace();
                CG.showPop = EGL.ToggleLeft("Preview Pop Map", CG.showPop);
                GL.FlexibleSpace();
                CG.showGrowth = EGL.ToggleLeft("Preview Growth Map", CG.showGrowth);
                GL.FlexibleSpace();
                GL.EndHorizontal();

                if (DebugMode)
                {
                    showPreviewGUI();
                }
            }
            EGL.HelpBox("The 'Generate Road Map' button may take several tries to generate road map due to the random nature of the algorithm.", MessageType.Info);
            GL.BeginHorizontal();
            if (GL.Button("Generate Road Map"))
            {
                GameObject roadMap = GameObject.Find("RoadMap");
                GameObject nodes   = GameObject.Find("Nodes");


                if (roadMap != null)
                {
                    roadMap.SetActive(true);
                }
                if (nodes != null)
                {
                    nodes.SetActive(true);
                }
                generator.generateRoadMap();
                roadMapGenerated  = true;
                roadMeshGenerated = false;
            }

            EG.BeginDisabledGroup(!roadMapGenerated);
            if (GL.Button("Generate Road Meshes & Blocks"))
            {
                generator.generateRoadMeshes();
                generator.generateBlocks();
                roadMeshGenerated = true;
            }
            EG.EndDisabledGroup();
            GL.EndHorizontal();

            EG.BeginDisabledGroup(!roadMeshGenerated);
            if (GL.Button("Save and Proceed"))
            {
                showRoadMapUI       = false;
                showRoadMapAdvanced = false;
                showBuildingUI      = true;
                GameObject roadMap = GameObject.Find("RoadMap");
                if (roadMap != null)
                {
                    roadMap.SetActive(false);
                }
                GameObject nodes = GameObject.Find("Nodes");
                if (nodes != null)
                {
                    nodes.SetActive(false);
                }
                roadmapLabel = "4. Road Map Generation - COMPLETED ✔";
            }
            EG.EndDisabledGroup();
        }
        EG.EndDisabledGroup();
    }
예제 #23
0
    void showGrowthMapGUI()
    {
        EG.BeginDisabledGroup(!(terrainGenerated));
        showGrowthUI = EGL.Foldout(showGrowthUI, growthLabel, true);
        if (showGrowthUI)
        {
            GL.BeginVertical();

            GL.BeginHorizontal();
            GL.BeginVertical();
            if (GL.Button("Basic Rule"))
            {
                CG.growthBasic   = 1;
                CG.growthNewYork = 0;
                CG.growthParis   = 0;
            }
            if (GL.Button("New York Rule"))
            {
                CG.growthNewYork = 1;
                CG.growthBasic   = 0;
                CG.growthParis   = 0;
            }
            if (GL.Button("Paris Rule"))
            {
                CG.growthParis   = 1;
                CG.growthBasic   = 0;
                CG.growthNewYork = 0;
            }
            GL.EndVertical();
            GL.BeginVertical();
            GL.Space(1);
            CG.growthBasic = EGL.Slider(1 - CG.growthNewYork - CG.growthParis, 0, 1);
            GL.Space(1);
            CG.growthNewYork = EGL.Slider(1 - CG.growthBasic - CG.growthParis, 0, 1);
            GL.Space(1);
            CG.growthParis = EGL.Slider(1 - CG.growthBasic - CG.growthNewYork, 0, 1);
            GL.EndVertical();
            GL.EndHorizontal();
            GL.Space(1);

            if (GL.Button("Default"))
            {
                CG.growthParis   = 1f / 3f;
                CG.growthBasic   = 1f / 3f;
                CG.growthNewYork = 1f / 3f;
            }

            GL.BeginHorizontal("box");
            GL.BeginVertical();
            GL.Label("Octaves");
            GL.Label("Persistance");
            GL.Label("Zoom");
            GL.Label("Seed");
            GL.EndVertical();

            GL.BeginVertical();
            CG.growthOctaves     = EGL.IntSlider(CG.growthOctaves, 1, 6);
            CG.growthPersistance = EGL.Slider(CG.growthPersistance, 0, 0.7f);
            CG.growthZoom        = EGL.Slider(CG.growthZoom, 0, 0.05f);
            GL.BeginHorizontal();
            EG.BeginDisabledGroup(rGrowthSeed.target == false);
            CG.growthSeed = EGL.IntSlider(CG.growthSeed, 0, int.MaxValue);
            EG.EndDisabledGroup();
            rGrowthSeed.target = EGL.Toggle(rGrowthSeed.target);
            GL.EndHorizontal();

            GL.Space(20);

            GL.BeginHorizontal();
            GL.Label("Or import your growth-rule map: ");
            CG.growthMapInput = (Texture2D)EGL.ObjectField(CG.growthMapInput, typeof(Texture2D), false);
            GL.EndHorizontal();
            GL.EndVertical();

            GL.EndHorizontal();
            GL.EndVertical();

            GL.BeginHorizontal();
            if (GL.Button("Generate Growth Map"))
            {
                if (rGrowthSeed.target == false && CG.growthMapInput == null)
                {
                    CG.growthSeed = Random.Range(0, int.MaxValue);
                }
                generator.generateGrowthRule();
                isGrowthMap   = true;
                CG.showGrowth = true;
            }

            EG.BeginDisabledGroup(!isGrowthMap);
            GL.BeginHorizontal();
            GL.FlexibleSpace();
            CG.showGrowth = EGL.ToggleLeft("Preview Growth Map", CG.showGrowth);
            GL.FlexibleSpace();
            GL.EndHorizontal();
            GL.EndHorizontal();

            if (GL.Button("Save and Proceed"))
            {
                growthMapGenerated = true;
                growthLabel        = "3. Growth Map Generation - COMPLETED ✔";
                showGrowthUI       = false;
                CG.showGrowth      = false;
                showRoadMapUI      = true;
            }
            EG.EndDisabledGroup();
        }
        EG.EndDisabledGroup();
    }
예제 #24
0
        // Build-Compatible GUI Utilities:

        /// <summary>
        /// List GUI drawer utility (Will modify the source list)
        /// </summary>
        public static List <T> ArrayFieldGUI <T>(List <T> list, ArrayFieldOption option = ArrayFieldOption.Default)
        {
            var _listCopy = new List <T>(list);

            U.GUIStyle _style = new U.GUIStyle("Box");

            if (!option.ContainsFlag(ArrayFieldOption.NoBoundries))
            {
                Gl.BeginVertical(_style, Gl.ExpandWidth(true));
            }

            var _clearButtonContent  = new U.GUIContent("Clr", "Clear Field");
            var _removeButtonContent = new U.GUIContent("X", "Remove Element");

            for (int i = 0; i < _listCopy.Count; i++)
            {
                if (!option.ContainsFlag(ArrayFieldOption.NoBoundries))
                {
                    Gl.BeginHorizontal(_style, Gl.ExpandWidth(true));
                }

                if (!option.ContainsFlag(ArrayFieldOption.NoIndex))
                {
                    Gl.Label(i.ToString(), Gl.ExpandWidth(false));
                }

                Gl.BeginVertical();
                {
                    _listCopy[i] = DrawPropertyField(_listCopy[i]);
                }
                Gl.EndVertical();

                if (!option.ContainsFlag(ArrayFieldOption.NoClearButton))
                {
                    if (Gl.Button(_clearButtonContent, Gl.ExpandWidth(false)))
                    {
                        _listCopy[i] = default(T);
                    }
                }

                if (!option.ContainsFlag(ArrayFieldOption.FixedSize))
                {
                    if (Gl.Button(_removeButtonContent, Gl.ExpandWidth(false)))
                    {
                        _listCopy.Remove(_listCopy[i]);
                        i--;
                    }
                }

                if (!option.ContainsFlag(ArrayFieldOption.NoBoundries))
                {
                    Gl.EndHorizontal();
                }
            }

            if (!option.ContainsFlag(ArrayFieldOption.FixedSize))
            {
                if (Gl.Button("Add Element"))
                {
                    _listCopy.Add(default(T));
                }
            }

            if (!option.ContainsFlag(ArrayFieldOption.NoBoundries))
            {
                Gl.EndVertical();
            }

            return(_listCopy);
        }
        public static void Render()
        {
            GL.BeginVertical("box");
            GL.BeginHorizontal();
            settings.showPartyStatisticsCategory = GL.Toggle(settings.showPartyStatisticsCategory, RichTextUtils.MainCategoryFormat(Strings.GetText("mainCategory_PartyStats")), GL.ExpandWidth(false));
            if (!settings.showPartyStatisticsCategory)
            {
                GL.EndHorizontal();
            }
            else
            {
                MenuTools.FlexibleSpaceCategoryMenuElementsEndHorizontal("PartyOptions");

                GL.Space(10);

                MenuTools.ToggleButton(ref settings.toggleAccessRemoteCharacters, "buttonToggle_AccessRemoteCharacters", "tooltip_AccessRemoteCharacters", nameof(settings.toggleAccessRemoteCharacters));

                MenuTools.ToggleButtonActions(ref settings.toggleShowAllPartyPortraits, GroupControllerUtils.NaviBlockShowAllPartyMembers, GroupControllerUtils.NaviBlockShowDefault, "buttonToggle_ShowAllPartyPortraits", "tooltip_ShowAllPartyPortraits", nameof(settings.toggleShowAllPartyPortraits));

                GL.Space(10);

                GL.BeginHorizontal();
                Storage.statsFilterUnitEntityDataIndex = GL.SelectionGrid(Storage.statsFilterUnitEntityDataIndex, unitEntityDataFiltersArray, 3);
                GL.EndHorizontal();
                Player player = Game.Instance.Player;
                switch (Storage.statsFilterUnitEntityDataIndex)
                {
                case 0:
                    Storage.statsUnitEntityData = player.Party;
                    break;

                case 1:
                    Storage.statsUnitEntityData = player.ControllableCharacters;
                    break;

                case 2:
                    Storage.statsUnitEntityData = player.ActiveCompanions;
                    break;

                case 3:
                    Storage.statsUnitEntityData = player.AllCharacters;
                    break;

                case 4:
                    Storage.statsUnitEntityData = PartyUtils.GetRemoteCompanions();
                    break;

                case 5:
                    Storage.statsUnitEntityData = PartyUtils.GetCustomCompanions();
                    break;

                case 6:
                    Storage.statsUnitEntityData = PartyUtils.GetPets();
                    break;
                }
                if (Storage.statsFilterUnitEntityDataIndex != Storage.statsFilterUnitEntityDataIndexOld)
                {
                    Storage.reloadPartyStats = true;
                    Storage.statsFilterUnitEntityDataIndexOld = Storage.statsFilterUnitEntityDataIndex;
                }

                GL.Space(10);

                if (Storage.statsUnitEntityData.Any())
                {
                    if (Storage.reloadPartyStats)
                    {
                        Storage.statsSelectedControllableCharacterIndex = 0;
                        Storage.statsPartyMembers = Storage.statsUnitEntityData;
                        Storage.statsControllableCharacterNamesList.Clear();
                        foreach (UnitEntityData controllableCharacter in Storage.statsUnitEntityData)
                        {
                            Storage.statsControllableCharacterNamesList.Add(controllableCharacter.CharacterName);
                        }
                        Storage.reloadPartyStats = false;
                    }
                    if (!Storage.reloadPartyStats)
                    {
                        GL.BeginHorizontal();
                        Storage.statsSelectedControllableCharacterIndex = GL.SelectionGrid(Storage.statsSelectedControllableCharacterIndex, Storage.statsControllableCharacterNamesList.ToArray(), 6);
                        GL.EndHorizontal();

                        GL.Space(10);

                        GL.BeginVertical("box");
                        if (Storage.statsFilterUnitEntityDataIndex != 4)
                        {
                            MenuTools.SingleLineLabelGt("warning_SelectRemoteCharacters");
                        }
                        else
                        {
                            if (GL.Button(MenuTools.TextWithTooltip("button_AddRemoteCompanionToParty", "tooltip_AddRemoteCompanionToParty", false), GL.ExpandWidth(false)))
                            {
                                UnitEntityDataUtils.AddCompanion(Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex]);
                            }
                            GL.Space(10);
                            if (!StringUtils.ToToggleBool(settings.toggleShowAllPartyPortraits) && Game.Instance.Player.Party.Count > 6)
                            {
                                MenuTools.SingleLineLabelGt("warning_PartyLimitShowAllPartyPortraits");
                            }
                        }
                        GL.EndVertical();

                        GL.Space(10);

                        MainMenu.CurrentHitPointsOptions();

                        GL.Space(10);

                        MainMenu.ChangeName();

                        GL.Space(10);

                        MainMenu.ChangeGender();

                        GL.Space(10);


                        MainMenu.ClassData();

                        GL.Space(10);

                        //Menu.RaceData();

                        //GL.Space(10);

                        /*
                         * if (GL.Button(MenuTools.TextWithTooltip("button_RemoveEquippedItems", "tooltip_RemoveEquippedItems", false), GL.ExpandWidth(false)))
                         * {
                         *  foreach (ItemEntity itemEntity in Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].Inventory.Items)
                         *  {
                         *      if (itemEntity.Owner == Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].Descriptor)
                         *      {
                         *          itemEntity.HoldingSlot.RemoveItem();
                         *      }
                         *  }
                         * }
                         * GL.Space(10);*/

                        GL.BeginVertical("box");
                        GL.BeginHorizontal();
                        if (GL.Button(MenuTools.TextWithTooltip("button_ResetCharacterLevel", "tooltip_ResetCharacterLevel", false), GL.ExpandWidth(false)))
                        {
                            int level = 21;
                            int xp    = Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].Descriptor.Progression.Experience;
                            BlueprintStatProgression xpTable = BlueprintRoot.Instance.Progression.XPTable;

                            for (int i = 20; i >= 1; i--)
                            {
                                int xpBonus = xpTable.GetBonus(i);

                                modLogger.Log(i + ": " + xpBonus + " | " + xp);

                                if ((xp - xpBonus) >= 0)
                                {
                                    modLogger.Log(i + ": " + (xp - xpBonus));
                                    level = i;
                                    break;
                                }
                            }

                            Type         type         = Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].Descriptor.Progression.GetType();
                            PropertyInfo propertyInfo = type.GetProperty("CharacterLevel");
                            propertyInfo.SetValue(Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].Descriptor.Progression, level, null);
                        }
                        GL.EndHorizontal();

                        GL.Space(10);

                        GL.BeginHorizontal();
                        Storage.setCharLevel = GL.HorizontalSlider(Storage.setCharLevel, 1f, 20f, GL.Width(250f));
                        GL.Label($" {Mathf.RoundToInt(Storage.setCharLevel)}", GL.ExpandWidth(false));
                        GL.EndHorizontal();
                        GL.BeginHorizontal();
                        if (GL.Button(MenuTools.TextWithTooltip("button_SetCharacterLevel", "tooltip_SetCharacterLevel", "", $" {Mathf.RoundToInt(Storage.setCharLevel)}" + " " + StringUtils.PutInParenthesis(Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].CharacterName)), GL.ExpandWidth(false)))
                        {
                            Type         type            = Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].Descriptor.Progression.GetType();
                            PropertyInfo propertyInfoLvl = type.GetProperty("CharacterLevel");
                            propertyInfoLvl.SetValue(Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].Descriptor.Progression, Mathf.RoundToInt(Storage.setCharLevel), null);

                            int          newXp          = BlueprintRoot.Instance.Progression.XPTable.GetBonus(Mathf.RoundToInt(Storage.setCharLevel));
                            PropertyInfo propertyInfoXp = type.GetProperty("Experience");
                            propertyInfoXp.SetValue(Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].Descriptor.Progression, newXp, null);
                        }
                        GL.EndHorizontal();
                        MenuTools.SingleLineLabel(Strings.GetText("warning_SetCharacterLevel"));
                        GL.EndVertical();

                        GL.Space(10);

                        MenuTools.UnitAlignment(Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex]);

                        GL.Space(10);

                        GL.BeginVertical("box");

                        MenuTools.SingleLineLabel(RichTextUtils.Bold(Strings.GetText("header_Size")));
                        GL.BeginHorizontal();
                        Storage.partySelectedSizeIndex = GL.SelectionGrid(Storage.partySelectedSizeIndex, Storage.charSizeArray, 4);
                        GL.EndHorizontal();
                        GL.Space(10);
                        GL.BeginHorizontal();
                        if (GL.Button(MenuTools.TextWithTooltip("button_SetSizeTo", "tooltip_SetSize", "", $" {Storage.charSizeArray[Storage.partySelectedSizeIndex]}"), GL.ExpandWidth(false)))
                        {
                            Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].Descriptor.State.Size = (Size)Storage.partySelectedSizeIndex;
                        }
                        GL.EndHorizontal();
                        GL.BeginHorizontal();
                        if (GL.Button(MenuTools.TextWithTooltip("button_SetToOriginalSize", "tooltip_SetToOriginalSize", "", $" ({Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].Descriptor.OriginalSize})"), GL.ExpandWidth(false)))
                        {
                            Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].Descriptor.State.Size = Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].Descriptor.OriginalSize;
                        }
                        GL.EndHorizontal();
                        MenuTools.SingleLineLabel(Strings.GetText("label_CurrentSize") + ": " + Common.SizeToString(Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].Descriptor.State.Size));
                        GL.EndVertical();

                        GL.Space(10);

                        GL.BeginHorizontal();
                        GL.Label(MenuTools.TextWithTooltip("header_Statistics", "tooltip_Statistics", true));
                        GL.EndHorizontal();

                        GL.BeginHorizontal();
                        settings.partyStatsAmount = GL.TextField(settings.partyStatsAmount, 10, GL.Width(85f));
                        MenuTools.SettingParse(ref settings.partyStatsAmount, ref settings.partyFinalStatsAmount);
                        GL.EndHorizontal();

                        CharacterStats charStats = Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].Descriptor.Stats;
                        MenuTools.SingleLineLabel(RichTextUtils.Bold(Strings.GetText("header_AttributesBaseValues")));
                        foreach (KeyValuePair <string, StatType> entry in Storage.statsAttributesDict)
                        {
                            MenuTools.CreateStatInterface(entry.Key, charStats, entry.Value, settings.partyFinalStatsAmount);
                        }
                        MenuTools.SingleLineLabel(RichTextUtils.Bold(Strings.GetText("header_SkillsRanks")));

                        MenuTools.ToggleButton(ref settings.toggleShowOnlyClassSkills, "buttonToggle_ShowOnlyClassSkills", "tooltip_ShowOnlyClassSkills");

                        foreach (KeyValuePair <string, StatType> entry in Storage.statsSkillsDict)
                        {
                            if (StringUtils.ToToggleBool(settings.toggleShowOnlyClassSkills))
                            {
                                ModifiableValueSkill stat = charStats.GetStat(entry.Value) as ModifiableValueSkill;
                                if (stat.ClassSkill && stat.BaseValue > 0)
                                {
                                    MenuTools.CreateStatInterface(entry.Key, charStats, entry.Value, settings.partyFinalStatsAmount);
                                }
                            }
                            else
                            {
                                MenuTools.CreateStatInterface(entry.Key, charStats, entry.Value, settings.partyFinalStatsAmount, true);
                            }
                        }

                        MenuTools.SingleLineLabel(RichTextUtils.Bold(Strings.GetText("header_SocialSkillsBaseValues")));
                        foreach (KeyValuePair <string, StatType> entry in Storage.statsSocialSkillsDict)
                        {
                            MenuTools.CreateStatInterface(entry.Key, charStats, entry.Value, settings.partyFinalStatsAmount);
                        }
                        MenuTools.SingleLineLabel(RichTextUtils.Bold(Strings.GetText("header_StatsSaves")));
                        foreach (KeyValuePair <string, StatType> entry in Storage.statsSavesDict)
                        {
                            MenuTools.CreateStatInterface(entry.Key, charStats, entry.Value, settings.partyFinalStatsAmount);
                        }
                        MenuTools.SingleLineLabel(RichTextUtils.Bold(Strings.GetText("header_StatsCombat")));
                        foreach (KeyValuePair <string, StatType> entry in Storage.statsCombatDict)
                        {
                            MenuTools.CreateStatInterface(entry.Key, charStats, entry.Value, settings.partyFinalStatsAmount);
                        }
                        GL.Space(10);

                        GL.BeginHorizontal();
                        GL.Label(MenuTools.TextWithTooltip("header_PartyMultipliers", "tooltip_PartyMultipliers", true));
                        GL.EndHorizontal();

                        GL.BeginHorizontal();
                        settings.partyStatMultiplier = GL.HorizontalSlider(settings.partyStatMultiplier, 0.1f, 10f, GL.Width(300f));
                        GL.Label($" {Math.Round(settings.partyStatMultiplier, 1)}", GL.ExpandWidth(false));
                        GL.EndHorizontal();
                        MenuTools.SingleLineLabel(RichTextUtils.Bold(Strings.GetText("header_Attributes")));
                        foreach (KeyValuePair <string, StatType> entry in Storage.statsAttributesDict)
                        {
                            MenuTools.CreateStatMultiplierInterface(entry.Key, charStats, entry.Value, Storage.statsPartyMembers, settings.partyStatMultiplier);
                        }
                        MenuTools.SingleLineLabel(RichTextUtils.Bold(Strings.GetText("header_Skills")));
                        foreach (KeyValuePair <string, StatType> entry in Storage.statsSkillsDict)
                        {
                            MenuTools.CreateStatMultiplierInterface(entry.Key, charStats, entry.Value, Storage.statsPartyMembers, settings.partyStatMultiplier);
                        }
                        MenuTools.SingleLineLabel(RichTextUtils.Bold(Strings.GetText("header_SocialSkills")));
                        foreach (KeyValuePair <string, StatType> entry in Storage.statsSocialSkillsDict)
                        {
                            MenuTools.CreateStatMultiplierInterface(entry.Key, charStats, entry.Value, Storage.statsPartyMembers, settings.partyStatMultiplier);
                        }
                        MenuTools.SingleLineLabel(RichTextUtils.Bold(Strings.GetText("header_Saves")));
                        foreach (KeyValuePair <string, StatType> entry in Storage.statsSavesDict)
                        {
                            MenuTools.CreateStatMultiplierInterface(entry.Key, charStats, entry.Value, Storage.statsPartyMembers, settings.partyStatMultiplier);
                        }
                        MenuTools.SingleLineLabel(RichTextUtils.Bold(Strings.GetText("header_Combat")));
                        foreach (KeyValuePair <string, StatType> entry in Storage.statsCombatDict)
                        {
                            MenuTools.CreateStatMultiplierInterface(entry.Key, charStats, entry.Value, Storage.statsPartyMembers, settings.partyStatMultiplier);
                        }

                        GL.BeginHorizontal();

                        if (GL.Button(MenuTools.TextWithTooltip("button_ExportCharInfo", "tooltip_ExportCharInfo", false), GL.ExpandWidth(false)))
                        {
                            List <string> charInfoTxt = new List <string>();
                            charInfoTxt.Add($"{Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].CharacterName}");
                            charInfoTxt.Add("");
                            charInfoTxt.Add(Strings.GetText("header_AttributesBaseValues"));
                            foreach (KeyValuePair <string, StatType> entry in Storage.statsAttributesDict)
                            {
                                charInfoTxt.Add(($"{entry.Key}: {charStats.GetStat(entry.Value).BaseValue} ({charStats.GetStat(entry.Value).ModifiedValue})"));
                            }
                            charInfoTxt.Add("");
                            charInfoTxt.Add(Strings.GetText("header_SkillsRanks"));
                            foreach (KeyValuePair <string, StatType> entry in Storage.statsSkillsDict)
                            {
                                charInfoTxt.Add(($"{entry.Key}: {charStats.GetStat(entry.Value).BaseValue} ({charStats.GetStat(entry.Value).ModifiedValue})"));
                            }
                            charInfoTxt.Add("");
                            charInfoTxt.Add(Strings.GetText("header_SocialSkillsBaseValues"));
                            foreach (KeyValuePair <string, StatType> entry in Storage.statsSocialSkillsDict)
                            {
                                charInfoTxt.Add(($"{entry.Key}: {charStats.GetStat(entry.Value).BaseValue} ({charStats.GetStat(entry.Value).ModifiedValue})"));
                            }
                            charInfoTxt.Add("");
                            charInfoTxt.Add(Strings.GetText("header_StatsSaves"));
                            foreach (KeyValuePair <string, StatType> entry in Storage.statsSavesDict)
                            {
                                charInfoTxt.Add(($"{entry.Key}: {charStats.GetStat(entry.Value).BaseValue} ({charStats.GetStat(entry.Value).ModifiedValue})"));
                            }
                            charInfoTxt.Add("");
                            charInfoTxt.Add(Strings.GetText("header_StatsCombat"));
                            foreach (KeyValuePair <string, StatType> entry in Storage.statsCombatDict)
                            {
                                charInfoTxt.Add(($"{entry.Key}: {charStats.GetStat(entry.Value).BaseValue} ({charStats.GetStat(entry.Value).ModifiedValue})"));
                            }

                            File.WriteAllLines(Path.Combine(Common.ExportPath(), $"{Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].CharacterName}.txt"), charInfoTxt.ToArray());
                        }
                        GL.Label(" " + Strings.GetText("label_Location") + $": {Path.Combine(Common.ExportPath(), $"{Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].CharacterName}.txt")}");
                        GL.EndHorizontal();

                        if (File.Exists(Storage.modEntryPath + Storage.charactersImportFolder + "\\" + Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].CharacterName + ".txt"))
                        {
                            if (GL.Button(MenuTools.TextWithTooltip("button_ImportStatsFrom", "tooltip_ImportStatsFrom", "", $" { Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].CharacterName}.txt"), GL.ExpandWidth(false)))
                            {
                                if (settings.settingCreateBackupBeforeImport)
                                {
                                    List <string> charInfoTxt = new List <string>();
                                    charInfoTxt.Add($"{Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].CharacterName}");
                                    charInfoTxt.Add("");
                                    charInfoTxt.Add(Strings.GetText("header_AttributesBaseValues"));
                                    foreach (KeyValuePair <string, StatType> entry in Storage.statsAttributesDict)
                                    {
                                        charInfoTxt.Add(($"{entry.Key}: {charStats.GetStat(entry.Value).BaseValue} ({charStats.GetStat(entry.Value).ModifiedValue})"));
                                    }
                                    charInfoTxt.Add("");
                                    charInfoTxt.Add(Strings.GetText("header_SkillsRanks"));
                                    foreach (KeyValuePair <string, StatType> entry in Storage.statsSkillsDict)
                                    {
                                        charInfoTxt.Add(($"{entry.Key}: {charStats.GetStat(entry.Value).BaseValue} ({charStats.GetStat(entry.Value).ModifiedValue})"));
                                    }
                                    charInfoTxt.Add("");
                                    charInfoTxt.Add(Strings.GetText("header_SocialSkillsBaseValues"));
                                    foreach (KeyValuePair <string, StatType> entry in Storage.statsSocialSkillsDict)
                                    {
                                        charInfoTxt.Add(($"{entry.Key}: {charStats.GetStat(entry.Value).BaseValue} ({charStats.GetStat(entry.Value).ModifiedValue})"));
                                    }
                                    charInfoTxt.Add("");
                                    charInfoTxt.Add(Strings.GetText("header_StatsSaves"));
                                    foreach (KeyValuePair <string, StatType> entry in Storage.statsSavesDict)
                                    {
                                        charInfoTxt.Add(($"{entry.Key}: {charStats.GetStat(entry.Value).BaseValue} ({charStats.GetStat(entry.Value).ModifiedValue})"));
                                    }
                                    charInfoTxt.Add("");
                                    charInfoTxt.Add(Strings.GetText("header_StatsCombat"));
                                    foreach (KeyValuePair <string, StatType> entry in Storage.statsCombatDict)
                                    {
                                        charInfoTxt.Add(($"{entry.Key}: {charStats.GetStat(entry.Value).BaseValue} ({charStats.GetStat(entry.Value).ModifiedValue})"));
                                    }
                                    File.WriteAllLines(Path.Combine(Storage.modEntryPath + Storage.charactersImportFolder + "\\" + Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].CharacterName + "_Backup.txt"), charInfoTxt.ToArray());
                                }

                                string[] lines = File.ReadAllLines(Storage.modEntryPath + Storage.charactersImportFolder + "\\" + Storage.statsPartyMembers[Storage.statsSelectedControllableCharacterIndex].CharacterName + ".txt");
                                lines = lines.Where(x => !string.IsNullOrEmpty(x)).ToArray();
                                lines = lines.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
                                for (int i = 0; i < lines.Length; i++)
                                {
                                    if (Regex.IsMatch(lines[i], @"[\x20A-Za-z()]+:\s*[0-9]+"))
                                    {
                                        Match match = Regex.Match(lines[i], @"[\x20A-Za-z()]+:\s*[0-9]+");
                                        lines[i] = match.Value;
                                        string[] splitLine = lines[i].Split(':');
                                        Dictionary <string, StatType> allStats = Storage.statsAttributesDict.Union(Storage.statsSkillsDict).Union(Storage.statsSocialSkillsDict).Union(Storage.statsSavesDict).Union(Storage.statsCombatDict).ToDictionary(k => k.Key, v => v.Value);
                                        if (allStats.TryGetValue(splitLine[0], out StatType statType) && int.TryParse(splitLine[1], out int baseValue))
                                        {
                                            charStats.GetStat(statType).BaseValue = baseValue;
                                        }
                                    }
                                    else
                                    {
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    MenuTools.SingleLineLabel(Strings.GetText("message_NoUnitFound"));
                }
            }
            GL.EndVertical();
        }