/// <summary> /// Reloads the composition. /// </summary> /// <remarks>Reloading is useful if you want to run simulation multiple times in one execution time. /// Some models aren't able to run simulation after it was already run, and may crash in such case. /// That's because they need to create new instance of them, on which the <c>Initialize</c> method /// is called. /// Reloading is done same way like when you save the composition to OPR file, restarts the application, /// and open this OPR file again. Of course, it is done only internally in the memory.</remarks> public void Reload() { _editorMode = EEditorMode.Unspecified; XmlDocument xmlDocument = new XmlDocument(); SaveToXmlDocument(xmlDocument); // preserve members that aren't saved to XML bool oldShouldBeSaved = _shouldBeSaved; Release(); AssemblySupport.ReleaseAll(); LoadFromXmlDocument(Path.GetDirectoryName(_filePath), xmlDocument); _shouldBeSaved = oldShouldBeSaved; }
void OnEnable() { gameData = new List<HideObjectData>(); currentMode = EEditorMode.ModeAdd; tmpData = new List<TempObject>(); windowGUI = new WindowGUI(this); }
/// <summary> /// Горячие клавиши /// </summary> private void onControls() { if (Event.current.keyCode == KeyCode.KeypadPlus) { windowGUI.brushSize += 0.02f; this.Repaint(); } if (Event.current.keyCode == KeyCode.KeypadMinus) { windowGUI.brushSize -= 0.02f; this.Repaint(); } if (Event.current.keyCode == KeyCode.F9 && Event.current.type == EventType.KeyDown) { windowGUI.designMode=!windowGUI.designMode; this.Repaint(); } if (Event.current.keyCode == KeyCode.F10 && Event.current.type == EventType.KeyDown) { windowGUI.consoleMode=!windowGUI.consoleMode; this.Repaint(); } if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape) { doDropObject(); this.Repaint(); } if (Event.current.alt) currentMode = EEditorMode.ModePick; if (Event.current.control) currentMode = EEditorMode.ModeDelete; if (!Event.current.alt && !Event.current.control) currentMode = EEditorMode.ModeAdd; selectModeOn = Event.current.alt && Event.current.type == EventType.MouseUp && Event.current.button == 0; addingModeOn = Event.current.shift && Event.current.type == EventType.MouseDown; deleteModeOn = Event.current.control && Event.current.type == EventType.mouseDown; }