コード例 #1
0
 public void OnWhisper(bnet.protocol.notification.Notification notification)
 {
     if (notification.HasSenderId && (notification.AttributeCount > 0))
     {
         BnetWhisper item = new BnetWhisper();
         item.SetSpeakerId(BnetGameAccountId.CreateFromProtocol(notification.SenderId));
         item.SetReceiverId(BnetGameAccountId.CreateFromProtocol(notification.TargetId));
         for (int i = 0; i < notification.AttributeCount; i++)
         {
             bnet.protocol.attribute.Attribute attribute = notification.Attribute[i];
             if (attribute.Name == "whisper")
             {
                 item.SetMessage(attribute.Value.StringValue);
             }
         }
         if (!string.IsNullOrEmpty(item.GetMessage()))
         {
             TimeSpan elapsedTimeSinceEpoch = TimeUtils.GetElapsedTimeSinceEpoch(null);
             item.SetTimestampMilliseconds(elapsedTimeSinceEpoch.TotalMilliseconds);
             this.m_whispers.Add(item);
         }
     }
 }
コード例 #2
0
 public static string GetMessage(BnetWhisper whisper)
 {
     return(GetMessage(whisper.GetMessage()));
 }