Ejemplo n.º 1
0
        protected virtual void  OnGUI()
        {
            if (this.labelStyle == null)
            {
                this.labelStyle                    = new GUIStyle(GUI.skin.label);
                this.labelStyle.wordWrap           = true;
                this.labelStyle.onNormal.textColor = Color.black;
                this.labelStyle.normal.textColor   = Color.black;
            }

#if UNITY_EDITOR
            if (TestUtility.RequireUnmaximized() == true)
            {
                return;
            }
#endif

            if (GUI.Button(new Rect(1F, 1F, 120F, 20F), "Toggle Tutorial") == true)
            {
                this.display = !this.display;
            }

            if (this.display == false)
            {
                return;
            }

            this.r.x      = TestRemoteScene.XOffset;
            this.r.y      = TestRemoteScene.YOffset;
            this.r.width  = Screen.width - this.r.x - this.r.x;
            this.r.height = Screen.height - this.r.y;

            GUI.Box(this.r, "Tutorial NG Remote Scene");

            GUILayout.Space(40F);
            this.scrollPosition = GUILayout.BeginScrollView(this.scrollPosition);
            {
                GUILayout.Label("1. Generate a standalone build with this current scene.", this.labelStyle);

                GUILayout.Label("2. Start the build.", this.labelStyle);

                GUILayout.Label("3. Open a <b>NG Remote Hierarchy</b> window. You will find it in the menu at <b>Window/NG Tools/NG Remote Hierarchy</b>.", this.labelStyle);

                GUILayout.Label("4. In <b>NG Remote Hierarchy</b>, type \"<i>127.0.0.1</i>\" in <b>Address</b> and \"<i>17257</i>\" in <b>Port</b>. Now press the button \"<b>Connect</b>\".", this.labelStyle);
                GUILayout.Label("   You should see the same Game Object as those in this current scene.", this.labelStyle);

                GUILayout.Label("5. Open a <b>NG Remote Inspector</b> window. You will find it in the menu at <b>Window/NG Tools/NG Remote Inspector</b>.", this.labelStyle);
                GUILayout.Label("   This is the equivalent of Unity's <b>Inspector</b> window", this.labelStyle);

                GUILayout.Label("6. Open a <b>NG Remote Project</b> window. You will find it in the menu at <b>Window/NG Tools/NG Remote Project</b>.", this.labelStyle);
                GUILayout.Label("   This is the equivalent of Unity's <b>Project</b> window", this.labelStyle);

                GUILayout.Label("7. To choose which assets appear in <b>NG Remote Project</b>, you need to check assets in <b>NG Remote Project Assets</b> in the component <b>NG Server Scene</b>.", this.labelStyle);
                GUILayout.Label("   This way you can avoid embedding unwanted assets and keep your test build lighter and faster to generate.", this.labelStyle);

                GUILayout.Label("Tips. When testing on device, make sure the port is open in both sides and the device is reachable from your network.", this.labelStyle);

                GUILayout.Label("Tips. When working on Game Object, DO NEVER DISABLE the Game Object containing <b>NG Server Scene</b>!", this.labelStyle);
            }
            GUILayout.EndScrollView();
        }
Ejemplo n.º 2
0
        protected virtual void  OnGUI()
        {
            if (this.centeredTextField == null)
            {
                this.centeredTextField           = new GUIStyle(GUI.skin.textField);
                this.centeredTextField.alignment = TextAnchor.MiddleCenter;
                this.centeredLabel           = new GUIStyle(GUI.skin.label);
                this.centeredLabel.alignment = TextAnchor.MiddleCenter;
            }

            if (this.NGConsoleType == null)
            {
                this.fullScreenRect.x      = 0F;
                this.fullScreenRect.y      = 0F;
                this.fullScreenRect.width  = Screen.width;
                this.fullScreenRect.height = Screen.height;
                if (GUI.Button(this.fullScreenRect, "The NG Console tutorial is encountering issues. Contact the author and tell him that it is broken.", this.centeredLabel) == true)
                {
                    // Force the wizard to be unique.
                    ScriptableWizard.GetWindow(this.ContactFormWizardType).Close();
                    ScriptableWizard.DisplayWizard(string.Empty, this.ContactFormWizardType);
                }
                return;
            }

            if (TestUtility.RequireUnmaximized() == true)
            {
                return;
            }

            this.r.x     = TestLoggers.XOffset;
            this.r.y     = TestLoggers.YOffset;
            this.r.width = Screen.width - this.r.x - this.r.x;

            Object[] instances = Resources.FindObjectsOfTypeAll(NGConsoleType);

            if (instances.Length == 0)
            {
                if (GUI.Button(r, "Open NG Console before starting the tutorial") == true)
                {
                    EditorApplication.ExecuteMenuItem("Window/" + Constants.PackageTitle + "/NG Console");
                }
                return;
            }

            this.NGConsoleInstance = instances[0];

            if (this.SettingsFieldInfo != null)
            {
                if (this.SettingsFieldInfo.GetValue(this.NGConsoleInstance) == null)
                {
                    this.fullScreenRect.x      = 0F;
                    this.fullScreenRect.y      = 0F;
                    this.fullScreenRect.width  = Screen.width;
                    this.fullScreenRect.height = Screen.height;
                    GUI.Label(this.fullScreenRect, "NG Console requires an instance of NGSetting to run. Go to the console and link it to one.", this.centeredLabel);
                    return;
                }
            }

            this.DrawTestLoggers();
        }