using System; using System.Collections.Generic; using MoleMole.Config; using UnityEngine; using UnityEngine.UI; using proto; namespace MoleMole { public class ChatDialogContext : BaseDialogContext { public enum Mode { World = 0, Guild = 1, Friend = 2 } private const int MAX_LENGTH = 40; private const float LONG_INPUT_LENGTH = 946f; private const float SHORT_INPUT_LENGTH = 710f; private const float FRIEND_LIST_MIN_HEIGHT = 215.3f; private const float FRIEND_LIST_MAX_HEIGHT = 351.3f; private const float FRIEND_LIST_ROW_HEIGHT = 60f; private const int LINE_NUMBER_BETWEEN_HISTORY_MSG = 4; private Mode _mode; private int _talkingFriendUid; private TabManager _tabManager; private bool _isFriendListShow; private TabManager _friendTabManager; public ChatDialogContext() { config = new ContextPattern { contextName = "ChatDialogContext", viewPrefabPath = "UI/Menus/Dialog/Chat/ChatDialog" }; _tabManager = new TabManager(); _friendTabManager = new TabManager(); _tabManager.onSetActive += OnTabSetActive; _friendTabManager.onSetActive += OnFriendTabSetActive; if (false) { _mode = Mode.Guild; } else { _mode = Mode.World; } _talkingFriendUid = 0; } public ChatDialogContext(int talkingUid) { config = new ContextPattern { contextName = "ChatDialogContext", viewPrefabPath = "UI/Menus/Dialog/Chat/ChatDialog" }; _tabManager = new TabManager(); _friendTabManager = new TabManager(); _tabManager.onSetActive += OnTabSetActive; _friendTabManager.onSetActive += OnFriendTabSetActive; _mode = Mode.Friend; _talkingFriendUid = (Singleton.Instance.IsMyFriend(talkingUid) ? talkingUid : 0); if (_talkingFriendUid != 0) { Singleton.Instance.SetFriendMsgRead(_talkingFriendUid); } } protected override void BindViewCallbacks() { BindViewCallback(base.view.transform.Find("Dialog/Content/Room/ChangeBtn").GetComponent