Esempio n. 1
0
 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");
 }
 private void FlipTurn()
 {
     if (turn == ColorType.WHITE)
         turn = ColorType.BLACK;
     else
         turn = ColorType.WHITE;
 }
Esempio n. 3
0
        private static void DrawFixed(SerializedProperty fixedProperty, ColorType type1, ColorType fixedType)
        {
            Rect position = EditorGUILayout.GetControlRect();
            Rect left = new Rect(position.x, position.y, EditorGUIUtility.labelWidth, position.height);
            Rect right = new Rect(position.x + EditorGUIUtility.labelWidth, position.y, position.width - EditorGUIUtility.labelWidth, position.height);

            EditorGUI.BeginChangeCheck();
            bool toggled = EditorGUI.ToggleLeft(left, "Fixed " + fixedType.ToString(), fixedProperty.floatValue >= 0);
            float defaultFixedValue = GetDefaultFixedValue(fixedType);
            if (EditorGUI.EndChangeCheck())
            {
                if (toggled)
                    fixedProperty.floatValue = defaultFixedValue;
                else
                    fixedProperty.floatValue = -1;
            }

            GUI.enabled = toggled;
            if (toggled)
            {
                fixedProperty.floatValue = EditorGUI.Slider(right, fixedProperty.floatValue, 0, 1);
            }
            else
            {
                EditorGUI.Slider(right, defaultFixedValue < 0 ? 0 : defaultFixedValue, 0, 1);
            }
            GUI.enabled = true;
        }
Esempio n. 4
0
    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);


        }
    }
Esempio n. 5
0
 // 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;
 }
Esempio n. 6
0
 public ColorComboBox()
 {
   SetComboBoxProperties(this);
   _contextStrip = new ContextMenuStrip();
   FillMenu();
   this.ContextMenuStrip = _contextStrip;
   _colorType = ColorType.KnownAndSystemColor;
 }
Esempio n. 7
0
 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);
     }
 }
Esempio n. 8
0
		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;
		}
Esempio n. 9
0
 /// <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;
 }
 /// <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;
 }
Esempio n. 11
0
 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;
 }
Esempio n. 12
0
            public King(ColorType color, int rank, int file,
				     ChessSide myside,
				     ChessSide oppside)
                : base(PieceType.KING,
							      color, rank,
							      file, myside,
							      oppside)
            {
            }
Esempio n. 13
0
            public Rook(ColorType color, int rank, int file,
				     ChessSide myside,
				     ChessSide oppside)
                : base(PieceType.ROOK,
							      color, rank,
							      file, myside,
							      oppside)
            {
            }
Esempio n. 14
0
 //    : 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);
 }
Esempio n. 15
0
            public Pawn(ColorType color, int rank, int file,
				     ChessSide myside,
				     ChessSide oppside)
                : base(PieceType.PAWN,
							      color, rank,
							      file, myside,
							      oppside)
            {
            }
Esempio n. 16
0
 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;
 }
Esempio n. 17
0
            public Bishop(ColorType color, int rank, int file,
				       ChessSide myside,
				       ChessSide oppside)
                : base(PieceType.
								BISHOP, color,
								rank, file,
								myside,
								oppside)
            {
            }
Esempio n. 18
0
 internal void read(BigEndianBinaryReader reader)
 {
     width = reader.ReadInt32();
     height = reader.ReadInt32();
     bitdepth = reader.ReadByte();
     colortype = (ColorType)reader.ReadByte();
     method = reader.ReadByte();
     filter = reader.ReadByte();
     interlace = reader.ReadByte();
 }
Esempio n. 19
0
            public Queen(ColorType color, int rank, int file,
				      ChessSide myside,
				      ChessSide oppside)
                : base(PieceType.
							       QUEEN, color,
							       rank, file,
							       myside,
							       oppside)
            {
            }
Esempio n. 20
0
            public Knight(ColorType color, int rank, int file,
				       ChessSide myside,
				       ChessSide oppside)
                : base(PieceType.
								KNIGHT, color,
								rank, file,
								myside,
								oppside)
            {
            }
