Пример #1
0
 void OtherSectionGUI()
 {
     if (BeginSettingsBox(5, new GUIContent("Other Settings")))
     {
         GUILayout.Label("Description", EditorStyles.boldLabel, new GUILayoutOption[0]);
         GUILayout.Label("132 characters (" + (132 - BuildSettings.Get.description.Length) + " left)");
         BuildSettings.Get.description = GUILayout.TextArea(BuildSettings.Get.description, 132, GUILayout.MinHeight(50));
         EditorGUILayout.Space();
         EditorGUILayout.BeginHorizontal();
         GUILayout.Label("Short Name (12 chars)");
         BuildSettings.Get.shortName = GUILayout.TextField(BuildSettings.Get.shortName, 12);
         EditorGUILayout.EndHorizontal();
         EditorGUILayout.Space();
         EditorGUILayout.HelpBox("Check the \"Other Settings\" section of the WebGL Player Settings.", MessageType.Info);
         EditorGUILayout.BeginHorizontal();
         GUILayout.FlexibleSpace();
         if (GUILayout.Button(new GUIContent("Player Settings..."), GUILayout.Width(150)))
         {
             Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
         }
         GUILayout.Space(10);
         EditorGUILayout.EndHorizontal();
     }
     EndSettingsBox();
 }
Пример #2
0
    private static void ModifyPlayerSettingForiOS(ExportXcodeConfiguration config)
    {
        //宏定义设置
        //PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, "ISSDK;IRIS");

        PlayerSettings.companyName           = config.CompanyName;
        PlayerSettings.productName           = config.ProductName;
        PlayerSettings.applicationIdentifier = config.ApplicationIdentifier;
        PlayerSettings.bundleVersion         = config.ClientVersion;
        PlayerSettings.iOS.buildNumber       = config.VersionCode;
        Texture2D splash_tx = config.Splash;

        PlayerSettings.SplashScreen.show = false;
        PlayerSettings.iOS.SetiPadLaunchScreenType(iOSLaunchScreenType.Default);
        PlayerSettings.iOS.SetiPhoneLaunchScreenType(iOSLaunchScreenType.Default);

        PlayerSettings.virtualRealitySplashScreen = splash_tx;

        //Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
        SerializedObject   serializeObj     = new SerializedObject(Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings"));
        SerializedProperty iOSSplashTexture = serializeObj.FindProperty("iPhoneSplashScreen");

        iOSSplashTexture.objectReferenceValue = splash_tx;
        serializeObj.ApplyModifiedProperties();
    }
Пример #3
0
    private void ShowProjectSettings(string settingsType, string settingsSuffix = "Settings")
    {
#if UNITY_2018_1_OR_NEWER
        Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton(settingsType + settingsSuffix);
#else
        EditorApplication.ExecuteMenuItem("Edit/Project Settings/" + settingsType);
#endif
    }
    /// <summary>
    /// Opens the player setting window.
    /// </summary>
    static public void OpenPlayerSetting()
    {
#if UNITY_2018_3_OR_NEWER
        Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
#elif
        EditorApplication.ExecuteMenuItem("Edit/Project Settings/Player");
#endif
    }
Пример #5
0
    public UTPlayerSettingsExt()
    {
        serializedObject = new SerializedObject(Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings"));

        iPhoneSplashScreen               = FindPropertyAssert("iPhoneSplashScreen");
        iPhoneHighResSplashScreen        = FindPropertyAssert("iPhoneHighResSplashScreen");
        iPhoneTallHighResSplashScreen    = FindPropertyAssert("iPhoneTallHighResSplashScreen");
        iPadPortraitSplashScreen         = FindPropertyAssert("iPadPortraitSplashScreen");
        iPadHighResPortraitSplashScreen  = FindPropertyAssert("iPadHighResPortraitSplashScreen");
        iPadLandscapeSplashScreen        = FindPropertyAssert("iPadLandscapeSplashScreen");
        iPadHighResLandscapeSplashScreen = FindPropertyAssert("iPadHighResLandscapeSplashScreen");
    }
Пример #6
0
 private void ThrowIfInvalid(string packageName)
 {
     if (!this.IsValidAndroidBundleIdentifier(packageName))
     {
         string message = "Please set the Bundle Identifier in the Player Settings.";
         message = (message + " The value must follow the convention 'com.YourCompanyName.YourProductName'") + " and can contain alphanumeric characters and underscore." + "\nEach segment must not start with a numeric character or underscore.";
         Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
         CancelPostProcess.AbortBuild("Bundle Identifier has not been set up correctly", message, null);
     }
     if (!this.IsValidJavaPackageName(packageName))
     {
         Debug.LogWarning((("As of Unity 4.2 the restrictions on the Bundle Identifier has been updated " + " to include those for java package names. Specifically the" + " restrictions have been updated regarding reserved java keywords.") + "\n" + "\nhttp://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html") + "\nhttp://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.9" + "\n");
     }
 }
Пример #7
0
 void SplashSectionGUI()
 {
     if (BeginSettingsBox(4, new GUIContent("Splash Image")))
     {
         EditorGUILayout.Space();
         EditorGUILayout.HelpBox("Check the \"Splash Image\" section of the WebGL Player Settings.", MessageType.Info);
         EditorGUILayout.BeginHorizontal();
         GUILayout.FlexibleSpace();
         if (GUILayout.Button(new GUIContent("Player Settings..."), GUILayout.Width(150)))
         {
             Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
         }
         GUILayout.Space(10);
         EditorGUILayout.EndHorizontal();
         ShowSharedNote();
     }
     EndSettingsBox();
 }
Пример #8
0
        public static SerializedObject GetSettingsObject(string className)
        {
            var settings = Unsupported.GetSerializedAssetInterfaceSingleton(className);

            return(new SerializedObject(settings));
        }
Пример #9
0
        private void DrawControlPanel()
        {
            Builder builder = serializedObject.targetObject as Builder;

            if (builder == null)
            {
                return;
            }

            GUILayout.FlexibleSpace();
            using (new EditorGUILayout.VerticalScope("box"))
            {
                GUILayout.Label(
                    new GUIContent(
                        $"{builder.productName} ver.{builder.version} ({builder.versionCode})",
                        GetBuildTargetIcon(builder)), EditorStyles.largeLabel);

                using (new EditorGUILayout.HorizontalScope())
                {
                    if (GUILayout.Button(new GUIContent("Apply Setting", EditorGUIUtility.FindTexture("vcs_check"))))
                    {
                        builder.ApplySettings();
                    }

                    if (GUILayout.Button(
                            new GUIContent("Player Setting", EditorGUIUtility.FindTexture("EditorSettings Icon")),
                            GUILayout.Height(21), GUILayout.Width(110)))
                    {
                        Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
                    }
                }

                using (new EditorGUILayout.HorizontalScope())
                {
                    if (GUILayout.Button(new GUIContent("Build Addressable Assets",
                                                        EditorGUIUtility.FindTexture("vcs_check"))))
                    {
                        Builder.BuildAddressableAssets();
                    }
                }

                EditorGUI.BeginDisabledGroup(builder.ActualBuildTarget != EditorUserBuildSettings.activeBuildTarget);

                using (new EditorGUILayout.HorizontalScope())
                {
                    if (GUILayout.Button(
                            new GUIContent($"Build to '{builder.BuildName}'",
                                           EditorGUIUtility.FindTexture("preAudioPlayOff")), "LargeButton"))
                    {
                        EditorApplication.delayCall += () => BuilderUtil.StartBuild(builder, false);
                    }

                    var r = EditorGUILayout.GetControlRect(false, GUILayout.Width(15));
                    if (GUI.Button(new Rect(r.x - 2, r.y + 5, 20, 20), contentOpen, EditorStyles.label))
                    {
                        BuilderUtil.RevealOutputInFinder(builder.OutputFolderPath);
                    }
                    EditorGUI.EndDisabledGroup();
                }

                if (GUILayout.Button(new GUIContent("Build & Run", EditorGUIUtility.FindTexture("preAudioPlayOn")),
                                     "LargeButton"))
                {
                    EditorApplication.delayCall += () => BuilderUtil.StartBuild(builder, true);
                }

                EditorGUI.EndDisabledGroup();

                if (GUILayout.Button("Convert to JSON (console log)"))
                {
                    Debug.Log(JsonUtility.ToJson(builder, true));
                }

                GUILayout.Space(10);
                GUILayout.Label("Available Project Builders", EditorStyles.boldLabel);
                roBuilderList.list  = buildersInProject;
                roBuilderList.index = buildersInProject.FindIndex(x => x == serializedObject.targetObject);
                roBuilderList.DoLayoutList();
            }
        }
Пример #10
0
    internal NavMeshProjectSettingsParamSetter()
    {
        var serializedAssetInterfaceSingleton = Unsupported.GetSerializedAssetInterfaceSingleton("NavMeshProjectSettings");

        m_navMeshProjectSettingsSo = new SerializedObject(serializedAssetInterfaceSingleton);
    }
Пример #11
0
 public static void OpenPlayerProjectSettings()
 {
     // SettingsService.OpenProjectSettings("Project/Player");
     Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
 }
Пример #12
0
        private AndroidDevice FindDevice(PostProcessorContext context)
        {
            BuildTarget         platform     = context.Get <BuildTarget>("BuildTarget");
            AndroidTargetDevice targetDevice = PlayerSettings.Android.targetDevice;
            List <string>       list         = null;

            do
            {
                list = ADB.Devices(null);
            }while ((list.Count == 0) && EditorUtility.DisplayDialog("No Android device found!", " * Make sure USB debugging has been enabled\n * Check your device, in most cases there should be a small icon in the status bar telling you if the USB connection is up.\n * If you are sure that device is attached then it might be USB driver problem, for details please check Android SDK Setup section in Unity manual.", "Retry", "Cancel"));
            if (list.Count < 1)
            {
                string message = $"No Android devices found.{(Application.platform != RuntimePlatform.WindowsEditor) ? "" : " If you are sure that device is attached then it might be USB driver problem, for details please check Android SDK Setup section in Unity manual."}
";
                CancelPostProcess.AbortBuild("Couldn't find Android device", message, null);
            }
            AndroidDevice device2 = new AndroidDevice(list[0]);
            int           num     = Convert.ToInt32(device2.Properties["ro.build.version.sdk"]);

            if (num < 9)
            {
                string str2 = (("Device: " + device2.Describe() + "\n") + "The connected device is not running Android OS 2.3 or later.") + " Unity Android does not support earlier versions of the Android OS;" + " please upgrade your device to a later OS version.";
                Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
                CancelPostProcess.AbortBuild("Device software is not supported", str2, null);
            }
            int num2 = 0;

            try
            {
                num2 = Convert.ToInt32(device2.Properties["ro.opengles.version"]);
            }
            catch (FormatException)
            {
                num2 = -1;
            }
            int num3 = 0xf0000;

            GraphicsDeviceType[] graphicsAPIs = PlayerSettings.GetGraphicsAPIs(platform);
            if (graphicsAPIs.Contains <GraphicsDeviceType>(GraphicsDeviceType.OpenGLES3))
            {
                num3 = 0x30000;
            }
            if (graphicsAPIs.Contains <GraphicsDeviceType>(GraphicsDeviceType.OpenGLES2))
            {
                num3 = 0x20000;
            }
            bool flag = device2.Features.Contains("android.hardware.opengles.aep");

            if ((num3 == 0x30000) && (PlayerSettings.openGLRequireES31 || PlayerSettings.openGLRequireES31AEP))
            {
                num3 = 0x30001;
            }
            bool flag2 = true;
            bool flag3 = (graphicsAPIs.Length == 1) && (graphicsAPIs[0] == GraphicsDeviceType.Vulkan);

            if ("Amazon" != device2.Properties["ro.product.brand"])
            {
                string str3 = null;
                if (flag3 && !flag2)
                {
                    str3 = "The connected device does not support Vulkan.";
                    str3 = str3 + " Please select OpenGLES under Player Settings instead.";
                }
                if (((num2 >= 0) && (num2 < num3)) || (PlayerSettings.openGLRequireES31AEP && !flag))
                {
                    str3 = "The connected device is not compatible with the selected OpenGLES version.";
                    str3 = str3 + " Please select a lower OpenGLES version under Player Settings instead.";
                }
                if (str3 != null)
                {
                    Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
                    CancelPostProcess.AbortBuild("Device hardware is not supported", str3, null);
                }
            }
            if ((targetDevice == AndroidTargetDevice.x86) && device2.Properties["ro.product.cpu.abi"].Equals("armeabi-v7a"))
            {
                string str4 = "You are trying to install x86 APK to ARM device. ";
                str4 = str4 + "Please select FAT or ARM as device filter under Player Settings, or connect a x86 device.";
                Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
                CancelPostProcess.AbortBuild("Device hardware is not supported", str4, null);
            }
            string str5   = device2.Properties["ro.product.manufacturer"];
            string str6   = device2.Properties["ro.product.model"];
            string action = device2.Properties["ro.product.cpu.abi"];
            bool   flag4  = device2.Properties["ro.secure"].Equals("1");
            string str8   = $"{char.ToUpper(str5[0])}{str5.Substring(1)} {str6}";
            string label  = $"Android API-{num}";

            UsabilityAnalytics.Event("Android Device", str8, label, !flag4 ? 0 : 1);
            string str10 = $"gles {num2 >> 0x10}.{num2 & 0xffff}{!flag ? "" : " AEP"}";

            if (num2 < 0)
            {
                str10 = "gles 2.0";
            }
            UsabilityAnalytics.Event("Android Architecture", action, str10, 1);
            string str11 = device2.Properties["ro.board.platform"];
            ulong  i     = device2.MemInfo["MemTotal"];

            i = UpperboundPowerOf2(i) / ((ulong)0x100000L);
            UsabilityAnalytics.Event("Android Chipset", str11, $"{i}MB", 1);
            return(device2);
        }
Пример #13
0
        public override void OnGUI(Rect rect)
        {
            GUILayout.BeginArea(rect);
            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);

            EditorGUILayout.Space();
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();

            //this.buildVM.BuildTarget = (BuildTarget)EditorGUILayout.EnumPopup(buildTargetContent, this.buildVM.BuildTarget);

            this.buildVM.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
            EditorGUILayout.LabelField(this.buildTargetContent, new GUIContent(buildVM.BuildTarget.ToString()), GUILayout.Width(300f), GUILayout.Height(20));
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Switch Platform", GUILayout.Width(200f)))
            {
                EditorWindow.GetWindow(Type.GetType("UnityEditor.BuildPlayerWindow,UnityEditor"));
                GUIUtility.ExitGUI();
            }
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            if (this.buildVM.UsePlayerSettingVersion)
            {
                EditorGUILayout.LabelField(this.dataVersionContent, new GUIContent(buildVM.DataVersion), GUILayout.MinWidth(230f), GUILayout.MaxWidth(250f), GUILayout.Height(20));
            }
            else
            {
                buildVM.DataVersion = EditorGUILayout.TextField(this.dataVersionContent, buildVM.DataVersion, GUILayout.MinWidth(230f), GUILayout.MaxWidth(250f), GUILayout.Height(20));
            }

            this.buildVM.UsePlayerSettingVersion = EditorGUILayout.ToggleLeft(this.usePlaySettingVersionContent, this.buildVM.UsePlayerSettingVersion);

            GUILayout.FlexibleSpace();

            if (this.buildVM.UsePlayerSettingVersion)
            {
                if (GUILayout.Button("Player Setting", GUILayout.Width(200f)))
                {
                    Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
                    GUIUtility.ExitGUI();
                }
            }
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();
            GUILayout.BeginHorizontal();
            this.buildVM.OutputPath = EditorGUILayout.TextField(this.outputPathContent, this.buildVM.OutputPath, GUILayout.Height(20));

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Browse", GUILayout.MaxWidth(100f), GUILayout.MinHeight(25f)))
            {
                this.buildVM.BrowseOutputFolder();
                this.Repaint();
                GUIUtility.ExitGUI();
            }
            if (GUILayout.Button("Reset", GUILayout.MaxWidth(100f), GUILayout.MinHeight(25f)))
            {
                this.buildVM.ResetOutputFolder();
                this.Repaint();
                GUIUtility.ExitGUI();
            }
            if (GUILayout.Button("Open", GUILayout.MaxWidth(100f), GUILayout.MinHeight(25f)))
            {
                this.buildVM.OpenOutputFolder();
                this.Repaint();
                GUIUtility.ExitGUI();
            }

            GUILayout.EndHorizontal();
            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            this.buildVM.CopyToStreaming = EditorGUILayout.ToggleLeft(this.copyToStreamingContent, this.buildVM.CopyToStreaming);
            this.buildVM.UseHashFilename = EditorGUILayout.ToggleLeft(this.useHashFilenameContent, this.buildVM.UseHashFilename);
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            // advanced options
            EditorGUILayout.Space();
            EditorGUILayout.Space();
            GUILayout.BeginHorizontal();
            this.buildVM.AdvancedSettings = EditorGUILayout.Foldout(this.buildVM.AdvancedSettings, "Advanced Settings");

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            if (this.buildVM.AdvancedSettings)
            {
                var indent = EditorGUI.indentLevel;
                EditorGUI.indentLevel += 1;

                GUILayout.BeginHorizontal();
                this.buildVM.Compression = (CompressOptions)EditorGUILayout.IntPopup(compressionContent, (int)this.buildVM.Compression,
                                                                                     new GUIContent[] {
                    new GUIContent(CompressOptions.Uncompressed.GetRemark()),
                    new GUIContent(CompressOptions.StandardCompression.GetRemark()),
                    new GUIContent(CompressOptions.ChunkBasedCompression.GetRemark())
                }, new int[] { 0, 1, 2 }, GUILayout.Width(400), GUILayout.Height(20));

                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();

                for (int i = 0; i < buildOptionList.Count; i++)
                {
                    GUILayout.BeginHorizontal();
                    var buildOption = buildOptionList[i];

                    var newValue = EditorGUILayout.ToggleLeft(buildOption.Content, buildOption.Value);
                    if (newValue != buildOption.Value)
                    {
                        buildOption.Value = newValue;
                        if (buildOption.Value && (buildOption.Tag == BuildAssetBundleOptions.IgnoreTypeTreeChanges || buildOption.Tag == BuildAssetBundleOptions.DisableWriteTypeTree))
                        {
                            for (int j = 0; j < buildOptionList.Count; j++)
                            {
                                var checkBox2 = buildOptionList[j];
                                if (buildOption != checkBox2 && (checkBox2.Tag == BuildAssetBundleOptions.IgnoreTypeTreeChanges || checkBox2.Tag == BuildAssetBundleOptions.DisableWriteTypeTree) && checkBox2.Value)
                                {
                                    checkBox2.Value = false;
                                    break;
                                }
                            }
                        }

                        BuildAssetBundleOptions options = BuildAssetBundleOptions.None;
                        for (int j = 0; j < buildOptionList.Count; j++)
                        {
                            if (buildOptionList[j].Value)
                            {
                                options |= buildOptionList[j].Tag;
                            }
                        }
                        this.buildVM.BuildAssetBundleOptions = options;
                    }
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();
                }

                EditorGUILayout.Space();
                EditorGUILayout.Space();

                GUILayout.BeginHorizontal();
                this.buildVM.Encryption = EditorGUILayout.ToggleLeft(this.encryptionContent, this.buildVM.Encryption);

                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                if (this.buildVM.Encryption)
                {
                    int indent2 = EditorGUI.indentLevel;
                    EditorGUI.indentLevel += 1;
                    GUILayout.BeginHorizontal();
                    this.buildVM.Algorithm = (Algorithm)EditorGUILayout.EnumPopup(this.algorithmContent, this.buildVM.Algorithm, GUILayout.Height(20));
#if UNITY_2018_1_OR_NEWER && !NETFX_CORE && !UNITY_WSA && !UNITY_WSA_10_0
                    Color oldColor = GUI.color;
                    GUI.color = Color.red;
                    if (Application.systemLanguage == SystemLanguage.Chinese)
                    {
                        EditorGUILayout.LabelField("推荐(AES128_CTR_NONE) 支持字节流,有更好的性能");
                    }
                    else
                    {
                        EditorGUILayout.LabelField("AES128_CTR_NONE is recommended, it has better performance");
                    }
                    GUI.color = oldColor;
#endif
                    GUILayout.EndHorizontal();

                    EditorGUILayout.Space();
                    GUILayout.BeginHorizontal();
                    this.buildVM.IV = EditorGUILayout.TextField("IV", this.buildVM.IV, GUILayout.MinWidth(230f), GUILayout.Height(20));

                    if (GUILayout.Button("Generate IV", GUILayout.Width(100f)))
                    {
                        this.buildVM.IV = this.buildVM.GenerateIV();
                    }
                    GUILayout.EndHorizontal();
                    EditorGUILayout.Space();
                    GUILayout.BeginHorizontal();
                    this.buildVM.KEY = EditorGUILayout.TextField("KEY", this.buildVM.KEY, GUILayout.MinWidth(230f), GUILayout.Height(20));
                    if (GUILayout.Button("Generate KEY", GUILayout.Width(100f)))
                    {
                        this.buildVM.KEY = this.buildVM.GenerateKey();
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    //EditorGUILayout.LabelField(new GUIContent("Bundles", "All the names of Assetbundle that need to be encrypted."));
                    this.buildVM.FilterType = (EncryptionFilterType)EditorGUILayout.EnumPopup(this.filterTypeContent, this.buildVM.FilterType, GUILayout.Height(20));
                    GUILayout.EndHorizontal();
                    EditorGUILayout.Space();

                    if (this.buildVM.FilterType == EncryptionFilterType.BundleNameList)
                    {
                        this.textScrollPosition  = EditorGUILayout.BeginScrollView(textScrollPosition);
                        this.buildVM.BundleNames = EditorGUILayout.TextArea(this.buildVM.BundleNames, GUILayout.Height(rect.height - 80));
                        EditorGUILayout.EndScrollView();
                    }
                    else if (this.buildVM.FilterType == EncryptionFilterType.RegularExpression)
                    {
                        this.buildVM.FilterExpression = EditorGUILayout.TextField("", this.buildVM.FilterExpression, GUILayout.MinWidth(230f), GUILayout.Height(20));
                    }

                    EditorGUI.indentLevel = indent2;
                }

                EditorGUI.indentLevel = indent;
            }

            EditorGUILayout.Space();


            // build.
            EditorGUILayout.Space();
            GUILayout.BeginHorizontal();

            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Rebuild", GUILayout.Width(250f), GUILayout.MinHeight(40f)))
            {
                if (!this.buildVM.VersionExists() || EditorUtility.DisplayDialog("Version already exist", "The version already exist!Are you sure you want to replace this version?", "Yes", "No"))
                {
                    EditorApplication.delayCall += () => this.buildVM.Build(true);
                }
            }

            if (GUILayout.Button("Build", GUILayout.Width(250f), GUILayout.MinHeight(40f)))
            {
                if (!this.buildVM.VersionExists() || EditorUtility.DisplayDialog("Version already exist", "The version already exist!Are you sure you want to replace this version?", "Yes", "No"))
                {
                    EditorApplication.delayCall += () => this.buildVM.Build(false);
                }
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Clear from StreamingAssets", GUILayout.Width(250f), GUILayout.MinHeight(40f)))
            {
                EditorApplication.delayCall += () => this.buildVM.ClearFromStreamingAssets();
            }

            if (GUILayout.Button("Copy to StreamingAssets", GUILayout.Width(250f), GUILayout.MinHeight(40f)))
            {
                EditorApplication.delayCall += () => this.buildVM.CopyToStreamingAssets();
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            EditorGUILayout.EndScrollView();
            GUILayout.EndArea();
        }
 public static void Execute()
 {
     EditorUtil.FocusOnInspectorWindow();
     Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
 }
Пример #15
0
        internal static void PostProcess(BuildTarget target, string stagingAreaDataUpperCase, string stagingArea, string stagingAreaDataManaged, string playerPackage, string installPath, string companyName, string productName, BuildOptions options)
        {
            bool  flag = (options & BuildOptions.AutoRunPlayer) != BuildOptions.CompressTextures;
            bool  developmentPlayer = (options & BuildOptions.Development) != BuildOptions.CompressTextures;
            float numSteps          = !flag ? ((float)2) : ((float)5);

            progress.Reset(numSteps);
            if (PlayerSettings.Tizen.deploymentTargetType == 2)
            {
                flag = false;
            }
            Regex  regex = new Regex("[^a-zA-Z_-]");
            string normalizedProductName = regex.Replace(productName, "").ToLower();
            string str2 = Path.Combine(playerPackage, "assets");

            if (!IsValidTizenBundleIdentifier(PlayerSettings.bundleIdentifier))
            {
                string message = "Please set the Bundle Identifier in the Player Settings.";
                message = (message + " The value must follow the convention 'com.YourCompanyName.YourProductName'") + " and can contain alphanumeric characters and underscore." + "\nEach segment must not start with a numeric character or underscore.";
                Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
                TizenUtilities.ShowErrDlgAndThrow("Bundle Identifier has not been set up correctly", message);
            }
            if (TizenUtilities.ThisIsAUnityTestProject())
            {
                PlayerSettings.Tizen.deploymentTargetType = 0;
            }
            if (PlayerSettings.Tizen.deploymentTargetType < 0)
            {
                string str4 = "Please select a Tizen deployment target.";
                str4 = str4 + " Press the Discover button in the Publishing section of Player Settings." + " Then select a type of target to get a list of available targets to select.";
                Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
                TizenUtilities.ShowErrDlgAndThrow("Tizen Deployment Target has not been selected.", str4);
            }
            TizenUtilities.PrepareToolPaths();
            TizenUtilities.ValidateSigningProfile(stagingArea);
            if (flag)
            {
                TizenUtilities.AssertAnyDeviceReady(new Command.WaitingForProcessToExit(new Progress("Tizen Device Detection", "Detecting attached devices", progress.Get()).Show));
            }
            Directory.CreateDirectory(Path.Combine(stagingArea, "lib"));
            Directory.CreateDirectory(Path.Combine(stagingArea, "res"));
            Directory.CreateDirectory(Path.Combine(stagingArea, "setting"));
            string path = Path.Combine(stagingArea, "shared");

            Directory.CreateDirectory(path);
            string str9 = Path.Combine(path, "res");

            Directory.CreateDirectory(str9);
            string destDirName = Path.Combine(str9, "data");
            string dst         = Path.Combine(str9, "app_icon.png");

            FileUtil.MoveFileIfExists(Path.Combine(stagingArea, "app_icon.png"), dst);
            if (!PlayerSettings.SplashScreen.show)
            {
                string str12 = Path.Combine(str9, "app_splash.png");
                FileUtil.MoveFileIfExists(Path.Combine(stagingArea, "app_splash.png"), str12);
                if (!File.Exists(str12))
                {
                    FileUtil.CopyFileOrDirectory(playerPackage + "/assets/splash.png", str12);
                }
            }
            Directory.CreateDirectory(Path.Combine(path, "trusted"));
            Directory.Move(stagingAreaDataUpperCase, destDirName + "2");
            Directory.Move(destDirName + "2", destDirName);
            if (!File.Exists(dst))
            {
                FileUtil.CopyFileOrDirectory(str2 + "/icon.png", dst);
            }
            Directory.CreateDirectory(Path.Combine(destDirName, "Managed/mono/2.0"));
            FileUtil.CopyFileOrDirectory(playerPackage + "/Data/Resources/unity default resources", destDirName + "/unity default resources");
            Directory.CreateDirectory(Path.Combine(stagingArea, "data"));
            string str15 = Path.Combine(stagingArea, "lib");

            Directory.CreateDirectory(str15);
            foreach (PluginImporter importer in PluginImporter.GetImporters(target))
            {
                string fileName = Path.GetFileName(importer.assetPath);
                FileUtil.UnityFileCopy(importer.assetPath, Path.Combine(str15, fileName));
            }
            if (Directory.Exists("Assets/StreamingAssets"))
            {
                FileUtil.CopyDirectoryRecursive("Assets/StreamingAssets", Path.Combine(destDirName, "Raw"), true, true);
            }
            AssemblyReferenceChecker checker = new AssemblyReferenceChecker();
            bool collectMethods   = true;
            bool ignoreSystemDlls = true;

            string[] components = new string[] { destDirName, "Managed" };
            string   str17      = Paths.Combine(components);

            checker.CollectReferences(str17, collectMethods, 0f, ignoreSystemDlls);
            string bundleIdentifier = PlayerSettings.bundleIdentifier;

            CreateManifest(Path.Combine(stagingArea, "tizen-manifest.xml"), companyName, productName, normalizedProductName, bundleIdentifier, checker);
            CreateProject(stagingArea);
            PackageTargets(PlayerSettings.Tizen.deploymentTargetType, installPath, playerPackage, stagingArea, developmentPlayer, normalizedProductName);
            if (flag)
            {
                progress.Step("Installing", EditorGUIUtility.TextContent("Installing application on " + TizenUtilities.SelectedDeploymentTarget() + "...").text);
                if (TizenUtilities.InstallTpkPackage(installPath))
                {
                    if (developmentPlayer)
                    {
                        progress.Step("Port Forwarding", EditorGUIUtility.TextContent("Setting up profiler tunnel...").text);
                        TizenUtilities.ForwardPort(ProfilerDriver.directConnectionPort, "55000");
                    }
                    progress.Step("Launching", EditorGUIUtility.TextContent("Launching application on " + TizenUtilities.SelectedDeploymentTarget() + "...").text);
                    TizenUtilities.LaunchTpkPackage(bundleIdentifier, stagingArea);
                }
            }
        }