Exemplo n.º 1
0
        private static void Apply()
        {
            AssetDatabase.StartAssetEditing();
            bool flag1 = DOTweenUtilityWindowModules.ToggleModule(DOTweenUtilityWindowModules._audioModule, ref DOTweenUtilityWindowModules._src.modules.audioEnabled);
            bool flag2 = DOTweenUtilityWindowModules.ToggleModule(DOTweenUtilityWindowModules._physicsModule, ref DOTweenUtilityWindowModules._src.modules.physicsEnabled);
            bool flag3 = DOTweenUtilityWindowModules.ToggleModule(DOTweenUtilityWindowModules._physics2DModule, ref DOTweenUtilityWindowModules._src.modules.physics2DEnabled);
            bool flag4 = DOTweenUtilityWindowModules.ToggleModule(DOTweenUtilityWindowModules._spriteModule, ref DOTweenUtilityWindowModules._src.modules.spriteEnabled);
            bool flag5 = DOTweenUtilityWindowModules.ToggleModule(DOTweenUtilityWindowModules._uiModule, ref DOTweenUtilityWindowModules._src.modules.uiEnabled);
            bool flag6 = false;
            bool flag7 = false;

            if (EditorUtils.hasPro)
            {
                flag6 = DOTweenUtilityWindowModules.ToggleModule(DOTweenUtilityWindowModules._textMeshProModule, ref DOTweenUtilityWindowModules._src.modules.textMeshProEnabled);
                flag7 = DOTweenUtilityWindowModules.ToggleModule(DOTweenUtilityWindowModules._tk2DModule, ref DOTweenUtilityWindowModules._src.modules.tk2DEnabled);
            }
            AssetDatabase.StopAssetEditing();
            EditorUtility.SetDirty((Object)DOTweenUtilityWindowModules._src);
            if (flag1 | flag2 | flag3 | flag4 | flag5 | flag6 | flag7)
            {
                StringBuilder strb = new StringBuilder();
                strb.Append("<b>DOTween module files modified ► </b>");
                if (flag1)
                {
                    DOTweenUtilityWindowModules.Apply_AppendLog(strb, DOTweenUtilityWindowModules._src.modules.audioEnabled, "Audio");
                }
                if (flag2)
                {
                    DOTweenUtilityWindowModules.Apply_AppendLog(strb, DOTweenUtilityWindowModules._src.modules.physicsEnabled, "Physics");
                }
                if (flag3)
                {
                    DOTweenUtilityWindowModules.Apply_AppendLog(strb, DOTweenUtilityWindowModules._src.modules.physics2DEnabled, "Physics2D");
                }
                if (flag4)
                {
                    DOTweenUtilityWindowModules.Apply_AppendLog(strb, DOTweenUtilityWindowModules._src.modules.spriteEnabled, "Sprites");
                }
                if (flag5)
                {
                    DOTweenUtilityWindowModules.Apply_AppendLog(strb, DOTweenUtilityWindowModules._src.modules.uiEnabled, "UI");
                }
                if (flag6)
                {
                    DOTweenUtilityWindowModules.Apply_AppendLog(strb, DOTweenUtilityWindowModules._src.modules.textMeshProEnabled, "TextMesh Pro");
                }
                if (flag7)
                {
                    DOTweenUtilityWindowModules.Apply_AppendLog(strb, DOTweenUtilityWindowModules._src.modules.tk2DEnabled, "2D Toolkit");
                }
                strb.Remove(strb.Length - 3, 3);
                Debug.Log((object)strb.ToString());
            }
            ASMDEFManager.RefreshExistingASMDEFFiles();
        }
