Пример #1
0
        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
        }