public MenuService(IMenuHolder holder, IAccountPermissionsManager userPermissionsManager, ITranslation translation) { _holder = holder; _userPermissionsManager = userPermissionsManager; _translation = translation; }
public WaitForJoinMenuViewModel( IMenuHolder parent) : base(parent) { WeakEventManager <NetworkGameClient, GameJoinRequestedEventArgs> .AddHandler( parent.Game.Client, nameof(parent.Game.Client.GameJoinRequested), JoinRequestedHandler); _canCancel = true; }
internal IGuiElement[] BuildMenu(IMenuHolder menuHolder, BuildMode buildMode) { List <IGuiElement> elements = new List <IGuiElement>(); if (buildMode == BuildMode.Children || Type == MenuType.Menu) { if (Children.Count > 0) { foreach (var child in Children) { elements.AddRange(child.BuildMenu(menuHolder, BuildMode.Parent)); } } } else if (buildMode == BuildMode.Parent) { if (Type == MenuType.SubMenu || Type == MenuType.Button) { GuiStackMenuItem me = new GuiStackMenuItem(); me.Text = Title; if (IsTranslatable) { me.TranslationKey = Title; } me.Action = () => { if (Type == MenuType.SubMenu) { menuHolder.ShowMenu(this); } else { OnClick?.Invoke(this, new MenuItemClickedEventArgs()); } }; elements.Add(me); } } return(elements.ToArray()); }
public NetworkGameMenuViewModel( IMenuHolder parent) : base(parent) { Games = new ObservableCollection <GameInfo>(); _gamesView = new CollectionViewSource { Source = Games }; _gamesView.Filter += GamesView_Filter; WeakEventManager <NetworkGameClient, ServerInfoEventArgs> .AddHandler( parent.Game.Client, nameof(parent.Game.Client.ServerInfoReceived), ServerInfoReceivedHandler); WeakEventManager <NetworkGameClient, GameJoinRequestedEventArgs> .AddHandler( parent.Game.Client, nameof(parent.Game.Client.GameJoinRequested), JoinRequestedHandler); WeakEventManager <NetworkGameClient, GameJoinRequestedEventArgs> .AddHandler( parent.Game.Client, nameof(parent.Game.Client.ConfirmJoinCalled), ConfirmJoinCalledHandler); _gameListUpdateTimer = new System.Threading.Timer(new System.Threading.TimerCallback(UpdateGameList)); }
public DeploymentViewModel( IMenuHolder parent) : base(parent) { }
// Just a dummy for the DataTemplate public OpponentTurnViewModel(IMenuHolder parent) : base(parent) { }
public WelcomeMenuViewModel(IMenuHolder parent) : base(parent) { }
public GameViewModel(IMenuHolder parent) { _parent = parent; BoardFieldList = new List <BoardFieldViewModel>(); BoardFieldVm = new BoardFieldViewModel[8, 11]; Board = new BoardField[8, 11]; for (ushort y = 0; y < 11; ++y) { for (ushort x = 0; x < 8; ++x) { Board[x, y] = new BoardField(x, y); } } for (int y = 0; y < 11; ++y) { for (int x = 0; x < 8; ++x) { var model = new BoardFieldViewModel(); BoardFieldVm[x, y] = model; BoardFieldList.Add(BoardFieldVm[x, y]); } } _isPlayerHost = true; RegisterBoardToViewModel(); #region Set default visual states // Server area p1 is at index 84, p2 at 85 BoardFieldVm[3, 0].DefaultVisualState = BoardFieldVisualState.Exit; BoardFieldVm[4, 0].DefaultVisualState = BoardFieldVisualState.Exit; BoardFieldVm[3, 7].DefaultVisualState = BoardFieldVisualState.Exit; BoardFieldVm[4, 7].DefaultVisualState = BoardFieldVisualState.Exit; // Stack BoardFieldVm[0, 8].DefaultVisualState = BoardFieldVisualState.Link; // 64 BoardFieldVm[1, 8].DefaultVisualState = BoardFieldVisualState.Link; BoardFieldVm[2, 8].DefaultVisualState = BoardFieldVisualState.Link; BoardFieldVm[3, 8].DefaultVisualState = BoardFieldVisualState.Link; BoardFieldVm[4, 8].DefaultVisualState = BoardFieldVisualState.Virus; // 68 BoardFieldVm[5, 8].DefaultVisualState = BoardFieldVisualState.Virus; BoardFieldVm[6, 8].DefaultVisualState = BoardFieldVisualState.Virus; BoardFieldVm[7, 8].DefaultVisualState = BoardFieldVisualState.Virus; BoardFieldVm[0, 9].DefaultVisualState = BoardFieldVisualState.Link; // 72 BoardFieldVm[1, 9].DefaultVisualState = BoardFieldVisualState.Link; BoardFieldVm[2, 9].DefaultVisualState = BoardFieldVisualState.Link; BoardFieldVm[3, 9].DefaultVisualState = BoardFieldVisualState.Link; BoardFieldVm[4, 9].DefaultVisualState = BoardFieldVisualState.Virus; // 76 BoardFieldVm[5, 9].DefaultVisualState = BoardFieldVisualState.Virus; BoardFieldVm[6, 9].DefaultVisualState = BoardFieldVisualState.Virus; BoardFieldVm[7, 9].DefaultVisualState = BoardFieldVisualState.Virus; // 79 #endregion _players = new PlayerState[2]; _players[0] = new PlayerState(1); _players[1] = new PlayerState(2); _client.GameSyncReceived += GameSyncReceived; _players[0].PropertyChanged += PlayerPropChanged; _players[1].PropertyChanged += PlayerPropChanged; _client.PropertyChanged += (s, a) => { var empty = string.IsNullOrEmpty(a.PropertyName); if (empty || a.PropertyName == nameof(UID)) { OnPropertyChanged(nameof(UID)); } }; }
public AcceptJoinMenuViewModel( IMenuHolder parent) : base(parent) { WeakEventManager <NetworkGameClient, GameJoinRequestedEventArgs> .AddHandler( parent.Game.Client, nameof(parent.Game.Client.GameJoinRequested), JoinRequestedHandler); }
protected MenuViewModelBase(IMenuHolder parent) { ParentViewModel = parent; }
public WaitForAcceptMenuViewModel( IMenuHolder parent) : base(parent) { }
#pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void public GameOverMenuViewModel(IMenuHolder parent) : base(parent) { }
public static void RegisterMenuHolder(IMenuHolder menuHolder) { CheckHelper.ArgumentNotNull(menuHolder, "menuHolder"); EditableContainer.SetConstant <IMenuHolder, IMenuHolder>(menuHolder); }
public SwitchCards404MenuViewModel(IMenuHolder parent) : base(parent) { }