Esempio n. 21
0
        public Ihdr(UInt32 width, UInt32 height, BitDepth bitDepth, ColorType colorType, CompressionMethod compressionMethod = CompressionMethod.Default, FilterMethod filterMethod = FilterMethod.Default, InterlaceMethod interlaceMethod = InterlaceMethod.None)
            : base(ChunkType.IHDR)
        {
            #region Sanity
            if(width == 0 || width > Int32.MaxValue)
                throw new ArgumentOutOfRangeException("width", "width must be greater than 0 and smaller than In32.MaxValue(2^31-1)");
            if(height == 0 || height > Int32.MaxValue)
                throw new ArgumentOutOfRangeException("height", "height must be greater than 0 and smaller than In32.MaxValue(2^31-1)");

            BitDepth[] allowedBitDepths;
            switch (colorType)
                {
                case ColorType.Grayscale:
                    if(!(allowedBitDepths = new[] { BitDepth._1, BitDepth._2, BitDepth._4, BitDepth._8, BitDepth._16 }).Contains(bitDepth))
                        throw new ArgumentOutOfRangeException("bitDepth", String.Format("bitDepth must be one of {0} for colorType {1}", allowedBitDepths.Aggregate("", (s, bd) => s + bd + ", ", s => s.Trim().Substring(0, s.Length - 2)), colorType));
                    break;
                case ColorType.Rgb:
                    if(!(allowedBitDepths = new[]{BitDepth._8, BitDepth._16}).Contains(bitDepth))
                        throw new ArgumentOutOfRangeException("bitDepth", String.Format("bitDepth must be one of {0} for colorType {1}", allowedBitDepths.Aggregate("", (s, bd) => s + bd + ", ", s => s.Trim().Substring(0, s.Length - 2)), colorType));
                    break;
                case ColorType.Palette:
                    if(!(allowedBitDepths = new[] { BitDepth._1, BitDepth._2, BitDepth._4, BitDepth._8}).Contains(bitDepth))
                        throw new ArgumentOutOfRangeException("bitDepth", String.Format("bitDepth must be one of {0} for colorType {1}", allowedBitDepths.Aggregate("", (s, bd) => s + bd + ", ", s => s.Trim().Substring(0, s.Length - 2)), colorType));
                    break;
                case ColorType.GrayscaleWithAlpha:
                    if(!(allowedBitDepths = new[] { BitDepth._8, BitDepth._16}).Contains(bitDepth))
                        throw new ArgumentOutOfRangeException("bitDepth", String.Format("bitDepth must be one of {0} for colorType {1}", allowedBitDepths.Aggregate("", (s, bd) => s + bd + ", ", s => s.Trim().Substring(0, s.Length - 2)), colorType));
                    break;
                case ColorType.Rgba:
                    if(!(allowedBitDepths = new[] { BitDepth._8, BitDepth._16}).Contains(bitDepth))
                        throw new ArgumentOutOfRangeException("bitDepth", String.Format("bitDepth must be one of {0} for colorType {1}", allowedBitDepths.Aggregate("", (s, bd) => s + bd + ", ", s => s.Trim().Substring(0, s.Length - 2)), colorType));
                    break;
                default:
                    throw new ArgumentOutOfRangeException("colorType", String.Format("Unknown colorType: {0}", colorType));
                }

            if(compressionMethod != CompressionMethod.Default)
                throw new ArgumentOutOfRangeException("compressionMethod", String.Format("Unknown compressionMethod: {0}", compressionMethod));
            if(filterMethod != FilterMethod.Default)
                throw new ArgumentOutOfRangeException("filterMethod", String.Format("Unknown filterMethod: {0}", filterMethod));

            var allowedInterlaceMethods = new[] {InterlaceMethod.None, InterlaceMethod.Adam7};
            if(!allowedInterlaceMethods.Contains(interlaceMethod))
                throw new ArgumentOutOfRangeException("interlaceMethod", String.Format("interlaceMethod must be one of {0}", allowedInterlaceMethods.Aggregate("", (s, bd) => s + bd + ", ", s => s.Trim().Substring(0, s.Length - 2))));

            #endregion

            Width = width;
            Height = height;
            BitDepth = bitDepth;
            ColorType = colorType;
            CompressionMethod = compressionMethod;
            FilterMethod = filterMethod;
            InterlaceMethod = interlaceMethod;
        }
 public IField Create(IPosition position, ColorType color, IChessBoard chessBoard)
 {
     switch (color)
     {
         case ColorType.Black:
             return new BlackField(position, chessBoard);
         case ColorType.White:
             return new WhiteField(position, chessBoard);
         default:
             throw new ArgumentOutOfRangeException("color", ErrorMessages.InvalidColor);
     }
 }
Esempio n. 23
0
            protected ChessPiece(PieceType type, ColorType color,
					      int rank, int file,
					      ChessSide myside,
					      ChessSide oppside)
            {
                this.type = type;
                this.myside = myside;
                this.oppside = oppside;
                this.color = color;
                this.rank = rank;
                this.file = file;
            }
Esempio n. 24
0
 public void changeColor(IShape shape, ColorType type, Nullable<Color> color)
 {
     switch (type)
     {
         case ColorType.FILL:
             this.changeFillColor(shape, color);
             break;
         case ColorType.PEN:
             this.changePenColor(shape, color);
             break;
     }
 }
Esempio n. 25
0
 public Color getColor(ColorType colorType)
 {
     switch (colorType)
     {
         case ColorType.BackColor:
             return this.backColor;
         case ColorType.ForeColor:
             return this.foreColor;
         default:
             throw new Exception("invalid color type");
     }
 }
Esempio n. 26
0
    public bool Init()
    {
        elapsedTime     =   0f;
        startPos        =   transform.position;
        enemyColor      =   GameLogic.Instance.spawnColorList[Random.Range(0, GameLogic.Instance.spawnColorList.Count)];
        isMixedColor    =   ColorManager.Instance.IsMixedColor(enemyColor);


        ChangeColor(enemyColor);
        StartCoroutine(MoveRoutine());

        return isMixedColor;
    }
Esempio n. 27
0
 public Figure(ColorType color, int blocksize, Engine e)
 {
     this.color = color;
     this.blocksize = blocksize;
     this.engine = e;
     this.maxX = engine.getMaxX();
     this.maxY = engine.getMaxY();
     this.terminate = false;
     x1 = 0;
     x2 = 0;
     y1 = 0;
     y2 = 0;
 }
Esempio n. 28
0
	public static Color GetColor(ColorType type)
	{
		switch (type)
		{
		case ColorType.Red:
			return Color.red;
		case ColorType.Green:
			return Color.green;
		case ColorType.Blue:
			return Color.blue;
		}
		return Color.white;
	}
