private static IEnumerator StartCoroutine_internal(MonoBehaviour mono, System.Action onComplete, params Coroutine[] routines) { if (routines == null || routines.Length == 0) { if (onComplete != null) { onComplete(); } yield break; } int completeCount = 0; for (int i = 0; i < routines.Length; i++) { mono.Start_Coroutine(routines[i], () => ++ completeCount); } CompleteMode mode = CompleteMode.All; //目前没有放在参数上 if (mode == CompleteMode.Single) //单个完成就算全部完成 { while (completeCount < 1) { yield return(0); } } else if (mode == CompleteMode.All)//全部都完成才算完成 { while (completeCount < routines.Length) { yield return(0); } } //停止所有协程 for (int i = 0; i < routines.Length; i++) { if (mono && routines[i] != null) { mono.StopCoroutine(routines[i]); } } if (onComplete != null) { onComplete(); } }
private void HandleCompletion(CompleteMode mode, LocalContext context, bool autoInsert, bool autoHide) { List <ICompletionListItem> items = null; switch (mode) { case CompleteMode.Selector: items = HandleSelectorCompletion(context); break; case CompleteMode.Pseudo: items = HandlePseudoCompletion(context); break; case CompleteMode.Prefix: items = HandlePrefixCompletion(context); break; case CompleteMode.Attribute: items = HandlePropertyCompletion(context); break; case CompleteMode.Variable: items = HandleVariableCompletion(context); break; case CompleteMode.Value: items = HandleValueCompletion(context); break; } if (items == null) { return; } if (autoInsert && !string.IsNullOrEmpty(context.Word)) { var matches = new List <ICompletionListItem>(); foreach (var item in items) { if (item.Label.StartsWithOrdinal(context.Word)) { matches.Add(item); } } if (matches.Count == 1) { ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl; sci.SetSel(context.Position, sci.CurrentPos); sci.ReplaceSel(matches[0].Label); } //else } else { CompletionList.Show(items, autoHide, context.Word); } }
private void HandleCompletion(CompleteMode mode, LocalContext context, bool autoInsert, bool autoHide) { List<ICompletionListItem> items = null; switch (mode) { case CompleteMode.Selector: items = HandleSelectorCompletion(context); break; case CompleteMode.Pseudo: items = HandlePseudoCompletion(context); break; case CompleteMode.Prefix: items = HandlePrefixCompletion(context); break; case CompleteMode.Attribute: items = HandlePropertyCompletion(context); break; case CompleteMode.Variable: items = HandleVariableCompletion(context); break; case CompleteMode.Value: items = HandleValueCompletion(context); break; } if (items == null) return; if (autoInsert && !string.IsNullOrEmpty(context.Word)) { var matches = new List<ICompletionListItem>(); foreach(var item in items) if (item.Label.StartsWith(context.Word)) matches.Add(item); if (matches.Count == 1) { ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl; sci.SetSel(context.Position, sci.CurrentPos); sci.ReplaceSel(matches[0].Label); } //else } else CompletionList.Show(items, autoHide, context.Word); }