Example #1
0
    public void Update()
    {
        if (networkView.isMine)
        {
            ServerNotifier.Address         = Relay.Instance.AddressFinder.ExternalAddress;
            ServerNotifier.CurrentMapName  = Application.loadedLevelName;
            ServerNotifier.NumberOfPlayers = PlayerPresence.UnsafeAllPlayerPresences.Count;
            // In case our external address is still null, Update() in the
            // ServerNotifier won't actually send to the list server, so it's
            // fine to call it here. (It will send as soon as our address is not
            // null).
            ServerNotifier.Update();
        }
        Leaderboard.Update();

        // Update banner messages
        float yAccum = 0f;

        for (int i = BannerMessages.Count - 1; i >= 0; i--)
        {
            //BannerMessages[i].Index = displayIndex;
            BannerMessages[i].IndexY = yAccum;
            BannerMessages[i].Update();
            if (BannerMessages[i].Active)
            {
                yAccum += BannerMessages[i].CalculatedHeight + 1f;
            }
            if (BannerMessages[i].Finished)
            {
                BannerMessages.RemoveAt(i);
            }
        }
    }
Example #2
0
 private void HandleMessage(string text, int messageType)
 {
     if (messageType == ChatMessageType)
     {
         GlobalSoundsScript.PlayChatMessageSound();
     }
     else if (messageType == BannerMessageType)
     {
         BannerMessages.Add(new BannerMessage(text.ToUpper(), BannerStyle));
     }
     else if (messageType == BannerMessageWithSoundType)
     {
         GlobalSoundsScript.PlayServerMessageSound();
         BannerMessages.Add(new BannerMessage(text.ToUpper(), BannerStyle));
     }
 }