Example #1
0
        public static Color ToColor(this KeyColor color)
        {
            switch (color)
            {
            case KeyColor.KeyBlue:
                return(Color.Blue);

            case KeyColor.KeyCyan:
                return(Color.Cyan);

            case KeyColor.KeyGreen:
                return(Color.Green);

            case KeyColor.KeyMagenta:
                return(Color.Magenta);

            case KeyColor.KeyRed:
                return(Color.Red);

            case KeyColor.KeyYellow:
                return(Color.Yellow);

            default:
                throw new NotImplementedException();
            }
        }
        public void SetKeyFill(KeyColor inputColor)
        {
            switch (inputColor)
            {
            case KeyColor.BLACK:
                fill = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
                break;

            case KeyColor.RED:
                fill = new System.Drawing.SolidBrush(System.Drawing.Color.Red);
                break;

            case KeyColor.GREEN:
                fill = new System.Drawing.SolidBrush(System.Drawing.Color.Green);
                break;

            case KeyColor.BLUE:
                fill = new System.Drawing.SolidBrush(System.Drawing.Color.Blue);
                break;

            case KeyColor.YELLOW:
                fill = new System.Drawing.SolidBrush(System.Drawing.Color.Yellow);
                break;

            default:
                fill = new System.Drawing.SolidBrush(System.Drawing.Color.White);
                break;
            }
        }
Example #3
0
        public static InventoryItemType ToInventeryItemType(this KeyColor color)
        {
            switch (color)
            {
            case KeyColor.KeyBlue:
                return(InventoryItemType.KeyBlue);

            case KeyColor.KeyCyan:
                return(InventoryItemType.KeyCyan);

            case KeyColor.KeyGreen:
                return(InventoryItemType.KeyGreen);

            case KeyColor.KeyMagenta:
                return(InventoryItemType.KeyMagenta);

            case KeyColor.KeyRed:
                return(InventoryItemType.KeyRed);

            case KeyColor.KeyYellow:
                return(InventoryItemType.KeyYellow);

            default:
                throw new NotImplementedException();
            }
        }
        public void UpdateColor()
        {
            metroSMMainForm.Style = mainColor;
            switch (mainColor)
            {
            case MetroFramework.MetroColorStyle.Red:
                mainKeyColor = KeyColor.RED;
                learnHandler.mainKeyColor = KeyColor.RED;
                break;

            case MetroFramework.MetroColorStyle.Green:
                mainKeyColor = KeyColor.GREEN;
                learnHandler.mainKeyColor = KeyColor.GREEN;
                break;

            case MetroFramework.MetroColorStyle.Blue:
                mainKeyColor = KeyColor.BLUE;
                learnHandler.mainKeyColor = KeyColor.BLUE;
                break;

            case MetroFramework.MetroColorStyle.Yellow:
                mainKeyColor = KeyColor.YELLOW;
                learnHandler.mainKeyColor = KeyColor.YELLOW;
                break;

            default:
                mainKeyColor = KeyColor.BLUE;
                learnHandler.mainKeyColor = KeyColor.BLUE;
                break;
            }
        }
Example #5
0
 public Bar(int x, int length, int bottom_offset, KeyColor color)
 {
     this.X             = x;
     this.Y             = new int[length];
     this.Length        = length;
     this.Bottom_offset = bottom_offset;
     this.Color         = color;
 }
Example #6
0
 public ChromaKeyData()
 {
     LowerLimit          = 0;
     UpperLimit          = 1;
     KeyColor            = Color.FromArgb(0, 255, 0);
     KeySaturation       = HSV.FromRGB(KeyColor).S;
     KeyHue              = KeyColor.GetHue();
     HueTolerance        = 5;
     SaturationTolerance = HueTolerance / 100;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ns">Notescheduler handles all the code for playing music</param>
 /// <param name="_Keyboard">Keyboard to draw the keyboard</param>
 /// <param name="_canvas">Canvas needed to draw and fill in the colors</param>
 public LearnHandler(NoteScheduler ns, List <Key> _Keyboard, System.Windows.Forms.Panel _canvas, MetroButton _learnSongBtn, MetroButton _previewSongBtn, KeyColor _mainKeyColor, MidiFileHandler mfh)
 {
     MFH               = mfh;
     noteScheduler     = ns;
     MidiFileDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase), "MidiTextFiles");
     keyBoard          = _Keyboard;
     canvas            = _canvas;
     LearnSongBtn      = _learnSongBtn;
     PreviewSongBtn    = _previewSongBtn;
     mainKeyColor      = _mainKeyColor;
 }
