// TODO: Rewrite this whole logic so that all these dependencies are created PER PAGE when it opens, and are disposed when the page closes.
    public WorldScreenStateManager(
        ITyperPool typerPool,
        IConnectionManager connectionManager,
        WorldScreenState state,
        ILocationsClient locationsClient)
    {
        _characterId     = connectionManager.CharacterId;
        _typerPool       = typerPool;
        _locationsClient = locationsClient;

        connectionManager.WorldStateObservable.Subscribe(state =>
        {
            if (state == null)
            {
                return; // TODO: Show loading screen?
            }
            lock (_updateStateLock)
            {
                UpdateState(state);
            }
        });

        _currentState = state;
        _stateSubject = new BehaviorSubject <WorldScreenState>(_currentState);
    }
 protected MultiTyperInputHandler(
     ITyperPool typerPool,
     ComponentPool?componentPool = null)
 {
     TyperPool      = typerPool;
     _componentPool = componentPool;
 }
Пример #3
0
    public MainMenuState(ITyperPool typerPool)
    {
        _typerPool = typerPool;

        Exit            = _typerPool.MakeUniqueTyper("exit");
        CreateCharacter = _typerPool.MakeUniqueTyper("create-character");
    }
Пример #4
0
    public WorldScreenState(
        ITyperPool typerPool)
    {
        _typerPool      = typerPool;
        CurrentLocation = null;

        Disconnect = _typerPool.MakeUniqueTyper("disconnect");
    }
 public CharacterCreationState(
     ITyperPool typerPool,
     ComponentPool componentPool)
 {
     CharacterNameInput = componentPool.MakeInputComponent();
     BackToMainMenu     = typerPool.MakeUniqueTyper();
     CreateCharacter    = typerPool.MakeUniqueTyper();
 }
Пример #6
0
    public static Typer MakeUniqueTyper(this ITyperPool typerPool)
    {
        var id    = Guid.NewGuid().ToString();
        var typer = typerPool.MakeUniqueTyper(id);

        typer.Id = id;

        return(typer);
    }
Пример #7
0
 public MainMenuInputHandler(
     ITyperPool typerPool,
     ComponentPool componentPool,
     MainMenuState state,
     IScreenNavigation screenNavigation,
     IConnectionManager connectionManager) : base(typerPool, componentPool)
 {
     _screenNavigation  = screenNavigation;
     _connectionManager = connectionManager;
     _state             = state;
 }
 public CharacterCreationInputHandler(
     ITyperPool typerPool,
     ComponentPool componentPool,
     CharacterCreationState state,
     IScreenNavigation screenNavigation,
     ICharactersClient charactersClient) : base(typerPool, componentPool)
 {
     _screenNavigation = screenNavigation;
     _charactersClient = charactersClient;
     _state            = state;
 }
Пример #9
0
    public static void RemoveTyper(this ITyperPool typerPool, string id)
    {
        var typer = typerPool.GetByKey(id);

        if (typer == null)
        {
            return;
        }

        typerPool.RemoveTyper(typer);
    }
Пример #10
0
    public DialogScreenHandler(
        ITyperPool typerPool,
        IOutput output) : base(typerPool)
    {
        _output = output;

        _text         = null !;
        _ok           = null !;
        _cancel       = null !;
        _okAction     = null !;
        _cancelAction = null !;
    }
Пример #11
0
 public ComponentPool(ITyperPool focusTyperPool)
 {
     _focusTyperPool = focusTyperPool;
 }