示例#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;
 }
示例#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);
    }
示例#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);
            }
        }
示例#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);
 }
示例#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);
 }