示例#1
0
 public void ClearMessageNot()
 {
     if (parentNotification != null)
     {
         parentNotification.RemoveNotification(PlayerData.uid);
     }
     pendingMsgNotification.ClearAll();
 }
示例#2
0
        void RefreshOnlinePlayerList(AdminPlayersList playerList)
        {
            foreach (var p in playerList.players)
            {
                var index = playerEntries.FindIndex(x => x.PlayerData.uid == p.uid);
                if (index != -1)
                {
                    playerEntries[index].UpdateButton(p, SelectPlayerInList, masterNotification, disableButtonInteract);
                }
                else
                {
                    if (showAdminsOnly)
                    {
                        if (!p.isAdmin)
                        {
                            continue;
                        }
                    }
                    var e     = Instantiate(playerEntryPrefab, playerListContent);
                    var entry = e.GetComponent <AdminPlayerEntry>();
                    entry.UpdateButton(p, SelectPlayerInList, masterNotification, disableButtonInteract);
                    playerEntries.Add(entry);
                    index = playerEntries.Count - 1;
                }

                if (!p.isOnline)
                {
                    playerEntries[index].transform.SetAsLastSibling();
                }
            }

            Search();

            if (SelectedPlayer == null)
            {
                if (playerEntries.Count == 0)
                {
                    return;
                }

                SelectPlayerInList(playerEntries[0]);
            }
            else
            {
                if (gameObject.activeInHierarchy)
                {
                    SelectedPlayer.pendingMsgNotification.ClearAll();
                    if (masterNotification != null)
                    {
                        masterNotification.RemoveNotification(SelectedPlayer.PlayerData.uid);
                    }
                }
            }
        }
        public void ClientUpdateNotifications(string notificationKey, AdminChatWindow targetWindow,
                                              int amt, bool clearAll)
        {
            switch (targetWindow)
            {
            case AdminChatWindow.AdminPlayerChat:
                if (clearAll)
                {
                    playerNotification.RemoveNotification(notificationKey);
                    if (amt == 0)
                    {
                        return;
                    }
                }
                //No need to update notification if the player is already selected in admin chat
                if (adminChatWindows.SelectedWindow == AdminChatWindow.AdminPlayerChat)
                {
                    if (adminChatWindows.adminPlayerChat.SelectedPlayer != null &&
                        adminChatWindows.adminPlayerChat.SelectedPlayer.uid == notificationKey)
                    {
                        break;
                    }
                }
                playerNotification.AddNotification(notificationKey, amt);
                break;

            case AdminChatWindow.AdminToAdminChat:
                if (clearAll)
                {
                    adminNotification.RemoveNotification(notificationKey);
                    if (amt == 0)
                    {
                        return;
                    }
                }

                if (adminChatWindows.adminToAdminChat.gameObject.activeInHierarchy)
                {
                    return;
                }

                adminNotification.AddNotification(notificationKey, amt);
                break;

            case AdminChatWindow.PrayerWindow:
                if (clearAll)
                {
                    prayerNotification.AddNotification(notificationKey, amt);
                }
                prayerNotification.AddNotification(notificationKey, amt);
                break;
            }
        }