private Color GetBorderColor(ChannelColor color)
 {
     switch (color)
     {
         case ChannelColor.Black:
         case ChannelColor.Gray:
             return Colors.Black;
         case ChannelColor.Red:
         case ChannelColor.RedInverse:
             return Colors.Red;
         case ChannelColor.Green:
         case ChannelColor.GreenInverse:
             return Colors.Lime;
         case ChannelColor.Yellow:
         case ChannelColor.YellowInverse:
             return Colors.Yellow;
         case ChannelColor.Blue:
         case ChannelColor.BlueInverse:
             return Color.FromArgb(255, 32, 112, 255);
         case ChannelColor.Magenta:
         case ChannelColor.MagentaInverse:
             return Colors.Magenta;
         case ChannelColor.Cyan:
         case ChannelColor.CyanInverse:
             return Colors.Cyan;
         case ChannelColor.White:
         case ChannelColor.WhiteInverse:
             return Colors.White;
         default:
             return Colors.Transparent;
     }
 }
 private Color GetBackgroundColor(ChannelColor color)
 {
     switch (color)
     {
         case ChannelColor.Black:
             return Colors.Black;
         case ChannelColor.Red:
             return Colors.Red;
         case ChannelColor.Green:
             return Colors.Lime;
         case ChannelColor.Yellow:
             return Colors.Yellow;
         case ChannelColor.Blue:
             return Color.FromArgb(255,32,112,255);
         case ChannelColor.Magenta:
             return Colors.Magenta;
         case ChannelColor.Cyan:
             return Colors.Cyan;
         case ChannelColor.White:
             return Colors.White;
         case ChannelColor.Gray:
             return Colors.Gray;
         default:
             return Colors.Black;
     }
 }
        private static Color ReadPixelValue(Texture2D texture, Vector2 pPos, ChannelColor channelColor)
        {
            if (texture != null)
            {
                int width, height;
                width  = Mathf.RoundToInt((float)texture.width * pPos.x);
                height = Mathf.RoundToInt((float)texture.height * pPos.y);

                return(texture.GetPixel(width, height));
            }
            else
            {
                Color color;

                switch (channelColor)
                {
                case ChannelColor.Black:
                    color = new Color(0, 0, 0, 1);
                    break;

                case ChannelColor.White:
                    color = new Color(1, 1, 1, 1);
                    break;

                default:
                    color = new Color(0, 0, 0, 1);
                    break;
                }

                return(color);
            }
        }
Пример #4
0
        private void InitChannelBarButton()
        {
            btnColor_1.EditValueChanged += btnColor_1_EditValueChanged;

            BarButtonItem btn = new BarButtonItem();

            btn.Caption      = "";
            btn.ButtonStyle  = BarButtonStyle.Check;
            btn.Name         = "ToolButton_ChannelALL";
            btn.Glyph        = DevExpress.Images.ImageResourceCache.Default.GetImage("images/actions/apply_16x16.png");
            btn.DownChanged += barButton_ChannelAll_ItemClick;
            barTool3.AddItem(btn);

            for (int i = 0; i < 24; i++)
            {
                popupMenus[i] = new PopupMenu();
                popupMenus[i].AddItem(btnColor_1);
                popupMenus[i].Name         = $"pM_Channel_{i + 1}";
                popupMenus[i].BeforePopup += popupMenu_BeforePopup;
                popupMenus[i].Popup       += PopUpMenu_Popup;


                btn                 = new BarButtonItem();
                btn.Caption         = $"{i + 1}";
                btn.DropDownControl = popupMenus[i];
                btn.ButtonStyle     = BarButtonStyle.CheckDropDown;
                btn.Name            = $"ToolButton_Channel_{i + 1}";
                btn.Tag             = new SuperTag()
                {
                    BarButtonItemIndex = i
                };
                btn.Visibility = BarItemVisibility.Never;
                Random r = new Random(Guid.NewGuid().GetHashCode());
                Color  clr;
                do
                {
                    clr = Color.FromArgb(r.Next(255), r.Next(255), r.Next(255));
                    if (!ChannelColor.ContainsValue(clr))
                    {
                        ChannelColor.Add(i, clr);

                        CETCManagerApp.Instance.m_pETETCStage.m_ETProduct.m_SamplesPoints[i].m_clrColor = clr;
                        break;
                    }
                }while (true);

                btn.ItemAppearance.Normal.BackColor2 = clr;
                btn.DownChanged += barBtnChannel_DownChanged;

                btnChannels.Add(i, btn);
                var link = barTool3.AddItem(btn);
                if (i == 0)
                {
                    link.BeginGroup = true;
                }
            }
        }
