Ejemplo n.º 1
0
 public MenuState(IoCResolver resolver)
     : base(resolver)
 {
     resolver.Resolve(out _messager);
     resolver.Resolve(out _canvasProvider);
     resolver.Resolve(out _uiManager);
 }
        public MainMenuCanvasController(IoCResolver resolver, Canvas canvasView)
            : base(resolver, canvasView)
        {
            // resolve
            resolver.Resolve(out _messager);
            resolver.Resolve(out _user);

            ResolveElement(out _welcomeText, "welcome_text");
            ResolveElement(out _hostGameButton, "host_game_button");
            ResolveElement(out _joinGameButton, "join_game_button");
            ResolveElement(out _exitGameButton, "exit_game_button");

            // initialize
            ShowCanvas = false;

            _hostGameButton.onClick.AddListener(() =>
            {
                _messager.Publish(new HostGameClickedMessage());
            });

            _exitGameButton.onClick.AddListener(() =>
            {
                _messager.Publish(new ExitMessage());
            });

            // subscribe
            _onMainMenuSelected = _messager.Subscribe<MainMenuSelectedMessage>(message =>
            {
                ShowCanvas = true;
                _welcomeText.text = String.Format(LanguageStrings.MainMenuWelcome, _user.Username);
            });
        }
        public CreateAccountCanvasController(IoCResolver resolver, Canvas canvasView)
            : base(resolver, canvasView)
        {
            // resolve
            resolver.Resolve(out _messager);
            resolver.Resolve(out _user);

            ResolveElement(out _usernameInputField, "username_input_field");
            ResolveElement(out _passwordInputField, "password_input_field");
            ResolveElement(out _passwordConfirmationInputField, "password_confirmation_input_field");
            ResolveElement(out _confirmButton, "confirm_button");
            ResolveElement(out _backButton, "back_button");

            // initialize
            ShowCanvas = false;

            _usernameInputField.text = "";
            _passwordInputField.text = "";

            // subscribe
            _onCreateAccountSelected = _messager.Subscribe<CreateAccountSelectedMessage>(message =>
            {
                ShowCanvas = true;
                _currentAccountCreationSession = message;

                _usernameInputField.text = "";
                _passwordInputField.text = "";

                _confirmButton.onClick.RemoveAllListeners();
                _backButton.onClick.RemoveAllListeners();

                _confirmButton.onClick.AddListener(RegisterAccount);
                _backButton.onClick.AddListener(() => message.OnCancelled());
            });
        }
Ejemplo n.º 4
0
        public SignInCanvasController(IoCResolver resolver, Canvas canvasView) : base(resolver, canvasView)
        {
            // resolve
            resolver.Resolve(out _messager);
            resolver.Resolve(out _user);

            ResolveElement(out _usernameInputField, "username_input_field");
            ResolveElement(out _passwordInputField, "password_input_field");
            ResolveElement(out _signInButton, "sign_in_button");
            ResolveElement(out _createAccountButton, "create_account_button");

            // initialize
            _createAccountButton.onClick.AddListener(() =>
            {
                ShowCanvas = false;

                _messager.Publish(new CreateAccountSelectedMessage
                {
                    OnCancelled = () => ShowCanvas = true,
                    OnConfirmed = credentials =>
                    {
                        ShowCanvas = true;

                        _usernameInputField.text = credentials.Username;
                        _passwordInputField.text = credentials.Password;
                    }
                });
            });
            _signInButton.onClick.AddListener(AttemptSignIn);
        }
        public CreateAccountCanvasController(IoCResolver resolver, Canvas canvasView) : base(resolver, canvasView)
        {
            // resolve
            resolver.Resolve(out _messager);
            resolver.Resolve(out _user);

            ResolveElement(out _usernameInputField, "username_input_field");
            ResolveElement(out _passwordInputField, "password_input_field");
            ResolveElement(out _passwordConfirmationInputField, "password_confirmation_input_field");
            ResolveElement(out _confirmButton, "confirm_button");
            ResolveElement(out _backButton, "back_button");

            // initialize
            ShowCanvas = false;

            _usernameInputField.text = "";
            _passwordInputField.text = "";

            // subscribe
            _onCreateAccountSelected = _messager.Subscribe <CreateAccountSelectedMessage>(message =>
            {
                ShowCanvas = true;
                _currentAccountCreationSession = message;

                _usernameInputField.text = "";
                _passwordInputField.text = "";

                _confirmButton.onClick.RemoveAllListeners();
                _backButton.onClick.RemoveAllListeners();

                _confirmButton.onClick.AddListener(RegisterAccount);
                _backButton.onClick.AddListener(() => message.OnCancelled());
            });
        }
