Exemplo n.º 1
0
    public void OnGUI()
    {
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Undo"))
        {
            commandManager.Undo(viewer.blockManager);
            viewer.SetDirty();
        }
        if (GUILayout.Button("Redo"))
        {
            commandManager.Redo(viewer.blockManager);
            viewer.SetDirty();
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(5);

        GUIBuild();
        GUIFile();
    }
Exemplo n.º 2
0
    void OnGUI()
    {
        //设置皮肤,缩放
        GUI.skin = skin;
        float scaleX = Screen.width / (float)designedWidth;
        float scaleY = Screen.height / (float)designedHeight;

        scale = Mathf.Min(scaleX, scaleY);

        int splitX = ScreenWidth() - toolWidht;

        modelCamera.rect = new Rect(0, 0, (splitX * 1.0f) / ScreenWidth(), 1);
        uiCamera.rect    = new Rect((splitX * 1.0f) / ScreenWidth(), 0, toolWidht * 1.0f / ScreenWidth(), 1);

        //操作窗口
        if (!browser.isWindowOpened())
        {
            cameraController.OnGUI();
            modelViewer.OnGUI();
        }

        GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(scale, scale, 1));
        //画工具框
        GUI.Box(new Rect(splitX, 0, toolWidht, ScreenHeight()), "");
        GUILayout.BeginArea(new Rect(splitX + 20, 20, toolWidht - 40, ScreenHeight() - 40));
        editorTool.OnGUI();
        GUILayout.EndArea();

        if (Event.current.isKey && Event.current.keyCode == KeyCode.Z)
        {
            if (Input.GetKey(KeyCode.LeftControl))
            {
                commandManager.Undo(modelViewer.blockManager);
                modelViewer.SetDirty();
            }
        }
    }