private void ShowDialogPreview(GameData.Action action) { if (action.Params.Length == 2) { string[] paras = action.Value.Split(new char[] { '#' }); string roleName = paras[0]; string info = paras[1]; info = info.Replace("$FEMALE$", "女主"); info = info.Replace("$MALE$", "主角"); this.Head.Source = RoleManager.GetRole(roleName).Head; this.Text.Text = info; if (roleName == "女主") { this.RoleName.Text = "女主" + ":"; } else if (roleName == "主角") { this.RoleName.Text = "主角" + ":"; this.Head.Source = ResourceManager.GetImage("头像.主角"); } else { this.RoleName.Text = RoleManager.GetRole(roleName).Name + ":"; } } else { this.RoleName.Text = ""; this.Head.Source = null; this.Text.Text = ""; } }
private void NewActionButton_Click(object sender, System.Windows.RoutedEventArgs e) { if (ActionTypeCombo.SelectedItem == null) { MessageBox.Show("请先选择要增加的剧本类型"); return; } string type = ActionTypeCombo.SelectedItem.ToString(); GameData.Action newAction = new GameData.Action() { Type = type, Value = "" }; if (StoryListBox.SelectedItem != null) { int index = StoryListBox.SelectedIndex; story.Actions.Insert(index + 1, newAction); this.Refresh(); StoryListBox.SelectedIndex = index + 1; } else { story.Actions.Add(newAction); this.Refresh(); StoryListBox.SelectedIndex = story.Actions.Count - 1; } }
private void ShowSelectEditor(GameData.Action action) { string[] p = action.Value.Split(new char[] { '#' }); SelectEditCanvas.Visibility = System.Windows.Visibility.Visible; if (p.Length <= 2) { //MessageBox.Show("SELECT脚本格式解析错误!"); //this.ShowActionEditor(action); SelectEditTitle.Text = ""; SelectRoleText.Text = ""; SelectContent.Text = ""; return; } string title = p[1]; string role = p[0]; string temp = string.Empty; for (int i = 2; i < p.Length; ++i) { temp += p[i] + '\n'; } SelectEditTitle.Text = title; SelectRoleText.Text = role; SelectContent.Text = temp; }
private void ShowMapEditor(GameData.Action action) { MapEditCanvas.Visibility = System.Windows.Visibility.Visible; MapValueTextBox.Text = action.Value; MapActualPathText.Text = ResourceManager.Get(action.Value); MapPreviewImage.Source = ResourceManager.GetImage(action.Value); }
private void ShowDialogEditor(GameData.Action action) { DialogEditCanvas.Visibility = System.Windows.Visibility.Visible; this.ShowDialogPreview(action); if (action.Value != string.Empty) { DialogRoleNameTextBox.Text = action.Params[0]; DialogInfoTextBox.Text = action.Params[1]; } else { DialogRoleNameTextBox.Text = ""; DialogInfoTextBox.Text = ""; } }
private void StoryListBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { this.ResetView(); if (StoryListBox.SelectedItem == null) { return; } int index = StoryListBox.SelectedIndex; if (index + 1 <= story.Actions.Count) { GameData.Action action = story.Actions[index]; CurrentAction = action; ActionTypeText.Text = action.Type; if (action.Type == "DIALOG") { this.ShowDialogEditor(action); } else if (action.Type == "MUSIC") { this.ShowMusicEditor(action); } else if (action.Type == "BACKGROUND") { this.ShowMapEditor(action); } else if (action.Type == "SELECT") { this.ShowSelectEditor(action); } else //否则使用默认编辑器 { this.ShowActionEditor(action); } } }
private void ShowMusicEditor(GameData.Action action) { MusicEditCanvas.Visibility = System.Windows.Visibility.Visible; MusicValueTextBox.Text = action.Value; MusicActualPathText.Text = ResourceManager.Get(action.Value); }
private void ShowActionEditor(GameData.Action action) { ActionEditCanvas.Visibility = System.Windows.Visibility.Visible; ActionValueTextBox.Text = action.Value; }