public GlobeTransitionHandler(IGlobeExpander globeExpander, ITransitionPool transitionPool)
        {
            _globeExpander  = globeExpander ?? throw new ArgumentNullException(nameof(globeExpander));
            _transitionPool = transitionPool ?? throw new ArgumentNullException(nameof(transitionPool));

            _semaphoreSlim = new SemaphoreSlim(1, 1);
        }
Exemple #2
0
        public GlobeTransitionHandler(IGlobeExpander globeExpander, ITransitionPool transitionPool)
        {
            _globeExpander  = globeExpander ?? throw new ArgumentNullException(nameof(globeExpander));
            _transitionPool = transitionPool ?? throw new ArgumentNullException(nameof(transitionPool));

            //Instantiate a Singleton of the Semaphore with a value of 1. This means that only 1 thread can be granted access at a time.
            _semaphoreSlim = new SemaphoreSlim(1, 1);
        }
        public TransitionScreen(Game game, SpriteBatch spriteBatch) : base(game)
        {
            var serviceScope = ((LivGame)Game).ServiceProvider;

            _player         = serviceScope.GetRequiredService <IPlayer>();
            _transitionPool = serviceScope.GetRequiredService <ITransitionPool>();
            _spriteBatch    = spriteBatch;
        }
Exemple #4
0
        public MainScreen(Game game, SpriteBatch spriteBatch) : base(game)
        {
            _spriteBatch = spriteBatch;

            var serviceScope = ((LivGame)Game).ServiceProvider;

            _uiState                 = serviceScope.GetRequiredService <ISectorUiState>();
            _player                  = serviceScope.GetRequiredService <IPlayer>();
            _transitionPool          = serviceScope.GetRequiredService <ITransitionPool>();
            _animationBlockerService = serviceScope.GetRequiredService <IAnimationBlockerService>();

            var uiContentStorage = serviceScope.GetRequiredService <IUiContentStorage>();

            _camera             = new Camera();
            _personEffectsPanel =
                new PersonConditionsPanel(_uiState, screenX: 8, screenY: 8, uiContentStorage: uiContentStorage);

            _personEquipmentModal = new PersonPropsModalDialog(
                uiContentStorage,
                game.GraphicsDevice,
                _uiState,
                ((LivGame)game).ServiceProvider);

            _personStatsModal = new PersonStatsModalDialog(
                uiContentStorage,
                game.GraphicsDevice,
                _uiState);

            _containerModal = new ContainerModalDialog(
                _uiState,
                uiContentStorage,
                Game.GraphicsDevice,
                serviceScope);

            var humanActorTaskSource =
                serviceScope.GetRequiredService <IHumanActorTaskSource <ISectorTaskSourceContext> >();
            var mainPerson = _player.MainPerson;

            if (mainPerson is null)
            {
                throw new InvalidOperationException("Main person is not initalized. Generate globe first.");
            }

            _bottomMenu = new BottomMenuPanel(
                humanActorTaskSource,
                mainPerson.GetModule <ICombatActModule>(),
                uiContentStorage,
                mainPerson.GetModule <IEquipmentModule>(),
                _uiState);
            _bottomMenu.PropButtonClicked += BottomMenu_PropButtonClicked;
            _bottomMenu.StatButtonClicked += BottomMenu_StatButtonClicked;
        }
 public static IStream <TState> Create <TState>(TState first, ITransitionPool <TState> pool)
 {
     return(new Stream <TState>(first, pool));
 }