Beispiel #1
0
        private static void OnSendAvatarStreamsToClientMessageReceived(SendAvatarStreamsToClientMessage message)
        {
            AvatarStreamMessage                avatarStreamMessage = new AvatarStreamMessage();
            LogicArrayList <LogicLong>         ids = message.StreamIds;
            LogicArrayList <AvatarStreamEntry> avatarStreamList = new LogicArrayList <AvatarStreamEntry>(ids.Size());

            for (int i = 0; i < ids.Size(); i++)
            {
                AvatarStreamEntry avatarStreamEntry = StreamManager.GetAvatarStream(ids[i]);

                if (avatarStreamEntry != null)
                {
                    avatarStreamList.Add(avatarStreamEntry);
                }
            }

            avatarStreamMessage.SetStreamEntries(avatarStreamList);
            avatarStreamMessage.Encode();

            ServerMessageManager.SendMessage(StreamMessageManager.CreateForwardLogicMessage(avatarStreamMessage, message.SessionId), ServerManager.GetProxySocket(message.SessionId));

            for (int i = 0; i < avatarStreamList.Size(); i++)
            {
                AvatarStreamEntry avatarStreamEntry = avatarStreamList[i];

                if (avatarStreamEntry.IsNew())
                {
                    avatarStreamEntry.SetNew(false);
                    StreamManager.Save(avatarStreamEntry);
                }
            }
        }
        private void AddAvatarStreamEntry(AvatarStreamEntry entry)
        {
            if (this.AvatarStreamList.Size() > 50)
            {
                this.RemoveAvatarStreamEntry(this.AvatarStreamList[0]);
            }
            this.AvatarStreamList.Add(entry.GetId());

            if (this.CurrentSession != null)
            {
                AvatarStreamEntryMessage avatarStreamEntryMessage = new AvatarStreamEntryMessage();
                avatarStreamEntryMessage.SetAvatarStreamEntry(entry);
                this.CurrentSession.SendPiranhaMessage(avatarStreamEntryMessage, 1);

                if (entry.IsNew())
                {
                    ServerMessageManager.SendMessage(new AvatarStreamSeenMessage
                    {
                        AccountId = entry.GetId()
                    }, 11);
                }
            }
            else
            {
                GameAvatar.Save(this);
            }
        }
Beispiel #3
0
        private static void OnAvatarStreamSeenMessageReceived(AvatarStreamSeenMessage message)
        {
            AvatarStreamEntry entry = StreamManager.GetAvatarStream(message.AccountId);

            if (entry != null && entry.IsNew())
            {
                entry.SetNew(false);
                StreamManager.Save(entry);
            }
        }