Esempio n. 29
0
 public static int BytesPerPixelCeil(ColorType colorType, BitDepth bitDepth)
 {
     int bitsPerPixel;
     switch (colorType)
     {
         case ColorType.Grayscale: bitsPerPixel = (int)bitDepth; break;
         case ColorType.TrueColor: bitsPerPixel = 3 * (int)bitDepth; break;
         case ColorType.PaletteColor: bitsPerPixel = (int)bitDepth; break;
         case ColorType.GrayscaleAlpha: bitsPerPixel = 2 * (int)bitDepth; break;
         case ColorType.TrueColorAlpha: bitsPerPixel = 4 * (int)bitDepth; break;
         default: throw new ArgumentOutOfRangeException("colorType");
     }
     return bitsPerPixel % 8 == 0 ? bitsPerPixel / 8 : bitsPerPixel / 8 + 1;
 }
Esempio n. 30
0
        internal static Color ZColorToColor(int color, ColorType Type)
        {
            if (color == 0 || color == 1)
            {
                if (Type == ColorType.Foreground) return CurrentForeColor;
                if (Type == ColorType.Background) return CurrentBackColor; 
            }

            switch (color)
            {
                case ZColor.BLACK_COLOUR:
                    return Colors.Black;
                case ZColor.BLUE_COLOUR:
                    return c64Blue;
                case ZColor.CYAN_COLOUR:
                    return Colors.Cyan;
                case ZColor.DARKGREY_COLOUR:
                    return Colors.DarkGray;
                case ZColor.GREEN_COLOUR:
                    return Colors.Green;
                // case ZColor.LIGHTGREY_COLOUR: // Light Grey & Grey both equal 10
                case ZColor.GREY_COLOUR:
                    return Colors.Gray;
                case ZColor.MAGENTA_COLOUR:
                    return Colors.Magenta;
                case ZColor.MEDIUMGREY_COLOUR:
                    return Colors.DimGray;
                case ZColor.RED_COLOUR:
                    return Colors.Red;
                case ZColor.TRANSPARENT_COLOUR:
                    return Colors.Transparent;
                case ZColor.WHITE_COLOUR:
                    return Colors.White;
                case ZColor.YELLOW_COLOUR:
                    return Colors.Yellow;
                case 32:
                    return Properties.Settings.Default.DefaultInputColor;
            }

            long new_color = TrueColorStuff.GetColour(color);
            byte r = TrueColorStuff.GetRValue(new_color);
            byte g = TrueColorStuff.GetGValue(new_color);
            byte b = TrueColorStuff.GetBValue(new_color);

            return Color.FromRgb(r, g, b);
        }
Esempio n. 31
0
 public ColorTypeProperty(ColorType colorType)
 {
     this.colorType = colorType;
 }
Esempio n. 32
0
 public Color(ConsoleColor consoleColor)
 {
     _type         = ColorType.Console;
     _consoleColor = consoleColor;
 }
Esempio n. 33
0
 /// <summary>
 /// 获取文本颜色
 /// </summary>
 /// <param name="cType"></param>
 /// <param name="str"></param>
 /// <returns></returns>
 public static string GetColorString(ColorType cType, string str)
 {
     return(ColorUtil.GetColorString(GetColorIntByType(cType), str));
 }
Esempio n. 34
0
        public Theme(XElement root)
        {
            var guid = root.Attribute("guid");

            if (guid is null || string.IsNullOrEmpty(guid.Value))
            {
                throw new Exception("Missing or empty guid attribute");
            }
            Guid = new Guid(guid.Value);

            var name = root.Attribute("name");

            Name = name is null ? string.Empty : (string)name;

            var menuName = root.Attribute("menu-name");

            if (menuName is null || string.IsNullOrEmpty(menuName.Value))
            {
                throw new Exception("Missing or empty menu-name attribute");
            }
            MenuName = menuName.Value;

            var hcName = root.Attribute("is-high-contrast");

            IsHighContrast = !(hcName is null) && (bool)hcName;

            var darkThemeName = root.Attribute("is-dark");

            IsDark = !(darkThemeName is null) && (bool)darkThemeName;

            var lightThemeName = root.Attribute("is-light");

            IsLight = !(lightThemeName is null) && (bool)lightThemeName;

            var sort = root.Attribute("order");

            Order = sort is null ? 1 : (double)sort;

            for (int i = 0; i < hlColors.Length; i++)
            {
                hlColors[i] = new Color(colorInfos[i]);
            }

            var colors = root.Element("colors");

            if (!(colors is null))
            {
                foreach (var color in colors.Elements("color"))
                {
                    ColorType colorType = 0;
                    var       hl        = ReadColor(color, ref colorType);
                    if (hl is null)
                    {
                        continue;
                    }
                    hlColors[ToIndex(colorType)].OriginalColor = hl;
                }
            }
            for (int i = 0; i < hlColors.Length; i++)
            {
                if (hlColors[i].OriginalColor is null)
                {
                    hlColors[i].OriginalColor = CreateThemeColor(ToColorType(i));
                }
                hlColors[i].TextInheritedColor = new ThemeColor {
                    Name = hlColors[i].OriginalColor.Name
                };
                hlColors[i].InheritedColor = new ThemeColor {
                    Name = hlColors[i].OriginalColor.Name
                };
            }

            RecalculateInheritedColorProperties();
        }
Esempio n. 35
0
 public static int SizeOfFilteredImageData(int width, int height, ColorType colorType, BitDepth bitDepth)
 {
     return(SizeOfImageData(width, height, colorType, bitDepth) + height);
 }
Esempio n. 36
0
 public void Initialize(ColorType type)
 {
     GetComponent <ParticleSystemRenderer>().material = mList[(int)type];
     fx.Play();
 }
