Beispiel #1
0
        protected override void OnGUI()
        {
            base.OnGUI();

            if (!mInit)
            {
                Initialize();
            }

            if (mEmpty)
            {
                // still no process existing?
                GUILayout.Label("Nothing to build", Styles.bigHint);
                return;
            }

            GUILayout.BeginArea(new Rect(25, 25, 300, 20));
            {
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Build Processes", "BoldLabel");
                    GUILayout.FlexibleSpace();

                    if (GUILayout.Button("Select Build Collection"))
                    {
                        Selection.activeObject = mProcess.BuildCollection;
                    }
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndArea();

            GUILayout.BeginArea(new Rect(25, 50, 300, 125), EditorStyles.helpBox);
            {
                scrollPosition01 = GUILayout.BeginScrollView(scrollPosition01);
                {
                    GUILayout.BeginVertical();
                    {
                        for (int i = 0; i < mProcess.BuildCollection.mProcesses.Count; i++)
                        {
                            var  p   = mProcess.BuildCollection.mProcesses[i];
                            bool odd = (i % 2) == 0;

                            GUI.enabled = p.mSelected;
                            UBSWindowBase.DrawBuildProcessEntry(mProcess.BuildCollection, p, odd, 0, false);
                        }
                        GUI.enabled = true;
                    }
                    GUILayout.EndVertical();
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndArea();

            GUI.Box(new Rect(25, 205, 300, 230), "", EditorStyles.helpBox);


            float fTop  = 205;
            float fLeft = 30;

            GUI.BeginGroup(new Rect(fLeft, fTop, 300, kHeight));
            KeyValue("Collection:", mProcess.BuildCollection.name);
            GUI.EndGroup();

            fTop += kHeight;
            GUI.BeginGroup(new Rect(fLeft, fTop, 300, kHeight));
            KeyValue("CurrentProcess: ", mProcess.CurrentProcessName);
            GUI.EndGroup();

            fTop += kHeight;
            GUI.BeginGroup(new Rect(fLeft, fTop, 300, kHeight));
            KeyValue("CurrentState: ", mProcess.CurrentState);
            GUI.EndGroup();


            fTop += kHeight;
            GUI.BeginGroup(new Rect(fLeft, fTop, 300, kHeight));
            KeyProgress("Pre Steps Progress: ", mProcess.SubPreWalker.Progress);
            GUI.EndGroup();

            fTop += kHeight;
            GUI.BeginGroup(new Rect(fLeft, fTop, 300, kHeight));
            KeyValue("Pre Step Current: ", mProcess.SubPreWalker.Step);
            GUI.EndGroup();

            fTop += kHeight;
            GUI.BeginGroup(new Rect(fLeft, fTop, 300, kHeight));
            KeyProgress("Post Steps Progress: ", mProcess.SubPostWalker.Progress);
            GUI.EndGroup();

            fTop += kHeight;
            GUI.BeginGroup(new Rect(fLeft, fTop, 300, kHeight));
            KeyValue("Post Step Current: ", mProcess.SubPostWalker.Step);
            GUI.EndGroup();

            fTop += kHeight;
            GUI.BeginGroup(new Rect(fLeft, fTop, 300, kHeight));
            KeyProgress("Progress: ", mProcess.Progress);
            GUI.EndGroup();

            fTop += kHeight;
            GUILayout.BeginArea(new Rect(fLeft, fTop, 290, kHeight * 5));

            GUILayout.Space(5);
            if (UBSProcess.BuildBehavior == UBSBuildBehavior.manual && mProcess.CurrentState == UBSState.building)
            {
                GUILayout.BeginVertical();
                EditorGUILayout.HelpBox("You use Unity free. Open build settings and press \"Build\" manually. ", MessageType.Info);
                EditorGUILayout.HelpBox("Output path: " + mProcess.GetCurrentProcess().mOutputPath, MessageType.Info);

                if (GUILayout.Button("Open Build Settings"))
                {
                    System.Reflection.Assembly asm = System.Reflection.Assembly.GetAssembly(typeof(EditorWindow));
                    var M = asm
                            .GetType("UnityEditor.BuildPlayerWindow")
                            .GetMethod("ShowBuildPlayerWindow", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
                    M.Invoke(null, null);
                }
                GUILayout.EndVertical();
            }
            else
            {
                GUI.enabled = !mProcess.IsDone;
                if (GUILayout.Button("Cancel"))
                {
                    mProcess.Cancel();
                }
            }


            GUILayout.EndArea();
        }
Beispiel #2
0
        public override void OnInspectorGUI()
        {
            var data = target as BuildCollection;

            int selectedCount = 0;

            GUILayout.Label("With a Build Collection you can have multiple Build Processes in one list. " +
                            "They can target different platforms and each have their own pre- and post-steps. ",
                            EditorStyles.wordWrappedMiniLabel);
            GUILayout.Label("You can either run one Build Process manually or run a set of selected " +
                            "Build Processes at once. ",
                            EditorStyles.wordWrappedMiniLabel);

            GUILayout.Label("This asset can be accessed by hitting CTRL+SHIFT+C. ",
                            EditorStyles.wordWrappedMiniLabel);

            if (data.mProcesses.Count == 0)
            {
                GUI.color = Color.yellow;
                GUILayout.Label("You should start by adding a Build Process. Hit \"Edit\" to do so. ",
                                EditorStyles.wordWrappedLabel);
                GUI.color = Color.white;
            }

            GUILayout.Label("Build Processes", "BoldLabel");

            GUILayout.BeginVertical("HelpBox", GUILayout.MinHeight(40));
            {
                if (data.mProcesses.Count == 0)
                {
                    GUILayout.Label("None", UBS.Styles.bigHint);
                }
                bool odd = false;
                foreach (var e in data.mProcesses)
                {
                    if (e == null)
                    {
                        break;
                    }
                    selectedCount = UBSWindowBase.DrawBuildProcessEntry(data, e, odd, selectedCount, true);
                    odd           = !odd;
                }
            }
            GUILayout.EndVertical();
            GUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("Edit"))
                {
                    UBSEditorWindow.Init(data);
                }
                GUILayout.Space(5);
                GUI.enabled = selectedCount >= 1;

                if (GUILayout.Button("Run selected builds"))
                {
                    UBSBuildWindow.Init(data);
                }
                GUILayout.Space(5);

                GUI.enabled = selectedCount == 1;
                if (GUILayout.Button("Build and run"))
                {
                    UBSBuildWindow.Init(data, true);
                }
                GUI.enabled = true;

                if (GUILayout.Button("?", GUILayout.Width(32)))
                {
                    EditorUtility.OpenWithDefaultApp("http://kwnetzwelt.net/unity-build-system");
                }
            }
            GUILayout.EndHorizontal();
        }