Esempio n. 1
0
 public override void Apply(MessageState messageState)
 {
     if (player == null)
     {
         messageState.forPlayer = false;
     }
     else
     {
         messageState.forPlayer = true;
         messageState.player    = player;
     }
 }
Esempio n. 2
0
        public static void sendMessage(string message)
        {
            currentState = computeMessageState();
            if (!currentState.shown)
            {
                currentState = null;
                return;
            }
            if (currentState.closeTags)
            {
                message = closeTags(message);
            }
            if (currentState.forPlayer)
            {
                // slightly blue text for local-only messages
                Entry.Instance.chatReplicationManager.AddPersonal(currentState.player.NetworkPlayer_, (message).Colorize("[70AAAA]"));
                Entry.Instance.chatReplicationManager.MarkForReplication(currentState.player.NetworkPlayer_);
                if (currentState.log != null)
                {
                    currentState.log.Add((message).Colorize("[70AAAA]"));
                }
                if (currentState.showToHost && !currentState.player.IsLocal_)
                {
                    var client = GeneralUtilities.localClient();
                    if (client == null)
                    {
                        Console.WriteLine("Error: Local client can't be found (sendMessage) !");
                        return;
                    }
                    Entry.Instance.chatReplicationManager.AddPersonal(client.NetworkPlayer_, (message).Colorize("[70AAAA]"));
                }
            }
            else
            {
                //StaticEvent<ChatSubmitMessage.Data>.Broadcast(new ChatSubmitMessage.Data(message));
                //Chat.SendAction(message);
#pragma warning disable CS0618 // Type or member is obsolete
                StaticTransceivedEvent <ChatMessage.Data> .Broadcast(new ChatMessage.Data((message).Colorize("[AAAAAA]")));

#pragma warning restore CS0618 // Type or member is obsolete
                //Console.WriteLine("Log : " + message);
                if (currentState.log != null)
                {
                    currentState.log.Add((message).Colorize("[AAAAAA]"));
                }
            }
            currentState = null;
        }
Esempio n. 3
0
        public static MessageState computeMessageState()
        {
            MessageState state = new MessageState();
            Dictionary <Type, MessageStateOption> firstOfType = new Dictionary <Type, MessageStateOption>();

            foreach (var optionList in messageOptionStack)
            {
                foreach (var option in optionList)
                {
                    if (!firstOfType.ContainsKey(option.GetType()))
                    {
                        firstOfType.Add(option.GetType(), option);
                    }
                }
            }
            foreach (var option in firstOfType.Values)
            {
                option.Apply(state);
            }
            return(state);
        }
Esempio n. 4
0
 public override void Apply(MessageState messageState)
 {
     messageState.shown = shown;
 }
Esempio n. 5
0
 public override void Apply(MessageState messageState)
 {
     messageState.showToHost = showToHost;
 }
Esempio n. 6
0
 public override void Apply(MessageState messageState)
 {
     messageState.closeTags = closeTags;
 }
Esempio n. 7
0
 public abstract void Apply(MessageState messageState);
Esempio n. 8
0
 public override void Apply(MessageState messageState)
 {
     messageState.log = log;
 }