| | |
| | |
|
| | | DTC0102_tagCDBPlayer.switchAccountEvent += SwitchAccountEvent;
|
| | | StageManager.Instance.onStageLoadFinish += OnStageLoadFinish;
|
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += PlayerLoginOkEvent;
|
| | |
|
| | | InitChatRedpoints();
|
| | |
|
| | | FuncConfigConfig _cfg = Config.Instance.Get<FuncConfigConfig>("RandomWord");
|
| | | try
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void PlayerLoginOkEvent()
|
| | | {
|
| | | UpdateRedpoint(ChatInfoType.Team);
|
| | | UpdateRedpoint(ChatInfoType.Fairy);
|
| | | }
|
| | |
|
| | | private void OnStageLoadFinish()
|
| | | {
|
| | | bool isDungeon = StageManager.Instance.CurrentStage is DungeonStage;
|
| | | if (!isDungeon)
|
| | | {
|
| | | ClearAllChatInfo();
|
| | | unReadChatCounts[ChatInfoType.Fairy] = 0;
|
| | | unReadChatCounts[ChatInfoType.Team] = 0;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | ChatData chatData = new ChatFamilyData(vNetData.Content, (int)vNetData.PlayerID, vNetData.Name, vNetData.Extras);
|
| | | KeepChatInfo(chatData);
|
| | | ReceiveNewChat(ChatInfoType.Fairy);
|
| | | }
|
| | | /// <summary>
|
| | | /// 好友私聊
|
| | |
| | | {
|
| | | ChatData chatData = new ChatTeamData(vNetData.Content, (int)vNetData.PlayerID, vNetData.Name, vNetData.Extras);
|
| | | KeepChatInfo(chatData);
|
| | | ReceiveNewChat(ChatInfoType.Team);
|
| | | }
|
| | | /// <summary>
|
| | | /// GM
|
| | |
| | | return string.Empty;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 仙缘红点
|
| | | Dictionary<ChatInfoType, Redpoint> chatSocialRedpoints = new Dictionary<ChatInfoType, Redpoint>();
|
| | | Dictionary<ChatInfoType, int> unReadChatCounts = new Dictionary<ChatInfoType, int>();
|
| | | public void InitChatRedpoints()
|
| | | {
|
| | | chatSocialRedpoints.Add(ChatInfoType.Fairy, new Redpoint(MainRedDot.RedPoint_FriendChatKey, 2502));
|
| | | chatSocialRedpoints.Add(ChatInfoType.Team, new Redpoint(MainRedDot.RedPoint_FriendChatKey, 2503));
|
| | | unReadChatCounts.Add(ChatInfoType.Fairy, 0);
|
| | | unReadChatCounts.Add(ChatInfoType.Team, 0);
|
| | | }
|
| | |
|
| | | public void ViewChat(ChatInfoType type)
|
| | | {
|
| | | if (unReadChatCounts.ContainsKey(type))
|
| | | {
|
| | | unReadChatCounts[type] = 0;
|
| | | UpdateRedpoint(type);
|
| | | }
|
| | | }
|
| | |
|
| | | void ReceiveNewChat(ChatInfoType type)
|
| | | {
|
| | | switch (type)
|
| | | {
|
| | | case ChatInfoType.Team:
|
| | | if (!WindowCenter.Instance.CheckOpen<TeamChatWin>())
|
| | | {
|
| | | unReadChatCounts[ChatInfoType.Team] = Mathf.Min(unReadChatCounts[ChatInfoType.Team] + 1, 99);
|
| | | }
|
| | | break;
|
| | | case ChatInfoType.Fairy:
|
| | | if (!WindowCenter.Instance.CheckOpen<FairyChatWin>())
|
| | | {
|
| | | unReadChatCounts[ChatInfoType.Fairy] = Mathf.Min(unReadChatCounts[ChatInfoType.Fairy] + 1, 99);
|
| | | }
|
| | | break;
|
| | | }
|
| | | UpdateRedpoint(type);
|
| | | }
|
| | |
|
| | | public void UpdateRedpoint(ChatInfoType type)
|
| | | {
|
| | | if (chatSocialRedpoints.ContainsKey(type))
|
| | | {
|
| | | var redpoint = chatSocialRedpoints[type];
|
| | | if (unReadChatCounts[type] > 0)
|
| | | {
|
| | | redpoint.state = RedPointState.Quantity;
|
| | | redpoint.count = unReadChatCounts[type];
|
| | | }
|
| | | else
|
| | | {
|
| | | redpoint.state = RedPointState.None;
|
| | | }
|
| | | }
|
| | | var socialRed = MainRedDot.Instance.redPointFriendChat;
|
| | | if (chatSocialRedpoints[ChatInfoType.Fairy].state == RedPointState.Quantity
|
| | | || chatSocialRedpoints[ChatInfoType.Team].state == RedPointState.Quantity)
|
| | | {
|
| | | socialRed.count = unReadChatCounts[ChatInfoType.Fairy] > 0 ?
|
| | | unReadChatCounts[ChatInfoType.Fairy] : unReadChatCounts[ChatInfoType.Team];
|
| | | }
|
| | | else
|
| | | {
|
| | | socialRed.count = 0;
|
| | | }
|
| | | }
|
| | | #endregion
|
| | | }
|
| | | public struct ChatExtraData
|
| | | {
|