コード例 #1
0
        private bool DrawForceGenButton()
        {
            bool clicked = GL.Button(
                new GUIContent("Force Generate", "Deletes the current file thus forcing the generator to create a new one."),
                GL.Height(20)
                );

            return(clicked);
        }
コード例 #2
0
        private bool DrawGenButton()
        {
            GUI.backgroundColor = Color.white * 2.5f;
            GUI.contentColor    = Color.black * 5;
            bool clicked = GL.Button(
                new GUIContent("Generate", "Generates the file by writing new updated contents or generates the file is none is present."),
                GL.Height(20)
                );

            return(clicked);
        }
コード例 #3
0
 void blockHeader(string mainHeader, string secondHeader, int blockIdex)
 {
     BV();
     GL.Label(mainHeader, "TL Selection H2");
     BH();
     if (GL.Button(buttons[blockIdex], GL.Height(25f), GL.Width(50f))) toggles[blockIdex] = !toggles[blockIdex];
     BHS("HelpBox");
     GL.Label(secondHeader, "infoHelpBoxText");
     GL.Label(book, GL.Height(18f), GL.Width(20f));
     EH();
     EH();
     GL.Space(3);
 }
コード例 #4
0
        /// <summary>
        /// Draws expand (foldout type) button and allows you to set custom button height
        /// [ref override recommended]
        /// </summary>
        public static bool ExpandButton(bool b, string label, int height, U.FontStyle fontStyle = U.FontStyle.Normal)
        {
            bool _b = b;

            Gl.BeginHorizontal();
            U.GUIStyle _style = new U.GUIStyle(G.skin.button);
            _style.fontStyle = fontStyle;
            _style.richText  = true;
            _style.alignment = U.TextAnchor.MiddleLeft;

            if (Gl.Button((b ? "▼ " : "► ") + label, _style, Gl.Height(height)))
            {
                _b = !b;
            }
            Gl.EndHorizontal();
            return(_b);
        }
コード例 #5
0
 public static GUILayoutOption Height(float v) => GL.Height(v);
コード例 #6
0
 void separator()
 {
     GL.Space(10f);
     GL.Label("", "separator", GL.Height(1f));
     GL.Space(10f);
 }
コード例 #7
0
 ///<summary> Draws simple horizontal GUI line </summary>
 public static void HorizontalRule()
 {
     Gl.Box("", Gl.ExpandWidth(true), Gl.Height(2));
 }
コード例 #8
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);
        if (toggles[0])
        {
            buttons[0] = "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);
            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();

            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(20f));
            GL.EndHorizontal();
            GL.Space(15f);
            //Facebook Url
            GL.BeginVertical();
            GL.Label("FB Page ID", GL.Width(100f));
            GL.Label("Example:- 275994256098966 , angrybirds", GL.Width(250f));
            vars.facebookBtnUrl = EGL.TextArea(vars.facebookBtnUrl, GL.Height(20f));
            GL.EndVertical();
            GL.Space(15f);
            //Twitter Url
            GL.BeginVertical();
            GL.Label("Twitter URL", GL.Width(100f));
            GL.Label("Example:- https://twitter.com/SwapnilRane9", GL.Width(250f));
            vars.twitterBtnUrl = EGL.TextArea(vars.twitterBtnUrl, GL.Height(20f));
            GL.EndVertical();
            GL.Space(15f);
            separator();

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

        GL.EndScrollView();
        EditorUtility.SetDirty(vars);
    }
