Exemplo n.º 1
0
        public string GetKey(KeybindOptions Option)
        {
            string output = "";

            for (int i = 0; i < Keylist.Count; i++)
            {
                if (Keylist[i].function == Option)
                {
                    if (CMain.InputKeys.Keylist[i].Key == Keys.None)
                    {
                        return(output);
                    }
                    if (CMain.InputKeys.Keylist[i].RequireAlt == 1)
                    {
                        output = "Alt";
                    }
                    if (CMain.InputKeys.Keylist[i].RequireCtrl == 1)
                    {
                        output = output != "" ? output + "\nCtrl" : "Ctrl";
                    }
                    if (CMain.InputKeys.Keylist[i].RequireShift == 1)
                    {
                        output = output != "" ? output + "\nShift" : "Shift";
                    }
                    if (CMain.InputKeys.Keylist[i].RequireTilde == 1)
                    {
                        output = output != "" ? output + "\n~" : "~";
                    }

                    output = output != "" ? output + "\n" + CMain.InputKeys.Keylist[i].Key.ToString() : CMain.InputKeys.Keylist[i].Key.ToString();
                    return(output);
                }
            }
            return("");
        }
Exemplo n.º 2
0
 //通过fun查询绑定
 public KeyBind GetKeyBindByFun(KeybindOptions Option)
 {
     if (!funcdict.ContainsKey(Option))
     {
         return(null);
     }
     return(funcdict[Option]);
 }
Exemplo n.º 3
0
        public KeybindRow(KeybindOptions option)
        {
            KeyBind defaultBind = CMain.InputKeys.DefaultKeylist.Single(x => x.function == option);
            KeyBind currentBind = CMain.InputKeys.Keylist.Single(x => x.function == option);

            KeyBind = currentBind;

            BindName = new MirLabel
            {
                Parent   = this,
                Size     = new Size(200, 15),
                Location = new Point(0, 0),
                Text     = defaultBind.Description,
                Visible  = true
            };

            DefaultBind = new MirLabel
            {
                Parent   = this,
                Size     = new Size(100, 15),
                Location = new Point(200, 0),
                Text     = CMain.InputKeys.GetKey(option, true),
                Visible  = true
            };

            CurrentBindButton = new MirButton
            {
                Parent       = this,
                Text         = string.Format("  {0}", CMain.InputKeys.GetKey(option, false)),
                Location     = new Point(340, 0),
                Size         = new Size(120, 16),
                Visible      = true,
                Index        = 190,
                Library      = Libraries.Prguse2,
                HoverIndex   = 191,
                PressedIndex = 192
            };
            CurrentBindButton.Click += (o, e) =>
            {
                if (GameScene.Scene.KeyboardLayoutDialog.WaitingForBind != null)
                {
                    GameScene.Scene.KeyboardLayoutDialog.WaitingForBind = null;
                    GameScene.Scene.KeyboardLayoutDialog.UpdateText();
                    return;
                }

                GameScene.Scene.KeyboardLayoutDialog.WaitingForBind = KeyBind;

                ((MirButton)o).Text         = string.Format("  {0}", "????");
                ((MirButton)o).Index        = 192;
                ((MirButton)o).HoverIndex   = 192;
                ((MirButton)o).PressedIndex = 192;
            };
        }
Exemplo n.º 4
0
        public Keys GetKey(KeybindOptions op)
        {
            Keys result;

            foreach (KeyBind current in Keylist)
            {
                bool flag = current.function == op;
                if (flag)
                {
                    result = current.CutomKey.Key;
                    return(result);
                }
            }
            result = Keys.None;
            return(result);
        }
Exemplo n.º 5
0
        public string GetKey(KeybindOptions Option, bool defaultKey = false)
        {
            List <KeyBind> lst;

            if (defaultKey)
            {
                lst = CMain.InputKeys.DefaultKeylist;
            }
            else
            {
                lst = CMain.InputKeys.Keylist;
            }

            string output = "";

            for (int i = 0; i < lst.Count; i++)
            {
                if (lst[i].function == Option)
                {
                    if (lst[i].Key == Keys.None)
                    {
                        return(output);
                    }
                    if (lst[i].RequireAlt == 1)
                    {
                        output = "Alt";
                    }
                    if (lst[i].RequireCtrl == 1)
                    {
                        output = output != "" ? output + " + Ctrl" : "Ctrl";
                    }
                    if (lst[i].RequireShift == 1)
                    {
                        output = output != "" ? output + " + Shift" : "Shift";
                    }
                    if (lst[i].RequireTilde == 1)
                    {
                        output = output != "" ? output + " + ~" : "~";
                    }

                    output = output != "" ? output + " + " + lst[i].Key.ToString() : lst[i].Key.ToString();
                    return(output);
                }
            }
            return("");
        }
Exemplo n.º 6
0
        public string GetKey(KeybindOptions Option)
        {
            string output = "";
            for (int i = 0; i < Keylist.Count; i++ )
            {
                if (Keylist[i].function == Option)
                {
                    if (CMain.InputKeys.Keylist[i].Key == Keys.None) return output;
                    if (CMain.InputKeys.Keylist[i].RequireAlt == 1)
                        output = "Alt";
                    if (CMain.InputKeys.Keylist[i].RequireCtrl == 1)
                        output = output != "" ? output + "\nCtrl" : "Ctrl";
                    if (CMain.InputKeys.Keylist[i].RequireShift == 1)
                        output = output != "" ? output + "\nShift" : "Shift";
                    if (CMain.InputKeys.Keylist[i].RequireTilde == 1)
                        output = output != "" ? output + "\n~" : "~";

                    output = output != "" ? output + "\n" + CMain.InputKeys.Keylist[i].Key.ToString() : CMain.InputKeys.Keylist[i].Key.ToString();
                    return output;
                }
            }
            return "";
        }