/// <summary>Initialise the list dictionary.</summary> /// <param name="getKey"></param> public ListDictionary(GetKeyCallback getKey) { if (getKey == null) { throw new ArgumentNullException("getKey"); } GetKeyValue = getKey; }
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); }
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); } }
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); }
/// <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); }