Exemplo n.º 2
0
        // ===================================================================================
        // GUI METHODS -----------------------------------------------------------------------

        void DrawSetupGUI()
        {
            Rect areaRect = new Rect(0, 30, _headerSize.x, _headerSize.y);

            GUI.DrawTexture(areaRect, _headerImg, ScaleMode.StretchToFill, false);
            GUILayout.Space(areaRect.y + _headerSize.y + 2);
            GUILayout.Label(_innerTitle, TweenManager.isDebugBuild ? EditorGUIUtils.redLabelStyle : EditorGUIUtils.boldLabelStyle);

            if (_setupRequired)
            {
                GUI.backgroundColor = Color.red;
                GUILayout.BeginVertical(GUI.skin.box);
                GUILayout.Label("DOTWEEN SETUP REQUIRED", EditorGUIUtils.setupLabelStyle);
                GUILayout.EndVertical();
                GUI.backgroundColor = Color.white;
            }
            else
            {
                GUILayout.Space(8);
            }
            GUI.color = Color.green;
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("<b>Setup DOTween...</b>\n(add/remove Modules)", EditorGUIUtils.btSetup, GUILayout.Width(200)))
            {
//                DOTweenDefines.Setup();
//                _setupRequired = EditorUtils.DOTweenSetupRequired();
                DOTweenUtilityWindowModules.ApplyModulesSettings();
                _src.modules.showPanel = true;
                EditorUtility.SetDirty(_src);
                EditorUtils.DeleteLegacyNoModulesDOTweenFiles();
                DOTweenDefines.RemoveAllLegacyDefines();
                EditorUtils.DeleteDOTweenUpgradeManagerFiles();
                return;
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUI.color = Color.white;
            GUILayout.Space(4);

            // ASMDEF
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUI.color = ASMDEFManager.hasModulesASMDEF ? Color.yellow : Color.cyan;
            if (GUILayout.Button(ASMDEFManager.hasModulesASMDEF ? "Remove ASMDEF..." : "Create ASMDEF...", EditorGUIUtils.btSetup, GUILayout.Width(200)))
            {
                if (ASMDEFManager.hasModulesASMDEF)
                {
                    if (EditorUtility.DisplayDialog("Remove ASMDEF",
                                                    string.Format("This will remove the \"DOTween/Modules/DOTween.Modules.asmdef\" file" +
                                                                  " (and if you have DOTween Pro also the \"DOTweenPro/DOTweenPro.Scripts.asmdef\"" +
                                                                  " and \"DOTweenPro/Editor/DOTweenPro.EditorScripts.asmdef\" files)"),
                                                    "Ok", "Cancel"
                                                    ))
                    {
                        ASMDEFManager.RemoveAllASMDEF();
                    }
                }
                else
                {
                    if (EditorUtility.DisplayDialog("Create ASMDEF",
                                                    string.Format("This will create the \"DOTween/Modules/DOTween.Modules.asmdef\" file" +
                                                                  " (and if you have DOTween Pro also the \"DOTweenPro/DOTweenPro.Scripts.asmdef\"" +
                                                                  " and \"DOTweenPro/Editor/DOTweenPro.EditorScripts.asmdef\" files)"),
                                                    "Ok", "Cancel"
                                                    ))
                    {
                        ASMDEFManager.CreateAllASMDEF();
                    }
                }
            }
            GUI.color = Color.white;
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Label(
                "ASMDEFs are useful if you need to reference the extra DOTween modules API (like [<i>UIelement</i>].DOColor)" +
                " from other ASMDEFs/Libraries instead of loose scripts," +
                " but remember to have those <b>ASMDEFs/Libraries reference DOTween ones</b>.",
                EditorGUIUtils.wordWrapRichTextLabelStyle
                );
            GUILayout.Space(3);

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Website", EditorGUIUtils.btBigStyle, GUILayout.Width(_HalfBtSize)))
            {
                Application.OpenURL("http://dotween.demigiant.com/index.php");
            }
            if (GUILayout.Button("Get Started", EditorGUIUtils.btBigStyle, GUILayout.Width(_HalfBtSize)))
            {
                Application.OpenURL("http://dotween.demigiant.com/getstarted.php");
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Documentation", EditorGUIUtils.btBigStyle, GUILayout.Width(_HalfBtSize)))
            {
                Application.OpenURL("http://dotween.demigiant.com/documentation.php");
            }
            if (GUILayout.Button("Support", EditorGUIUtils.btBigStyle, GUILayout.Width(_HalfBtSize)))
            {
                Application.OpenURL("http://dotween.demigiant.com/support.php");
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Changelog", EditorGUIUtils.btBigStyle, GUILayout.Width(_HalfBtSize)))
            {
                Application.OpenURL("http://dotween.demigiant.com/download.php");
            }
            if (GUILayout.Button("Check Updates", EditorGUIUtils.btBigStyle, GUILayout.Width(_HalfBtSize)))
            {
                Application.OpenURL("http://dotween.demigiant.com/download.php?v=" + DOTween.Version);
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(4);
            if (GUILayout.Button(_footerImg, EditorGUIUtils.btImgStyle))
            {
                Application.OpenURL("http://www.demigiant.com/");
            }
        }
Exemplo n.º 3
0
        static void Apply()
        {
            AssetDatabase.StartAssetEditing();
            bool audioToggled     = ToggleModule(_audioModule, ref _src.modules.audioEnabled);
            bool physicsToggled   = ToggleModule(_physicsModule, ref _src.modules.physicsEnabled);
            bool physics2DToggled = ToggleModule(_physics2DModule, ref _src.modules.physics2DEnabled);
            bool spriteToggled    = ToggleModule(_spriteModule, ref _src.modules.spriteEnabled);
            bool uiToggled        = ToggleModule(_uiModule, ref _src.modules.uiEnabled);

            bool textMeshProToggled = false;
            bool tk2DToggled        = false;

            if (EditorUtils.hasPro)
            {
                textMeshProToggled = ToggleModule(_textMeshProModule, ref _src.modules.textMeshProEnabled);
                tk2DToggled        = ToggleModule(_tk2DModule, ref _src.modules.tk2DEnabled);
            }
            AssetDatabase.StopAssetEditing();
            EditorUtility.SetDirty(_src);

            bool anyToggled = audioToggled || physicsToggled || physics2DToggled || spriteToggled || uiToggled ||
                              textMeshProToggled || tk2DToggled;

            if (anyToggled)
            {
                StringBuilder strb = new StringBuilder();
                strb.Append("<b>DOTween module files modified ► </b>");
                if (audioToggled)
                {
                    Apply_AppendLog(strb, _src.modules.audioEnabled, "Audio");
                }
                if (physicsToggled)
                {
                    Apply_AppendLog(strb, _src.modules.physicsEnabled, "Physics");
                }
                if (physics2DToggled)
                {
                    Apply_AppendLog(strb, _src.modules.physics2DEnabled, "Physics2D");
                }
                if (spriteToggled)
                {
                    Apply_AppendLog(strb, _src.modules.spriteEnabled, "Sprites");
                }
                if (uiToggled)
                {
                    Apply_AppendLog(strb, _src.modules.uiEnabled, "UI");
                }
                if (textMeshProToggled)
                {
                    Apply_AppendLog(strb, _src.modules.textMeshProEnabled, "TextMesh Pro");
                }
                if (tk2DToggled)
                {
                    Apply_AppendLog(strb, _src.modules.tk2DEnabled, "2D Toolkit");
                }
                // Remove last divider
                strb.Remove(strb.Length - 3, 3);
                Debug.Log(strb.ToString());
            }

            ASMDEFManager.RefreshExistingASMDEFFiles();
        }
Exemplo n.º 4
0
        private void DrawSetupGUI()
        {
            Rect position = new Rect(0.0f, 30f, this._headerSize.x, this._headerSize.y);

            GUI.DrawTexture(position, (Texture)this._headerImg, ScaleMode.StretchToFill, false);
            GUILayout.Space((float)((double)position.y + (double)this._headerSize.y + 2.0));
            GUILayout.Label(this._innerTitle, EditorGUIUtils.boldLabelStyle, new GUILayoutOption[0]);
            if (this._setupRequired)
            {
                GUI.backgroundColor = Color.red;
                GUILayout.BeginVertical(GUI.skin.box, new GUILayoutOption[0]);
                GUILayout.Label("DOTWEEN SETUP REQUIRED", EditorGUIUtils.setupLabelStyle, new GUILayoutOption[0]);
                GUILayout.EndVertical();
                GUI.backgroundColor = Color.white;
            }
            else
            {
                GUILayout.Space(8f);
            }
            GUI.color = Color.green;
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("<b>Setup DOTween...</b>\n(add/remove Modules)", EditorGUIUtils.btSetup, new GUILayoutOption[1]
            {
                GUILayout.Width(200f)
            }))
            {
                DOTweenUtilityWindowModules.ApplyModulesSettings();
                this._src.modules.showPanel = true;
                EditorUtility.SetDirty((UnityEngine.Object) this._src);
                EditorUtils.DeleteLegacyNoModulesDOTweenFiles();
                DOTweenDefines.RemoveAllLegacyDefines();
                EditorUtils.DeleteDOTweenUpgradeManagerFiles();
            }
            else
            {
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUI.color = Color.white;
                GUILayout.Space(4f);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUI.color = ASMDEFManager.hasModulesASMDEF ? Color.yellow : Color.cyan;
                if (GUILayout.Button(ASMDEFManager.hasModulesASMDEF ? "Remove ASMDEF..." : "Create ASMDEF...", EditorGUIUtils.btSetup, new GUILayoutOption[1]
                {
                    GUILayout.Width(200f)
                }))
                {
                    if (ASMDEFManager.hasModulesASMDEF)
                    {
                        if (EditorUtility.DisplayDialog("Remove ASMDEF", string.Format("This will remove the \"DOTween/Modules/DOTween.Modules.asmdef\" and \"DOTweenPro/DOTweenPro.Scripts.asmdef\" (if you have DOTween Pro) files."), "Ok", "Cancel"))
                        {
                            ASMDEFManager.RemoveAllASMDEF();
                        }
                    }
                    else if (EditorUtility.DisplayDialog("Create ASMDEF", string.Format("This will create the \"DOTween/Modules/DOTween.Modules.asmdef\" and \"DOTweenPro/DOTweenPro.Scripts.asmdef\" (if you have DOTween Pro) files."), "Ok", "Cancel"))
                    {
                        ASMDEFManager.CreateAllASMDEF();
                    }
                }
                GUI.color = Color.white;
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUILayout.Space(8f);
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Website", EditorGUIUtils.btBigStyle, new GUILayoutOption[1]
                {
                    GUILayout.Width(DOTweenUtilityWindow._HalfBtSize)
                }))
                {
                    Application.OpenURL("http://dotween.demigiant.com/index.php");
                }
                if (GUILayout.Button("Get Started", EditorGUIUtils.btBigStyle, new GUILayoutOption[1]
                {
                    GUILayout.Width(DOTweenUtilityWindow._HalfBtSize)
                }))
                {
                    Application.OpenURL("http://dotween.demigiant.com/getstarted.php");
                }
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Documentation", EditorGUIUtils.btBigStyle, new GUILayoutOption[1]
                {
                    GUILayout.Width(DOTweenUtilityWindow._HalfBtSize)
                }))
                {
                    Application.OpenURL("http://dotween.demigiant.com/documentation.php");
                }
                if (GUILayout.Button("Support", EditorGUIUtils.btBigStyle, new GUILayoutOption[1]
                {
                    GUILayout.Width(DOTweenUtilityWindow._HalfBtSize)
                }))
                {
                    Application.OpenURL("http://dotween.demigiant.com/support.php");
                }
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Changelog", EditorGUIUtils.btBigStyle, new GUILayoutOption[1]
                {
                    GUILayout.Width(DOTweenUtilityWindow._HalfBtSize)
                }))
                {
                    Application.OpenURL("http://dotween.demigiant.com/download.php");
                }
                if (GUILayout.Button("Check Updates", EditorGUIUtils.btBigStyle, new GUILayoutOption[1]
                {
                    GUILayout.Width(DOTweenUtilityWindow._HalfBtSize)
                }))
                {
                    Application.OpenURL("http://dotween.demigiant.com/download.php?v=" + DOTween.Version);
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(14f);
                if (!GUILayout.Button((Texture)this._footerImg, EditorGUIUtils.btImgStyle, new GUILayoutOption[0]))
                {
                    return;
                }
                Application.OpenURL("http://www.demigiant.com/");
            }
        }