public async Task StartGameAsync(Func <BuncoDiceGameSaveInfo, bool, DiceCup <SimpleDice> > loadCup) { if (await _thisState.CanOpenSavedSinglePlayerGameAsync() == true) { await ReloadGameAsync(loadCup); return; } _saveRoot = _container.Resolve <BuncoDiceGameSaveInfo>(); _saveRoot.PlayOrder = (PlayOrderClass)_container.Resolve <IPlayOrder>(); //has to be here so they both use the same object. _saveRoot.PlayerList = new PlayerCollection <PlayerItem>(); _saveRoot.PlayerList.LoadPlayers(1, 11); _saveRoot.PlayerList.FinishLoading(); //i think we will go ahead and shuffle the players. _saveRoot.PlayerList.ForEach(singleInfo => { singleInfo.Buncos = 0; singleInfo.Wins = 0; singleInfo.Losses = 0; singleInfo.PlayerNum = -1; singleInfo.Points = 0; singleInfo.WinDetermined = false; singleInfo.Acceptable = false; singleInfo.PreviousMate = -1; singleInfo.Team = 0; singleInfo.Table = 0; singleInfo.WonPrevious = false; }); _saveRoot.WhatSet = 1; _saveRoot.WhatNumber = 1; _saveRoot.ThisStats.Status = "Game In Progress"; _cup = loadCup.Invoke(_saveRoot, false); await Aggregator.SendLoadAsync(); await StartRoundAsync(); }
private async Task OpenBeginningAsync() { if (BeginningScreen != null) { return; } BeginningScreen = _resolver.Resolve <SpadesBeginningViewModel>(); await LoadScreenAsync(BeginningScreen); }
public async Task LoadShapeAsync() { if (ShapeScreen != null) { return; } ShapeScreen = _resolver.Resolve <XactikaSubmitShapeViewModel>(); await LoadScreenAsync(ShapeScreen); }
private async Task OpenBiddingAsync() { if (BidScreen != null) { return; } BidScreen = _resolver.Resolve <RookBiddingViewModel>(); await LoadScreenAsync(BidScreen); }
private async Task LoadScoreAsync() { if (ScoreScreen != null) { return; } ScoreScreen = _resolver.Resolve <LifeScoreboardViewModel>(); await LoadScreenAsync(ScoreScreen); }
protected override async Task ActivateAsync() { await base.ActivateAsync(); YourSetsScreen = _resolver.Resolve <PlayerSetsViewModel>(); await LoadScreenAsync(YourSetsScreen); OpponentSetsScreen = _resolver.Resolve <PlayerSetsViewModel>(); await LoadScreenAsync(OpponentSetsScreen); }
Task IHandleAsync <LoadEventModel> .HandleAsync(LoadEventModel message) { GamePackageViewModelBinder.ManuelElements.Clear(); //often times i have to add manually. _gameBoard1 = _resolver.Resolve <GameBoardCP>(); _ship1 = _resolver.Resolve <ShipControlCP>(); _gameBoard1.SpaceSize = 80; _boardUI !.CreateHeadersColumnsRows(_gameBoard1.RowList !.Values.ToCustomBasicList(), _gameBoard1.ColumnList !.Values.ToCustomBasicList()); _boardUI.CreateControls(_gameBoard1.HumanList !); _shipUI !.LoadShips(_ship1.ShipList.Values.ToCustomBasicList(), _model !); return(this.RefreshBindingsAsync(_aggregator)); }
private async Task LoadMailListScreenAsync() { if (MailListScreen != null) { return; } MailListScreen = _resolver.Resolve <MailListViewModel>(); await LoadScreenAsync(MailListScreen); }
public ScatteringPiecesObservable(CommandContainer command, IGamePackageResolver resolver) : base(command) { //Visible = true; // the old did not have this. will always be true here. _thisI = resolver.Resolve <IProportionImage>(TagUsed); _rs = resolver.Resolve <RandomGenerator>(); _thisE = resolver.Resolve <EventAggregator>(); MethodInfo method = this.GetPrivateMethod(nameof(PrivateClickItemAsync)); ObjectCommand = new ControlCommand(this, method, command); method = this.GetPrivateMethod(nameof(PrivateBoardClickAsync)); BoardCommand = new ControlCommand(this, method, command); }
public void SendDiceInfo(IStandardDice thisDice) //it did send dice { IGamePackageResolver thisR = (IGamePackageResolver)cons !; IProportionImage thisP = thisR.Resolve <IProportionImage>(GetDiceTag); _mains = new StandardDiceGraphicsCP(this); _mains.OriginalHeightWidth = thisDice.HeightWidth; HorizontalOptions = LayoutOptions.Start; VerticalOptions = LayoutOptions.Start; SetBinding(DiceStyleProperty, new Binding(nameof(IStandardDice.Style))); SetBinding(DotColorProperty, new Binding(nameof(IStandardDice.DotColor))); SetBinding(DiceValueProperty, new Binding(nameof(IStandardDice.Value))); SetBinding(FillColorProperty, new Binding(nameof(IStandardDice.FillColor))); SetBinding(HoldProperty, new Binding(nameof(IStandardDice.Hold))); SetBinding(IsSelectedProperty, new Binding(nameof(IStandardDice.IsSelected))); //maybe i forgot this too. BindingContext = thisDice; SKSize tempSize = new SKSize(thisDice.HeightWidth, thisDice.HeightWidth); DiceSize = tempSize.GetSizeUsed(thisP.Proportion); HeightRequest = DiceSize.Height; WidthRequest = DiceSize.Width; _thisDraw.HeightRequest = DiceSize.Height; _thisDraw.WidthRequest = DiceSize.Width; Init(); }
async Task IFirstOptionProcesses.BeginningOptionSelectedAsync(EnumFirstOption firstOption) { if (_basicData.Client == false) { //send message to client so they can process. await _network !.SendAllAsync("firstoption", firstOption); } else if (_test.NoAnimations == false) { await _delayer.DelayMilli(300); } //this needs to send message to shell view model to do the next part. if (firstOption == EnumFirstOption.Beginner) { ThreeLetterFunSaveInfo saveRoot = _resolver.Resolve <ThreeLetterFunSaveInfo>(); saveRoot.Level = EnumLevel.Easy; await _aggregator.PublishAsync(new NextScreenEventModel(EnumNextScreen.Cards)); if (_basicData.Client == true) { _checker !.IsEnabled = true; } return; } await _aggregator.PublishAsync(new NextScreenEventModel(EnumNextScreen.Advanced)); if (_basicData.Client == true) { _checker !.IsEnabled = true; } }
protected override async Task ActivateAsync() { ScoreScreen = _resolver.Resolve <ScoreViewModel>(); await LoadScreenAsync(ScoreScreen); await base.ActivateAsync(); }
public void LoadList(DominosRegularVMData model, IGamePackageResolver resolver) { _model = model; IProportionImage thisP = resolver.Resolve <IProportionImage>(ts.TagUsed); Text = "Display"; _thisGrid = new Grid(); Grid finalGrid = new Grid(); _dominoList = _model.GameBoard1 !.DominoList; _dominoList.CollectionChanged += DominoCollectionChange; if (_dominoList.Count != 3) { throw new BasicBlankException("Only 3 dominos are supported"); } if (_dominoList.First().DefaultSize.Width == 0) { throw new BasicBlankException("The width can never be 0 for dominos"); } SKSize thisSize = _dominoList.First().DefaultSize.GetSizeUsed(thisP.Proportion); int pixels = (int)thisSize.Width / 2; for (int x = 0; x < 4; x++) { AddPixelColumn(_thisGrid, pixels); } RepopulateList(); SetUpMarginsOnParentControl(_thisGrid); finalGrid.Children.Add(ThisDraw); finalGrid.Children.Add(_thisGrid); Content = finalGrid; }
public BasicGameClass(IGamePackageResolver mainContainer, IEventAggregator aggregator, BasicData basicData, TestOptions test, IViewModelData currentMod, IMultiplayerSaveState state, IAsyncDelayer delay, CommandContainer command, BasicGameContainer <P, S> gameContainer ) { MainContainer = mainContainer; Aggregator = aggregator; BasicData = basicData; Test = test; _currentMod = currentMod; State = state; Delay = delay; _command = command; _gameContainer = gameContainer; SaveRoot = mainContainer.Resolve <S>(); //i think this would be fine (?) PlayerList = SaveRoot.PlayerList; gameContainer.EndTurnAsync = EndTurnAsync; gameContainer.ContinueTurnAsync = ContinueTurnAsync; gameContainer.ShowWinAsync = ShowWinAsync; gameContainer.StartNewTurnAsync = StartNewTurnAsync; gameContainer.SaveStateAsync = SaveStateAsync; //if i need anything else, rethink. Network = gameContainer.Network; Check = gameContainer.Check; }
public DiceCup(DiceList <D> PrivateList, IGamePackageResolver resolver, CommandContainer command) : base(command) { DiceList = PrivateList; BasicData thisData = resolver.Resolve <BasicData>(); MainContainer = resolver; DiceList.MainContainer = MainContainer; if (thisData.MultiPlayer == true) { _network = resolver.Resolve <INetworkMessages>(); } MethodInfo method = this.GetPrivateMethod(nameof(PrivateDiceClickAsync)); DiceCommand = new ControlCommand(this, method, command); }
Task IHandleAsync <LoadEventModel> .HandleAsync(LoadEventModel message) { GamePackageViewModelBinder.ManuelElements.Clear(); //often times i have to add manually. SixtySix2PlayerSaveInfo save = cons !.Resolve <SixtySix2PlayerSaveInfo>(); //usually needs this part for multiplayer games. _score !.LoadLists(save.PlayerList); _playerHandWPF !.LoadList(_model.PlayerHand1 !, ts.TagUsed); // i think _discardGPile !.Init(_model.Pile1 !, ts.TagUsed); // may have to be here (well see) _discardGPile.StartListeningDiscardPile(); // its the main one. _deckGPile !.Init(_model.Deck1 !, ts.TagUsed); // try here. may have to do something else as well (?) _deckGPile.StartListeningMainDeck(); _trick1 !.Init(_model.TrickArea1 !, ts.TagUsed); _guide1.LoadList(_model); _marriage1 !.LoadList(_model.Marriage1 !, ts.TagUsed); var thisCard = new SixtySix2PlayerCardInformation(); IProportionImage thisP = _resolver.Resolve <IProportionImage>(ts.TagUsed); SKSize thisSize = thisCard.DefaultSize.GetSizeUsed(thisP.Proportion); var heights = thisSize.Height / 1.5f; _deckGPile.Margin = new Thickness(6, heights * -1, 0, 0); _deckStack !.Children.Add(_deckGPile); return(this.RefreshBindingsAsync(_aggregator)); }
public MainPilesCP(IScoreData thisMod, CommandContainer command, IGamePackageResolver resolver, IEventAggregator aggregator) { _score = thisMod; DeckContents = resolver.Resolve <IRegularDeckInfo>(); //this is even better. Piles = new BasicMultiplePilesCP <SolitaireCard>(command, aggregator); //Piles.Visible = true; Piles.PileClickedAsync += Piles_PileClickedAsync; }
public Task InitAsync() { _client1 = new SimpleClientClass(_thisTCP); _client1.OnReceivedMessage += Client1_OnReceivedMessage; _client1.NickName = NickName; _thisOpen = _resolver.Resolve <IOpeningMessenger>(); return(Task.CompletedTask); }
private async Task LoadAskScreenAsync() { if (AskScreen != null) { return; } AskScreen = _resolver.Resolve <AskViewModel>(); await LoadScreenAsync(AskScreen); }
private async Task LoadPlayerPilesAsync() { if (PlayerPilesScreen != null) { await CloseSpecificChildAsync(PlayerPilesScreen); } PlayerPilesScreen = _resolver.Resolve <PlayerPilesViewModel>(); await LoadScreenAsync(PlayerPilesScreen); }
private async Task LoadSayUnoAsync() { if (_gameContainer.SingleInfo !.PlayerCategory != EnumPlayerCategory.Self) { return; } SayUnoScreen = _resolver.Resolve <SayUnoViewModel>(); await LoadScreenAsync(SayUnoScreen); }
//anything else needed is here. public async Task LoadOtherScreenAsync() { if (OtherScreen != null) { return; } OtherScreen = _resolver.Resolve <OtherViewModel>(); await LoadScreenAsync(OtherScreen); }
Task IHandleAsync <LoadEventModel> .HandleAsync(LoadEventModel message) { GamePackageViewModelBinder.ManuelElements.Clear(); //often times i have to add manually. var mainGame = _resolver.Resolve <BowlingDiceGameMainGameClass>(); _completeBoard.LoadPlayerScores(); _diceBoard.LoadBoard(mainGame.DiceBoard !.DiceList); return(this.RefreshBindingsAsync(_aggregator)); }
private async Task LoadCoupeAsync() { if (CoupeScreen != null) { throw new BasicBlankException("Coupe screen was already loaded. Rethink"); } CoupeScreen = _resolver.Resolve <CoupeViewModel>(); await LoadScreenAsync(CoupeScreen); }
public BaseGameBoardCP(IGamePackageResolver mainContainer) //we need the advanced one here though. { _thisPro = mainContainer.Resolve <IProportionBoard>(TagUsed); _mainContainer = mainContainer; if (mainContainer.RegistrationExist <ISkiaSharpGameBoard>(TagUsed)) { LinkBoard(); } }
private async Task LoadOpponentScreenAsync() { if (OpponentScreen != null) { return; } OpponentScreen = _resolver.Resolve <OpponentCardsViewModel>(); await LoadScreenAsync(OpponentScreen); }
} //you have to do properties for screens. protected override async Task ActivateAsync() { if (_mainGame.SaveRoot.GameStatus == Data.EnumStatus.ChooseNumber) { ChooseScreen = _resolver.Resolve <ChooseNumberViewModel>(); await LoadScreenAsync(ChooseScreen); return; } if (_mainGame.SaveRoot.GameStatus == Data.EnumStatus.NormalPlay) { BoardScreen = _resolver.Resolve <MainBoardViewModel>(); await LoadScreenAsync(BoardScreen); //hopefully no need for load event. return; } throw new BasicBlankException("Rethink because no status found"); }
public BaseGameBoardCP(IGamePackageResolver mainContainer, ISkiaSharpGameBoard thisElement) { _mainContainer = mainContainer; _thisPro = mainContainer.Resolve <IProportionBoard>(TagUsed); //for games like countdown where each player has their own, i can't register. otherwise, would get hosed. _thisElement = thisElement; _thisElement.CPPaint += ThisElement_CPPaint; _thisElement.SingleClickBoard += ThisElement_SingleClickBoard; }
public void LinkBoard() { //if (_thisElement != null) //{ // return; //} _thisElement = _mainContainer.Resolve <ISkiaSharpGameBoard>(TagUsed); //hopefully this works. _thisElement.CPPaint += ThisElement_CPPaint; _thisElement.SingleClickBoard += ThisElement_SingleClickBoard; }
private void PrepSort() { bool rets; rets = _resolver.RegistrationExist <ISortObjects <R> >(); if (rets == true) { _thisSort = _resolver.Resolve <ISortObjects <R> >(); } }