Task IHandleAsync <LoadEventModel> .HandleAsync(LoadEventModel message) { GamePackageViewModelBinder.ManuelElements.Clear(); //often times i have to add manually. RackoSaveInfo save = cons !.Resolve <RackoSaveInfo>(); //usually needs this part for multiplayer games. _score !.LoadLists(save.PlayerList); _discardGPile !.Init(_model.Pile1 !, ""); // may have to be here (well see) _discardGPile.StartListeningDiscardPile(); // its the main one. _deckGPile !.Init(_model.Deck1 !, ""); // try here. may have to do something else as well (?) _deckGPile.StartListeningMainDeck(); RackoMainViewModel vm = (RackoMainViewModel)DataContext; _handWPF !.Init(vm, _model, _gameContainer); _currentWPF !.Init(_model.OtherPile !, ""); _currentWPF.StartAnimationListener("otherpile"); return(this.RefreshBindingsAsync(_aggregator)); }
public void Init(RackoMainViewModel viewModel, RackoVMData model, RackoGameContainer gameContainer) { gameContainer.SingleInfo = gameContainer !.PlayerList !.GetSelf(); _cardList = gameContainer.SingleInfo.MainHandList; _thisCommand = viewModel.GetBasicGameCommand(nameof(RackoMainViewModel.PlayOnPileAsync)); Grid mainGrid = new Grid(); _thisStack = new StackLayout(); Text = "Your Card List"; var thisRect = ThisFrame.GetControlArea(); _thisStack.Margin = new Thickness(thisRect.Left + 3, thisRect.Top + 10, 3, 3); if (gameContainer.SingleInfo.MainHandList.Count != 10) { throw new BasicBlankException("Must have 10 cards before i can init. Rethink now."); } _thisCommand !.CanExecuteChanged += ThisCommand_CanExecuteChanged; _cardList.CollectionChanged += CardList_CollectionChanged; PopulateControls(gameContainer); mainGrid.Children.Add(ThisDraw); mainGrid.Children.Add(_thisStack); Content = mainGrid; }