本文整理汇总了C#中ColorType类的典型用法代码示例。如果您正苦于以下问题:C# ColorType类的具体用法?C# ColorType怎么用?C# ColorType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ColorType类属于命名空间,在下文中一共展示了ColorType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBytes
public static byte[] GetBytes(Color color, ColorType type)
{
switch (type)
{
case ColorType.ARGB8888_32:
return ByteConverter.GetBytes(color.ToArgb());
case ColorType.XRGB8888_32:
color = Color.FromArgb(0, color);
goto case ColorType.ARGB8888_32;
case ColorType.ARGB8888_16:
{
byte[] result = new byte[4];
int i = color.ToArgb();
ByteConverter.GetBytes((ushort)(i & 0xFFFF)).CopyTo(result, 0);
ByteConverter.GetBytes((ushort)((i >> 16) & 0xFFFF)).CopyTo(result, 2);
return result;
}
case ColorType.XRGB8888_16:
color = Color.FromArgb(0, color);
goto case ColorType.ARGB8888_16;
case ColorType.ARGB4444:
return ByteConverter.GetBytes((ushort)(((color.A >> 4) << 12) | ((color.R >> 4) << 8) | ((color.G >> 4) << 4) | (color.B >> 4)));
case ColorType.RGB565:
return ByteConverter.GetBytes((ushort)(((color.R >> 3) << 11) | ((color.G >> 2) << 5) | (color.B >> 3)));
}
throw new ArgumentOutOfRangeException("type");
}
示例2: FlipTurn
private void FlipTurn()
{
if (turn == ColorType.WHITE)
turn = ColorType.BLACK;
else
turn = ColorType.WHITE;
}
示例3: OnTriggerEnter2D
public void OnTriggerEnter2D(Collider2D collision)
{
if(collision.transform.CompareTag("Player"))
{
DestoryEvent();
GameLogic.Instance.Hit(20);
}
if (collision.transform.CompareTag("Bullet"))
{
if (ColorManager.Instance.IsColorCollision(collision.GetComponent<Bullet>().myColor,enemyColor))
{
ColorType temp;
temp = ColorManager.Instance.CheckMixColor(enemyColor,collision.GetComponent<Bullet>().myColor);
GameLogic.Instance.AddScore(10);
Debug.Log(temp);
if (temp == enemyColor)
{
DestoryEvent();
}
else
{
enemyColor = temp;
ChangeColor(enemyColor);
}
}
else
GameLogic.Instance.Hit(10);
}
}
示例4: NumberSprite
// if numDigits = 0, don't care how much space it takes up
private NumberSprite(ContentManager Content, int number, int numDigits, ColorType color, OperatorType op)
{
this.Content = Content;
this.number = number;
this.numDigits = numDigits;
this.color = color;
this.op = op;
}
示例5: TextDecoration
private TextDecoration(ColorType ctbg, Color bg, ColorType cttxt, Color txt, bool underline, bool bold) {
_bgColor = bg;
_bgColorType = ctbg;
_textColor = txt;
_textColorType = cttxt;
_underline = underline;
_bold = bold;
}
示例6: SetColorPalette
public static void SetColorPalette(Entity entity, ColorType color)
{
if (entity.HasComponent<Sprite>())
{
ColorTypeAttribute attr = color.GetAttributeOfType<ColorTypeAttribute>();
entity.GetComponent<Sprite>().SetColorOverride(attr.Red, attr.Green, attr.Blue, attr.Alpha);
}
}
示例7: ColorComboBox
public ColorComboBox()
{
SetComboBoxProperties(this);
_contextStrip = new ContextMenuStrip();
FillMenu();
this.ContextMenuStrip = _contextStrip;
_colorType = ColorType.KnownAndSystemColor;
}
示例8: PngHeader
/// <summary>
/// Creates a new instance of PngHeader
/// </summary>
public PngHeader(int width, int height)
{
_width = width;
_height = height;
_bitdepth = BitDepth.Eight;
_colortype = ColorType.TruecolorAlpha;
_interlaceMethod = InterlaceMethod.NoInterlacing;
}
示例9: Field
/// <summary>
/// Field constructor that takes an IPosition object as argument
/// </summary>
/// <param name="position">The position for the current IField object</param>
/// <param name="color">The color for the current IField object</param>
/// <param name="chessBoard">The chess board for the current IField object</param>
protected Field(IPosition position, ColorType color, IChessBoard chessBoard)
{
this.ChessBoard = chessBoard;
this.Position = position;
this.Color = color;
this.HasChessPiece = false;
this.IsDrawable = true;
}
示例10: ToIndex
static int ToIndex(ColorType colorType) {
if (ColorType.FirstNR <= colorType && colorType < ColorType.LastNR)
return (int)(colorType - ColorType.FirstNR);
if (ColorType.FirstUI <= colorType && colorType < ColorType.LastUI)
return (int)(colorType - ColorType.FirstUI + ColorType.LastNR - ColorType.FirstNR);
Debug.Fail(string.Format("Invalid color: {0}", colorType));
return 0;
}
示例11: Rook
public Rook(ColorType color, int rank, int file,
ChessSide myside,
ChessSide oppside)
: base(PieceType.ROOK,
color, rank,
file, myside,
oppside)
{
}
示例12: Pawn
public Pawn(ColorType color, int rank, int file,
ChessSide myside,
ChessSide oppside)
: base(PieceType.PAWN,
color, rank,
file, myside,
oppside)
{
}
示例13: Block
public Block(int x1, int y1, int x2, int y2, ColorType color)
{
this.x1 = x1;
this.x2 = x2;
this.y1 = y1;
this.y2 = y2;
this.color = color;
this.ID = null;
}
示例14: Coloration
// : this(colorType, pallet.ToList())
//{
//}
//public Coloration(ColorType colorType, IEnumerable<Color> pallet)
public Coloration(ColorType colorType, params Color[] pallet)
{
if (pallet == null || pallet.Length == 0)
{
throw new InvalidOperationException("The pallet cannot be empty.");
}
this._ColorType = colorType;
this.SetSourcePallet(pallet);
}
示例15: King
public King(ColorType color, int rank, int file,
ChessSide myside,
ChessSide oppside)
: base(PieceType.KING,
color, rank,
file, myside,
oppside)
{
}