Exemplo n.º 1
0
        public override void InitializeOnLoad(Lost.AppConfig.AppConfig appConfig)
        {
            var lostDefineSettings = appConfig.GetSettings <LostDefineSettings>();

            HashSet <string> definesToAdd    = new HashSet <string>();
            HashSet <string> definesToRemove = new HashSet <string>();

            foreach (var define in lostDefineSettings.defines)
            {
                if (define.IsEnabled)
                {
                    definesToAdd.Add(define.Name);
                }
                else
                {
                    definesToRemove.Add(define.Name);
                }
            }

            EditorAppConfigDefinesHelper.UpdateProjectDefines(definesToAdd, definesToRemove);
        }
Exemplo n.º 2
0
        public override void GetRuntimeConfigSettings(AppConfig.AppConfig appConfig, Dictionary <string, string> runtimeConfigSettings)
        {
            var settings = appConfig.GetSettings <DebugMenuSettings>();

            if (settings != null)
            {
                runtimeConfigSettings.Add(DebugMenuSettingsRuntime.InitializeAtStartupKey, settings.initializeAtStartup ? "1" : "0");

                // Settings
                runtimeConfigSettings.Add(DebugMenuSettingsRuntime.SettingsKey, JsonUtility.ToJson(this.settings));

                // Overlay
                runtimeConfigSettings.Add(DebugMenuSettingsRuntime.ShowAppVersionInLowerLeftKey, settings.showAppVersionToLowerLeft ? "1" : "0");
                runtimeConfigSettings.Add(DebugMenuSettingsRuntime.ShowPlayFabIdInLowerRightKey, settings.showPlayFabIdInLowerRight ? "1" : "0");

                // Menu Options
                runtimeConfigSettings.Add(DebugMenuSettingsRuntime.ShowTestAdKey, settings.showTestAd ? "1" : "0");
                runtimeConfigSettings.Add(DebugMenuSettingsRuntime.ShowToggleFpsKey, settings.showToggleFps ? "1" : "0");
                runtimeConfigSettings.Add(DebugMenuSettingsRuntime.ShowPrintAdsInfoKey, settings.showPrintAdsInfo ? "1" : "0");
            }
        }
Exemplo n.º 3
0
        public override void InitializeOnLoad(AppConfig.AppConfig buildConfig)
        {
            var settings = buildConfig.GetSettings <GeneralAppSettings>();

            if (settings == null)
            {
                return;
            }

            if (PlayerSettings.bundleVersion != settings.appVersion)
            {
                PlayerSettings.bundleVersion = settings.appVersion;
            }

            if (PlayerSettings.productName != settings.productName)
            {
                PlayerSettings.productName = settings.productName;
            }

            if (PlayerSettings.companyName != settings.companyName)
            {
                PlayerSettings.companyName = settings.companyName;
            }

            if (EditorSettings.projectGenerationRootNamespace != settings.rootNamespace)
            {
                EditorSettings.projectGenerationRootNamespace = settings.rootNamespace;
            }

            if (EditorSettings.lineEndingsForNewScripts != this.Convert(settings.lineEndings))
            {
                EditorSettings.lineEndingsForNewScripts = this.Convert(settings.lineEndings);
            }

            if (EditorSettings.serializationMode != settings.serializationMode)
            {
                EditorSettings.serializationMode = settings.serializationMode;
            }
        }
Exemplo n.º 4
0
        ////
        //// https://stackoverflow.com/questions/54186051/is-there-a-way-to-change-the-gradle-properties-file-in-unity
        ////
        public override void OnPostGenerateGradleAndroidProject(AppConfig.AppConfig appConfig, string gradlePath)
        {
            var settings = appConfig.GetSettings <AndroidXSetting>();

            if (settings == null || settings.overrideGradleProperties == false)
            {
                return;
            }

            string gradlePropertiesFile = gradlePath + "/gradle.properties";

            if (File.Exists(gradlePropertiesFile))
            {
                File.Delete(gradlePropertiesFile);
            }

            StreamWriter writer = File.CreateText(gradlePropertiesFile);

            writer.WriteLine("org.gradle.jvmargs=-Xmx4096M");
            writer.WriteLine("android.useAndroidX=" + settings.useAndroidX.ToString().ToLower());
            writer.WriteLine("android.enableJetifier=" + settings.enableJetifier.ToString().ToLower());
            writer.Flush();
            writer.Close();
        }
Exemplo n.º 5
0
        private void DrawAppConfigSettings(AppConfig appConfig, float currentViewWidth)
        {
            appConfig.ShowInherited = EditorGUILayout.Toggle("Show Inherited", appConfig.ShowInherited);

            List <Type> settingsToAdd = new List <Type>();

            foreach (var settingsType in BuildSettingsTypes)
            {
                bool isInherited = false;

                AppConfigSettings settings = appConfig.GetSettings(settingsType, out isInherited);

                if (settings == null)
                {
                    settingsToAdd.Add(settingsType);
                }
                else
                {
                    // Checking if we should skip this
                    if (isInherited && appConfig.ShowInherited == false)
                    {
                        continue;
                    }

                    bool didDeleteSettings = false;
                    this.DrawAppConfigSettings(appConfig, settings, isInherited, out didDeleteSettings);

                    if (didDeleteSettings)
                    {
                        break;
                    }
                }
            }

            int buttonWidth = (int)(currentViewWidth / 2.0f);

            for (int i = 0; i < settingsToAdd.Count; i += 2)
            {
                using (new EditorGUILayout.HorizontalScope())
                {
                    for (int j = 0; j < 2; j++)
                    {
                        int index = i + j;

                        if (index >= settingsToAdd.Count)
                        {
                            break;
                        }

                        var settingsType = settingsToAdd[index];

                        string buttonName = settingsType.Name;

                        if (buttonName.EndsWith("Settings"))
                        {
                            buttonName = buttonName.Replace("Settings", string.Empty);
                        }

                        if (GUILayout.Button(buttonName, GUILayout.Width(buttonWidth)))
                        {
                            var newSettings = ScriptableObject.CreateInstance(settingsType) as AppConfigSettings;
                            newSettings.name = newSettings.DisplayName;

                            appConfig.Settings.Add(newSettings);

                            string path = appConfig.GetPath();
                            AssetDatabase.AddObjectToAsset(newSettings, path);
                            AssetDatabase.ImportAsset(path);
                        }
                    }
                }
            }
        }