Esempio 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);
        }
Esempio 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));
 }
 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 );
 }
        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;
        }
Esempio 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);
        }
Esempio 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);
            }
        }
Esempio n. 8
0
 /// <summary>
 /// 构造函数,指定存储 大写?小写
 /// </summary>
 /// <param name="keyCase">大写/小写</param>
 public IgCaseDictionary(KeyCase keyCase)
 {
     this.Case   = keyCase;
     this.Locker = new ReaderWriterLockSlim();
 }