Exemplo n.º 1
0
        // private Button[] keys;

        // private bool _interactable = true;
        // public bool interactable
        // {
        //     get
        //     {
        //         return _interactable;
        //     }
        //     set
        //     {
        //         if (_interactable != value)
        //         {
        //             SetInteractable(_interactable);
        //         }
        //     }
        // }

        // private void SetInteractable (bool value)
        // {
        //     if (keys == null)
        //     {
        //         return;
        //     }

        //     for (int i = 0; i < keys.Length; i++)
        //     {
        //         keys[i].interactable = value;
        //     }

        //     _interactable = value;
        // }

        private void Awake()
        {
            currentKeyCase = defaultKeyCase;

            // keys = GetComponentsInChildren<Button>();
            // SetInteractable(_interactable);
        }
Exemplo n.º 2
0
 private static KeyValuePair <string, int> makeKvp(string key, int value, KeyCase forceKeyCase)
 {
     if (forceKeyCase.CompareTo(KeyCase.FORCE_UPPER) == 0)
     {
         key = key.ToUpper();
     }
     if (forceKeyCase.CompareTo(KeyCase.FORCE_LOWER) == 0)
     {
         key = key.ToLower();
     }
     return(new KeyValuePair <string, int>(key, value));
 }
Exemplo n.º 3
0
 private static KeyValuePair<string, int> makeKvp( string key, int value, KeyCase forceKeyCase )
 {
     if ( forceKeyCase.CompareTo( KeyCase.FORCE_UPPER ) == 0 )
     {
         key = key.ToUpper();
     }
     if ( forceKeyCase.CompareTo( KeyCase.FORCE_LOWER ) == 0 )
     {
         key = key.ToLower();
     }
     return new KeyValuePair<string, int>( key, value );
 }
Exemplo n.º 4
0
        public static Dictionary<String, Int32> convertToDictionary( Mapping m, KeyCase forceKeyCase )
        {
            Dictionary<String, Int32> dic = new Dictionary<string, Int32>();
            foreach ( MappingEntry me in m.Enties )
            {
                String key = me.Key.ToString();
                Int32 value = Convert.ToInt32( Double.Parse( me.Value.ToString() ) );
                KeyValuePair<String, Int32> kvp = makeKvp( key, value, forceKeyCase );
                dic.Add( kvp.Key, kvp.Value );
            }

            return dic;
        }
Exemplo n.º 5
0
        public static Dictionary <String, Int32> convertToDictionary(Mapping m, KeyCase forceKeyCase)
        {
            Dictionary <String, Int32> dic = new Dictionary <string, Int32>();

            foreach (MappingEntry me in m.Enties)
            {
                String key   = me.Key.ToString();
                Int32  value = Convert.ToInt32(Double.Parse(me.Value.ToString()));
                KeyValuePair <String, Int32> kvp = makeKvp(key, value, forceKeyCase);
                dic.Add(kvp.Key, kvp.Value);
            }

            return(dic);
        }
        private static string ChangeCase(string key, KeyCase keyCase)
        {
            if (keyCase == KeyCase.CamelCase)
            {
                key = char.ToLowerInvariant(key[0]) + key.Substring(1);
            }

            if (keyCase == KeyCase.PascalCase)
            {
                key = char.ToUpperInvariant(key[0]) + key.Substring(1);
            }

            return(key);
        }
Exemplo n.º 7
0
        public void Input(KeyCode keyCode)
        {
            OnInput.Invoke(keyCode);

            if (currentKeyCase != defaultKeyCase)
            {
                currentKeyCase = defaultKeyCase;
                OnKeyCaseChange.Invoke(currentKeyCase);
            }
            else if (keyCode == KeyCode.LeftShift ||
                     keyCode == KeyCode.RightShift)
            {
                currentKeyCase = (defaultKeyCase == KeyCase.Lower)
                    ? KeyCase.Upper
                    : KeyCase.Lower;
                OnKeyCaseChange.Invoke(currentKeyCase);
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// 构造函数,指定存储 大写?小写
 /// </summary>
 /// <param name="keyCase">大写/小写</param>
 public IgCaseDictionary(KeyCase keyCase)
 {
     this.Case   = keyCase;
     this.Locker = new ReaderWriterLockSlim();
 }