Пример #1
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);
    }
Пример #2
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) {}
    }