void OnGUI()
    {
        EditorGUILayout.BeginVertical();

        root    = (Transform)EditorGUILayout.ObjectField("Ragdoll Root", root, typeof(Transform), true);
        folder  = EditorGUILayout.ObjectField("Destination Folder", folder, typeof(Object), false);
        ragdoll = (RagdollAsset)EditorGUILayout.ObjectField("Ragdoll to Update (Optional)", ragdoll, typeof(RagdollAsset), false);

        GUILayoutHelpers.HorzLine();

        GUI.enabled = (root != null) && ((ragdoll != null) || (folder != null));

        if (GUILayout.Button((ragdoll != null) ? "Update Ragdoll Asset" : "Create Ragdoll Asset"))
        {
            if (ragdoll != null)
            {
                ragdoll.Rebuild(root);
            }
            else
            {
                if (RagdollAsset.Create(root, Utils.SafeGetNewAssetPathFromPath(AssetDatabase.GetAssetPath(folder) + "/NewRagdoll")) == null)
                {
                    EditorUtility.DisplayDialog("Error", "No ragdoll components were found from the specified root.", "OK");
                }
            }
        }

        GUI.enabled = true;

        EditorGUILayout.EndVertical();
    }
Esempio n. 2
0
    void OnGUI()
    {
        EditorGUILayout.BeginVertical();

        root   = (Transform)EditorGUILayout.ObjectField("Hierarchy Root", root, typeof(Transform), true);
        folder = EditorGUILayout.ObjectField("Destination Folder", folder, typeof(Object), false);
        tags   = (TagsAsset)EditorGUILayout.ObjectField("Tags to Update (Optional)", tags, typeof(TagsAsset), false);

        GUILayoutHelpers.HorzLine();

        GUI.enabled = (root != null) && ((tags != null) || (folder != null));

        if (GUILayout.Button((tags != null) ? "Update Tags Asset" : "Create Tags Asset"))
        {
            if (tags != null)
            {
                tags.Rebuild(root);
            }
            else
            {
                if (TagsAsset.Create(root, Utils.SafeGetNewAssetPathFromPath(AssetDatabase.GetAssetPath(folder) + "/NewTags")) == null)
                {
                    EditorUtility.DisplayDialog("Error", "Couldn't create tags asset.", "OK");
                }
            }
        }

        GUI.enabled = true;

        EditorGUILayout.EndVertical();
    }
Esempio n. 3
0
        void OnGUI()
        {
            EditorGUILayout.BeginVertical();

            GUILayoutHelpers.HorzLine();

            {
                var s = BuildOptionsWindow.OnGUI_ScriptFlags(scriptFlags, true);
                if (s != scriptFlags)
                {
                    EditorPrefs.SetString("steamscriptflags", s);
                    scriptFlags = s;
                }
            }

            GUILayoutHelpers.HorzLine();

            OnGUI_BuildPlatforms();

            GUILayoutHelpers.HorzLine();

#if PERFORCE
            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            GUILayoutHelpers.CenterLabel("Perforce");
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            {
                var s = EditorGUILayout.TextField("P4 Directory", p4path);
                if (s != p4path)
                {
                    EditorPrefs.SetString("p4path", s);
                    p4path = s;
                }

                s = EditorGUILayout.TextField("P4 Server", p4server);
                if (s != p4server)
                {
                    EditorPrefs.SetString("p4server", s);
                    p4server = s;
                }

                s = EditorGUILayout.TextField("P4 User", p4user);
                if (s != p4user)
                {
                    EditorPrefs.SetString("p4user", s);
                    p4user = s;
                }

                s = EditorGUILayout.PasswordField("P4 Password", p4pass);
                if (s != p4pass)
                {
                    EditorPrefs.SetString("p4pass", s);
                    p4pass = s;
                }

                s = EditorGUILayout.TextField("P4 Workspace", p4client);
                if (s != p4client)
                {
                    EditorPrefs.SetString("p4client", s);
                    p4client = s;
                }
            }

            GUILayoutHelpers.HorzLine();
#endif

            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            GUILayoutHelpers.CenterLabel("Steam");
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            {
                var i = 0;
                while ((branch != BRANCHES[i]) && (i < BRANCHES.Length))
                {
                    ++i;
                }

                if (i >= BRANCHES.Length)
                {
                    i = 0;
                }

                var s = EditorGUILayout.Popup("Set Live", i, BRANCHES);
                if (s != i)
                {
                    branch = BRANCHES[s];
                    EditorPrefs.SetString("steambranch", branch);
                }
            }

            {
                var s = EditorGUILayout.TextField("Steam Login", steamLogin);
                if (s != steamLogin)
                {
                    EditorPrefs.SetString("steamlogin", s);
                    steamLogin = s;
                }
            }

            {
                var s = EditorGUILayout.PasswordField("Steam Password", steamPassword);
                if (s != steamPassword)
                {
                    EditorPrefs.SetString("steampass", s);
                    steamPassword = s;
                }
            }

            GUILayoutHelpers.HorzLine();

            bool build = false;

            if (GUILayout.Button("Build (testing only!)..."))
            {
                build = true;
            }

            bool publish = false;

            if (GUILayout.Button("Build and Publish..."))
            {
                publish = true;
                build   = true;
            }

            //if (GUILayout.Button("Retry Publish (careful!)...")) {
            //	publish = true;
            //}

            EditorGUILayout.EndVertical();

            string oldScriptFlags = null;

            if (build || publish)
            {
#if PERFORCE
                if (string.IsNullOrEmpty(p4path) || string.IsNullOrEmpty(p4server) || string.IsNullOrEmpty(p4user) || string.IsNullOrEmpty(p4pass) || string.IsNullOrEmpty(p4client))
                {
                    EditorUtility.DisplayDialog("Error", "Please fill in the perforce fields to build for Steam.", "OK");
                    return;
                }
#endif
                oldScriptFlags = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
            }

            if (build && publish)
            {
                var progress = new EditorProgressBar("Building...", 2);
                var r        = CheckForPrereqs() && Build();
                if (r)
                {
                    progress.Step("Publishing...");
                    r = Publish();
                    progress.Step(null);
                }
                else
                {
                    progress.Close();
                }

                if (r)
                {
                    EditorUtility.DisplayDialog("Success", "Build and publish completed successfully.", "OK");
                }
                else
                {
                    EditorUtility.DisplayDialog("Error", "Build failed.", "OK");
                }
            }
            else if (build)
            {
                var progress = new EditorProgressBar("Building...", 1);
                var r        = CheckForPrereqs() && Build();
                progress.Step(null);
                if (r)
                {
                    EditorUtility.DisplayDialog("Success", "Build completed successfully.", "OK");
                }
                else
                {
                    EditorUtility.DisplayDialog("Error", "Build failed.", "OK");
                }
            }
            else if (publish)
            {
                var progress = new EditorProgressBar("Publishing...", 1);
                var r        = CheckForPrereqs();
                if (r)
                {
                    progress.Step("Publishing...");
                    r = Publish();
                    progress.Step(null);
                }
                else
                {
                    progress.Close();
                }

                if (r)
                {
                    EditorUtility.DisplayDialog("Success", "Publish completed successfully.", "OK");
                }
                else
                {
                    EditorUtility.DisplayDialog("Error", "Publish failed.", "OK");
                }
            }

            if (build || publish)
            {
                if (oldScriptFlags != PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone))
                {
                    PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, oldScriptFlags);
                }
            }
        }