Exemple #1
0
        /// <summary>
        /// 切换场景工具
        /// </summary>
        public void SwitchTools(SceneToolsType stt)
        {
            if (stt == m_sceneToolType)
            {
                return;
            }

            m_sceneToolType = stt;

            if (stt != SceneToolsType.Selector)
            {
                selectorTools.Close();
                selectorWindow.CloseWindow();
            }
            if (stt != SceneToolsType.Brush)
            {
                brushTools.Close();
                brushWindow.CloseWindow();
            }
            if (stt != SceneToolsType.Sucker)
            {
                suckerTools.Close();
            }
            if (stt != SceneToolsType.Erase)
            {
                eraseTools.Close();
            }


            if (stt == SceneToolsType.Selector)
            {
                selectorTools.Open();
                selectorWindow.ShowWindow();
            }
            if (stt == SceneToolsType.Brush)
            {
                brushTools.Open();
                brushWindow.ShowWindow();
            }
            if (stt == SceneToolsType.Sucker)
            {
                suckerTools.Open();
            }
            if (stt == SceneToolsType.Erase)
            {
                eraseTools.Open();
            }

            if (switchToolsEventHandler != null)
            {
                switchToolsEventHandler(stt);
            }

            if (stt == SceneToolsType.None)
            {
                Selection.activeGameObject = null;
            }
        }
 // 切换工具事件
 void OnSwitchToolsEventHandler(SceneToolsType stt)
 {
     // 笔刷绑定资源
     if (stt == SceneToolsType.Brush)
     {
         sceneWindow.brushTools.Bind(m_resObject);
         sceneWindow.brushWindow.Initialize();
     }
 }
Exemple #3
0
        private void OnOperationGUI(int id)
        {
            using (new HorizontalCenteredScope())
            {
                // Template Grid 背景
                templateGrid.transparentEnabled = GUILayout.Toggle(templateGrid.transparentEnabled, EUI.GetTextureContent("iconIsolate"), GUI.skin.button, m_layoutHeight, m_layoutWidth);

                // Template Grid 高度
                if (GUILayout.Toggle(false, EUI.GetTextureContent("iconGridUp"), GUI.skin.button, m_layoutHeight, m_layoutWidth))
                {
                    m_sceneToolType = SceneToolsType.None;
                    templateGrid.height++;
                    CubeWorldEditorWindow.Inst.Repaint();
                }

                // GizmoPanelDown
                if (GUILayout.Toggle(false, EUI.GetTextureContent("iconGridDown"), GUI.skin.button, m_layoutHeight, m_layoutWidth))
                {
                    m_sceneToolType = SceneToolsType.None;
                    templateGrid.height--;
                    CubeWorldEditorWindow.Inst.Repaint();
                }

                // camera view
                if (GUILayout.Button(EUI.GetTextureContent("iconEye"), GUI.skin.button, m_layoutHeight, m_layoutWidth))
                {
                    m_sceneViewQuaIndex++;
                    if (m_sceneViewQuaIndex >= m_sceneViewQuas.Length)
                    {
                        m_sceneViewQuaIndex = 0;
                    }
                    SceneView.lastActiveSceneView.LookAt(Vector3.zero, m_sceneViewQuas[m_sceneViewQuaIndex]);
                }

                // 截图
                if (GUILayout.Button(EUI.GetTextureContent("iconCapture"), GUI.skin.button, m_layoutHeight, m_layoutWidth))
                {
                    SwitchTools(SceneToolsType.None);

                    var path = Utils.GetPathToAssets(Utils.GetSceneDirectory(Environment.Inst.sceneName, false)) + "/ScreenShot/" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".png";
                    Utils.CaptureScreenShot(path, SettingManager.Inst.Setting.screenshotOpenFinder);

                    EditorUtility.DisplayDialog("Capture ScreenShot", "Capture ScreenShot Succeed!", "ok");
                }
            }
        }