Esempio n. 37
0
 public ColorEventArgs(MyColor color, ColorType colorType)
 {
     Color     = color;
     ColorType = colorType;
 }
Esempio n. 38
0
        private void ConvertColors(object sender, RoutedEventArgs e)
        {
            ColorType source = IdentifySender(sender);

            Color csource = Colors.Black;

            switch (source)
            {
            case ColorType.RGB:
                csource = Color.FromRgb((byte)RGB_Red.Value, (byte)RGB_Green.Value, (byte)RGB_Blue.Value);
                break;

            case ColorType.CMYK:
                csource = ColorSpaceConversions.FromCMYK(CMYK_C.Value, CMYK_M.Value, CMYK_Y.Value, CMYK_K.Value);
                break;

            case ColorType.HSL:
                csource = ColorSpaceConversions.FromHSL(HSL_Hue.Value, HSL_Saturation.Value, HSL_Lumiance.Value);
                break;

            case ColorType.HSB:
                csource = ColorSpaceConversions.FromHSB(HSB_Hue.Value, HSB_Saturation.Value, HSB_Brightness.Value);
                break;

            case ColorType.Picker:
                csource = Picker.Color;
                break;
            }

            var hsl  = ColorSpaceConversions.ToHSL(csource);
            var hsb  = ColorSpaceConversions.ToHSB(csource);
            var cmyk = ColorSpaceConversions.ToCMYK(csource);

            if (source != ColorType.RGB)
            {
                RGB_Red.SetValue(csource.R);
                RGB_Green.SetValue(csource.G);
                RGB_Blue.SetValue(csource.B);
            }

            if (source != ColorType.CMYK)
            {
                CMYK_C.SetValue(cmyk.Cyan);
                CMYK_M.SetValue(cmyk.Magenta);
                CMYK_Y.SetValue(cmyk.Yellow);
                CMYK_K.SetValue(cmyk.Black);
            }

            if (source != ColorType.HSB)
            {
                HSB_Hue.SetValue(hsb.Hue);
                HSB_Saturation.SetValue(hsb.Saturation);
                HSB_Brightness.SetValue(hsb.Brightness);
            }

            if (source != ColorType.HSL)
            {
                HSL_Hue.SetValue(hsl.Hue);
                HSL_Saturation.SetValue(hsl.Saturation);
                HSL_Lumiance.SetValue(hsl.Luminance);
            }

            if (source != ColorType.Picker)
            {
                Picker.Color = csource;
            }
        }
Esempio n. 39
0
        public BlockEntity GetBlockEntity(LevelBlock block)
        {
            if (block is LevelBlockType)
            {
                var type = (LevelBlockType)block;
                switch (type.type)
                {
                case BlockType.empty:
                {
                    return(empty.GetObj().GetComponent <BlockEntity>());
                }

                case BlockType.red:
                {
                    return(redBlockPool.GetObj().GetComponent <BlockEntity>());
                }

                case BlockType.orange:
                {
                    return(orangeBlockPool.GetObj().GetComponent <BlockEntity>());
                }

                case BlockType.yellow:
                {
                    return(yellowBlockPool.GetObj().GetComponent <BlockEntity>());
                }

                case BlockType.green:
                {
                    return(greenBlockPool.GetObj().GetComponent <BlockEntity>());
                }

                case BlockType.blue:
                {
                    return(blueBlockPool.GetObj().GetComponent <BlockEntity>());
                }

                case BlockType.purple:
                {
                    return(purpleBlockPool.GetObj().GetComponent <BlockEntity>());
                }

                case BlockType.random:
                {
                    int        random    = Random.Range(0, GameMgr.G.availableColors.Count);
                    ColorType  colorType = GameMgr.G.availableColors[random];
                    ObjectPool temp      = null;
                    switch (colorType)
                    {
                    case ColorType.red:
                        temp = redBlockPool;
                        break;

                    case ColorType.orange:
                        temp = orangeBlockPool;
                        break;

                    case ColorType.yellow:
                        temp = yellowBlockPool;
                        break;

                    case ColorType.green:
                        temp = greenBlockPool;
                        break;

                    case ColorType.blue:
                        temp = blueBlockPool;
                        break;

                    case ColorType.purple:
                        temp = purpleBlockPool;
                        break;
                    }
                    return(temp.GetObj().GetComponent <BlockEntity>());
                }

                case BlockType.bubble:
                {
                    return(bubbleBlockPool.GetObj().GetComponent <BlockEntity>());
                }

                case BlockType.can:
                {
                    return(canBlockPool.GetObj().GetComponent <BlockEntity>());
                }

                case BlockType.paper:
                {
                    return(paperBlockPool.GetObj().GetComponent <BlockEntity>());
                }

                case BlockType.box1:
                {
                    return(box1BlockPool.GetObj().GetComponent <BlockEntity>());
                }

                case BlockType.box2:
                {
                    return(box2BlockPool.GetObj().GetComponent <BlockEntity>());
                }

                case BlockType.radiation:
                {
                    return(radiationBlockPool.GetObj().GetComponent <BlockEntity>());
                }
                }
            }
            else if (block is LevelBoosterType)
            {
                var type = (LevelBoosterType)block;
                switch (type.type)
                {
                case BoosterType.arrow:
                    return(arrowBombPool.GetObj().GetComponent <BlockEntity>());

                case BoosterType.bomb:
                    return(bombPool.GetObj().GetComponent <BlockEntity>());

                case BoosterType.rainbow:
                    return(rainbowPool.GetObj().GetComponent <BlockEntity>());
                }
            }

            return(null);
        }