Ejemplo n.º 6
0
        public MainMenuCanvasController(IoCResolver resolver, Canvas canvasView) : base(resolver, canvasView)
        {
            // resolve
            resolver.Resolve(out _messager);
            resolver.Resolve(out _user);

            ResolveElement(out _welcomeText, "welcome_text");
            ResolveElement(out _hostGameButton, "host_game_button");
            ResolveElement(out _joinGameButton, "join_game_button");
            ResolveElement(out _exitGameButton, "exit_game_button");

            // initialize
            ShowCanvas = false;

            _hostGameButton.onClick.AddListener(() =>
            {
                _messager.Publish(new HostGameClickedMessage());
            });

            _exitGameButton.onClick.AddListener(() =>
            {
                _messager.Publish(new ExitMessage());
            });

            // subscribe
            _onMainMenuSelected = _messager.Subscribe <MainMenuSelectedMessage>(message =>
            {
                ShowCanvas        = true;
                _welcomeText.text = String.Format(LanguageStrings.MainMenuWelcome, _user.Username);
            });
        }
Ejemplo n.º 7
0
 public PlayState(IoCResolver resolver) : base(resolver)
 {
     // resolve
     resolver.Resolve(out _messager);
     resolver.Resolve(out _canvasProvider);
     resolver.Resolve(out _prefabProvider);
     resolver.Resolve(out _uiManager);
 }
Ejemplo n.º 8
0
 public PlayState(IoCResolver resolver)
     : base(resolver)
 {
     // resolve
     resolver.Resolve(out _messager);
     resolver.Resolve(out _canvasProvider);
     resolver.Resolve(out _prefabProvider);
     resolver.Resolve(out _uiManager);
 }
Ejemplo n.º 9
0
        public PoolingParticleManager(IoCResolver resolver)
        {
            _loops           = new List <ActiveParticleLoop>();
            _particleSystems = new Dictionary <string, ParticleSystem>();

            // resolve references
            resolver.Resolve(out _logger);
            resolver.Resolve(out _config);
            resolver.Resolve(out _prefabProvider);
            resolver.Resolve(out _unityReferenceMaster);

            // initialize properties
            _particleParent      = Object.Instantiate(_prefabProvider.GetPrefab("empty_prefab"));
            _particleParent.name = "pooled_particle_system_parent";

            _unityReferenceMaster.OnGamePausedChangedEvent += OnGamePausedChanged;
        }
        public PoolingParticleManager(IoCResolver resolver)
        {
            _loops = new List<ActiveParticleLoop>();
            _particleSystems = new Dictionary<string, ParticleSystem>();

            // resolve references
            resolver.Resolve(out _logger);
            resolver.Resolve(out _config);
            resolver.Resolve(out _prefabProvider);
            resolver.Resolve(out _unityReferenceMaster);

            // initialize properties
            _particleParent = Object.Instantiate(_prefabProvider.GetPrefab("empty_prefab"));
            _particleParent.name = "pooled_particle_system_parent";

            _unityReferenceMaster.OnGamePausedChangedEvent += OnGamePausedChanged;
        }
Ejemplo n.º 11
0
        protected BaseCanvasController(IoCResolver resolver, Canvas canvasView)
        {
            _elements = new Dictionary <string, GameObject>();
            resolver.Resolve(out _logger);

            _canvasView = canvasView;

            _canvasView.gameObject.SetActive(true);

            CacheObject("", canvasView.gameObject);
        }
Ejemplo n.º 12
0
        public void Initialize(IoCResolver resolver)
        {
            resolver.Resolve(out _unity);

            IsSelected = false;
            IsHovered  = false;
            OnIsSelectedValueChangedEvent += OnIsSelectedChanged;
            OnIsHoveredValueChangedEvent  += OnIsHoveredChanged;

            MarkAsInitialized();
        }
Ejemplo n.º 13
0
        public static void ConfigureContainer(this IServiceCollection serviceCollection)
        {
            //serviceCollection
            //    .AddSingleton<IQueryExecutorFactory<KeyValueHandler, KeyValue>,
            //        QueryExecutorFactory<KeyValueHandler, KeyValue>>();

            var ignoreTypes = new HashSet <Type>
            {
                typeof(IYandexMusicClient),
                typeof(IYandexCredentials),
                typeof(ISpecialTrackGetter),
            };

            IoCResolver.Resolve((x, y) => serviceCollection.AddSingleton(x, y), ignoreTypes, "Tolltech");
        }
