//this will do without the canexceute version. public static CustomBasicList <BoardCommand> GetBoardCommandList(this ISeveralCommands vm) { CustomBasicList <BoardCommand> output = new CustomBasicList <BoardCommand>(); Type type = vm.GetType(); CustomBasicList <MethodInfo> methods = type.GetMethods().ToCustomBasicList(); //decided to just show all methods period. //must have no methods.ForEach(x => { output.Add(new BoardCommand(vm, x, vm.Command, x.Name)); }); BoardCommand board = output.First(); return(output); }
/// <summary> /// Dodaje komendy do startowego CommandInvokera /// </summary> private void AddCommands() { SyncCommand sync0 = new SyncCommand(0); SyncCommand sync1 = new SyncCommand(1); Command temporaryRoom = new TemporaryRoomCommand(); Command subscribeEvents = new SubscribeEventsCommand(new List <IEventSubscribable> { instance, this.banking, this.session, menu, this.board, this.arController, this.flow, sync0, sync1 }); Command session = new SessionCommand(this.session); Command board = new BoardCommand(this.board); Command gameMenu = new GameMenuCommand(menu); Command banking = new BankingControllerCommand(this.banking); Command arController = new ARControllerCommand(this.arController); Command gameplayController = new GameplayControllerCommand(instance); Command loadFromSave = new LoadFromSaveCommand(); Command popupSystem = new PopupSystemCommand(); invoker = new CommandInvoker(null, null, delegate { OnExecutionFinished(); sync0.UnsubscribeEvents(); sync1.UnsubscribeEvents(); }); invoker.AddCommand(temporaryRoom); invoker.AddCommand(subscribeEvents); invoker.AddCommand(session); invoker.AddCommand(board); invoker.AddCommand(gameMenu); invoker.AddCommand(banking); invoker.AddCommand(gameplayController); invoker.AddCommand(loadFromSave); invoker.AddCommand(sync0); invoker.AddCommand(arController); invoker.AddCommand(popupSystem); invoker.AddCommand(sync1); }
protected override void EnableChange() { BoardCommand.ReportCanExecuteChange(); DiceCommand.ReportCanExecuteChange(); //i think you have to do manually since its a controlcommand. }
public void Play(BoardCommand command) { command.Execute(); }
private void Play(BoardCommand command, Output expectedOutput) { _player.Play(command); Assert.AreEqual(expectedOutput, _board.Output()); }