Esempio n. 40
0
        /// <summary>
        /// To any type color converter
        /// </summary>
        /// <param name="fromColor"></param>
        /// <param name="toColor"></param>
        /// <returns></returns>
        public static object ConvertColor(object fromColor, ColorType toColor)
        {
            var color = Detector.FindColorType(fromColor);

            // if is undefined returns false
            if (color.Type == ColorType.Undefined)
            {
                return(false);
            }
            // hex to hex
            else if (color.Type == ColorType.Hex && color.Type == toColor)
            {
                if (color.Color is string)
                {
                    return((Color)ColorConverter.ConvertFromString((string)color.Color));
                }
                else if (color.Color is Color)
                {
                    return(((Color)color.Color).ToString());
                }
            }
            // hex to rgb
            else if (color.Type == ColorType.Hex && toColor == ColorType.Rgb)
            {
                if (color.Color is string)
                {
                    return((Color)ColorConverter.ConvertFromString((string)color.Color));
                }
                else if (color.Color is Color)
                {
                    return(((Color)color.Color).R + "," + ((Color)color.Color).G + "," + ((Color)color.Color).B);
                }
            }
            // hex to argb
            else if (color.Type == ColorType.Hex && toColor == ColorType.Argb)
            {
                if (color.Color is string)
                {
                    return((Color)ColorConverter.ConvertFromString((string)color.Color));
                }
                else if (color.Color is Color)
                {
                    return(((Color)color.Color).A + "," + ((Color)color.Color).R + "," + ((Color)color.Color).G + "," + ((Color)color.Color).B);
                }
            }
            // rgb to hex
            else if (color.Type == ColorType.Rgb && toColor == ColorType.Hex)
            {
                if (color.Color is string)
                {
                    return(RgbString2Color((string)color.Color));
                }
                else if (color.Color is Color)
                {
                    return(((Color)color.Color).R + "," + ((Color)color.Color).G + "," + ((Color)color.Color).B);
                }
            }
            // argb to hex
            else if (color.Type == ColorType.Argb && toColor == ColorType.Hex)
            {
                if (color.Color is string)
                {
                    return(ArgbString2Color((string)color.Color));
                }
                else if (color.Color is Color)
                {
                    return(((Color)color.Color).A + "," + ((Color)color.Color).R + "," + ((Color)color.Color).G + "," + ((Color)color.Color).B);
                }
            }

            return(false);
        }
Esempio n. 41
0
 public PngWriter()
 {
     colorType = ColorType.RgbWithAlpha;
 }
Esempio n. 42
0
/* COLOR SCHEME
 *
 #A2BEFF #476EC7 #1C397E #C8D9FF #E4ECFF    -- blue (hue 240)
 #FFBC37 #C78B15 #7F5500 #FFD580 #FFEDC8    -- orange (hue 60)
 *
 *      base    dark    xdark   light   xlight
 *
 *     S36L100 S64-L78 S78-L49 S22B100 S11L100    -- blue (hue 222)
 *     S78L100 S89-L78 S100L50 S50L100 S22L100    -- orange (hue 40)
 */


        public static string GetColor(ColorType type, ColorVariant variant, ColorShift shift = ColorShift.None)
        {
            int hue        = (type == ColorType.Base ? 222 : 40);
            int saturation = 0;
            int luminosity = 0;

            switch (variant)
            {
            case ColorVariant.Base:
                saturation = 100;
                luminosity = 80;
                break;

            case ColorVariant.Dark:
                saturation = 50;
                luminosity = 50;
                break;

            case ColorVariant.XDark:
                saturation = 65;
                luminosity = 30;
                break;

            case ColorVariant.Light:
                saturation = 100;
                luminosity = 90;
                break;

            case ColorVariant.XLight:
                saturation = 100;
                luminosity = 95;
                break;

            default:
                throw new NotImplementedException();
            }

            if (type == ColorType.Accent)
            {
                saturation *= 2;
                if (saturation > 100)
                {
                    saturation = 100;
                }
            }

            switch (shift)
            {
            case ColorShift.SlightlyDarker:
                luminosity -= 2;
                break;

            case ColorShift.SlightlyLighter:
                luminosity += 2;
                break;

            default:
                // do nothing
                break;
            }

            Color color = ColorFromAhsb(100, hue, saturation / 100.0, luminosity / 100.0);

            return(String.Format("#{0:x2}{1:x2}{2:x2}", color.R, color.G, color.B));
        }
 /// <summary>
 /// Selects the Color/Black for the scanned file
 /// </summary>
 /// <param name="colorOrBlack">The Color/Black is selected.</param>
 void INetworkFolderJobOptions.SelectColorOrBlack(ColorType colorOrBlack)
 {
     throw new NotImplementedException($"SelectColor or Black  with setting {colorOrBlack} feature is not implemented on PhoenixMagicFrame devices");
 }
Esempio n. 44
0
 private Color(ColorType type)
 {
     _type         = type;
     _consoleColor = null;
 }
Esempio n. 45
0
 public abstract IColor CreateColor(ColorType colorType);
Esempio n. 46
0
 public Van(string brand, int numberOfSeats, int numberOfWheels, ColorType color, /*CarType type, */ ISteering steering)
     : base(brand, numberOfSeats, numberOfWheels, color, CarType.Van, steering)
 {
 }
