public void Initialize(IGameState entity) { _logoLine1Text = new UIText(_gameContext.AssetManager.GetFont(GameConstants.GameStateConstants.MenuStateConstants.LogoFontName), GameConstants.GameStateConstants.PlayStateConstants.PausedText, Color.White); _line1Position.X = _gameContext.GameGraphics.ScreenBounds.Width / 2 - _logoLine1Text.Size.X / 2; _line1Position.Y = 40; }
protected override void OnEntityCreationFinished(EntityCreationFinishedEventArgs args) { //If they have a floating name root we should try to set the name. EntityGameObjectDirectory directory = ObjectDirectoryMappable.RetrieveEntity(args.EntityGuid); GameObject nameRoot = directory.GetGameObject(EntityGameObjectDirectory.Type.NameRoot); IUIText text = nameRoot.GetComponent <IUIText>(); if (text == null) { return; } if (NameQueryable.Exists(args.EntityGuid)) { text.Text = NameQueryable.Retrieve(args.EntityGuid); } else { UnityAsyncHelper.UnityMainThreadContext.PostAsync(async() => { string name = await NameQueryable.RetrieveAsync(args.EntityGuid); //Maybe it got deleted before query was done. if (nameRoot == null) { return; } text.Text = NameQueryable.Retrieve(args.EntityGuid); }); } }
/// <inheritdoc /> protected override void Load(ContainerBuilder builder) { //TODO: Automate discovery of adapter types IUIText uiText = Mock.Of <IUIText>(); IUIImage uiImage = Mock.Of <IUIImage>(); IUIButton uiButton = Mock.Of <IUIButton>(); IUIFillableImage fillableImage = Mock.Of <IUIFillableImage>(); foreach (UnityUIRegisterationKey key in Enum.GetValues(typeof(UnityUIRegisterationKey))) { builder.RegisterInstance(uiText) .Keyed <IUIText>(key); builder.RegisterInstance(uiImage) .Keyed <IUIImage>(key); builder.RegisterInstance(uiButton) .Keyed <IUIButton>(key); builder.RegisterInstance(fillableImage) .Keyed <IUIFillableImage>(key); } }
void InitializeUIText(IUIText text, string message, FontSettings settings) { text.Text = message; text.Color = settings.color; text.FontSize = settings.fontSize; text.Alignment = settings.anchor; }
protected override void _initControl(Dictionary <string, IUIBaseControl> host) { this.progLoading = (host["progLoading"] as IUIProgressBar); this.statusLoading = (host["statusLoading"] as IUIText); this.uiLight = (host["uiLight"] as IUIImageBox); this.progLoading.maxNum = 100f; }
void Awake() { HealthBar = new UILabeledBar(new UnityTextUITextAdapterImplementation(HealthText), new UnityImageUIFillableImageAdapterImplementation(HealthBarImage)); TechniquePointsBar = new UILabeledBar(new UnityTextUITextAdapterImplementation(TechniquePointsText), new UnityImageUIFillableImageAdapterImplementation(TechniquePointsBarImage)); UnitName = new UnityTextUITextAdapterImplementation(PlayerNameText); UnitLevel = new UnityTextUITextAdapterImplementation(UnitLevelText); }
public SetDownloadProgressEventListener(IWorldDownloadBeginEventSubscribable subscriptionService, [KeyFilter(UnityUIRegisterationKey.WorldDownloadProgress)][NotNull] IUIFillableImage downloadFillImage, [KeyFilter(UnityUIRegisterationKey.WorldDownloadProgress)][NotNull] IUIText downloadText) : base(subscriptionService) { DownloadFillImage = downloadFillImage ?? throw new ArgumentNullException(nameof(downloadFillImage)); DownloadText = downloadText ?? throw new ArgumentNullException(nameof(downloadText)); }
/// <inheritdoc /> public OnAuthenticationFailureEventListener(IAuthenticationResultRecievedEventSubscribable subscriptionService, [KeyFilter(UnityUIRegisterationKey.Login)][NotNull] IUIButton loginButton, [KeyFilter(UnityUIRegisterationKey.PasswordTextBox)][NotNull] IUIText passwordInput) : base(subscriptionService) { LoginButton = loginButton ?? throw new ArgumentNullException(nameof(loginButton)); PasswordInput = passwordInput ?? throw new ArgumentNullException(nameof(passwordInput)); }
public InitializeLocalPlayerGuildNameEventListener(IReadonlyLocalPlayerDetails playerDetails, IGuildStatusChangedEventSubscribable subscriptionService, [NotNull][KeyFilter(UnityUIRegisterationKey.GuildList)] IUIText guildNameText, [NotNull] INameQueryService nameQueryService) : base(subscriptionService, playerDetails) { GuildNameText = guildNameText ?? throw new ArgumentNullException(nameof(guildNameText)); NameQueryService = nameQueryService ?? throw new ArgumentNullException(nameof(nameQueryService)); }
public RequestCharacterCreationEventListener(ICharacterCreationButtonClickedEventSubscribable subscriptionService, [NotNull] ICharacterService characterService, [KeyFilter(UnityUIRegisterationKey.CharacterNameInput)][NotNull] IUIText characterNameInput, [NotNull] ILog logger) : base(subscriptionService) { CharacterService = characterService ?? throw new ArgumentNullException(nameof(characterService)); CharacterNameInput = characterNameInput ?? throw new ArgumentNullException(nameof(characterNameInput)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public void DrawTextPlayable(IUIText uiText, Vector2 position, Color color) { throw new NotImplementedException("Method needs to be updated to handle screen scaling"); //ToDo Update to handle screen scaling _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, PlayableCamera.Transform); _spriteBatch.DrawString(uiText.Font, uiText.Text, position, color); _spriteBatch.End(); }
public FontSettings(IUIText text) { color = text.Color; fontSize = text.FontSize; anchor = text.Alignment; showAnimation = UIAnimationUtil.DefaultShowAnimation; hideAnimation = UIAnimationUtil.DefaultHideAnimation; showAnimationTime = 0.4f; hideAnimationTime = 0.3f; limitLife = 0.2f; }
/// <inheritdoc /> public ChatWindowInputController( [KeyFilter(UnityUIRegisterationKey.ChatBox)][NotNull] IUIButton chatInputButton, [KeyFilter(UnityUIRegisterationKey.ChatBox)][NotNull] IUIText chatInputText, //[NotNull] IRemoteSocialTextChatHubServer chatService, [NotNull] ILog logger) { ChatInputButton = chatInputButton ?? throw new ArgumentNullException(nameof(chatInputButton)); ChatInputText = chatInputText ?? throw new ArgumentNullException(nameof(chatInputText)); //ChatService = chatService ?? throw new ArgumentNullException(nameof(chatService)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public override void dispose() { base.dispose(); bool flag = this._textBitmap != null; if (flag) { this._textBitmap.dispose(); this._textBitmap = null; } }
public void Initialize() { _scoreHandler = _gameContext.NotificationMediator.SubscribeToPlayerScoreChanges(this); _totalScore = 0; _scoreText = new UIText( _gameContext.AssetManager.GetFont(GameConstants.GameStateConstants.MenuStateConstants.SelectedFontName), _totalScore.ToString(GameConstants.PlayerConstants.ScoreFormat)); _drawPosition = new Vector2(_gameContext.GameGraphics.ScreenBounds.Width - _scoreText.Size.X, _gameContext.GameGraphics.ScreenBounds.Y); }
/// <inheritdoc /> public LocalPlayerSpawnedPlayerNameNameplateUpdateEventListener([NotNull] ILocalPlayerSpawnedEventSubscribable subscriptionService, [NotNull][KeyFilter(UnityUIRegisterationKey.PlayerUnitFrame)] IUIText playerNameTextField, [NotNull] IEntityNameQueryable nameQueryable) : base(subscriptionService) { if (subscriptionService == null) { throw new ArgumentNullException(nameof(subscriptionService)); } PlayerNameTextField = playerNameTextField ?? throw new ArgumentNullException(nameof(playerNameTextField)); NameQueryable = nameQueryable ?? throw new ArgumentNullException(nameof(nameQueryable)); }
/// <inheritdoc /> public LoginButtonAuthenticationModelinitializationController( [KeyFilter(UnityUIRegisterationKey.TitleLoginUsername)][NotNull] IUIText usernameTextElement, [KeyFilter(UnityUIRegisterationKey.TitleLoginPassword)][NotNull] IUIText passwordTextElement, [KeyFilter(UnityUIRegisterationKey.TitleLoginButton)][NotNull] IUIButton loginButtonElement, [NotNull] IAuthenticationDetailsModel authenticationModel, [NotNull] ILog logger) { UsernameTextElement = usernameTextElement ?? throw new ArgumentNullException(nameof(usernameTextElement)); PasswordTextElement = passwordTextElement ?? throw new ArgumentNullException(nameof(passwordTextElement)); LoginButtonElement = loginButtonElement ?? throw new ArgumentNullException(nameof(loginButtonElement)); AuthenticationModel = authenticationModel ?? throw new ArgumentNullException(nameof(authenticationModel)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
/// <inheritdoc /> public TitleScreenTryAuthenticateOnLoginButtonClickedEventListener( [NotNull] ILoginButtonClickedEventSubscribable subscriptionService, [NotNull] IAuthenticationService authService, [NotNull] ILog logger, [NotNull][KeyFilter(UnityUIRegisterationKey.UsernameTextBox)] IUIText usernameText, [NotNull][KeyFilter(UnityUIRegisterationKey.PasswordTextBox)] IUIText passwordText) : base(subscriptionService) { AuthService = authService ?? throw new ArgumentNullException(nameof(authService)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); UsernameText = usernameText ?? throw new ArgumentNullException(nameof(usernameText)); PasswordText = passwordText ?? throw new ArgumentNullException(nameof(passwordText)); }
/// <inheritdoc /> public ChatInputEventRegisterationEventListener(IVoiceSessionAuthenticatedEventSubscribable subscriptionService, [NotNull][KeyFilter(UnityUIRegisterationKey.ChatInput)] IUIButton chatEnterButton, [NotNull][KeyFilter(UnityUIRegisterationKey.ChatInput)] IUIText chatEnterText, [NotNull] ILog logger) : base(subscriptionService) { ChatEnterButton = chatEnterButton ?? throw new ArgumentNullException(nameof(chatEnterButton)); ChatEnterText = chatEnterText ?? throw new ArgumentNullException(nameof(chatEnterText)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); //TODO: We disabled waiting for channel auth specificially for PSOBB integration reasons. Not sure it's a good idea. ChatEnterButton.AddOnClickListener(OnChatMessageEnterPressed); }
public RequestInviteGuildMemberEventListener(IInviteGuildMemberModalClickedEventSubscribable subscriptionService, [NotNull][KeyFilter(UnityUIRegisterationKey.AddGuildMemberModalWindow)] IUIButton inviteGuildMemberButton, [NotNull][KeyFilter(UnityUIRegisterationKey.AddGuildMemberModalWindow)] IUIElement guildInviteModalWindow, [NotNull][KeyFilter(UnityUIRegisterationKey.AddGuildMemberModalWindow)] IUIText guildInviteInputText, [NotNull] ILog logger, [NotNull] IRemoteSocialHubServer realtimeSocialConnection) : base(subscriptionService) { InviteGuildMemberButton = inviteGuildMemberButton ?? throw new ArgumentNullException(nameof(inviteGuildMemberButton)); GuildInviteModalWindow = guildInviteModalWindow; GuildInviteInputText = guildInviteInputText ?? throw new ArgumentNullException(nameof(guildInviteInputText)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); RealtimeSocialConnection = realtimeSocialConnection ?? throw new ArgumentNullException(nameof(realtimeSocialConnection)); }
public RequestAccountRegistrationEventListener(IRegisterAccountButtonClickedEventSubscribable subscriptionService, [NotNull] IAuthenticationService authService, [NotNull][KeyFilter(UnityUIRegisterationKey.UsernameTextBox)] IUIText usernameText, [NotNull][KeyFilter(UnityUIRegisterationKey.PasswordTextBox)] IUIText passwordText, [NotNull] IGeneralErrorEncounteredEventPublisher errorPublisher, [NotNull] ILog logger) : base(subscriptionService) { AuthService = authService ?? throw new ArgumentNullException(nameof(authService)); UsernameText = usernameText ?? throw new ArgumentNullException(nameof(usernameText)); PasswordText = passwordText ?? throw new ArgumentNullException(nameof(passwordText)); ErrorPublisher = errorPublisher ?? throw new ArgumentNullException(nameof(errorPublisher)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public void Initialize(IGameState entity) { _logoLine1Text = new UIText(_gameContext.AssetManager.GetFont(GameConstants.GameStateConstants.MenuStateConstants.LogoFontName), GameConstants.GameStateConstants.PlayStateConstants.GameOverLine1Text, Color.White); _logoLine2Text = new UIText(_gameContext.AssetManager.GetFont(GameConstants.GameStateConstants.MenuStateConstants.LogoFontName), GameConstants.GameStateConstants.PlayStateConstants.GameOverLine2Text, Color.White); _line1Position.X = (_gameContext.GameGraphics.ScreenBounds.Width / 2) - (_logoLine1Text.Size.X / 2); _line1Position.Y = 40; _line2Position.X = (_gameContext.GameGraphics.ScreenBounds.Width / 2) - (_logoLine2Text.Size.X / 2); _line2Position.Y = _line1Position.Y + _logoLine2Text.Size.Y + 40; _stopwatch = new Stopwatch(); _stopwatch.Start(); }
public AuthenticateOnLoginButtonClickEventListener(ILoginButtonClickedEventSubscribable subscriptionService, IAuthenticationService authService, [KeyFilter(ClientUIDependencyKey.UserName)] IUIText userNameField, [KeyFilter(ClientUIDependencyKey.Password)] IUIText passwordField, ILog logger, IGameContextEventQueueable gameQueueable, [NotNull] IAuthTokenRepository authTokenRepository) : base(subscriptionService) { AuthService = authService ?? throw new ArgumentNullException(nameof(authService)); UserNameField = userNameField; PasswordField = passwordField; Logger = logger ?? throw new ArgumentNullException(nameof(logger)); GameQueueable = gameQueueable ?? throw new ArgumentNullException(nameof(gameQueueable)); AuthTokenRepository = authTokenRepository ?? throw new ArgumentNullException(nameof(authTokenRepository)); }
public RequestAddFriendEventListener(IAddFriendModalClickedEventSubscribable subscriptionService, [NotNull][KeyFilter(UnityUIRegisterationKey.AddFriendModalWindow)] IUIButton addFriendButton, [NotNull] ISocialService socialService, [NotNull][KeyFilter(UnityUIRegisterationKey.AddFriendModalWindow)] IUIElement friendsAddModalWindow, [NotNull][KeyFilter(UnityUIRegisterationKey.AddFriendModalWindow)] IUIText friendInputText, [NotNull] ILog logger, [NotNull] ICharacterFriendAddedEventPublisher friendAddedPublisher) : base(subscriptionService) { AddFriendButton = addFriendButton ?? throw new ArgumentNullException(nameof(addFriendButton)); SocialService = socialService ?? throw new ArgumentNullException(nameof(socialService)); FriendsAddModalWindow = friendsAddModalWindow; FriendInputText = friendInputText ?? throw new ArgumentNullException(nameof(friendInputText)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); FriendAddedPublisher = friendAddedPublisher ?? throw new ArgumentNullException(nameof(friendAddedPublisher)); }
public void Initialize(IGameState entity) { _logoLine1Text = new UIText(_gameContext.AssetManager.GetFont(GameConstants.GameStateConstants.MenuStateConstants.LogoFontName), GameConstants.GameStateConstants.MenuStateConstants.GameTitleLine1Text, Color.White); _logoLine2Text = new UIText(_gameContext.AssetManager.GetFont(GameConstants.GameStateConstants.MenuStateConstants.LogoFontName), GameConstants.GameStateConstants.MenuStateConstants.GameTitleLine2Text, Color.White); _backgroundImage = new Sprite(_gameContext.AssetManager.GetTexture(GameConstants.GameStateConstants.MenuStateConstants.Textures.BackgroundTextureName)); _line1Position.X = -_logoLine1Text.Size.X; _line1Position.Y = 40; _line1TargetPosition.X = (_gameContext.GameGraphics.ScreenBounds.Width / 2) - (_logoLine1Text.Size.X / 2); _line1TargetPosition.Y = _line1Position.Y; _line2Position.X = _gameContext.GameGraphics.ScreenBounds.Width; _line2Position.Y = _line1TargetPosition.Y + _logoLine2Text.Size.Y + 40; _line2TargetPosition.X = (_gameContext.GameGraphics.ScreenBounds.Width / 2) - (_logoLine2Text.Size.X / 2); _line2TargetPosition.Y = _line2Position.Y; }
private static IUIText RetrieveUITextComponent([NotNull] GameObject textObject) { if (textObject == null) { throw new ArgumentNullException(nameof(textObject)); } //BIG problems if this doesn't exist. IUIText text = textObject.GetComponent <IUIText>(); if (text == null) { throw new InvalidOperationException($"Faile to load {nameof(IUIText)} from gameobject {textObject.name}"); } return(text); }
//This ctor looks BRUTAL but it's auto-wired with elements //from the scene via IoC. And external consumers access through the Elements prop //so it appears slightly cleanish. public CharacterTabUIElementsContext( [KeyFilter(UnityUIRegisterationKey.CharacterSlot1)] IUIButton button1, [KeyFilter(UnityUIRegisterationKey.CharacterSlot2)] IUIButton button2, [KeyFilter(UnityUIRegisterationKey.CharacterSlot3)] IUIButton button3, [KeyFilter(UnityUIRegisterationKey.CharacterSlot4)] IUIButton button4, [KeyFilter(UnityUIRegisterationKey.CharacterSlot1)] IUIText text1, [KeyFilter(UnityUIRegisterationKey.CharacterSlot2)] IUIText text2, [KeyFilter(UnityUIRegisterationKey.CharacterSlot3)] IUIText text3, [KeyFilter(UnityUIRegisterationKey.CharacterSlot4)] IUIText text4) { CharacterTabUIElement[] characterTabElements = new CharacterTabUIElement[4]; characterTabElements[0] = new CharacterTabUIElement(button1, text1); characterTabElements[1] = new CharacterTabUIElement(button2, text2); characterTabElements[2] = new CharacterTabUIElement(button3, text3); characterTabElements[3] = new CharacterTabUIElement(button4, text4); Elements = characterTabElements; }
public void ReceiveChatMessage(int tabId, [NotNull] string text) { if (text == null) { throw new ArgumentNullException(nameof(text)); } if (tabId <= 0) { throw new ArgumentOutOfRangeException(nameof(tabId)); } GameObject textObject = GameObject.Instantiate(PrefabFactory.Create(EntityPrefab.MessageBoxText)); IUIText uiText = RetrieveUITextComponent(textObject); uiText.Text = text; //Parent to the message box. ChatWindow.Parent(textObject); }
public GeneralErrorUIDispatchEventListener([NotNull] IGeneralErrorEncounteredEventSubscribable subscriptionService, [KeyFilter(UnityUIRegisterationKey.ErrorTitle)][NotNull] IUIText errorTitle, [KeyFilter(UnityUIRegisterationKey.ErrorMessage)][NotNull] IUIText errorMessage, [KeyFilter(UnityUIRegisterationKey.ErrorOkButton)][NotNull] IUIButton errorButton, [KeyFilter(UnityUIRegisterationKey.ErrorBox)][NotNull] IUIElement errorDialogBox) : base(subscriptionService) { if (subscriptionService == null) { throw new ArgumentNullException(nameof(subscriptionService)); } ErrorTitle = errorTitle ?? throw new ArgumentNullException(nameof(errorTitle)); ErrorMessage = errorMessage ?? throw new ArgumentNullException(nameof(errorMessage)); ErrorButton = errorButton ?? throw new ArgumentNullException(nameof(errorButton)); ErrorDialogBox = errorDialogBox ?? throw new ArgumentNullException(nameof(errorDialogBox)); ErrorArgsQueue = new Queue <GeneralErrorEncounteredEventArgs>(2); //Register callback into this dispatcher. ErrorButton.AddOnClickListener(OnErrorOkButtonClicked); }
/// <inheritdoc /> public CharacterSelectionUpdateCharacterSelectedNameOnCharacterSelectionEventListener(ICharacterSelectionButtonClickedEventSubscribable subscriptionService, [KeyFilter(UnityUIRegisterationKey.CharacterSelection)][NotNull] IUIText selectedCharacterText, [NotNull] IEntityNameQueryable nameryQueryable) : base(subscriptionService) { SelectedCharacterText = selectedCharacterText ?? throw new ArgumentNullException(nameof(selectedCharacterText)); NameryQueryable = nameryQueryable ?? throw new ArgumentNullException(nameof(nameryQueryable)); }