public bool OnSuccess(ChallengeManager.TrackingContext ctx) { Log.Unity($"PASSED challenge {cr.Description}"); //This saves completion. Needs to be done locally in case of continuations. //The callback will handle replaying. var record = Requester.MakeGameRecord(ctx.cm.ChallengePhotos.ToArray()); Requester.TrySave(record); if (Requester.replay == null && cr.NextChallenge(Requester.metadata).Try(out var nextC)) { Log.Unity($"Autoproceeding to next challenge: {nextC.Description}"); var nextGr = new InstanceRequest(Requester.cb, Requester.metadata, new InstanceLowRequest(nextC), null); nextGr.SetupInstance(); Replayer.Cancel(); //can't replay both scenes together, //or even just the second scene due to time-dependency of world objects such as shots ctx.cm.TrackChallenge(new SceneChallengeReqest(nextGr, nextC), ctx.onSuccess); ctx.cm.LinkBoss(ctx.exec); return(false); } else { UIManager.MessageChallengeEnd(true, out _); //The callback should have a wait procedure in it ctx.onSuccess(record); //WaitingUtils.WaitThenCB(ctx.cm, Cancellable.Null, t, false, () => ctx.onSuccess(record)); return(true); } }
public static bool GoToMainMenu() => SceneIntermediary.LoadScene( new SceneIntermediary.SceneRequest(References.mainMenu, SceneIntermediary.SceneRequest.Reason.ABORT_RETURN, () => { Instance.Request?.Cancel(); Replayer.Cancel(); }));