Esempio n. 47
0
        private IEnumerator TransformMap()
        {
            yield return(new WaitForSecondsRealtime(0.1f));

            var config = Configuration.instance.ConfigurationData;

            // Set up for One Color
            if (config.OneColor && !config.NoArrowsRandom)
            {
                this.useLeft =
                    (config.PlayMode == PlayMode.BeatSaber && config.UseLeftSaber) ||
                    (config.PlayMode == PlayMode.DarthMaul && config.UseLeftController) ||
                    (config.PlayMode == PlayMode.BeatSpear && config.UseLeftSpear);

                this.undesiredNoteType = this.useLeft ? ColorType.ColorB : ColorType.ColorA;

                // Change the other saber to desired type
                SaberType desiredSaberType = this.useLeft ? SaberType.SaberA : SaberType.SaberB;
                var       saberObject      = new GameObject("SaberTypeObject").AddComponent <SaberTypeObject>();
                saberObject.SetField("_saberType", desiredSaberType);

                var   player      = Resources.FindObjectsOfTypeAll <SaberManager>().FirstOrDefault();
                Saber saberToSwap = this.useLeft ? player.rightSaber : player.leftSaber;
                saberToSwap.SetField("_saberType", saberObject);
            }

            try
            {
                BeatmapObjectCallbackController callbackController = null;
                BeatmapData beatmapData = null;
                BeatmapObjectCallbackController[] callbackControllers = Resources.FindObjectsOfTypeAll <BeatmapObjectCallbackController>();
                foreach (BeatmapObjectCallbackController cbc in callbackControllers)
                {
                    if (cbc.GetField <BeatmapData>("_beatmapData") != null)
                    {
                        callbackController = cbc;
                        beatmapData        = callbackController.GetField <BeatmapData>("_beatmapData");
                    }
                }
                //BeatmapObjectCallbackController callbackController = Resources.FindObjectsOfTypeAll<BeatmapObjectCallbackController>().FirstOrDefault();
                // BeatmapData beatmapData = callbackController.GetField<BeatmapData>("_beatmapData");
                if (config.NoArrowsRandom)
                {
                    // Transform the map to No Arrows Random using the ingame algorithm first
                    AlternativePlay.Logger.Info($"Transforming NoArrowsRandom for song: {this.currentBeatmap.level.songName}");
                    var transformedBeatmap = BeatmapDataNoArrowsTransform.CreateTransformedData(beatmapData);
                    callbackController.SetNewBeatmapData(transformedBeatmap);
                }

                // Transform every note
                var allNoteObjects = beatmapData.beatmapLinesData
                                     .SelectMany(line => line.beatmapObjectsData)
                                     .Where(objectData => objectData.beatmapObjectType == BeatmapObjectType.Note)
                                     .ToList();
                allNoteObjects.ForEach(beatmapObject =>
                {
                    var note = beatmapObject as NoteData;

                    // Transform for NoArrows or TouchNotes here but do not if NoArrowsRandom was already applied
                    if ((config.NoArrows || config.TouchNotes) && !config.NoArrowsRandom)
                    {
                        note.SetNoteToAnyCutDirection();
                    }

                    // Transform for One Color if this is the other note type
                    if (config.OneColor && note.colorType == this.undesiredNoteType)
                    {
                        note.SwitchNoteColorType();
                    }
                });
                // Touch Notes speed detection is not handled here but in the HarmonyPatches
            }
            catch
            {
                AlternativePlay.Logger.Info($"Transforming Error: {this.currentBeatmap.level.songName}");
            }

            // Touch Notes speed detection is not handled here but in the HarmonyPatches
        }
Esempio n. 48
0
 public static int SizeOfImageData(int width, int height, ColorType colorType, BitDepth bitDepth)
 {
     return(SizeOfImageRow(width, colorType, bitDepth) * height);
 }
Esempio n. 49
0
 public Checker(ColorType color, CheckerStatus status)
 {
     this.Color  = color;
     this.Status = status;
 }
Esempio n. 50
0
 public override IColor GetInstance(ColorType type)
 {
     throw new NotImplementedException();
 }
Esempio n. 51
0
 void SetImage(ColorType colorType)
 {
     this.colorType = colorType;
     image.sprite   = Resources.Load <Sprite>("Images/" + colorType.ToString());
 }
Esempio n. 52
0
 public abstract IColor GetColor(ColorType colorType);
Esempio n. 53
0
 public IThemeColor GetExplicitColor(ColorType colorType) => GetColorInternal(colorType).OriginalColor;
Esempio n. 54
0
 /// <summary>
 /// 根据颜色类型获取NGUI颜色值
 /// </summary>
 /// <param name="cType"></param>
 /// <returns></returns>
 public static string GetNGUIColorOfType(ColorType cType)
 {
     return(ColorUtil.GetNGUIColor(GetColorIntByType(cType)));
 }
Esempio n. 55
0
 public void SetColor(ColorType colorType)
 {
     _player.SetColor(Config.GetColor(colorType));
 }
