public static void ResumeWaitingThread(Entity entity, string threadName) { if (entity.LogicObject != null) { LogicEntityObject.WaitingThreadItem[] waitingThreadsByName = entity.LogicObject.GetWaitingThreadsByName(threadName); for (int i = 0; i < waitingThreadsByName.Length; i++) { LogicEntityObject.WaitingThreadItem waitingThreadItem = waitingThreadsByName[i]; waitingThreadItem.RemainingTime = 0f; } } }
internal void TickWaitItems() { int num = this.waitintThreads.Count; for (int i = 0; i < num; i++) { LogicEntityObject.WaitingThreadItem waitingThreadItem = this.waitintThreads[i]; waitingThreadItem.RemainingTime -= Entity.TickDelta; if (waitingThreadItem.RemainingTime <= 0f) { this.waitintThreads.RemoveAt(i); i--; num--; this.ownerEntity.UnsubscribeToTickEvent(); if (this.GetCurrentExecutingMethodLevel() != -1) { Log.Fatal("LogicEntityObject: Internal error: TickWaitItems: currentExecutingMethodLevel != -1"); } if (this.currentExecutingMethodInformations != null) { Log.Fatal("LogicEntityObject: Internal error: TickWaitItems: currentExecutingMethodInformations != null"); } this.currentExecutingMethodInformations = waitingThreadItem.currentExecutingMethodInformations; foreach (LogicExecuteMethodInformation current in this.currentExecutingMethodInformations) { current.NeedReturn = false; current.NeedReturnForWait = false; } ((LogicDesignerMethod)this.currentExecutingMethodInformations[0].Method).A(this.currentExecutingMethodInformations[0]); if (this.currentExecutingMethodInformations == null) { Log.Fatal("LogicEntityObject: Internal error: TickWaitItems: currentExecutingMethodInformations == null"); } if (this.GetCurrentExecutingMethodLevel() != -1) { Log.Fatal("LogicEntityObject: Internal error: TickWaitItems: currentExecutingMethodLevel != -1"); } this.currentExecutingMethodInformations = null; } } }
internal bool A(TextBlock textBlock) { TextBlock textBlock2 = textBlock.FindChild("waitItems"); if (textBlock2 != null) { foreach (TextBlock current in textBlock2.Children) { LogicEntityObject.WaitingThreadItem waitingThreadItem = new LogicEntityObject.WaitingThreadItem(); if (current.IsAttributeExist("threadName")) { waitingThreadItem.ThreadName = current.GetAttribute("threadName"); } if (current.IsAttributeExist("remainingTime")) { waitingThreadItem.RemainingTime = float.Parse(current.GetAttribute("remainingTime")); } TextBlock textBlock3 = current.FindChild("executeMethodInformations"); if (textBlock3 != null) { waitingThreadItem.currentExecutingMethodInformations = new List <LogicExecuteMethodInformation>(); foreach (TextBlock current2 in textBlock3.Children) { LogicExecuteMethodInformation logicExecuteMethodInformation = new LogicExecuteMethodInformation(); if (!logicExecuteMethodInformation.A(current2)) { return(false); } waitingThreadItem.currentExecutingMethodInformations.Add(logicExecuteMethodInformation); } } this.waitintThreads.Add(waitingThreadItem); } } if (this.waitintThreads.Count != 0) { this.ownerEntity.SubscribeToTickEvent(); } return(true); }