Пример #5
0
        public void SendMessage(Account account, byte[] message, ushort color = 103)
        {
            Console.WriteLine("Sending");
            ChannelColor[] blues = { ChannelColor.Blue_Gray, ChannelColor.Blue_GrayA,
                                     ChannelColor.Blue_Light };

            ChannelColor sender = ChannelColor.Blue_Gray;

            // Depending on admin level, of player, or if they are the chan moderator
            // color will change
            // Color should also change slightly each time a message is displayed like on live.
            switch (Managers.MySqlManager.GetPLevel(account.SqlId))
            {
            case 4:     // Guide
                sender = ChannelColor.Green_Dark;
                break;

            case 3:     // Event Host
                sender = ChannelColor.Magenta;
                break;

            case 2:     // Moderator
                sender = ChannelColor.Peach;
                break;

            case 1:     // Game Staff
                sender = ChannelColor.Orange_Dark;
                break;

            case 0:     // Implementor
                sender = ChannelColor.Tan_Dark;
                break;

            default:     // Set 5 default player
            {
                int c = r.Next(blues.Length - 1);
                sender = blues[c];
            }
            break;
            }
            Console.WriteLine("Still sending");
            PacketWriter msg = new PacketWriter(0x26);

            msg.WriteUInt32(account.AccountId);
            msg.WriteUInt32(0);
            string s = string.Format("|c56|{0}>|c{1}|{2}: ", this.ChannelTitle, (int)sender, account.CurrentCharacter.Name);

            msg.WriteString(s, false);
            msg.WriteBytes(message);
            msg.WriteShort(0x0A);
            byte[] msgPck = msg.ToArray();

            Console.WriteLine("Chanel Members {0}", this.ChannelMembers.Count);
            foreach (Account a in this.ChannelMembers)
            {
                //if (account != a)
                // {
                Console.WriteLine(a.CurrentCharacter.Name);
                a.Socket.Send(ref msgPck);
                // }
            }
        }
Пример #6
0
 public Channel(string srcPath, ChannelColor channel) : base(srcPath)
 {
     this._channel = channel;
 }
 private Color GetForegroundColor(ChannelColor color)
 {
     switch (color)
     {
         case ChannelColor.Black:
             return Color.FromArgb(255, 154, 159, 164);
         case ChannelColor.RedInverse:
             return Colors.Red;
         case ChannelColor.GreenInverse:
             return Colors.Lime;
         case ChannelColor.YellowInverse:
             return Colors.Yellow;
         case ChannelColor.BlueInverse:
             return Color.FromArgb(255, 32, 112, 255);
         case ChannelColor.MagentaInverse:
             return Colors.Magenta;
         case ChannelColor.CyanInverse:
             return Colors.Cyan;
         case ChannelColor.WhiteInverse:
             return Colors.White;
         default:
             return Colors.Black;
     }
 }
 private static void PackerPopup(ref Texture2D texture, ref TextureChannel sourceChannel, ref TextureChannel targetChannel, ref ChannelColor targetChannelColor)
 {
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.BeginVertical();
     texture = (Texture2D)EditorGUILayout.ObjectField(texture, typeof(Texture2D), false, GUILayout.Width(70), GUILayout.Height(70));
     EditorGUILayout.EndVertical();
     if (texture != null)
     {
         EditorGUILayout.BeginVertical();
         EditorGUILayout.LabelField("From:", UnityEditor.EditorStyles.boldLabel, GUILayout.Width(70));
         sourceChannel = (TextureChannel)EditorGUILayout.EnumPopup(sourceChannel, GUILayout.Width(70));
         EditorGUILayout.EndVertical();
         EditorGUILayout.BeginVertical();
         EditorGUILayout.LabelField("To:", UnityEditor.EditorStyles.boldLabel, GUILayout.Width(70));
         targetChannel = (TextureChannel)EditorGUILayout.EnumPopup(targetChannel, GUILayout.Width(70));
         EditorGUILayout.EndVertical();
     }
     else
     {
         EditorGUILayout.BeginVertical();
         EditorGUILayout.LabelField("Assume:", UnityEditor.EditorStyles.boldLabel, GUILayout.Width(70));
         targetChannelColor = (ChannelColor)EditorGUILayout.EnumPopup(targetChannelColor, GUILayout.Width(70));
         EditorGUILayout.EndVertical();
         EditorGUILayout.BeginVertical();
         EditorGUILayout.LabelField("From:", UnityEditor.EditorStyles.boldLabel, GUILayout.Width(70));
         sourceChannel = (TextureChannel)EditorGUILayout.EnumPopup(sourceChannel, GUILayout.Width(70));
         EditorGUILayout.EndVertical();
         EditorGUILayout.BeginVertical();
         EditorGUILayout.LabelField("To:", UnityEditor.EditorStyles.boldLabel, GUILayout.Width(70));
         targetChannel = (TextureChannel)EditorGUILayout.EnumPopup(targetChannel, GUILayout.Width(70));
         EditorGUILayout.EndVertical();
     }
     EditorGUILayout.EndHorizontal();
 }