Esempio n. 56
0
    private void UpdateEvolve(Muhon data)
    {
        if (null == data)
        {
            return;
        }
        bool isMaxStarLv = data.IsMaxStarLv;

        if (null != m_trans_EvolveInfos &&
            m_trans_EvolveInfos.gameObject.activeSelf == isMaxStarLv)
        {
            m_trans_EvolveInfos.gameObject.SetActive(!isMaxStarLv);
        }
        if (!isMaxStarLv)
        {
            if (null != m_evolveCurGrow)
            {
                m_evolveCurGrow.SetGridData(data.QWThisID);
            }
            MuhonStarData starData = null;

            UIItemShowGrid showGrid = null;
            //星级显示
            for (EquipDefine.AttrIndex i = EquipDefine.AttrIndex.None + 1; i < EquipDefine.AttrIndex.Max; i++)
            {
                if (m_dicStarData.TryGetValue(i, out starData))
                {
                    starData.SetStatus(data.StartLevel >= (int)i);
                }

                if (m_dicMuhonDeputy.TryGetValue(i, out showGrid) && null != showGrid)
                {
                    if ((int)i > data.EvolveNeedMuhonNum)
                    {
                        showGrid.SetVisible(false);
                    }
                    else
                    {
                        if (!showGrid.Visible)
                        {
                            showGrid.SetVisible(true);
                        }

                        if (IsDeputyEvolveGridFill(i))
                        {
                            showGrid.SetGridData(m_dicSelectMuhonDeputy[i], true);
                        }
                        else
                        {
                            showGrid.SetGridData(0);
                        }
                    }
                }
            }
            //辅助物品


            UpdateEvolveSelectStarAnim();
            Muhon next = data.Next;
            //预览
            //星级
            if (null != m_slider_EvolveCurStarLv)
            {
                m_slider_EvolveCurStarLv.value = data.StartLevel / 5f;
            }
            if (null != m_slider_EvolveNextStarLv)
            {
                m_slider_EvolveNextStarLv.value = next.StartLevel / 5f;
            }
            //等级
            if (null != m_label_EvolveCurLv)
            {
                m_label_EvolveCurLv.text = tmgr.GetLocalFormatText(LocalTextType.Local_Txt_Set_4, data.MaxLv);
            }
            if (null != m_label_EvolveNextLv)
            {
                m_label_EvolveNextLv.text = tmgr.GetLocalFormatText(LocalTextType.Local_Txt_Set_4, next.MaxLv);
            }
            int attrCount = data.AdditionAttrCount;
            //附加属性
            if (null != m_label_EvolveCurAttrNum)
            {
                m_label_EvolveCurAttrNum.text = tmgr.GetLocalFormatText(LocalTextType.Local_TXT_Soul_Num, data.MuhonAttrUpLimit);
            }
            if (null != m_label_EvolveNextAttrNum)
            {
                m_label_EvolveNextAttrNum.text = tmgr.GetLocalFormatText(LocalTextType.Local_TXT_Soul_Num, data.Next.MuhonAttrUpLimit);
            }
            ColorType color = ColorType.JZRY_Green;
            if (null != m_label_EvolveMuhonLv)
            {
                if (data.Level != data.MaxLv)
                {
                    color = ColorType.JZRY_Txt_NotMatchRed;
                }
                else
                {
                    color = ColorType.JZRY_Green;
                }

                m_label_EvolveMuhonLv.text = tmgr.GetLocalFormatText(LocalTextType.Local_TXT_Soul_ColorLv,
                                                                     ColorManager.GetNGUIColorOfType(ColorType.JZRY_Txt_Black)
                                                                     , ColorManager.GetNGUIColorOfType(color), data.Level, data.MaxLv);
            }

            //角色等级限制
            if (null != m_label_EvolvePlayerLvLmit)
            {
                if (DataManager.Instance.PlayerLv < data.EvolveNeedPlayerLv)
                {
                    color = ColorType.JZRY_Txt_NotMatchRed;
                }
                else
                {
                    color = ColorType.JZRY_Green;
                }
                m_label_EvolvePlayerLvLmit.text = string.Format("{0}圣魂升星需达{1}主角{2}级"
                                                                , tmgr.GetMuhonStarName(data.StartLevel)
                                                                , ColorManager.GetNGUIColorOfType(color)
                                                                , data.EvolveNeedPlayerLv);
            }

            //辅助道具
            SetEvolveAssit();
        }

        //最大星级
        if (null != m_trans_EvolveMax &&
            m_trans_EvolveMax.gameObject.activeSelf != isMaxStarLv)
        {
            m_trans_EvolveMax.gameObject.SetActive(isMaxStarLv);
        }
        if (isMaxStarLv)
        {
            //刷新圣魂升级信息
            if (null != m_evolveMaxGrow)
            {
                m_evolveMaxGrow.SetGridData(data.QWThisID);
            }
            List <EquipDefine.EquipBasePropertyData> baseProperyList = emgr.GetWeaponSoulBasePropertyData(data.BaseId, data.Level);
            int countCur = (null != baseProperyList) ? baseProperyList.Count : 0;
            if (countCur == 0)
            {
                Engine.Utility.Log.Error("进化表格数据错误");
                return;
            }
            if (null != m_sprite_EvolveAttrTitle)
            {
                m_sprite_EvolveAttrTitle.transform.Find("Value").GetComponent <UILabel>().text
                    = tmgr.GetLocalFormatText(LocalTextType.Local_TXT_Soul_Num, data.MuhonAttrUpLimit);
            }
            EquipDefine.EquipBasePropertyData temp = null;
            if (null != m_sprite_EvolveAttr1)
            {
                if (countCur >= 1)
                {
                    temp = baseProperyList[0];
                    m_sprite_EvolveAttr1.transform.Find("Name").GetComponent <UILabel>().text  = temp.Name;
                    m_sprite_EvolveAttr1.transform.Find("Value").GetComponent <UILabel>().text = temp.ToString();
                }
                else if (m_sprite_EvolveAttr1.gameObject.activeSelf)
                {
                    m_sprite_EvolveAttr1.gameObject.SetActive(false);
                }
            }
            if (null != m_sprite_EvolveAttr2)
            {
                if (countCur >= 2)
                {
                    temp = baseProperyList[1];
                    m_sprite_EvolveAttr2.transform.Find("Name").GetComponent <UILabel>().text  = temp.Name;
                    m_sprite_EvolveAttr2.transform.Find("Value").GetComponent <UILabel>().text = temp.ToString();
                }
                else if (m_sprite_EvolveAttr2.gameObject.activeSelf)
                {
                    m_sprite_EvolveAttr2.gameObject.SetActive(false);
                }
            }
            if (null != m_sprite_EvolveAttr3)
            {
                if (countCur >= 3)
                {
                    temp = baseProperyList[2];
                    m_sprite_EvolveAttr3.transform.Find("Name").GetComponent <UILabel>().text  = temp.Name;
                    m_sprite_EvolveAttr3.transform.Find("Value").GetComponent <UILabel>().text = temp.ToString();
                }
                else if (m_sprite_EvolveAttr3.gameObject.activeSelf)
                {
                    m_sprite_EvolveAttr3.gameObject.SetActive(false);
                }
            }
            if (null != m_sprite_EvolveAttr4)
            {
                if (countCur >= 4)
                {
                    temp = baseProperyList[3];
                    m_sprite_EvolveAttr4.transform.Find("Name").GetComponent <UILabel>().text  = temp.Name;
                    m_sprite_EvolveAttr4.transform.Find("Value").GetComponent <UILabel>().text = temp.ToString();
                }
                else if (m_sprite_EvolveAttr4.gameObject.activeSelf)
                {
                    m_sprite_EvolveAttr4.gameObject.SetActive(false);
                }
            }
        }
    }