Ejemplo n.º 14
0
        public PlayCanvasController(IoCResolver resolver, Canvas canvasView) : base(resolver, canvasView)
        {
            // resolve
            resolver.Resolve(out _messager);

            ResolveElement(out _rollDiceButton, "roll_dice_button");
            ResolveElement(out _exitGameButton, "exit_game_button");

            // initialize
            _rollDiceButton.onClick.AddListener(() =>
            {
                _messager.Publish(new RollDiceClickedMessage());
            });

            _exitGameButton.onClick.AddListener(() =>
            {
                _messager.Publish(new ExitPlayClickedMessage());
            });
        }
        public DialoguePopUpCanvasController(IoCResolver resolver, Canvas canvasView)
            : base(resolver, canvasView)
        {
            // resolve references
            resolver.Resolve(out _messager);

            ResolveElement(out _dialogueText, "dialogue_text");
            ResolveElement(out _cancelText, "cancel_button/cancel_text");
            ResolveElement(out _confirmText, "confirm_button/confirm_text");
            ResolveElement(out _recognitionText, "recognition_button/recognition_text");
            ResolveElement(out _cancelButton, "cancel_button");
            ResolveElement(out _confirmButton, "confirm_button");
            ResolveElement(out _recognitionButton, "recognition_button");

            _cancelButton.onClick.AddListener(OnCancelButtonClicked);
            _confirmButton.onClick.AddListener(OnConfirmButtonClicked);
            _recognitionButton.onClick.AddListener(OnConfirmButtonClicked);

            // initialize
            _canvasView.gameObject.SetActive(false);

            _cancelButton.onClick.AddListener(OnCancelButtonClicked);
            _confirmButton.onClick.AddListener(OnConfirmButtonClicked);
            _recognitionButton.onClick.AddListener(OnConfirmButtonClicked);

            // subscribe
            _onShowConfirmationDialogue = _messager.Subscribe<ShowPopUpDialogueMessage>(message =>
            {
                ShowCanvas = true;

                _dialogueText.text = message.MainDialogue;
                _cancelText.text = message.CancelDialogue ?? "no";
                _confirmText.text = message.ConfirmDialogue ?? "yes";
                _recognitionText.text = message.ConfirmDialogue ?? "ok";

                _cancelButton.gameObject.SetActive(message.AllowCancel);
                _confirmButton.gameObject.SetActive(message.AllowCancel);
                _recognitionButton.gameObject.SetActive(!message.AllowCancel);

                _currentMessage = message;
            });
        }
Ejemplo n.º 16
0
        public PlayCanvasController(IoCResolver resolver, Canvas canvasView)
            : base(resolver, canvasView)
        {
            // resolve
            resolver.Resolve(out _messager);

            ResolveElement(out _rollDiceButton, "roll_dice_button");
            ResolveElement(out _exitGameButton, "exit_game_button");

            // initialize
            _rollDiceButton.onClick.AddListener(() =>
            {
                _messager.Publish(new RollDiceClickedMessage());
            });

            _exitGameButton.onClick.AddListener(() =>
            {
                _messager.Publish(new ExitPlayClickedMessage());
            });
        }
Ejemplo n.º 17
0
        public DialoguePopUpCanvasController(IoCResolver resolver, Canvas canvasView) : base(resolver, canvasView)
        {
            // resolve references
            resolver.Resolve(out _messager);

            ResolveElement(out _dialogueText, "dialogue_text");
            ResolveElement(out _cancelText, "cancel_button/cancel_text");
            ResolveElement(out _confirmText, "confirm_button/confirm_text");
            ResolveElement(out _recognitionText, "recognition_button/recognition_text");
            ResolveElement(out _cancelButton, "cancel_button");
            ResolveElement(out _confirmButton, "confirm_button");
            ResolveElement(out _recognitionButton, "recognition_button");

            _cancelButton.onClick.AddListener(OnCancelButtonClicked);
            _confirmButton.onClick.AddListener(OnConfirmButtonClicked);
            _recognitionButton.onClick.AddListener(OnConfirmButtonClicked);

            // initialize
            _canvasView.gameObject.SetActive(false);

            _cancelButton.onClick.AddListener(OnCancelButtonClicked);
            _confirmButton.onClick.AddListener(OnConfirmButtonClicked);
            _recognitionButton.onClick.AddListener(OnConfirmButtonClicked);

            // subscribe
            _onShowConfirmationDialogue = _messager.Subscribe <ShowPopUpDialogueMessage>(message =>
            {
                ShowCanvas = true;

                _dialogueText.text    = message.MainDialogue;
                _cancelText.text      = message.CancelDialogue ?? "no";
                _confirmText.text     = message.ConfirmDialogue ?? "yes";
                _recognitionText.text = message.ConfirmDialogue ?? "ok";

                _cancelButton.gameObject.SetActive(message.AllowCancel);
                _confirmButton.gameObject.SetActive(message.AllowCancel);
                _recognitionButton.gameObject.SetActive(!message.AllowCancel);

                _currentMessage = message;
            });
        }
Ejemplo n.º 18
0
        public void Initialize(IoCResolver resolver)
        {
            resolver.Resolve(out _unity);

            IsSelected = false;
            IsHovered = false;
            OnIsSelectedValueChangedEvent += OnIsSelectedChanged;
            OnIsHoveredValueChangedEvent += OnIsHoveredChanged;

            MarkAsInitialized();
        }
Ejemplo n.º 19
0
 public MenuState(IoCResolver resolver) : base(resolver)
 {
     resolver.Resolve(out _messager);
     resolver.Resolve(out _canvasProvider);
     resolver.Resolve(out _uiManager);
 }
Ejemplo n.º 20
0
 public override void Load()
 {
     IoCResolver.Resolve((@interface, implementation) => this.Bind(@interface).To(implementation), null, "Tolltech");
 }
Ejemplo n.º 21
0
        public override void Load()
        {
            Bind <ISettings>().ToConstant(settings);

            IoCResolver.Resolve((@interface, implementation) => this.Bind(@interface).To(implementation), new [] { "Tolltech", settings.RootNamespaceForNinjectConfiguring });
        }