private void aboutus_Click(object sender, System.Windows.RoutedEventArgs e) { NextGameState next = new NextGameState(); next.Type = "story"; next.Value = "aboutus_main"; this.Visibility = System.Windows.Visibility.Collapsed; RuntimeData.Instance.gameEngine.CallScence(RuntimeData.Instance.gameEngine.uihost.mapUI, next); }
private void DebugButton_Click(object sender, System.Windows.RoutedEventArgs e) { NextGameState next = new NextGameState(); next.Type = "story"; next.Value = story.Name; if (RuntimeData.Instance.gameEngine != null) { RuntimeData.Instance.gameEngine.CallScence(RuntimeData.Instance.gameEngine.uihost.mapUI, next); this.DialogResult = true; } else { MessageBox.Show("启动调试错误!你必须启动游戏,并新建或载入存档。"); } }
public void CallScence(IScence sender, NextGameState next) { if (next == null) { if (sender != null) { sender.Hide(); } //this.uihost.Dispatcher.BeginInvoke(() => { this.Scence(next); }); this.Scence(next); return; } //this.uihost.Dispatcher.BeginInvoke(() => { this.Scence(next); }); if (sender != null) { sender.Hide(); } this.Scence(next); //this.Scence(next); }
private void Button_Click(object sender, System.Windows.RoutedEventArgs e) { string cmd = commandText.Text; string[] tmp = cmd.Split(new char[] { ' ' }); if (tmp.Length == 0 || tmp.Length > 2) { MessageBox.Show("invalid command"); return; } else { NextGameState next = new NextGameState(); next.Type = tmp[0]; if (tmp.Length == 2) { next.Value = tmp[1]; } RuntimeData.Instance.gameEngine.CallScence(RuntimeData.Instance.gameEngine.uihost.mapUI, next); } }
public void GameState(NextGameState state) { this.CurrentGameState.Text = state.ToString(); }
private void Scence(NextGameState next) { if (RuntimeData.Instance.IsCheated) { MessageBox.Show("系统检测到你正在作弊,将结束游戏"); uihost.gameOverPanel.Show(); return; } uihost.reset(); if (next == null) { uihost.mapUI.resetTeam(); uihost.mapUI.Load(RuntimeData.Instance.CurrentBigMap); return; } //GC.Collect(); currentStatus = next.Type; if (Configer.Instance.Debug) { App.GameStudio.GameState(next); } switch (next.Type) { case "rollrole": uihost.rollRolePanel.Show(); break; case "tutorial": Tutorial(); break; case "map": uihost.mapUI.resetTeam(); if (next.Value == null || next.Value.Equals(string.Empty)) { next.Value = RuntimeData.Instance.CurrentBigMap; } RuntimeData.Instance.Date = RuntimeData.Instance.Date.AddHours(1); //地图耗时 if (Tools.ProbabilityTest(0.1)) { RuntimeData.Instance.CheckCheat(); } RuntimeData.Instance.CheckTimeFlags(); LoadMap(next.Value); if (Configer.Instance.AutoSave) { RuntimeData.Instance.Save("自动存档"); } break; //case "battle": // uihost.battleFieldContainer.Load(next.Value); // break; //case "scenario": // uihost.scence.Load(next.Value); // break; case "battle": Story story = new Story() { Name = "battle_" + next.Value }; story.Actions.Add(new GameData.Action() { Type = "BATTLE", Value = next.Value }); StoryManager.PlayStory(story, lastScenceIsMap); break; case "story": StoryManager.PlayStory(next.Value, lastScenceIsMap); lastScenceIsMap = false; break; case "arena": Arena(); break; case "trial": Trial(); break; case "tower": Tower(true); break; case "nextTower": Tower(false); break; case "huashan": Huashan(true); break; case "nextHuashan": Huashan(false); break; case "OLBattleHost": //OLBattle(true, 1); break; case "nextOLBattleHost": //OLBattle(false, 1); break; case "OLBattleGuest": //OLBattle(true, 2); break; case "nextOLBattleGuest": //OLBattle(false, 2); break; case "restart": Restart(); break; case "nextZhoumu": NextZhoumu(); break; case "gameOver": uihost.gameOverPanel.Show(); break; case "gameFin": uihost.fin.Visibility = Visibility.Visible; break; case "shop": uihost.shopPanel.Show(ShopManager.GetShop(next.Value)); break; case "sellshop": uihost.shopPanel.Show(SellShopManager.GetSellShop(next.Value)); break; case "game": uihost.playSmallGame(next.Value); break; case "mainmenu": uihost.mainMenu.Visibility = Visibility.Visible; break; case "xiangzi": //储物箱 uihost.shopPanel.ShowXiangzi(); break; case "item": //获得一个物品 RuntimeData.Instance.Items.Add(ItemManager.GetItem(next.Value).Clone()); LoadMap(RuntimeData.Instance.CurrentBigMap); break; case "danmu": uihost.AddDanMu(next.Value); LoadMap(RuntimeData.Instance.CurrentBigMap); break; case "wudaodahui": if (RuntimeData.Instance.IsCheated) { MessageBox.Show("系统检测到你正在作弊,禁止进入武道大会"); LoadMap(RuntimeData.Instance.CurrentBigMap); return; } uihost.wudaodahuiPanel.Show(); break; case "dropallsaves": SaveLoadManager.Instance.CreateEmptySave(); return; default: MessageBox.Show("error scence type: " + next.Type); uihost.mapUI.resetTeam(); uihost.mapUI.Load(RuntimeData.Instance.CurrentBigMap); break; } }