Exemplo n.º 1
0
 /// <summary>Initialise the list dictionary.</summary>
 /// <param name="getKey"></param>
 public ListDictionary(GetKeyCallback getKey)
 {
     if (getKey == null)
     {
         throw new ArgumentNullException("getKey");
     }
     GetKeyValue = getKey;
 }
Exemplo n.º 2
0
    private IEnumerator GetNextKeyRoutine(GetKeyCallback callback)
    {
        KeyCode extractedCode = KeyCode.None;

        while (extractedCode == KeyCode.None)
        {
            extractedCode = GetNextKey();
            if (extractedCode != KeyCode.None)
            {
                break;
            }
            yield return(new WaitForEndOfFrame());
        }
        storedGetNextKeyCancel = null;
        callback(extractedCode);
    }
Exemplo n.º 3
0
        public static void Open(GetKeyCallback getKey, IEnumerable <DataType> datas = null)
        {
            Model <KeyType, DataType> .Close();

            Model <KeyType, DataType> .IsOpened = true;
#if LOG_DEBUG
            ClosableDebugger.Open(CLASSNAME);
#endif// LOG_DEBUG
            ModelDisposer.Regist(typeof(Model <KeyType, DataType>), Model <KeyType, DataType> .Close);

            Model <KeyType, DataType> .GetKey = getKey;

            if (null != datas)
            {
                Model <KeyType, DataType> .AddRange(datas);
            }
        }
Exemplo n.º 4
0
 public void GetNextKey(GetKeyCallback callback, Action cancelCallback)
 {
     if (runner == null)
     {
         runner = CoroutineRunner.Instantiate(this.name + "_KeyGetter");
     }
     else if (nextKeyRoutine != null)
     {
         if (storedGetNextKeyCancel != null)
         {
             storedGetNextKeyCancel.Invoke();
         }
         runner.StopCoroutine(nextKeyRoutine);
     }
     storedGetNextKeyCancel = cancelCallback;
     nextKeyRoutine         = GetNextKeyRoutine(callback);
     runner.StartCoroutine(nextKeyRoutine);
 }
Exemplo n.º 5
0
 /// <summary>Initialise the list dictionary.</summary>
 /// <param name="collection"></param>
 /// <param name="getKey"></param>
 public ListDictionary(IEnumerable <TValue> collection, GetKeyCallback getKey)
     : this(getKey) {
     AddRange(collection);
 }