Exemple #1
0
        public void Paint(MessageOwner sender)
        {
            GradientStopCollection gradientStops = new GradientStopCollection();
            GradientStop           gradientStop1 = null, gradientStop2 = null;

            switch (sender)
            {
            case MessageOwner.SERVER:
                Color color = (Color)ColorConverter.ConvertFromString("#FF051BF7");
                gradientStop1 = new GradientStop(color, 0);
                color         = (Color)ColorConverter.ConvertFromString("#FF08D1F8");
                gradientStop2 = new GradientStop(color, 2);
                break;

            case MessageOwner.YOU:
                color         = (Color)ColorConverter.ConvertFromString("#FF8B8B8D");
                gradientStop1 = new GradientStop(color, 0);
                color         = (Color)ColorConverter.ConvertFromString("#FFB2B4B4");
                gradientStop2 = new GradientStop(color, 2);
                break;
            }

            gradientStops.Add(gradientStop1);
            gradientStops.Add(gradientStop2);
            messageBorder.Background = new LinearGradientBrush(gradientStops, new Point(1, 0), new Point(1, 1));
        }
Exemple #2
0
        public Message(string messageStr, MessageOwner sender, double maxWidth = 280)
        {
            InitializeComponent();

            text.MaxWidth = maxWidth;
            text.Text     = messageStr;

            Paint(sender);
        }
Exemple #3
0
        public void PrintMessage(string str, MessageOwner owner)
        {
            switch (owner)
            {
            case MessageOwner.Player1:
                PrintToConsole("Player1: ", Color.Green);
                PrintToConsoleLn(str, Color.FromArgb(64, 128, 255));
                break;

            case MessageOwner.Player2:
                PrintToConsole("Player2: ", Color.Green);
                PrintToConsoleLn(str, Color.FromArgb(128, 64, 255));
                break;

            case MessageOwner.System:
                PrintToConsole("System: ", Color.Red);
                PrintToConsoleLn(str, Color.Black);
                break;
            }
        }
Exemple #4
0
        public void PrintMessage(string str, MessageOwner owner)
        {
            switch (owner)
            {
                case MessageOwner.Player1:
                    PrintToConsole("Player1: ", Color.Green);
                    PrintToConsoleLn(str, Color.FromArgb(64, 128, 255));
                    break;

                case MessageOwner.Player2:
                    PrintToConsole("Player2: ", Color.Green);
                    PrintToConsoleLn(str, Color.FromArgb(128, 64, 255));
                    break;

                case MessageOwner.System:
                    PrintToConsole("System: ", Color.Red);
                    PrintToConsoleLn(str, Color.Black);
                    break;
            }
        }