Exemple #1
0
        public static SettingsWindow OpenSettings()
        {
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                return(null);
            }


            SettingsWindow window = SettingsWindow.InitWindow();

            #region COMMON
            CommonAppSettings commonAppSettings;

            string[] commonAppSettingsGuids = AssetDatabase.FindAssets(CommonAppSettings.NAME + " t:ScriptableObject");

            ThrowSettingsNotFound(commonAppSettingsGuids, CommonAppSettings.NAME);

                        #if UNITY_5_3_OR_NEWER
            commonAppSettings      = AssetDatabase.LoadAssetAtPath <CommonAppSettings>(AssetDatabase.GUIDToAssetPath(commonAppSettingsGuids[0]));
            Selection.activeObject = commonAppSettings;
                        #else
            commonAppSettings      = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(commonAppSettingsGuids[0]), typeof(CommonAppSettings));
            Selection.activeObject = commonAppSettings;
                        #endif
            window.SetCommonAppSettings(commonAppSettings);

            #endregion

            #region ADS

                        #if APPADVISORY_ADS
            ADIDS    adIDs;
            string[] adIDsGuids = AssetDatabase.FindAssets("ADS_SETTING" + " t:ScriptableObject");

            ThrowSettingsNotFound(adIDsGuids, ADIDS.NAME);

                        #if UNITY_5_3_OR_NEWER
            adIDs = AssetDatabase.LoadAssetAtPath <ADIDS>(AssetDatabase.GUIDToAssetPath(adIDsGuids[0]));
                        #else
            adIDs = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(adIDsGuids[0]), typeof(ADIDS));
                        #endif
            window.SetAdIDs(adIDs);
                        #endif

            #endregion

            #region GIFs

                        #if VSGIF
            GIFSettings gifSettings;
            string[]    gifsGuids = AssetDatabase.FindAssets(GIFSettings.NAME + " t:ScriptableObject");

            ThrowSettingsNotFound(gifsGuids, GIFSettings.NAME);

                        #if UNITY_5_3_OR_NEWER
            gifSettings = AssetDatabase.LoadAssetAtPath <GIFSettings>(AssetDatabase.GUIDToAssetPath(gifsGuids[0]));
                        #else
            gifSettings = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(gifsGuids[0]), typeof(GIFSettings));
                        #endif
            window.SetGIFs(gifSettings);
                        #endif

            #endregion

            #region LEADERBOARD

                        #if APPADVISORY_LEADERBOARD
            LEADERBOARDIDS leaderboardIDs;

            string[] leaderboardIDsGuids = AssetDatabase.FindAssets(LEADERBOARDIDS.NAME + " t:ScriptableObject");

            ThrowSettingsNotFound(leaderboardIDsGuids, LEADERBOARDIDS.NAME);

                        #if UNITY_5_3_OR_NEWER
            leaderboardIDs = AssetDatabase.LoadAssetAtPath <LEADERBOARDIDS>(AssetDatabase.GUIDToAssetPath(leaderboardIDsGuids[0]));
                        #else
            leaderboardIDs = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(leaderboardIDsGuids[0]), typeof(LEADERBOARDIDS));
                        #endif
            window.SetLeaderboardIDs(leaderboardIDs);
                        #endif

            #endregion

            #region RATEUS

                        #if VSRATE
            RateUsSettings rateUsSettings;

            string[] rateUsSettingsGuids = AssetDatabase.FindAssets(RateUsSettings.NAME + " t:ScriptableObject");

            ThrowSettingsNotFound(rateUsSettingsGuids, RateUsSettings.NAME);

                        #if UNITY_5_3_OR_NEWER
            rateUsSettings = AssetDatabase.LoadAssetAtPath <RateUsSettings>(AssetDatabase.GUIDToAssetPath(rateUsSettingsGuids[0]));
                        #else
            rateUsSettings = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(rateUsSettingsGuids[0]), typeof(RateUsSettings));
                        #endif
            window.SetRateUsSettings(rateUsSettings);
                        #endif

            #endregion

            #region SHARE

                        #if VS_SHARE
            ShareSettings shareSettings;

            string[] shareSettingsGuids = AssetDatabase.FindAssets(ShareSettings.NAME + " t:ScriptableObject");

            ThrowSettingsNotFound(shareSettingsGuids, ShareSettings.NAME);

                        #if UNITY_5_3_OR_NEWER
            shareSettings = AssetDatabase.LoadAssetAtPath <ShareSettings>(AssetDatabase.GUIDToAssetPath(shareSettingsGuids[0]));
                        #else
            shareSettings = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(shareSettingsGuids[0]), typeof(ShareSettings));
                        #endif

            window.SetShareSettings(shareSettings);
                        #endif

            #endregion
            window.SetModeFromOpenedTab();
            return(window);
        }
