| | |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | using DG.Tweening; |
| | | using System.Text; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | [SerializeField] Text guildMemberCountText; |
| | | [SerializeField] Button rankBtn; |
| | | [SerializeField] Button storeBtn; |
| | | |
| | | |
| | | [SerializeField] RichText talkInfoText; |
| | | [SerializeField] Button talkBtn; |
| | | [SerializeField] Button talkBtn1; |
| | | [SerializeField] Button requestBtn; |
| | | |
| | | |
| | |
| | | UIManager.Instance.OpenWindow<StoreBaseWin>(); |
| | | }); |
| | | InitHawker(); |
| | | talkBtn.AddListener(OnClickTalkButton); |
| | | talkBtn1.AddListener(OnClickTalkButton); |
| | | } |
| | | |
| | | |
| | |
| | | return; |
| | | GlobalTimeEvent.Instance.secondEvent += OnSecondEvent; |
| | | GlobalTimeEvent.Instance.fiveSecondEvent += OnFiveSecondEvent; |
| | | |
| | | ChatManager.Instance.OnUpdateTalkEvent += OnUpdateTalkEvent; |
| | | Display(); |
| | | } |
| | | |
| | |
| | | { |
| | | GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent; |
| | | GlobalTimeEvent.Instance.fiveSecondEvent -= OnFiveSecondEvent; |
| | | ChatManager.Instance.OnUpdateTalkEvent -= OnUpdateTalkEvent; |
| | | } |
| | | |
| | | private void OnUpdateTalkEvent(ChatChannel channel, TalkData data) |
| | | { |
| | | if (channel != ChatChannel.Guild) |
| | | return; |
| | | ShowTalkInfo(); |
| | | } |
| | | |
| | | void Display() |
| | | { |
| | | ShowGuildInfo(); |
| | | ShowHawkerTime(); |
| | | ShowTalkInfo(); |
| | | } |
| | | |
| | | void OnSecondEvent() |
| | |
| | | if (modelPlay) |
| | | HawkerMove(true); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | FuncNPCManager.Instance.isHawkerStandBy = isShow; |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //NPC对话相关 |
| | |
| | | var npc = funcNPCs[index].GetModel(); |
| | | npc.PlayAnimation("idle", true); |
| | | } |
| | | |
| | | public void OnClickTalkButton() |
| | | { |
| | | ChatManager.Instance.nowChatTab = ChatTab.Guild; |
| | | ChatManager.Instance.nowChatChannel = ChatChannel.Guild; |
| | | UIManager.Instance.OpenWindow<ChatWin>(); |
| | | } |
| | | |
| | | public string GetGuildChatAreaContent(TalkData talkData) |
| | | { |
| | | int type = ChatManager.Instance.GetTalkDataType(talkData); |
| | | if (type == 0) |
| | | { |
| | | return Language.Get("L1100", Language.Get("Chat13"), talkData.Content); |
| | | } |
| | | else if (type == 1) |
| | | { |
| | | return Language.Get("L1100", Language.Get("Chat13"), talkData.Content); |
| | | } |
| | | else |
| | | { |
| | | return Language.Get("L1100", talkData.Name, talkData.Content); |
| | | } |
| | | } |
| | | |
| | | public Color32 GetGuildChatAreaColor(TalkData talkData) |
| | | { |
| | | int type = ChatManager.Instance.GetTalkDataType(talkData); |
| | | if (type == 2) |
| | | { |
| | | return ChatManager.Instance.areaMyColor; |
| | | } |
| | | else |
| | | { |
| | | return ChatManager.Instance.areaOtherColor; |
| | | } |
| | | } |
| | | |
| | | void ShowTalkInfo() |
| | | { |
| | | if (!ChatManager.Instance.TryGetTalkData(ChatChannel.Guild, out List<TalkData> datas) || datas.IsNullOrEmpty()) |
| | | { |
| | | talkInfoText.text = string.Empty; |
| | | return; |
| | | } |
| | | |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | int startIndex = Mathf.Max(datas.Count - 2, 0); |
| | | for (int i = startIndex; i < datas.Count; i++) |
| | | { |
| | | TalkData data = datas[i]; |
| | | stringBuilder.Append(UIHelper.AppendColor(GetGuildChatAreaColor(data), GetGuildChatAreaContent(data))); |
| | | stringBuilder.AppendLine(); |
| | | } |
| | | talkInfoText.text = stringBuilder.ToString(); |
| | | } |
| | | } |