コード例 #1
0
ファイル: UI+Pickers.cs プロジェクト: cabarius/WrathModMaker
        public static void EnumerablePicker <T>(
            String title,
            ref int selected,
            IEnumerable <T> range,
            int xCols,
            Func <T, String> titleFormater = null,
            params GUILayoutOption[] options
            )
        {
            if (titleFormater == null)
            {
                titleFormater = (a) => $"{a}";
            }
            if (selected > range.Count())
            {
                selected = 0;
            }
            int sel    = selected;
            var titles = range.Select((a, i) => i == sel ? titleFormater(a).orange().bold() : titleFormater(a));

            if (xCols > range.Count())
            {
                xCols = range.Count();
            }
            if (xCols <= 0)
            {
                xCols = range.Count();
            }
            UI.Label(title, UI.AutoWidth());
            UI.Space(25);
            selected = GL.SelectionGrid(selected, titles.ToArray(), xCols, options);
        }
コード例 #2
0
ファイル: UI+Pickers.cs プロジェクト: cabarius/WrathModMaker
        public static NamedFunc <T> TypePicker <T>(String title, ref int selectedIndex, NamedFunc <T>[] items) where T : class
        {
            int sel    = selectedIndex;
            var titles = items.Select((item, i) => i == sel ? item.name.orange().bold() : item.name).ToArray();

            if (title?.Length > 0)
            {
                Label(title);
            }
            selectedIndex = GL.SelectionGrid(selectedIndex, titles, 6);
            return(items[selectedIndex]);
        }
コード例 #3
0
ファイル: UI+Pickers.cs プロジェクト: cabarius/WrathModMaker
        public static void ActionSelectionGrid(ref int selected, String[] texts, int xCols, Action <int> action, GUIStyle style, params GUILayoutOption[] options)
        {
            int sel    = selected;
            var titles = texts.Select((a, i) => i == sel ? a.orange().bold() : a);

            if (xCols <= 0)
            {
                xCols = texts.Count();
            }
            sel = GL.SelectionGrid(selected, titles.ToArray(), xCols, style, options);
            if (selected != sel)
            {
                selected = sel;
                action(selected);
            }
        }
コード例 #4
0
ファイル: UI+Pickers.cs プロジェクト: cabarius/WrathModMaker
        public static bool SelectionGrid <T>(ref int selected, T[] items, int xCols, GUIStyle style, params GUILayoutOption[] options)
        {
            if (xCols <= 0)
            {
                xCols = items.Count();
            }
            if (UI.IsNarrow)
            {
                xCols = Math.Min(4, xCols);
            }
            int sel    = selected;
            var titles = items.Select((a, i) => i == sel ? $"{a}".orange().bold() : $"{a}");

            if (xCols <= 0)
            {
                xCols = items.Count();
            }
            selected = GL.SelectionGrid(selected, titles.ToArray(), xCols, style, options);
            return(sel != selected);
        }
コード例 #5
0
ファイル: UI+Pickers.cs プロジェクト: cabarius/WrathModMaker
        public static bool SelectionGrid(ref int selected, String[] texts, int xCols, params GUILayoutOption[] options)
        {
            if (xCols <= 0)
            {
                xCols = texts.Count();
            }
            if (UI.IsNarrow)
            {
                xCols = Math.Min(4, xCols);
            }
            int sel    = selected;
            var titles = texts.Select((a, i) => i == sel ? a.orange().bold() : a);

            if (xCols <= 0)
            {
                xCols = texts.Count();
            }
            selected = GL.SelectionGrid(selected, titles.ToArray(), xCols, options);
            return(sel != selected);
        }
コード例 #6
0
ファイル: GUILayout.cs プロジェクト: kmlkmljkl2/Anarchy
 public static void SelectionGrid(Setting <int> set, string[] labels, int xCount)
 {
     set.Value = UGUI.SelectionGrid(set.Value, labels, xCount, Style.SelectionGrid, DefaultOption);
 }
コード例 #7
0
ファイル: GUILayout.cs プロジェクト: kmlkmljkl2/Anarchy
 public static int SelectionGrid(int value, string[] labels, int xCount, GUILayoutOption[] opts)
 {
     return(UGUI.SelectionGrid(value, labels, xCount, Style.SelectionGrid, opts));
 }
コード例 #8
0
ファイル: GUILayout.cs プロジェクト: kmlkmljkl2/Anarchy
 public static int SelectionGrid(int value, string[] labels, int xCount)
 {
     return(UGUI.SelectionGrid(value, labels, xCount, Style.SelectionGrid, DefaultOption));
 }
コード例 #9
0
 public static int SelectionGrid(int selected, string[] texts, int xCount, GUIStyle style, params GUILayoutOption[] options)
 {
     return(GUILayout.SelectionGrid(selected, GUIContent.Temp(texts), xCount, style, options));
 }
コード例 #10
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();
        }
