protected override void OnInitialize() { title = "Brush Setting"; w = 330; h = 175; m_positionOffset = Vector3.zero; m_angleOffset = Vector3.zero; windowId = EUI.GetWindowId(); selectedSnapping = 1; m_brushTools = CubeWorldEditorWindow.Inst.sceneWindow.brushTools; }
protected override void OnInitialize() { // 创建工具 if (m_selectorTools == null) { m_selectorTools = new SelectorTools(); } if (m_brushTools == null) { m_brushTools = new BrushTools(); } if (m_suckerTools == null) { m_suckerTools = new SuckerTools(); } if (m_eraseTools == null) { m_eraseTools = new EraseTools(); } // 工具事件注册 m_selectorTools.toolsEventHandler -= OnSelectorToolsEventHandler; m_selectorTools.toolsEventHandler += OnSelectorToolsEventHandler; m_brushTools.toolsEventHandler -= OnBrushToolsEventHandler; m_brushTools.toolsEventHandler += OnBrushToolsEventHandler; m_suckerTools.toolsEventHandler -= OnSuckerToolsEventHandler; m_suckerTools.toolsEventHandler += OnSuckerToolsEventHandler; m_eraseTools.toolsEventHandler -= OnEraseToolsEventHandler; m_eraseTools.toolsEventHandler += OnEraseToolsEventHandler; // 创建窗口 if (m_brushWindow == null) { m_brushWindow = new BrushWindow(); } if (m_selecterWindow == null) { m_selecterWindow = new SelectorWindow(); } // 模版格子 if (m_templateGrid == null) { m_templateGrid = GameObject.Find(typeof(TemplateGrid).Name).gameObject.GetComponent <TemplateGrid>(); } // 注册场景事件 m_templateGrid.SceneRenderHandler -= OnSceneRender; m_templateGrid.SceneRenderHandler += OnSceneRender; // window id m_toolsWindowId = EUI.GetWindowId(); m_operationWindowId = EUI.GetWindowId(); // GUILayoutOption m_layoutWidth = GUILayout.Width(SettingManager.Inst.Setting.sceneToolsIconSize); m_layoutHeight = GUILayout.Height(SettingManager.Inst.Setting.sceneToolsIconSize); // 场景视角设置 m_sceneViewQuaIndex = 0; }