public FormDialogPlayer(DialogInfo dialog) { Debug.Assert(dialog != null); InitializeComponent(); _playerProgress.Visible = false; _graph = dialog.Graph; _path.Push(_graph.RootNode); LoadControls(); }
public FormDialogProperties(DialogObjectManager manager, DialogObject dialog) { InitializeComponent(); _dialogObject = dialog; _dialog = _dialogObject.Dialog; _manager = manager; _comboCharacters.Items.AddRange(_dialog.Dialogs.Characters.Keys.ToArray()); foreach(var character in _dialog.DialogCharacters) { var item = _listCharacters.Items.Add(new ListViewItem(character.Name)); item.Tag = new DialogCharacter(_dialog) {IsPlayer = character.IsPlayer, Name = character.Name}; item.Checked = character.IsPlayer; } string name = _dialogObject.GetName(); _textDialogName.Text = name; string scriptFileName; try { if(_dialog.ScriptFile!=null) scriptFileName = _dialog.ScriptFile; else { var filePath = Path.Combine(manager.RootDirectory, _dialogObject.RelativePath + ".lua"); if (File.Exists(filePath)) scriptFileName = name + ".lua"; else scriptFileName = string.Empty; } } catch { scriptFileName = string.Empty; } _textScriptFile.Text = scriptFileName; }
public DialogObject GetOrCreateDialogObject(string relativePath) { string relPath = relativePath.ToLower(); DialogObject result; if(_directoryDialogMapping.TryGetValue(relPath,out result)) return result; result=new DialogObject(); string fPath = null; if (RootDirectory != null) fPath = Path.Combine(RootDirectory, relPath + ".dlg"); var changed = _dialogs.HasChanges; var dlgInfo = new DialogInfo(_dialogs); result.Dialog = dlgInfo; if (File.Exists(fPath)) { var pref = new UserPreferences(result); var xDialog = GetDialogNode(relativePath); pref.PrepareForReading(xDialog ?? new XElement("dialog", new XAttribute("path", relativePath))); dlgInfo.LoadFromFile(fPath, pref); } result.RelativePath = relativePath; result.HasChanges = false; _dialogs.Add(dlgInfo); if(!changed) _dialogs.HasChanges = false; _directoryDialogMapping.Add(relPath, result); return result; }