Exemple #2
0
        public static SettingsWindow OpenSettings()
        {
            SettingsWindow window = SettingsWindow.InitWindow();

            #region COMMON
            CommonAppSettings commonAppSettings;

            string[] commonAppSettingsGuids = AssetDatabase.FindAssets(CommonAppSettings.NAME + " t:ScriptableObject");

                        #if UNITY_5_3_OR_NEWER
            commonAppSettings      = AssetDatabase.LoadAssetAtPath <CommonAppSettings>(AssetDatabase.GUIDToAssetPath(commonAppSettingsGuids[0]));
            Selection.activeObject = commonAppSettings;
                        #else
            commonAppSettings      = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(commonAppSettingsGuids[0]), typeof(CommonAppSettings));
            Selection.activeObject = commonAppSettings;
                        #endif
            window.SetCommonAppSettings(commonAppSettings);

            #endregion

            #region ADS

                        #if APPADVISORY_ADS
            ADIDS    adIDs;
            string[] adIDsGuids = AssetDatabase.FindAssets("ADS_SETTING" + " t:ScriptableObject");

                        #if UNITY_5_3_OR_NEWER
            adIDs = AssetDatabase.LoadAssetAtPath <ADIDS>(AssetDatabase.GUIDToAssetPath(adIDsGuids[0]));
                        #else
            adIDs = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(adIDsGuids[0]), typeof(ADIDS));
                        #endif
            window.SetAdIDs(adIDs);
                        #endif

            #endregion

            #region GIFs

                        #if VSGIF
            GIFSettings gifSettings;
            string[]    gifsGuids = AssetDatabase.FindAssets(GIFSettings.NAME + " t:ScriptableObject");

                        #if UNITY_5_3_OR_NEWER
            gifSettings = AssetDatabase.LoadAssetAtPath <GIFSettings>(AssetDatabase.GUIDToAssetPath(gifsGuids[0]));
                        #else
            gifSettings = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(gifsGuids[0]), typeof(GIFSettings));
                        #endif
            window.SetGIFs(gifSettings);
                        #endif

            #endregion

            #region LEADERBOARD

                        #if APPADVISORY_LEADERBOARD
            LEADERBOARDIDS leaderboardIDs;

            string[] leaderboardIDsGuids = AssetDatabase.FindAssets("LEADERBOARD_SETTING" + " t:ScriptableObject");

                        #if UNITY_5_3_OR_NEWER
            leaderboardIDs = AssetDatabase.LoadAssetAtPath <LEADERBOARDIDS>(AssetDatabase.GUIDToAssetPath(leaderboardIDsGuids[0]));
                        #else
            leaderboardIDs = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(leaderboardIDsGuids[0]), typeof(LEADERBOARDIDS));
                        #endif
            window.SetLeaderboardIDs(leaderboardIDs);
                        #endif

            #endregion

            #region RATEUS

                        #if VSRATE
            RateUsSettings rateUsSettings;

            string[] rateUsSettingsGuids = AssetDatabase.FindAssets(RateUsSettings.NAME + " t:ScriptableObject");

                        #if UNITY_5_3_OR_NEWER
            rateUsSettings = AssetDatabase.LoadAssetAtPath <RateUsSettings>(AssetDatabase.GUIDToAssetPath(rateUsSettingsGuids[0]));
                        #else
            rateUsSettings = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(rateUsSettingsGuids[0]), typeof(RateUsSettings));
                        #endif
            window.SetRateUsSettings(rateUsSettings);
                        #endif

            #endregion

            #region SHARE

                        #if VS_SHARE
            ShareSettings shareSettings;

            string[] shareSettingsGuids = AssetDatabase.FindAssets(ShareSettings.NAME + " t:ScriptableObject");

                        #if UNITY_5_3_OR_NEWER
            shareSettings = AssetDatabase.LoadAssetAtPath <ShareSettings>(AssetDatabase.GUIDToAssetPath(shareSettingsGuids[0]));
                        #else
            shareSettings = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(shareSettingsGuids[0]), typeof(ShareSettings));
                        #endif

            window.SetShareSettings(shareSettings);
                        #endif

            #endregion

            return(window);
        }