Esempio n. 1
0
        private static void UpdateChatGround()
        {
            Chat chat = GetChat();
            MainCameraComponent mainCameraComponent = CameraUtil.GetMainCameraComponent();

            Vector2 middleWorldPos = Vector2.zero;
            Vector2 leftWorldPos   = Vector2.zero;
            Vector2 rightWorldPos  = Vector2.zero;

            CameraUtil.GetScreenToWorldPointBoundaires(ref leftWorldPos, ref middleWorldPos, ref rightWorldPos);

            float distanceBtweenScreenBounds = Vector2.Distance(leftWorldPos, rightWorldPos);

            middleWorldPos += Vector2.up * chat.GroundYOfset;
            chat.Ground.transform.position   = middleWorldPos;
            chat.Ground.transform.localScale = Vector2.one + (Vector2.right * distanceBtweenScreenBounds);
        }
Esempio n. 2
0
        private static void UpdateUsernamesAppearance()
        {
            Chat chat = ChatUtil.GetChat();
            MainCameraComponent  cameraComponent      = CameraUtil.GetMainCameraComponent();
            InChatPanelComponent inChatPanelComponent = (InChatPanelComponent)UIPanelUtil.GetUIPanel(PanelType.IN_CHAT);

            for (int i = 0; i < inChatPanelComponent.CharactersUsername.Length; i++)
            {
                UIText    uiText             = inChatPanelComponent.CharactersUsername[i];
                Character referenceCharacter = chat.Characters[i];

                uiText.text = chat.CharacterConfiguration.BaseName;
                UIUtil.FormatUIText(uiText, referenceCharacter);

                uiText.fontSize = chat.CharacterConfiguration.UsernameSize;
                uiText.color    = chat.CharacterConfiguration.UsernameColor;
            }
        }
Esempio n. 3
0
        private static void UpdateUsernamesPosition()
        {
            Chat chat = ChatUtil.GetChat();
            MainCameraComponent  cameraComponent      = CameraUtil.GetMainCameraComponent();
            InChatPanelComponent inChatPanelComponent = (InChatPanelComponent)UIPanelUtil.GetUIPanel(PanelType.IN_CHAT);

            for (int i = 0; i < inChatPanelComponent.CharactersUsername.Length; i++)
            {
                UIText    uiText             = inChatPanelComponent.CharactersUsername[i];
                Character referenceCharacter = chat.Characters[i];

                uiText.transform.SetParent(inChatPanelComponent.CharacterUsernamesHolder);

                Vector2 worldPosition = chat.Characters[i].Position + Vector2.up * referenceCharacter.PCharacter.Render.sprite.bounds.size;
                Vector2 offset        = chat.CharacterConfiguration.UsernameOffset;

                uiText.transform.position = cameraComponent.Camera.WorldToScreenPoint(worldPosition + offset);
            }
        }