示例#1
0
 /// <summary>
 /// Restarts the game instance.
 /// </summary>
 public static bool Restart()
 {
     if (Instance.Request == null)
     {
         throw new Exception("No game instance found to restart");
     }
     if (Instance.Request.Mode.PreserveReloadAudio())
     {
         AudioTrackService.PreserveBGM();
     }
     return(Instance.Request.Run());
 }
示例#2
0
 public static void ClearForScene()
 {
     AudioTrackService.ClearAllAudio(false);
     SFXService.ClearConstructed();
     BulletManager.ClearPoolControls();
     Events.Event0.DestroyAll();
     ETime.Slowdown.RevokeAll(MultiOp.Priority.CLEAR_SCENE);
     ETime.Timer.DestroyAll();
     BulletManager.OrphanAll();
     PublicDataHoisting.DestroyAll();
     FiringCtx.ClearNames();
     //SMs may have links to data hoisting, so we destroy both of them on phase end.
     ReflWrap.ClearWrappers();
     StateMachineManager.ClearCachedSMs();
     BehaviorEntity.ClearPointers();
     AyaPhoto.ClearTextures();
 }
示例#3
0
文件: RunBGM.cs 项目: Bagoum/danmokou
 private void Awake()
 {
     AudioTrackService.InvokeBGM(bgm);
 }
示例#4
0
        public override async Task Start(SMHandoff smh)
        {
            var jsmh       = smh.CreateJointCancellee(out var cts);
            var subbosses  = new List <Enemy>();
            var subsummons = new List <BehaviorEntity>();
            var ui         = DependencyInjection.MaybeFind <IUIManager>();

            if (props.boss != null)
            {
                GameManagement.Instance.SetCurrentBoss(props.boss, jsmh.Exec, jsmh.cT);
                ui?.SetBossHPLoader(jsmh.Exec.Enemy);
                (subbosses, subsummons) = ConfigureAllBosses(ui, jsmh, props.boss, props.bosses);
            }
            bool firstBoss = true;

            for (var next = jsmh.Exec.phaseController.WhatIsNextPhase();
                 next > -1 && next < phases.Length;
                 next = jsmh.Exec.phaseController.WhatIsNextPhase(next + 1))
            {
                if (phases[next].props.skip)
                {
                    continue;
                }
                if (PHASE_BUFFER)
                {
                    await WaitingUtils.WaitForUnchecked(jsmh.Exec, jsmh.cT, ETime.FRAME_TIME * 2f, false);
                }
                jsmh.ThrowIfCancelled();
                if (props.bgms != null)
                {
                    AudioTrackService.InvokeBGM(props.bgms.GetBounded(next, null));
                }
                if (props.boss != null && next >= props.setUIFrom)
                {
                    SetUniqueBossUI(ui, firstBoss, jsmh,
                                    props.bosses == null ? props.boss :
                                    props.bosses[props.bossUI?.GetBounded(next, 0) ?? 0]);
                    firstBoss = false;
                }
                //don't show lives on setup phase
                if (next > 0 && props.boss != null)
                {
                    ui?.ShowBossLives(RemainingLives(next));
                }
                try {
                    await phases[next].Start(jsmh, ui, subbosses);
                } catch (OperationCanceledException) {
                    //Runs the cleanup code if we were cancelled
                    break;
                }
            }
            cts.Cancel();
            if (props.boss != null && !SceneIntermediary.LOADING)
            {
                ui?.CloseBoss();
                if (!firstBoss)
                {
                    ui?.CloseProfile();
                }
                foreach (var subsummon in subsummons)
                {
                    subsummon.InvokeCull();
                }
            }
        }