Example #8
0
            public KeyColorMyRawBitmapData(Bitmap b) : base(b)
            {
                List <KeyColor> k = getKeyColor(this, 1);

                if (k.Count > 0)
                {
                    keyColor = k[0];
                }
                else
                {
                    keyColor = null;
                }
            }
Example #9
0
    private void Unlock(KeyColor keyType)
    {
        if (keyType != KeyTypeToUnlock)
        {
            return;
        }

        Color color = _spriteRenderer.color;

        color.a = 0.5f;
        _spriteRenderer.color = color;

        _boxCollider2D.enabled = false;
    }
Example #10
0
 //色と位置の初期化
 public void Initialize(KeyColor keyColor, float offset)
 {
     ren = gameObject.GetComponent <Renderer>();
     if (keyColor == KeyColor.White)
     {
         inactiveKeyColor = whiteKeyColor;
     }
     else
     {
         inactiveKeyColor = blackKeyColor;
     }
     ren.material.color       = inactiveKeyColor;
     transform.localPosition += Vector3.forward * offset;
     defaultLocalPos          = transform.localPosition;
 }
Example #11
0
 void Update()
 {
     if (Extensions.Editor()) {
         if (keyColor != oldKeyColor) {
             oldKeyColor = keyColor;
             closed = opened = keyColor.color;
             opened.a = openedAlpha;
             closed.a = closedAlpha;
         }
         colored.color = closed;
         colored.Update();
     } else {
         GetComponent<MeshRenderer>().material.ChangeAlpha(Opened(Player.instance.current) ? openedAlpha : closedAlpha);
     }
 }
Example #12
0
 public void AddKey(KeyColor color)
 {
     if (color == KeyColor.Gold)
     {
         goldkey++;
     }
     else if (color == KeyColor.Green)
     {
         greenKey++;
     }
     else if (color == KeyColor.Red)
     {
         redKey++;
     }
 }
Example #13
0
    void Update()
    {
        if (Extensions.Editor()) {
            if (keyColor == null) {
                Debug.Log("Key {0}: keyColor missing; set some", this);
                keyColor = FindObjectOfType<KeyColor>();
            }
        }
        colored.color = keyColor.color;
        colored.Update();

        //if (!Extensions.Editor()) {
        //    gameObject.name = string.Format("{0} key{1}", keyColor.name, inventorySlot == null ? "" : " in " + inventorySlot.name);
        //}
    }
Example #14
0
    public Sound(string name, KeyColor color)
    {
        Name  = name;
        Color = color;

        if (color == KeyColor.Black)
        {
            BlackImage = new BitmapImage(new Uri("ms-appx:///Assets/Images/Black.png"));
            AudioFile  = string.Format("ms-appx:///Assets/Audio/22.wav", name);
        }
        else if (color == KeyColor.White)
        {
            WhiteImage = new BitmapImage(new Uri("ms-appx:///Assets/Images/White.PNG"));
            AudioFile  = string.Format("ms-appx:///Assets/Audio/11.wav", name);
        }
    }
Example #15
0
 void Update()
 {
     if (Extensions.Editor())
     {
         if (keyColor != oldKeyColor)
         {
             oldKeyColor = keyColor;
             closed      = opened = keyColor.color;
             opened.a    = openedAlpha;
             closed.a    = closedAlpha;
         }
         colored.color = closed;
     }
     else
     {
         GetComponent <MeshRenderer>().material.ChangeAlpha(Opened(Player.current) ? openedAlpha : closedAlpha);
     }
 }
