private bool LoadScene(ScreenLoadData SLD) { if (!IsReady) { return(false); } bool reject = System.Array.Exists(nextLoads.ToArray(), o => (o.Match(SLD) && SLD.IsPreload) || (o.Match(SLD) && SLD.screenType != ScreenType.PopUp)); if (runningLoadOp != null) { reject |= (runningLoadOp.Match(SLD) && SLD.IsPreload) || (runningLoadOp.Match(SLD) && SLD.screenType != ScreenType.PopUp); } // Make sure that there must be only one Loading screen loaded reject |= System.Array.Exists(popupStack.ToArray(), e => SLD.screenType == e.type && SLD.screenType == ScreenType.Loading); if (reject) { return(false); } if (SLD.IsPreload) { ++preloadingCount; } nextLoads.Enqueue(new SceneLoadOperation(SLD)); return(true); }
public SceneLoadOperation(ScreenLoadData SLD) { this.SLD = SLD; director = instance; if (SLD.IsPreload) { state = State.LoadingScreen; } else { state = State.KillingOtherScreens; } }
static private bool LoadScreen(string name, bool additive, ScreenType type, LoadData loadData, bool cache, bool active, ScreenCallback onActive = null, ScreenCallback onDeactive = null) { ScreenLoadData SLD = new ScreenLoadData() { sceneName = name, screenType = type, additive = additive, loadData = loadData == null ? new LoadData() : loadData, cache = cache, active = active, onActive = onActive, onDeactive = onDeactive }; return(instance.LoadScene(SLD)); }
public bool Match(ScreenLoadData SLD) { return(this.SLD.sceneName == SLD.sceneName && this.SLD.screenType == SLD.screenType); }