Esempio n. 57
0
 public bool SetPixel(int X, int Y, ColorType Color)
 {
     return(SetPixel(X, Y, (int)Color));
 }
Esempio n. 58
0
 public static extern uint CON_CreateImgToByte(ColorType pColorType, MatrixType pMatrixType, BX_Screen pBX_Screen);
Esempio n. 59
0
 /// <summary>
 /// 根据颜色类型获取color
 /// </summary>
 /// <param name="cType"></param>
 /// <returns></returns>
 public static Color GetColor32OfType(ColorType cType)
 {
     return(GetColorOfColorInt(GetColorIntByType(cType)));
 }
Esempio n. 60
0
    public void settingColorsInList(List <ColorType> colortypes)
    {
        ColorType blue = new ColorType(); //new ColorType

        blue.name  = "blue";
        blue.color = new Color(0 / 255f, 35 / 255f, 142 / 255f); //RGB Color value
        colortypes.Add(blue);                                    // add to arraylist colortypes

        ColorType darkblue = new ColorType();

        darkblue.name  = "darkblue";
        darkblue.color = new Color(2 / 255f, 21 / 255f, 80 / 255f);
        colortypes.Add(darkblue);

        ColorType babyblue = new ColorType();

        babyblue.name  = "babyblue";
        babyblue.color = new Color(0 / 255f, 35 / 255f, 142 / 255f);
        colortypes.Add(babyblue);

        ColorType lightred = new ColorType();

        lightred.name  = "lightred";
        lightred.color = new Color(219 / 255f, 132 / 255f, 128 / 255f);
        colortypes.Add(lightred);

        ColorType red = new ColorType();

        red.name  = "red";
        red.color = new Color(193 / 255f, 57 / 255f, 50 / 255f);
        colortypes.Add(red);

        ColorType darkred = new ColorType();

        darkred.name  = "darkred";
        darkred.color = new Color(79 / 255f, 13 / 255f, 0 / 255f);
        colortypes.Add(darkred);

        ColorType pink = new ColorType();

        pink.name  = "pink";
        pink.color = new Color(205 / 255f, 3 / 255f, 177 / 255f);
        colortypes.Add(pink);

        ColorType lightpink = new ColorType();

        lightpink.name  = "lightpink";
        lightpink.color = new Color(243 / 255f, 130 / 255f, 228 / 255f);
        colortypes.Add(lightpink);

        ColorType purple = new ColorType();

        purple.name  = "purple";
        purple.color = new Color(63 / 255f, 21 / 255f, 57 / 255f);
        colortypes.Add(purple);

        ColorType yellow = new ColorType();

        yellow.name  = "yellow";
        yellow.color = new Color(255 / 255f, 239 / 255f, 0 / 255f);
        colortypes.Add(yellow);

        ColorType gold = new ColorType();

        gold.name  = "gold";
        gold.color = new Color(207 / 255f, 184 / 255f, 0 / 255f);
        colortypes.Add(gold);

        ColorType silver = new ColorType();

        silver.name  = "silver";
        silver.color = new Color(171 / 255f, 171 / 255f, 171 / 255f);
        colortypes.Add(silver);

        ColorType lime = new ColorType();

        lime.name  = "lime";
        lime.color = new Color(116 / 255f, 239 / 255f, 130 / 255f);
        colortypes.Add(lime);

        ColorType green = new ColorType();

        green.name  = "green";
        green.color = new Color(30 / 255f, 87 / 255f, 36 / 255f);
        colortypes.Add(green);

        ColorType black = new ColorType();

        black.name  = "black";
        black.color = new Color(39 / 255f, 39 / 255f, 39 / 255f);
        colortypes.Add(black);

        ColorType white = new ColorType();

        white.name  = "white";
        white.color = new Color(224 / 255f, 224 / 255f, 224 / 255f);
        colortypes.Add(white);
    }