Example #16
0
        /// <summary>
        /// 初始化
        /// </summary>
        private void Init()
        {
            Keys = new List <KeyColor>();

            string config = "./Resources/Resource.txt";

            StreamReader reader = new StreamReader(config, Encoding.UTF8);

            string line = string.Empty;

            while (!string.IsNullOrEmpty(line = reader.ReadLine()))
            {
                KeyColor item = JsonConvert.DeserializeObject <KeyColor>(line);

                string[] keys = item.Key.Split(',');

                System.Windows.Media.Color color = new System.Windows.Media.Color();

                switch (item.Color)
                {
                case "red":
                    color = Colors.Red;
                    break;

                case "blue":
                    color = Colors.Blue;
                    break;

                default:
                    color = Colors.Black;
                    break;
                }

                foreach (var key in keys)
                {
                    var temp = new KeyColor();
                    temp.Key             = key;
                    temp.SolidColorBrush = new SolidColorBrush(color);
                    Keys.Add(temp);
                }
            }
        }
Example #17
0
    public void AddKey(KeyColor color)
    {
        switch (color)
        {
        case KeyColor.Red:
            redKey++;
            redKeyText.text = redKey.ToString();     //<-----
            break;

        case KeyColor.Green:
            greenKey++;
            greenKeyText.text = greenKey.ToString();     //<-----
            break;

        case KeyColor.Gold:
            goldKey++;
            goldKeyText.text = goldKey.ToString();     //<-----
            break;
        }
    }
Example #18
0
        public void Flash(int amount, int color_duration, KeyColor color_on, KeyColor color_off)
        {
            for (int i = 0; i < amount; i++)
            {
                for (int j = 0; j < Length; j++)
                {
                    LaunchUtils.TellPad(X, 7 - Bottom_offset - j, color_off);
                }

                Thread.Sleep(color_duration);

                for (int j = 0; j < Length; j++)
                {
                    LaunchUtils.TellPad(X, 7 - Bottom_offset - j, color_on);
                }

                Thread.Sleep(color_duration);
            }

            Update();
        }
Example #19
0
 public bool SetLedColor(int iRow, int iColumn, KeyColor keyColor)
 {
     return(DLL.SetLedColor(iRow, iColumn, keyColor.r, keyColor.g, keyColor.b, DeviceIndex));
 }
Example #20
0
 public bool IsKeyReceived(KeyColor keyColor)
 {
     if(!dict.ContainsKey(keyColor))
         return false;
     return dict[keyColor].received;
 }
Example #21
0
 public void ReceiveKey(KeyColor keyColor)
 {
     dict[keyColor].received = true;
 }
 public L_Key(int inputX, int inputY, KeyColor inputColor)
     : base(KeyType.T_KEY, inputX, inputY, inputColor)
 {
     this.SetKeyFill(inputColor);
 }
Example #23
0
 public override void UpdateToAdditionalInfo()
 {
     doorColor            = (KeyColor)Data.AdditionalInfo;
     secondarySpriteColor = doorColor.ToColor();
 }
Example #24
0
 public static void TellPad(int key, KeyColor color)
 {
     MidiMessageHandler.Instance().SendMessage(key, (int)color);
 }
Example #25
0
 public InventoryKey(KeyColor color)
 {
     type = color.ToInventeryItemType();
 }
Example #26
0
 public bool isKeyFound(KeyColor color)
 {
     return(keysFound[(int)color]);
 }
Example #27
0
 public void setKey(KeyColor color, bool found)
 {
     keysFound[(int)color] = found;
 }
Example #28
0
 public static void TellPad(int x, int y, KeyColor color)
 {
     TellPad((y * 16) + x, color);
 }
Example #29
0
 public void setShape(KeyColor _color, Rectangle _shape)
 {
     color    = _color;
     shape    = _shape;
     interior = new Rectangle(shape.X + 1, shape.Y + 1, shape.Width - 2, shape.Height - 2);
 }
Example #30
0
 public bool SetFullLedColor(KeyColor keyColor)
 {
     return(DLL.SetFullLedColor(keyColor.r, keyColor.g, keyColor.b, DeviceIndex));
 }
Example #31
0
 public LaunchAction(int x, int y, KeyColor color) : this((y * 16) + x, color)
 {
 }
Example #32
0
 public LaunchAction(int key, KeyColor color)
 {
     this.Key   = key;
     this.Color = color;
 }
 public void GetActiveDoor(KeyColor color, Door pDoor)
 {
     _activeDoor      = pDoor;
     _activeDoorColor = color;
     CanOpenDoor      = true;
 }
 public bool HasKeyOfColor(KeyColor color)
 {
     return(_keys[(int)color]);
 }