コード例 #9
0
        private void OnGUI()
        {
            if (settings == null)
            {
                settings = ConstantGenerator.GetSettingsFile();
            }

            if (logo == null)
            {
                logo = ConstantGenerator.GetLogo();
            }

            if (border == null)
            {
                border = ConstantGenerator.GetBorder();
            }

            EditorGUI.BeginChangeCheck();

            StartGUI("Layers");
            if (DrawGenButton())
            {
                LayersGen.Generate();
                window.Close();
            }

            if (DrawForceGenButton())
            {
                LayersGen.ForceGenerate();
                window.Close();
            }
            EndGUI();
            // -------------------------------------------------------------------------------------
            StartGUI("Tags");
            if (DrawGenButton())
            {
                TagsGen.Generate();
                window.Close();
            }

            if (DrawForceGenButton())
            {
                TagsGen.ForceGenerate();
                window.Close();
            }
            EndGUI();
            // -------------------------------------------------------------------------------------
            StartGUI("Sort Layers");
            if (DrawGenButton())
            {
                SortingLayersGen.Generate();
                window.Close();
            }

            if (DrawForceGenButton())
            {
                SortingLayersGen.ForceGenerate();
                window.Close();
            }
            EndGUI();
            // -------------------------------------------------------------------------------------
            StartGUI("Scenes");
            if (DrawGenButton())
            {
                ScenesGen.Generate();
                window.Close();
            }

            if (DrawForceGenButton())
            {
                ScenesGen.ForceGenerate();
                window.Close();
            }
            EndGUI();
            // -------------------------------------------------------------------------------------
            StartGUI("Shader Props");
            if (DrawGenButton())
            {
                ShaderPropsGen.Generate(false);
                window.Close();
            }

            if (DrawForceGenButton())
            {
                ShaderPropsGen.ForceGenerate();
                window.Close();
            }
            EndGUI();
            // -------------------------------------------------------------------------------------
            StartGUI("Anim Params");
            if (DrawGenButton())
            {
                AnimParamsGen.Generate();
                window.Close();
            }

            if (DrawForceGenButton())
            {
                AnimParamsGen.ForceGenerate();
                window.Close();
            }
            EndGUI();
            // -------------------------------------------------------------------------------------
            StartGUI("Anim Layers");
            if (DrawGenButton())
            {
                AnimLayersGen.Generate();
                window.Close();
            }

            if (DrawForceGenButton())
            {
                AnimLayersGen.ForceGenerate();
                window.Close();
            }
            EndGUI();
            // -------------------------------------------------------------------------------------
            StartGUI("Anim States");
            if (DrawGenButton())
            {
                AnimStatesGen.Generate();
                window.Close();
            }

            if (DrawForceGenButton())
            {
                AnimStatesGen.ForceGenerate();
                window.Close();
            }
            EndGUI();
            // -------------------------------------------------------------------------------------
            StartGUI("Nav Areas");
            if (DrawGenButton())
            {
                NavAreasGen.Generate();
                window.Close();
            }

            if (DrawForceGenButton())
            {
                NavAreasGen.ForceGenerate();
                window.Close();
            }
            EndGUI();
            // =========================================================================================
            DrawLine(Color.white, 2, 5);

            GUIStyle style = new GUIStyle(GUI.skin.button);

            style.alignment = TextAnchor.MiddleCenter;
            style.fontStyle = FontStyle.Bold;

            EGL.BeginHorizontal();
            EGL.BeginVertical();
            EGL.BeginHorizontal();
            if (GL.Button("GENERATE ALL", style))
            {
                LayersGen.Generate();
                TagsGen.Generate();
                SortingLayersGen.Generate();
                ScenesGen.Generate();
                ShaderPropsGen.Generate(false);
                AnimParamsGen.Generate();
                AnimLayersGen.Generate();
                AnimStatesGen.Generate();
                window.Close();
            }
            GL.FlexibleSpace();
            EGL.EndHorizontal();

            EGL.BeginHorizontal();
            if (GL.Button("FORCE GENERATE ALL", style))
            {
                LayersGen.ForceGenerate();
                TagsGen.ForceGenerate();
                SortingLayersGen.ForceGenerate();
                ScenesGen.ForceGenerate();
                ShaderPropsGen.ForceGenerate();
                AnimParamsGen.ForceGenerate();
                AnimLayersGen.ForceGenerate();
                AnimStatesGen.ForceGenerate();
                window.Close();
            }
            GL.FlexibleSpace();
            EGL.EndHorizontal();
            EGL.EndVertical();
            EGL.BeginVertical();
            // ---------------------------------------------------------------------------------------
            Color genOnReloadColor;
            Color updateOnReloadColor;

            if (settings.regenerateOnMissing)
            {
                genOnReloadColor = Color.green * 2;
            }
            else
            {
                genOnReloadColor = Color.white * 1.5f;
            }

            if (settings.updateOnReload)
            {
                updateOnReloadColor = Color.green * 2;
            }
            else
            {
                updateOnReloadColor = Color.white * 1.5f;
            }

            EGL.BeginHorizontal();
            GUI.backgroundColor = genOnReloadColor;
            if (GL.Button(new GUIContent("ReGen On Missing", "Automatically re-generates the constants file is none is present."), style))
            {
                settings.regenerateOnMissing = !settings.regenerateOnMissing;
                EditorUtility.SetDirty(settings);
            }
            EGL.EndHorizontal();

            EGL.BeginHorizontal();
            GUI.backgroundColor = updateOnReloadColor;
            if (GL.Button(new GUIContent("Update On Reload", "Automatically re-generates the constants on editor recompile if any changes are detected."), style))
            {
                settings.updateOnReload = !settings.updateOnReload;
                EditorUtility.SetDirty(settings);
            }
            EGL.EndHorizontal();

            EGL.EndVertical();
            EGL.EndHorizontal();
            // =========================================================================================
            DrawLine(Color.white, 2, 5);

            GUI.backgroundColor = Color.gray;
            GUI.contentColor    = Color.white * 10;

// check for unity versions using conditional directives
// NOTE: there is no "BeginFoldoutHeaderGroup" in below 2019.1
 #if UNITY_2019_OR_NEWER
            showFoldOut = EGL.BeginFoldoutHeaderGroup(showFoldOut, "Create Generator Script");
#else
            showFoldOut = EGL.Foldout(showFoldOut, "Create Generator Script");
 #endif
            if (showFoldOut)
            {
                GL.Space(5);
                GUI.contentColor = Color.white * 10;
                generatorName    = EGL.TextField("Generator Name", generatorName);
                outputFileName   = EGL.TextField("Output File Name", outputFileName);

                GL.Space(5);
                EGL.BeginHorizontal();

                if (!settings.regenerateOnMissing)
                {
                    EGL.BeginVertical();
                    GL.FlexibleSpace();
                    EGL.HelpBox("NOTE: Force Generate will only delete the file but will NOT generate a new one if the [ReGen On Missing] is turned off",
                                MessageType.Warning);
                    EGL.EndVertical();
                }
                else
                {       // ============================================================================
                        // Draw Ma Awesome Logo
                    EGL.BeginVertical();
                    GL.FlexibleSpace();
                    Rect horiRect = EGL.BeginHorizontal();

                    Rect boxRect = new Rect(horiRect.x + 3, horiRect.y - 54, 125, 52);

                    Rect backgroundRect = boxRect;
                    backgroundRect.width  = border.width;
                    backgroundRect.height = border.height;
                    GUI.DrawTexture(backgroundRect, border);
                    // GUI.Box( boxRect, iconBackground, );

                    GUI.Label(new Rect(boxRect.x + 3, boxRect.y + 16, 100, 20), "Created BY: ");

                    Rect logoRect = new Rect(boxRect.x + 76, boxRect.y + 2, logo.width, logo.height);
                    GUI.DrawTexture(logoRect, logo);

                    EGL.EndHorizontal();
                    EGL.EndVertical();
                    // ============================================================================
                }

                GL.FlexibleSpace();

                GUI.contentColor = Color.white * 5;
                EGL.BeginVertical();
                GL.FlexibleSpace();
                GUI.backgroundColor = Color.white * 2.5f;
                GUI.contentColor    = Color.black * 5;
                if (GL.Button("Create", new GUIStyle(GUI.skin.button)
                {
                    fontStyle = FontStyle.Bold, fontSize = 12
                },
                              GL.Width(75), GL.Height(30)))
                {
                    if (generatorName == string.Empty || outputFileName == string.Empty || generatorName == null || outputFileName == null)
                    {
                        Debug.LogWarning("Fill out all the fields");
                    }
                    else
                    {
                        TemplateGen.GenerateTemplate(generatorName, outputFileName);
                        window.Close();
                    }
                }
                EGL.EndVertical();
                GL.Space(1);
                EGL.EndHorizontal();
            }

 #if UNITY_2019_OR_NEWER
            EGL.EndFoldoutHeaderGroup();
 #endif

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(settings);
            }
        }