コード例 #11
0
        public static void ActionKeyEditStatsGui(UnitEntityData unit)
        {
            GL.Space(10);
            GL.BeginHorizontal();
            editUnitSelectedSizeIndex = GL.SelectionGrid(editUnitSelectedSizeIndex, Storage.charSizeArray, 4);
            GL.EndHorizontal();

            GL.Space(10);
            GL.BeginHorizontal();
            if (GL.Button(Strings.GetText("button_SetSizeTo") + $" {Storage.charSizeArray[editUnitSelectedSizeIndex]}",
                          GL.ExpandWidth(false)))
            {
                unit.Descriptor.State.Size = (Size)editUnitSelectedSizeIndex;
            }
            GL.EndHorizontal();
            GL.BeginHorizontal();
            if (GL.Button(Strings.GetText("button_SetToOriginalSize") + $" ({unit.Descriptor.OriginalSize})",
                          GL.ExpandWidth(false)))
            {
                unit.Descriptor.State.Size = unit.Descriptor.OriginalSize;
            }
            GL.EndHorizontal();
            MenuTools.SingleLineLabel(Strings.GetText("label_CurrentSize") + ": " + unit.Descriptor.State.Size);
            GL.Space(10);

            GL.BeginHorizontal();
            if (unit.Descriptor.HPLeft > 0)
            {
                if (GL.Button(Strings.GetText("button_Kill"), GL.ExpandWidth(false)))
                {
                    Common.Kill(unit);
                }
                if (GL.Button(Strings.GetText("button_Panic"), GL.ExpandWidth(false)))
                {
                    unit.Descriptor.AddFact(
                        (BlueprintUnitFact)Utilities.GetBlueprintByGuid <BlueprintBuff>(
                            "cf0e277e6b785f449bbaf4e993b556e0"), (MechanicsContext)null, new FeatureParam());
                }
                if (GL.Button(Strings.GetText("button_Freeze"), GL.ExpandWidth(false)))
                {
                    unit.Descriptor.AddFact(
                        (BlueprintUnitFact)Utilities.GetBlueprintByGuid <BlueprintBuff>(
                            "af1e2d232ebbb334aaf25e2a46a92591"), (MechanicsContext)null, new FeatureParam());
                }
                if (GL.Button(Strings.GetText("button_MakeCower"), GL.ExpandWidth(false)))
                {
                    unit.Descriptor.AddFact(
                        (BlueprintUnitFact)Utilities.GetBlueprintByGuid <BlueprintBuff>(
                            "6062e3a8206a4284d867cbb7120dc091"), (MechanicsContext)null, new FeatureParam());
                }
                if (GL.Button(Strings.GetText("button_SetOnFire"), GL.ExpandWidth(false)))
                {
                    unit.Descriptor.AddFact(
                        (BlueprintUnitFact)Utilities.GetBlueprintByGuid <BlueprintBuff>(
                            "315acb0b29671f74c8c7cc062b23b9d6"), (MechanicsContext)null, new FeatureParam());
                }
            }

            GL.EndHorizontal();

            GL.BeginHorizontal();
            editUnitStatsAmount = GL.TextField(editUnitStatsAmount, 10, GL.Width(85f));

            editUnitStatsAmount      = MenuTools.IntTestSettingStage1(editUnitStatsAmount);
            editUnitFinalStatsAmount = MenuTools.IntTestSettingStage2(editUnitStatsAmount, editUnitFinalStatsAmount);
            GL.EndHorizontal();

            var charStats = unit.Descriptor.Stats;

            MenuTools.SingleLineLabel(RichText.Bold(Strings.GetText("header_AttributesBaseValues")));
            foreach (var entry in Storage.statsAttributesDict)
            {
                MenuTools.CreateStatInterface(entry.Key, charStats, entry.Value, editUnitFinalStatsAmount);
            }
            MenuTools.SingleLineLabel(RichText.Bold(Strings.GetText("header_SkillsRanks")));
            foreach (var entry in Storage.statsSkillsDict)
            {
                MenuTools.CreateStatInterface(entry.Key, charStats, entry.Value, editUnitFinalStatsAmount);
            }
            MenuTools.SingleLineLabel(RichText.Bold(Strings.GetText("header_SocialSkillsBaseValues")));
            foreach (var entry in Storage.statsSocialSkillsDict)
            {
                MenuTools.CreateStatInterface(entry.Key, charStats, entry.Value, editUnitFinalStatsAmount);
            }
            MenuTools.SingleLineLabel(RichText.Bold(Strings.GetText("header_StatsSaves")));
            foreach (var entry in Storage.statsSavesDict)
            {
                MenuTools.CreateStatInterface(entry.Key, charStats, entry.Value, editUnitFinalStatsAmount);
            }
            MenuTools.SingleLineLabel(RichText.Bold(Strings.GetText("header_StatsCombat")));
            foreach (var entry in Storage.statsCombatDict)
            {
                MenuTools.CreateStatInterface(entry.Key, charStats, entry.Value, editUnitFinalStatsAmount);
            }
        }
コード例 #12
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) {}
    }
コード例 #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) { }
    }
コード例 #14
0
        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();
        }
コード例 #15
0
 public static int SelectionGrid(int selected, Texture[] images, int xCount, GUIStyle style, params GUILayoutOption[] options)
 {
     return(GUILayout.SelectionGrid(selected, GUIContent.Temp(images), xCount, style, options));
 }
コード例 #16
0
ファイル: GUILayout.cs プロジェクト: kmlkmljkl2/Anarchy
 public static void SelectionGrid(Setting <int> set, string[] labels, int xCount, GUILayoutOption[] opts)
 {
     set.Value = UGUI.SelectionGrid(set.Value, labels, xCount, Style.SelectionGrid, opts);
 }
コード例 #17
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);
    }
コード例 #18
0
 public static int SelectionGrid(int selected, GUIContent[] content, int xCount, params GUILayoutOption[] options)
 {
     return(GUILayout.SelectionGrid(selected, content, xCount, GUI.skin.button, options));
 }