Example #1
0
 public void Init(KeyType p_type, EHotkeyType p_hotkeyType)
 {
     m_type        = p_type;
     m_hotkeyType  = p_hotkeyType;
     m_normalColor = m_label.color;
     UpdateHotkey();
 }
Example #2
0
		protected override bool LoadFromDatabase(DataRow row) {
			Index = row.Field<short>("index");
			ID = row.Field<int>("id");
			Level = row.Field<ushort>("level");
			Type = (EHotkeyType)row.Field<int>("type");

			return true;
		}
Example #3
0
 public static Hotkey GetHotkeyData(EHotkeyType type)
 {
     if (type >= EHotkeyType.OPEN_CLOSE_MENU && type < (EHotkeyType)s_HotkeyMap.Length)
     {
         return(s_HotkeyMap[(Int32)type].m_Action);
     }
     throw new ArgumentOutOfRangeException("type");
 }
Example #4
0
 public void Init(EHotkeyType p_hotkeyType, OptionsInput p_optionsInput)
 {
     m_normalColor  = m_label.color;
     m_optionsInput = p_optionsInput;
     m_hotkeyType   = p_hotkeyType;
     m_keyPrimary.Init(KeyConfigBox.KeyType.PRIMARY, p_hotkeyType);
     m_keyAlternative.Init(KeyConfigBox.KeyType.ALTERNATIVE, p_hotkeyType);
     m_label.text = LocaManager.GetText("OPTIONS_INPUT_KEY_" + p_hotkeyType);
 }
Example #5
0
        protected override bool LoadFromDatabase(DataRow row)
        {
            Index = row.Field <short>("index");
            ID    = row.Field <int>("id");
            Level = row.Field <ushort>("level");
            Type  = (EHotkeyType)row.Field <int>("type");

            return(true);
        }
Example #6
0
        private void AddHotkey(EHotkeyType p_hotkeyType)
        {
            GameObject    gameObject = NGUITools.AddChild(m_keysRoot.gameObject, m_keyConfigPrefab);
            KeyConfigView component  = gameObject.GetComponent <KeyConfigView>();

            component.Init(p_hotkeyType, this);
            m_keyConfigViews[p_hotkeyType] = component;
            m_entriesCount++;
        }
Example #7
0
 public static void UnregisterHotkeyEvent(EHotkeyType type, EventHandler <HotkeyEventArgs> callback)
 {
     if (type >= EHotkeyType.OPEN_CLOSE_MENU && type < (EHotkeyType)s_HotkeyMap.Length)
     {
         HotkeyData[] array = s_HotkeyMap;
         array[(Int32)type].m_EventHandler = (EventHandler <HotkeyEventArgs>)Delegate.Remove(array[(Int32)type].m_EventHandler, callback);
         s_HotkeyMapDirty = true;
         return;
     }
     throw new ArgumentOutOfRangeException("type");
 }
Example #8
0
 public void RequestKeyBinding(KeyCode p_key)
 {
     foreach (EHotkeyType ehotkeyType in m_keyConfigViews.Keys)
     {
         if (m_currentKeyView.HotkeyType != ehotkeyType)
         {
             Hotkey hotkey = KeyConfigManager.KeyBindings[ehotkeyType];
             if (hotkey.Key1 == p_key || hotkey.AltKey1 == p_key)
             {
                 m_currentOverrideHotkey  = ehotkeyType;
                 m_currentOverrideKeyCode = p_key;
                 String arg  = m_requestHighlightColorHex + LocaManager.GetText("OPTIONS_INPUT_KEY_" + ehotkeyType) + "[-]";
                 String arg2 = m_requestHighlightColorHex + LocaManager.GetText("OPTIONS_INPUT_KEYNAME_" + p_key.ToString().ToUpper()) + "[-]";
                 String text = LocaManager.GetText("OPTIONS_INPUT_KEY_REBIND", arg2, arg);
                 PopupRequest.Instance.OpenRequest(PopupRequest.ERequestType.YES_NO, String.Empty, text, new PopupRequest.RequestCallback(KeyBindRequestCallback));
                 return;
             }
         }
     }
     m_currentKeyView.ConfirmKeyBinding();
 }
