protected virtual void ReplaceGame() { //return; _ = MainContainer.ReplaceObject <IViewModelData>(); //this has to be replaced before the game obviously. Assembly assembly = Assembly.GetAssembly(GetType()) !; CustomBasicList <Type> thisList = assembly.GetTypes().Where(items => items.HasAttribute <AutoResetAttribute>()).ToCustomBasicList(); thisList.AddRange(GetAdditionalObjectsToReset()); ClearSubscriptions(); Type?type = MainContainer.LookUpType <IStandardRollProcesses>(); if (type != null) { thisList.Add(type); //hopefully this simple. this allows more parts to be able to be added without a new class //useful for dice games. } //attempt to also unsubscribe to all as well. //could do delegates. however, if not set, then won't do. if (MiscDelegates.GetMiscObjectsToReplace != null) { thisList.AddRange(MiscDelegates.GetMiscObjectsToReplace.Invoke()); } MainContainer.ResetSeveralObjects(thisList); _mainGame = MainContainer.ReplaceObject <IBasicGameProcesses <P> >(); //hopefully this works }
private async Task LoadGameScreenAsync() { if (_mainGame == null) { _mainGame = MainContainer.Resolve <IBasicGameProcesses <P> >(); } if (_mainGame.CanMakeMainOptionsVisibleAtBeginning) { ClearSubscriptions(); //try this too. await StartNewGameAsync(); if (_test.AlwaysNewGame) { NewGameScreen = MainContainer.Resolve <INewGameVM>(); await LoadScreenAsync(NewGameScreen); } return; } //only host or single player game gets to this part. await GetStartingScreenAsync(); if (_test.AlwaysNewGame) { NewGameScreen = MainContainer.Resolve <INewGameVM>(); await LoadScreenAsync(NewGameScreen); } }
public static void StartingStatus <P>(this IBasicGameProcesses <P> game) where P : class, IPlayerItem, new() { if (game.CurrentMod == null) { return; } if (game.BasicData !.MultiPlayer == true) { game.CurrentMod.Status = "Multiplayer game in progress"; }
public static async Task RoundOverNextAsync <P>(this IBasicGameProcesses <P> game) where P : class, IPlayerItem, new() { if (game.BasicData !.MultiPlayer == false || game.BasicData.Client == false) { game.CurrentMod.Status = "Goto the next round"; await game.Aggregator.PublishAsync(new RoundOverEventModel()); //game.CurrentMod.NewRoundVisible = true; //brand new. //game.CurrentMod.CommandContainer!.ManuelFinish = false; //game.CurrentMod.CommandContainer.IsExecuting = false; }
public static void ShowTurn <P>(this IBasicGameProcesses <P> game) where P : class, IPlayerItem, new() { if (game.CurrentMod == null) { return; } if (game.SingleInfo == null) { return; } game.SingleInfo = game.PlayerList !.GetWhoPlayer(); game.CurrentMod.NormalTurn = game.SingleInfo.NickName; }
public static async Task ProtectedGameOverNextAsync <P>(this IBasicGameProcesses <P> game) //no longer will send state since something else will delete it now. where P : class, IPlayerItem, new() { game.CurrentMod.NormalTurn = "None"; if (game.BasicData !.MultiPlayer == true && game.BasicData.Client == true) { CommandContainer command = Resolve <CommandContainer>(); command.ManuelFinish = true; command.IsExecuting = true; //to double check. since its waiting for message. game.Check !.IsEnabled = true; return; } await game.SendGameOverAsync(); //await thisState.DeleteGameAsync(); //game.CurrentMod.NewGameVisible = true; //game.CurrentMod.CommandContainer!.IsExecuting = false; //i think }