private void updateState(ChatBarState chatBarState) { if (chatBarController == null) { chatBarController = root.GetComponentInChildren <ChatBarController>(); } switch (chatBarState) { case ChatBarState.Instant: base.transform.position = chatBarController.QuickChatLocation.position; chatArrowImage.enabled = true; break; case ChatBarState.EmoteInstant: base.transform.position = chatBarController.QuickEmoteLocation.position; chatArrowImage.enabled = true; break; case ChatBarState.EmoteInput: base.transform.position = chatBarController.EmoteLocation.position; chatArrowImage.enabled = true; break; case ChatBarState.Default: chatArrowImage.enabled = false; break; } }
private void Start() { rectTransform = (base.transform as RectTransform); root = GetComponentInParent <Canvas>().transform; chatBarController = root.GetComponentInChildren <ChatBarController>(); if (chatBarController != null) { updateState(chatBarController.CurrentState); } Service.Get <EventDispatcher>().AddListener <ChatBarEvents.ChatBarStateChanged>(onChatBarStateChanged, EventDispatcher.Priority.HIGH); }
private void Start() { chatArrowImage = GetComponentInChildren <Image>(); root = GetComponentInParent <StateMachineContext>().transform; chatBarController = root.GetComponentInChildren <ChatBarController>(); if (chatBarController != null) { updateState(chatBarController.CurrentState); } else { chatArrowImage.enabled = false; } Service.Get <EventDispatcher>().AddListener <ChatBarEvents.ChatBarStateChanged>(onChatBarStateChanged, EventDispatcher.Priority.LOW); }
private void updateState(ChatBarState chatBarState) { if (chatBarController == null) { chatBarController = root.GetComponentInChildren <ChatBarController>(); } if (chatBarState == ChatBarState.EmoteInput) { rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x, InputPosition); } else { rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x, InstantPosition); } }
protected override void Awake() { chatBarController = GetComponent <ChatBarController>(); base.Awake(); }