Example #9
0
 public Hotkey(EHotkeyType type, KeyCode key1, KeyCode key2, KeyCode key3)
 {
     Type        = type;
     Key1        = key1;
     Key2        = key2;
     Key3        = key3;
     AltKey1     = KeyCode.None;
     AltKey2     = KeyCode.None;
     AltKey3     = KeyCode.None;
     AltKeyCount = 0;
     KeyCount    = 0;
     if (key1 != KeyCode.None)
     {
         KeyCount += 1;
     }
     if (key2 != KeyCode.None)
     {
         KeyCount += 1;
     }
     if (key3 != KeyCode.None)
     {
         KeyCount += 1;
     }
 }
Example #10
0
 public HotkeyEventArgs(EHotkeyType action, Boolean keyDown)
 {
     Action  = action;
     KeyDown = keyDown;
 }
Example #11
0
 public HotkeyEventArgs(EHotkeyType action, Boolean keyDown, KeyCode key) : this(action, keyDown)
 {
     Key = key;
 }
Example #12
0
 public Hotkey(EHotkeyType type, KeyCode key1, KeyCode key2)
 {
     this = new Hotkey(type, key1, key2, KeyCode.None);
 }
Example #13
0
        public static Boolean TryParse(EHotkeyType p_type, String p_value, out Hotkey p_hotkey)
        {
            Boolean result = false;

            p_hotkey = new Hotkey(p_type, KeyCode.None);
            String[] array = p_value.Split(new Char[]
            {
                ','
            }, StringSplitOptions.RemoveEmptyEntries);
            if (array.Length > 0)
            {
                String[] array2 = array[0].Split(new Char[]
                {
                    '+'
                }, StringSplitOptions.RemoveEmptyEntries);
                try
                {
                    if (array2.Length == 1)
                    {
                        p_hotkey = new Hotkey(p_type, (KeyCode)Enum.Parse(typeof(KeyCode), array2[0], true));
                        result   = true;
                    }
                    if (array2.Length == 2)
                    {
                        KeyCode key  = (KeyCode)Enum.Parse(typeof(KeyCode), array2[0], true);
                        KeyCode key2 = (KeyCode)Enum.Parse(typeof(KeyCode), array2[1], true);
                        p_hotkey = new Hotkey(p_type, key, key2);
                        result   = true;
                    }
                    if (array2.Length == 3)
                    {
                        KeyCode key3 = (KeyCode)Enum.Parse(typeof(KeyCode), array2[0], true);
                        KeyCode key4 = (KeyCode)Enum.Parse(typeof(KeyCode), array2[1], true);
                        KeyCode key5 = (KeyCode)Enum.Parse(typeof(KeyCode), array2[2], true);
                        p_hotkey = new Hotkey(p_type, key3, key4, key5);
                        result   = true;
                    }
                }
                catch
                {
                }
            }
            if (array.Length > 1 && array.Length > 0)
            {
                String[] array3 = array[1].Split(new Char[]
                {
                    '+'
                }, StringSplitOptions.RemoveEmptyEntries);
                try
                {
                    if (array3.Length == 1)
                    {
                        p_hotkey.SetAlternativeHotkeys((KeyCode)Enum.Parse(typeof(KeyCode), array3[0], true));
                        result = true;
                    }
                    if (array3.Length == 2)
                    {
                        KeyCode key6 = (KeyCode)Enum.Parse(typeof(KeyCode), array3[0], true);
                        KeyCode key7 = (KeyCode)Enum.Parse(typeof(KeyCode), array3[1], true);
                        p_hotkey.SetAlternativeHotkeys(key6, key7);
                        result = true;
                    }
                    if (array3.Length == 3)
                    {
                        KeyCode key8  = (KeyCode)Enum.Parse(typeof(KeyCode), array3[0], true);
                        KeyCode key9  = (KeyCode)Enum.Parse(typeof(KeyCode), array3[1], true);
                        KeyCode key10 = (KeyCode)Enum.Parse(typeof(KeyCode), array3[2], true);
                        p_hotkey.SetAlternativeHotkeys(key8, key9, key10);
                        result = true;
                    }
                }
                catch
                {
                }
            }
            return(result);
        }
Example #14
0
 public Hotkey this[EHotkeyType type]
 {
     get => m_hotkeys[(Int32)type];