示例#1
0
文件: Chat.cs 项目: larnin/Spectrum
        static Chat()
        {
            ChatSubmitMessage.Subscribe(data =>
            {
                var eventArgs = new ChatMessageEventArgs(G.Sys.PlayerManager_.Current_.profile_.Name_, data.message_);
                MessageSent?.Invoke(null, eventArgs);
            });

            ChatMessage.Subscribe(data =>
            {
                Console.WriteLine(data.message_);

                var author = ExtractMessageAuthor(data.message_);

                if (author != G.Sys.PlayerManager_.Current_.profile_.Name_ && !IsSystemMessage(data.message_))
                {
                    var eventArgs = new ChatMessageEventArgs(author, ExtractMessageBody(data.message_));
                    MessageReceived?.Invoke(null, eventArgs);
                }
            });

            ToAllClientsRemotePlayerActionMessage.Subscribe(data =>
            {
                if (G.Sys.NetworkingManager_.IsOnline_)
                {
                    var nickname  = G.Sys.PlayerManager_.PlayerList_[data.index_].Username_;
                    var eventArgs = new ChatActionEventArgs(data.index_, nickname, data.message_);
                    ActionReceived?.Invoke(null, eventArgs);
                }
            });
        }
 public virtual void OnActionReceived(BeaconEventArgs beaconEventArgs)
 {
     if (ActionReceived != null)
     {
         ActionReceived.Invoke(this, beaconEventArgs);
     }
 }
示例#3
0
 /// <summary>Place an action on the command queue for execution.</summary>
 /// <param name="actionInput">The action input to attempt to execute.</param>
 public void ExecuteAction(ActionInput actionInput)
 {
     LastActionInput = actionInput;
     ActionReceived?.Invoke((IController)this, actionInput);
 }