/// <summary> /// Vytvori a zobrazi okno se statistikami za posledni hru a nastavi akci, ktera se ma provest po zavreni statistik /// </summary> /// <param name="endType">typ konce hry</param> private void ShowEndGameStats(GameEnd endType) { //zrusime static mouse a zabranime dalsimu update - hrac pozna ze je konec StaticMouse.Enable(false); stopUpdating = true; Invoke(new Action(() => { // vytvorime okno se statistikami za posledni hru EndGameStats s = GuiObjectFactory.CreateAndAddPlayerStatsUc(this, currentPlayer, currentPlayer.IsActivePlayer(), new Vector((SharedDef.VIEW_PORT_SIZE.Width - 800) / 2, (SharedDef.VIEW_PORT_SIZE.Height - 500) / 2)); // a vytvorime akci, ktera se zavola pri zavreni statistik s.CloseAction = new Action(() => { // zavreni vyvola bud uzivatel (vlakno gui) nebo GameState (vlakno sceny), proto je potreba synchronizovat Enqueue(new Action(() => { if (endType != GameEnd.TOURNAMENT_FINISHED) { CloseGameWindowAndCleanup(endType); } else { TournamentFinished(); } })); }); })); }
public void InitElement() { mgr.BeginInvoke(new Action(() => { element = (AlertBox)LogicalTreeHelper.FindLogicalNode(mgr.GetCanvas(), "AlertBoxUC"); if (element == null) { Size size = SharedDef.VIEW_PORT_SIZE; element = GuiObjectFactory.CreateAndAddAlertBox(mgr, new Vector((SharedDef.VIEW_PORT_SIZE.Width - 395) / 2, 0)); } })); }
public void CreateActionBarItems(List <ISpecialAction> actions, bool spectator) { this.actions = actions; mgr.Invoke(new Action(() => { ActionBar = LogicalTreeHelper.FindLogicalNode(Application.Current.MainWindow, "ActionBarUC") as ActionBar; ActionUC window; ActionController <ActionUC> controller; foreach (ISpecialAction action in actions) { controller = spectator ? new SpectatorActionController(mgr, action) : new ActionControllerImpl(mgr, action); window = GuiObjectFactory.CreateAndAddActionUC(mgr, ActionBar, controller); windows.Add(new WindowController(window, controller)); } })); }
private void btnStats_Click(object sender, RoutedEventArgs e) { StatisticsTabbedPanel stats = GuiObjectFactory.CreateStatisticsTabbedPanel(App.Instance.GetSceneMgr()); App.Instance.AddMenu(stats); }