예제 #1
0
        private ContentDocument GetScriptEditor(UnloadedRoom selectedRoom)
        {
            if ((_roomScriptEditors.ContainsKey(selectedRoom.Number)) &&
                (!_roomScriptEditors[selectedRoom.Number].Visible))
            {
                DisposePane(_roomScriptEditors[selectedRoom.Number]);
                _roomScriptEditors.Remove(selectedRoom.Number);
            }

            if (!_roomScriptEditors.ContainsKey(selectedRoom.Number))
            {
                if (selectedRoom.Script == null)
                {
                    selectedRoom.LoadScript();
                }
                ScriptEditor scriptEditor = new ScriptEditor(selectedRoom.Script, _agsEditor);
                scriptEditor.RoomNumber = selectedRoom.Number;
                scriptEditor.IsModifiedChanged += new EventHandler(ScriptEditor_IsModifiedChanged);
                if ((_loadedRoom != null) && (_loadedRoom.Number == selectedRoom.Number))
                {
                    scriptEditor.Room = _loadedRoom;
                }
                _roomScriptEditors.Add(selectedRoom.Number, new ContentDocument(scriptEditor, selectedRoom.Script.FileName, this));
                _roomScriptEditors[selectedRoom.Number].ToolbarCommands = scriptEditor.ToolbarIcons;
                _roomScriptEditors[selectedRoom.Number].MainMenu = scriptEditor.ExtraMenu;
            }

            return _roomScriptEditors[selectedRoom.Number];
        }
예제 #2
0
 private Room LoadNewRoomIntoMemory(UnloadedRoom newRoom, CompileMessages errors)
 {
     if ((newRoom.Script == null) || (!newRoom.Script.Modified))
     {
         try
         {
             newRoom.LoadScript();
         }
         catch (FileNotFoundException)
         {
             _guiController.ShowMessage("The script file '" + newRoom.ScriptFileName + "' is missing. An empty script has been loaded instead.", MessageBoxIcon.Warning);
         }
     }
     else if (_roomScriptEditors.ContainsKey(newRoom.Number))
     {
         ((ScriptEditor)_roomScriptEditors[newRoom.Number].Control).UpdateScriptObjectWithLatestTextInWindow();
     }
     _loadedRoom = _nativeProxy.LoadRoom(newRoom);
     _loadedRoom.Modified = ImportExport.CreateInteractionScripts(_loadedRoom, errors);
     _loadedRoom.Modified |= HookUpInteractionVariables(_loadedRoom);
     _loadedRoom.Modified |= AddPlayMusicCommandToPlayerEntersRoomScript(_loadedRoom, errors);
     if (_loadedRoom.Script.Modified)
     {
         if (_roomScriptEditors.ContainsKey(_loadedRoom.Number))
         {
             ((ScriptEditor)_roomScriptEditors[_loadedRoom.Number].Control).ScriptModifiedExternally();
         }
     }
     return _loadedRoom;
 }