Exemple #1
0
        private static void RunStory(string storyName)
        {
            var storyManager = new StoryManager(new StoryReadRepository(), new StoryRepository());
            var story        = storyManager.GetStory(storyName);

            Console.WriteLine(story.Name);
            Console.WriteLine();
            RunProblems(story.FirstProblem, storyManager, new List <int>(), storyName);
            Console.ReadKey();
        }
        private void CurrentScriptCombo_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            if ((sender as ComboBox).SelectedItem == null)
            {
                return;
            }
            string storyKey = (sender as ComboBox).SelectedItem.ToString();

            CurrentScript.Text = StoryManager.GetStory(storyKey).GenerateXml().ToString();
        }
 private void EditStoryButton_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     if (CurrentScriptCombo.SelectedItem != null)
     {
         StoryEditWindow win      = new StoryEditWindow();
         string          storyKey = CurrentScriptCombo.SelectedItem.ToString();
         win.BindData(StoryManager.GetStory(storyKey));
         win.Show();
     }
     else
     {
         MessageBox.Show("请先选择要编辑的剧本");
     }
 }
        /// <summary>
        /// 试炼之地
        /// </summary>
        public void Trial()
        {
            string passedRoles = RuntimeData.Instance.TrialRoles;

            Collection <string> cannotSelectList = new Collection <string>();

            cannotSelectList.Add("主角");
            foreach (var r in passedRoles.Split(new char[] { '#' }))
            {
                cannotSelectList.Add(r);
            }
            uihost.towerSelectRole.confirmBack = () =>
            {
                this.uihost.Dispatcher.BeginInvoke(() =>
                {
                    Battle battle = BattleManager.GetBattle("试炼之地_战斗");
                    uihost.battleFieldContainer.LoadTrail(
                        battle, uihost.towerSelectRole.selectedFriends[0], (result) =>
                    {
                        uihost.battleFieldContainer.field.battleCallback = null;
                        //win
                        if (result == 1)
                        {
                            Role role = RuntimeData.Instance.Team[uihost.towerSelectRole.selectedFriends[0]];
                            RuntimeData.Instance.TrialRoles += "#" + role.Key;
                            RuntimeData.Instance.TrialRoles.Trim(new char[] { '#' });
                            RuntimeData.Instance.AddLog(role.Name + "通过试炼之地");
                            string storyName = "霹雳堂_" + role.Key;
                            Story story      = StoryManager.GetStory(storyName);
                            if (story == null)
                            {
                                RuntimeData.Instance.gameEngine.CallScence(
                                    uihost.battleFieldContainer.field,
                                    new NextGameState()
                                {
                                    Type = "story", Value = "霹雳堂_胜利"
                                });
                            }
                            else
                            {
                                RuntimeData.Instance.gameEngine.CallScence(
                                    uihost.battleFieldContainer.field,
                                    new NextGameState()
                                {
                                    Type = "story", Value = storyName
                                });
                            }
                        }
                        else //lose
                        {
                            RuntimeData.Instance.gameEngine.CallScence(
                                uihost.battleFieldContainer.field,
                                new NextGameState()
                            {
                                Type = "story", Value = "original_试炼之地.失败"
                            });
                        }
                    });
                });
            };
            uihost.towerSelectRole.load(1, null, cannotSelectList);
        }