Пример #1
0
        private void OnGUI()
        {
            GUI.color = Color.white;
            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            EditorGUILayout.GameViewSizePopup(ScriptableSingleton <GameViewSizes> .instance.currentGroupType, ScriptableSingleton <NScreenManager> .instance.SelectedSizeIndex, this, EditorStyles.toolbarDropDown, new GUILayoutOption[]
            {
                GUILayout.Width(160f)
            });
            GUILayout.FlexibleSpace();
            GUI.enabled = !Application.isPlaying;
            bool buildOnPlay = ScriptableSingleton <NScreenManager> .instance.BuildOnPlay;

            ScriptableSingleton <NScreenManager> .instance.BuildOnPlay = GUILayout.Toggle(ScriptableSingleton <NScreenManager> .instance.BuildOnPlay, "Build on Play", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            if (buildOnPlay != ScriptableSingleton <NScreenManager> .instance.BuildOnPlay)
            {
                NScreenManager.RepaintAllGameViews();
            }
            if (GUILayout.Button("Build Now", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                this.shouldBuild = true;
            }
            GUI.enabled = Application.isPlaying;
            GUILayout.EndHorizontal();
            if (!this.shouldExit && this.bridge != null)
            {
                Texture2D screenTexture = this.bridge.GetScreenTexture();
                if (screenTexture != null)
                {
                    GUI.DrawTexture(this.remoteViewRect, screenTexture);
                }
                if (this == EditorWindow.focusedWindow)
                {
                    this.bridge.SetInput((int)Event.current.mousePosition.x - (int)this.remoteViewRect.x, (int)base.position.height - (int)Event.current.mousePosition.y - (int)this.remoteViewRect.y + this.ToolBarHeight - (int)Mathf.Max(0f, base.position.height - 720f), Event.current.button, (int)((!Event.current.isKey) ? ((KeyCode)(-1)) : Event.current.keyCode), (int)Event.current.type);
                }
                else
                {
                    this.bridge.ResetInput();
                }
            }
            else
            {
                GUILayout.Label("Game Stopped", new GUILayoutOption[0]);
            }
        }