public Assistant(AssistType assistType) { this.assistType = assistType; allSteps = StepBase.GetAllSteps(assistType); Initialize(); if (assistType == AssistType.ApplicationSetup) { AppendStep(new StepAppSetup()); } else if (assistType == AssistType.DatabaseSetup) { AppendStep(new StepDBSetup()); } else { throw new ArgumentOutOfRangeException("assistType"); } backgroundWorker = new Thread(delegate() { while (true) { if (backgroundJobs.Count > 0) { BackgroundJob job = backgroundJobs.Dequeue(); try { PresentationDomain.Invoke(() => job.Step.ChangeStatus(StepStatus.InProgress)); job.Action(); PresentationDomain.Invoke(() => job.Step.ChangeStatus(StepStatus.Complete)); } catch (Exception ex) { PresentationDomain.Invoke(() => job.Step.ChangeStatus(StepStatus.Failed)); ErrorHandling.LogException(ex, ErrorSeverity.FatalError); } } else { Thread.Sleep(100); } if (stopBackgroundWorker) { return; } } }) { IsBackground = true, Name = "Setup Assistant Worker" }; backgroundWorker.Start(); }
public static List <StepBase> GetAllSteps(AssistType group) { List <StepBase> allSteps = new List <StepBase> (); foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/Warehouse/Presentation/SetupAssistant/Step")) { object instance = node.CreateInstance(); StepBase step = instance as StepBase; if (step != null) { allSteps.Add(step); } } allSteps.Sort((s1, s2) => Math.Max(-1, Math.Min(1, s1.Ordinal - s2.Ordinal))); return(allSteps.FindAll(s => s.Group == group)); }
public Assistant(StepBase step) { assistType = AssistType.ApplicationSetup; allSteps = new List <StepBase> { step }; Initialize(); AppendStep(step); backgroundWorker = new Thread(delegate() { while (true) { if (backgroundJobs.Count > 0) { BackgroundJob job = backgroundJobs.Dequeue(); try { PresentationDomain.Invoke(() => job.Step.ChangeStatus(StepStatus.InProgress)); job.Action(); PresentationDomain.Invoke(() => job.Step.ChangeStatus(StepStatus.Complete)); } catch (Exception ex) { PresentationDomain.Invoke(() => job.Step.ChangeStatus(StepStatus.Failed)); ErrorHandling.LogException(ex, ErrorSeverity.FatalError); } } else { Thread.Sleep(100); } if (stopBackgroundWorker) { return; } } }) { IsBackground = true, Name = "Setup Assistant Worker" }; backgroundWorker.Start(); }
IEnumerator LoadingScreen() { int modNo = MenuManager.GetInstance().modularNo; setNo = modNo / 4; //setNo = setNo > 4 ? 4 : setNo; stopMovement = true; TouchObjPool.GetInstance().ResetTargets(); if (modNo < 0) { switch (modNo) { case -5: aimAssistType = AssistType.BaseTest; break; case -4: aimAssistType = AssistType.TargetGravity; break; case -3: aimAssistType = AssistType.StickyTarget; break; case -2: aimAssistType = AssistType.Bubble; break; case -1: aimAssistType = AssistType.Touch; break; } } else { if (setNo < enumArray.Length) { aimAssistType = (AssistType)Enum.Parse(typeof(AssistType), enumArray[setNo]); //(AssistType) enumArray.GetValue(setNo+1); } else { aimAssistType = AssistType.GameOver; } } playerInputObj.ResetCursors(); //Debug.Log(setNo+"/"+enumArray.Length+":"+ MenuManager.GetInstance().modularNo); MenuManager.GetInstance().ShowLoading(true); yield return(new WaitForSeconds(2f)); if (aimAssistType != AssistType.GameOver) { MenuManager.GetInstance().ShowLoading(false); MenuManager.GetInstance().InfoUIStatus(true); int moduleNo = MenuManager.GetInstance().modularNo; if (moduleNo > 0) { timeTaken.Add(enumArray[setNo] + moduleNo % 4, timer); } for (int i = 0; i < setObjects.Length; i++) { setObjects[i].SetActive(false); } } yield return(new WaitForSeconds(2f)); if (aimAssistType != AssistType.GameOver) { setObjects[setNo].SetActive(true); //setObjects[setNo].Initiate(); timer = 0; playerInputObj.NextSet(); //ActivateTargetObects(); DeactivateMe(); } else { AnalyticsManager.GetInstance().SetLevelTimes(timeTaken); MenuManager.GetInstance().ShowGameOver(); } }