Пример #1
0
        /////////////////////////////////////////
        internal static void DrawRightBottom(SceneView sceneView)
        {
            if (!E.i.enableTimeScaleSlider)
            {
                return;
            }


            Rect rcPop = new Rect(108, 8, 160, 16);

            rcPop.x     = Screen.width - 180 - 10;
            rcPop.width = 180 - 8;
            rcPop.y     = Screen.height - (24 * 2) - (8 * 2);

            var rc = rcPop.AddW(4);

            EditorGUI.DrawRect(rc, E.i.uiBkColor);

            //int controlID = GUIUtility.GetControlID( "HEditorSliderKnob".GetHashCode(), FocusType.Passive, rcPop );
            //Time.timeScale = GUI.Slider( rcPop, Time.timeScale, 0.0f, 0.00f, 1.00f, GUI.skin.horizontalSlider, GUI.skin.horizontalSliderThumb, true, controlID );
            //EditorGUI.DrawRect( rcPop, new Color(0,0,1,0.50f));

            Time.timeScale = EditorGUI.Slider(rcPop, Time.timeScale, 0.00f, 1.00f);

            //Rect rrr = new Rect( Screen.width, Screen.height - ( 24 * 2 ), 0, 0 );
            //rrr.x -= 16;
            //rrr.width = 16;
            //rrr.y -= 32;
            //rrr.height = 16;
            //s_process = System.Diagnostics.Process.GetCurrentProcess();

            //if( GUI.Button( rrr, "b" ) ) {
            //	Cursor.visible = false;
            //	Debug.Log( Win32API.ShowCursor( false ) );
            //	EnumWindows( new EnumWindowsCallback( _EnumWindowsProc ), 0 );
            //	int _EnumWindowsProc( IntPtr hWnd, int lParam ) {
            //		uint processId;
            //		GetWindowThreadProcessId( hWnd, out processId );
            //		if( s_process.Id == processId ) {
            //			var v = new System.Text.StringBuilder( 255 );
            //			GetWindowText( hWnd, v, v.Capacity );
            //			//UnityEngine.Debug.Log( v.ToString());
            //			if( v.ToString().Contains( "Unity" ) ) {
            //				//SetWindowPos( hWnd, 0, 16, 16, 1600 + 14, 900 + 7, 0 );
            //				Debug.Log( $"{GetForegroundWindow()} {hWnd}" );
            //				return 0;
            //			}
            //		}

            //		return 1;
            //}
            //}

            //rrr.x -= 16;
        }
Пример #2
0
        /////////////////////////////////////////
        internal static void DrawLeftBottom(SceneView sceneView)
        {
            Rect rcPop    = new Rect(8, 0, 0, 24);
            Rect rcRad    = new Rect(12, 0, 160 - 4, 16);
            Rect rcToggle = new Rect(rcPop.max.x, 0, 16, 16);

            var cameras = UnityObject.FindObjectsOfType <Camera>();

            rcPop.y = Screen.height - (24 * 2) - (8 * 2);

            if (E.i.syncScene2Game)
            {
                string[] displayNames = new string[] { "None", "" };
                ArrayUtility.AddRange(ref displayNames, cameras.Select(c => c.name).ToArray());

                rcPop.width = 160;

                //GUI.skin = EditorGUIUtility.GetBuiltinSkin( EditorSkin.Inspector );
                s_cameraSelect = EditorGUI.Popup(rcPop, s_cameraSelect, displayNames, Styles.popup);

                // Match GameView

                int index = s_cameraSelect - 2;

                if (index >= 0 && index < cameras.Length)
                {
                    var camera = cameras[index];
                    if (s_gameviewMatch)
                    {
                        var a = camera.transform.rotation * Vector3.forward;
                        a *= 25.0f;
                        sceneView.pivot    = camera.transform.position + a;
                        sceneView.rotation = camera.transform.rotation;
                        sceneView.size     = 25.0f;

                        s_gameviewMatch = false;
                    }
                    else
                    {
                        camera.transform.position = sceneView.camera.transform.position;
                        camera.transform.rotation = sceneView.camera.transform.rotation;
                    }
                }
                else
                {
                    rcRad.y = rcPop.y - 16;
                    if (UnitySymbol.Has("UNITY_2019_3_OR_NEWER"))
                    {
                        rcRad.y -= 2;
                    }
                    var cont = EditorHelper.TempContent(S._MatchGameView);
                    var sz   = EditorStyles.toggle.CalcSize(cont);
                    rcRad.width = sz.x;
                    var rc = rcRad.AddW(2);
                    EditorGUI.DrawRect(rc, E.i.uiBkColor);
                    s_gameviewMatch = GUI.Toggle(rcRad, s_gameviewMatch, S._MatchGameView, Styles.toggle);
                }
            }


            // orthographic
            if (E.i.toggleOrthographic)
            {
                rcToggle.y = rcPop.y + 1;
                rcToggle.x = rcPop.x + rcPop.width;
                if (UnitySymbol.Has("UNITY_2019_3_OR_NEWER"))
                {
                    rcToggle.x += 2;
                }
                var cont = EditorHelper.TempContent("Iso");
                var sz   = EditorStyles.toggle.CalcSize(cont);
                rcToggle.width = sz.x;

                var rc = rcToggle.AddW(2);
                EditorGUI.DrawRect(rc, E.i.uiBkColor);
                sceneView.orthographic = GUI.Toggle(rcToggle, sceneView.orthographic, cont, Styles.toggle);
            }
        }