/* * Lock editor if mouse pointer is inside window rect */ private void PreventClickThrough(Rect rect) { Vector2 pointerPos = Mouse.screenPos; // if (rect.Contains(pointerPos) && !EditorLogic.softLock) if (rect.Contains(pointerPos)) { EditorLockManager.lockEditor(Constants.settingPreventClickThroughLock); } // else if (!rect.Contains(pointerPos) && EditorLogic.softLock) else if (!rect.Contains(pointerPos)) { EditorLockManager.unlockEditor(Constants.settingPreventClickThroughLock); } }
/// <summary> /// Public Eventcall at the GuiDraw /// </summary> private void HandleGUI() { if (!_guiVisible) { //TODO: Play a "uh-uh" (nops) sound. Log.dbgGui(this, "GUI is set to invisible!"); return; } GUI.skin = _guiskin; switch (this.state) { case DisplayState.none: EditorLockManager.unlockEditor(Constants.settingPreventClickThroughLock); EditorLockManager.unlockEditor(Constants.settingWeldingLock); break; case DisplayState.weldError: _editorErrorDial = ClickThruBlocker.GUILayoutWindow((int)this.state, _editorErrorDial, OnErrorDisplay, Constants.weldManufacturer); break; case DisplayState.weldWarning: _editorWarningDial = ClickThruBlocker.GUILayoutWindow((int)this.state, _editorWarningDial, OnWarningDisplay, Constants.weldManufacturer); break; case DisplayState.infoWindow: _editorInfoWindow = ClickThruBlocker.GUIWindow((int)this.state, _editorInfoWindow, OnInfoWindow, Constants.weldManufacturer); PreventClickThrough(_editorInfoWindow); break; case DisplayState.savedWindow: _editorSavedDial = ClickThruBlocker.GUILayoutWindow((int)this.state, _editorSavedDial, OnSavedDisplay, Constants.weldManufacturer); break; case DisplayState.overwriteDial: _editorOverwriteDial = ClickThruBlocker.GUILayoutWindow((int)this.state, _editorOverwriteDial, OnOverwriteDisplay, Constants.weldManufacturer); break; case DisplayState.mainWindow: _editorMainWindow = ClickThruBlocker.GUIWindow((int)this.state, _editorMainWindow, OnMainWindow, Constants.weldManufacturer); PreventClickThrough(_editorMainWindow); break; case DisplayState.partSelection: ScreenMessages.PostScreenMessage(Constants.guiScreenMessagePartSelection, Time.deltaTime, ScreenMessageStyle.UPPER_CENTER); break; } } //private void OnDraw()
/// <summary> /// Public Eventcall at the GuiDraw /// </summary> private void OnDraw() { if (_guiVisible) { GUI.skin = _guiskin; switch (_state) { case DisplayState.none: EditorLockManager.unlockEditor(Constants.settingPreventClickThroughLock); EditorLockManager.unlockEditor(Constants.settingWeldingLock); break; case DisplayState.weldError: _editorErrorDial = GUILayout.Window((int)_state, _editorErrorDial, OnErrorDisplay, Constants.weldManufacturer); break; case DisplayState.weldWarning: _editorWarningDial = GUILayout.Window((int)_state, _editorWarningDial, OnWarningDisplay, Constants.weldManufacturer); break; case DisplayState.infoWindow: _editorInfoWindow = GUI.Window((int)_state, _editorInfoWindow, OnInfoWindow, Constants.weldManufacturer); PreventClickThrough(_editorInfoWindow); break; case DisplayState.savedWindow: _editorSavedDial = GUILayout.Window((int)_state, _editorSavedDial, OnSavedDisplay, Constants.weldManufacturer); break; case DisplayState.overwriteDial: _editorOverwriteDial = GUILayout.Window((int)_state, _editorOverwriteDial, OnOverwriteDisplay, Constants.weldManufacturer); break; case DisplayState.mainWindow: _editorMainWindow = GUI.Window((int)_state, _editorMainWindow, OnMainWindow, Constants.weldManufacturer); PreventClickThrough(_editorMainWindow); break; case DisplayState.partSelection: ScreenMessages.PostScreenMessage(Constants.guiScreenMessagePartSelection, Time.deltaTime, ScreenMessageStyle.UPPER_CENTER); break; } } //if (_guiVisible) } //private void OnDraw()
/* * Error Message */ private void HandleErrorDisplay(int windowID) { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label(Constants.guiDialFail); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(Constants.guiOK)) { EditorLockManager.unlockEditor(Constants.settingWeldingLock); this.state = DisplayState.none; } GUILayout.EndVertical(); GUI.DragWindow(); } //private void OnErrorDisplay()