コード例 #10
0
    void OnGUI()
    {
        //This is used for debugging, when the code is changed, simply refocussing the City Generator window will reload the code
        if (window == null)
        {
            OpenWindow();
        }
        scrollLocation = EGL.BeginScrollView(scrollLocation);

        GL.BeginHorizontal();
        GL.Label("Procedural City Generator", EditorStyles.boldLabel);
        GL.Space(50);
        EGL.BeginHorizontal("Box");
        rDebugToggle.target = EGL.ToggleLeft("Debug Mode?", rDebugToggle.target);
        EGL.EndHorizontal();
        GL.EndHorizontal();

        GL.Box("", new GUILayoutOption[] { GL.ExpandWidth(true), GL.Height(1) });
        showTerrainGUI();

        GL.Box("", new GUILayoutOption[] { GL.ExpandWidth(true), GL.Height(1) });
        showPopulationMapGUI();

        GL.Box("", new GUILayoutOption[] { GL.ExpandWidth(true), GL.Height(1) });
        showGrowthMapGUI();

        GL.Box("", new GUILayoutOption[] { GL.ExpandWidth(true), GL.Height(1) });
        showRoadMapGUI();

        GL.Box("", new GUILayoutOption[] { GL.ExpandWidth(true), GL.Height(1) });
        showBuildingGUI();

        GL.Box("", new GUILayoutOption[] { GL.ExpandWidth(true), GL.Height(1) });
        if (GL.Button("Reset"))
        {
            oldShowPop          = false;
            oldShowGrowth       = false;
            showTerrainUI       = true;
            showPopUI           = false;
            showGrowthUI        = false;
            showRoadMapAdvanced = false;
            showRoadMapUI       = false;
            showBuildingUI      = false;
            terrainGenerated    = false;
            populationGenerated = false;
            growthMapGenerated  = false;
            roadMapGenerated    = false;
            roadMeshGenerated   = false;

            terrainLabel    = "1. Terrain Generation - NOT COMPLETED ✘";
            populationLabel = "2. Population Map Generation - NOT COMPLETED ✘";
            growthLabel     = "3. Growth Map Generation - NOT COMPLETED ✘";
            roadmapLabel    = "4. Road Map Generation - NOT COMPLETED ✘";
            buildingLabel   = "5. Building Generation - NOT COMPLETED ✘";
        }

        // TESTING

        /*
         * if (GL.Button ("Generate Houses")) {
         *      generator.testHouses ();
         * }*/
        //END TESTING

        EGL.EndScrollView();
    }
コード例 #11
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();
    }
コード例 #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) { }
    }