Example #1
0
        private void ChangeScene()
        {
            Application.LoadLevel("Loading");
            Resources.UnloadUnusedAssets();
            GC.Collect();
            Application.LoadLevel(NextScene);
            SoundLib.StopAllSoundEffects();
            if (CurrentScene != NextScene)
            {
                if (String.Equals(CurrentScene, "QuadMist"))
                {
                    FF9Wipe_FadeInEx(30);
                }
                if (String.Equals(NextScene, "MainMenu"))
                {
                    SoundLib.StopAllSounds();
                }
                if (String.Equals(NextScene, FieldMapSceneName))
                {
                    FF9Snd.sndFuncPtr = FF9Snd.FF9FieldSoundDispatch;
                    if (String.Equals(CurrentScene, WorldMapSceneName))
                    {
                        FF9Snd.HasJustChangedBetweenWorldAndField = true;
                    }
                }
                else if (String.Equals(NextScene, WorldMapSceneName))
                {
                    AllSoundDispatchPlayer soundDispatchPlayer = SoundLib.GetAllSoundDispatchPlayer();
                    soundDispatchPlayer.FF9SOUND_SNDEFFECTRES_STOPCURRENT();
                    HashSet <Int32> exceptObjNo = new HashSet <Int32> {
                        1261
                    };
                    soundDispatchPlayer.FF9SOUND_SNDEFFECT_STOP_ALL(exceptObjNo);
                    soundDispatchPlayer.FF9SOUND_STREAM_STOP();

                    FF9Snd.sndFuncPtr = FF9Snd.FF9WorldSoundDispatch;
                    if (String.Equals(CurrentScene, FieldMapSceneName))
                    {
                        FF9Snd.HasJustChangedBetweenWorldAndField = true;
                    }
                }
                else if (!String.Equals(NextScene, BattleMapSceneName))
                {
                    FF9Snd.sndFuncPtr = !String.Equals(NextScene, "QuadMist") ? FF9Snd.FF9AllSoundDispatch : (FF9Snd.SoundDispatchDelegate)FF9Snd.FF9MiniGameSoundDispatch;
                }
                if (String.IsNullOrEmpty(PendingCurrentScene))
                {
                    LastScene = CurrentScene;
                }
                else
                {
                    LastScene           = PendingCurrentScene;
                    PendingCurrentScene = String.Empty;
                }
                CurrentScene = NextScene;
                UnityEngine.Debug.Log("---------- Current Scene : " + Instance.CurrentScene + " ----------");
            }
            NextScene = String.Empty;
            SetTargetFrameRateForCurrentScene();
        }
Example #2
0
 private void Exit()
 {
     EndGameMain.Instance.endGame.FF9SFX_Play(103u);
     FF9Snd.ff9endsnd_song_vol_intpl(156, 60, 0);
     SoundLib.GetAllSoundDispatchPlayer().StopCurrentSong(60);
     SceneDirector.Replace(PersistenSingleton <SceneDirector> .Instance.LastScene, SceneTransition.FadeOutToBlack_FadeIn, true);
 }
Example #3
0
    public static void ff9ShutdownStateBattleResult()
    {
        if ((FF9StateSystem.Common.FF9.btl_flag & 8) != 0)
        {
            return;
        }

        btlsnd.ff9btlsnd_song_vol_intplall(120, 0);
        SoundLib.GetAllSoundDispatchPlayer().StopCurrentSong(120);
    }
Example #4
0
	private void ff9ShutdownStateFieldMap()
	{
		FF9StateFieldMap map = FF9StateSystem.Field.FF9Field.loc.map;
		FF9Snd.ff9fieldsound_stopall_mapsndeffect((Int32)this.FF9.fldMapNo);
		EBin eBin = this.ee.eBin;
		Int32 varManually = eBin.getVarManually(6357);
		switch (map.nextMode)
		{
		case 1:
			this.FF9.fldMapNo = map.nextMapNo;
			break;
		case 2:
			this.FF9.btlMapNo = map.nextMapNo;
			FF9StateSystem.Battle.battleMapIndex = (Int32)this.FF9.btlMapNo;
			this.FF9Sys.mode = 2;
			this.FF9Sys.prevMode = 1;
			break;
		case 3:
			this.FF9.wldMapNo = map.nextMapNo;
			this.FF9.wldLocNo = (Int16)EventEngineUtils.eventIDToMESID[(Int32)this.FF9.wldMapNo];
			this.FF9Sys.mode = 3;
			this.FF9Sys.prevMode = 1;
			break;
		case 4:
		{
			AllSoundDispatchPlayer allSoundDispatchPlayer = SoundLib.GetAllSoundDispatchPlayer();
			allSoundDispatchPlayer.FF9SOUND_SNDEFFECT_STOP_ALL(null);
			allSoundDispatchPlayer.FF9SOUND_SNDEFFECTRES_STOPCURRENT();
			allSoundDispatchPlayer.FF9SOUND_STREAM_STOP();
			break;
		}
		case 7:
		{
			AllSoundDispatchPlayer allSoundDispatchPlayer2 = SoundLib.GetAllSoundDispatchPlayer();
			allSoundDispatchPlayer2.FF9SOUND_SNDEFFECT_STOP_ALL(null);
			allSoundDispatchPlayer2.FF9SOUND_SNDEFFECTRES_STOPCURRENT();
			allSoundDispatchPlayer2.FF9SOUND_STREAM_STOP();
			this.FF9Sys.mode = 7;
			this.FF9Sys.prevMode = 1;
			break;
		}
		case 9:
		{
			Int32 currentMusicId = FF9Snd.GetCurrentMusicId();
			if (currentMusicId != -1)
			{
				FF9Snd.ff9fldsnd_song_suspend(currentMusicId);
			}
			FF9Snd.ff9fieldSoundSuspendAllResidentSndEffect();
			AllSoundDispatchPlayer allSoundDispatchPlayer3 = SoundLib.GetAllSoundDispatchPlayer();
			allSoundDispatchPlayer3.FF9SOUND_STREAM_STOP();
			break;
		}
		}
	}
Example #5
0
 public static void DidAutoload()
 {
     if (FF9StateSystem.Sound.auto_save_bgm_id != -1)
     {
         if (FF9StateSystem.Settings.cfg.sound == 0UL)
         {
             SoundLib.EnableMusic();
         }
         else
         {
             SoundLib.DisableMusic();
         }
         AllSoundDispatchPlayer allSoundDispatchPlayer = SoundLib.GetAllSoundDispatchPlayer();
         allSoundDispatchPlayer.FF9SOUND_SONG_PLAY(FF9StateSystem.Sound.auto_save_bgm_id, 127);
         allSoundDispatchPlayer.FF9SOUND_SONG_VOL_FADE(FF9StateSystem.Sound.auto_save_bgm_id, 30, 0, 127);
         FF9StateSystem.Sound.auto_save_bgm_id = -1;
     }
 }
Example #6
0
    private void RequestPlayBattleEncounterSongForField()
    {
        AllSoundDispatchPlayer soundDispatchPlayer = SoundLib.GetAllSoundDispatchPlayer();

        FF9Snd.ff9fieldSoundSuspendAllResidentSndEffect();
        AllSoundDispatchPlayer.PlayingSfx[] residentSndEffectSlot1 = soundDispatchPlayer.GetResidentSndEffectSlot();
        Int32 num1 = residentSndEffectSlot1[0]?.SndEffectVol ?? 0;
        Int32 num2 = residentSndEffectSlot1[1]?.SndEffectVol ?? 0;

        soundDispatchPlayer.FF9SOUND_SNDEFFECTRES_VOL_INTPLALL(15, 0);
        AllSoundDispatchPlayer.PlayingSfx[] residentSndEffectSlot2 = soundDispatchPlayer.GetResidentSndEffectSlot();
        if (residentSndEffectSlot2[0] != null)
        {
            residentSndEffectSlot2[0].SndEffectVol = num1;
        }
        if (residentSndEffectSlot2[1] != null)
        {
            residentSndEffectSlot2[1].SndEffectVol = num2;
        }

        Int32                     index            = FF9StateSystem.Common.FF9.fldMapNo;
        FF9StateFieldMap          ff9StateFieldMap = FF9StateSystem.Field.FF9Field.loc.map;
        Dictionary <Int32, Int32> dictionary       = FF9SndMetaData.BtlBgmMapperForFieldMap[index];
        Int32                     currentMusicId   = FF9Snd.GetCurrentMusicId();

        FF9StateSystem.Battle.IsPlayFieldBGMInCurrentBattle = true;
        if (dictionary.Count == 0 || !dictionary.ContainsKey(ff9StateFieldMap.nextMapNo))
        {
            return;
        }

        Int32 songid = dictionary[ff9StateFieldMap.nextMapNo];

        if (songid == currentMusicId)
        {
            return;
        }

        FF9Snd.ff9fldsnd_song_suspend(currentMusicId);
        btlsnd.ff9btlsnd_song_play(songid);
        FF9StateSystem.Battle.IsPlayFieldBGMInCurrentBattle = false;
    }
Example #7
0
    public void HonoUpdate20FPS()
    {
        if ((this.FF9.attr & 256u) == 0u)
        {
            if (ff9.w_frameCounter >= 5)
            {
                UIManager.World.SetPerspectiveToggle(ff9.w_cameraSysDataCamera.upperCounter == 4096);
                UIManager.World.SetRotationLockToggle(!ff9.w_cameraSysData.cameraNotrot);
            }
            if (this.FF9WorldMap.nextMode != 2)
            {
                switch (ff9.w_frameMainRoutine())
                {
                case 3:
                    this.FF9WorldMap.nextMode = 2;
                    ff9.ff9worldInternalBattleEncountStart();
                    PersistenSingleton <HonoInputManager> .Instance.IgnoreCheckingDirectionSources = false;
                    break;

                case 4:
                    this.FF9WorldMap.nextMode = 1;
                    PersistenSingleton <HonoInputManager> .Instance.IgnoreCheckingDirectionSources = false;
                    this.FF9Sys.attr |= 4096u;
                    break;
                }
            }
            this.RenderTextureBank.OnUpdate20FPS();
            if ((this.FF9World.attr & 512u) == 0u)
            {
                SceneDirector.ServiceFade();
            }
            if ((this.FF9World.attr & 1024u) == 0u)
            {
                ff9.ff9worldInternalBattleEncountService();
            }
            if (HonoBehaviorSystem.Instance.IsFastForwardModeActive())
            {
                this.fastForwardFrameCounter20FPS++;
                if (this.fastForwardFrameCounter20FPS == HonoBehaviorSystem.Instance.GetFastForwardFactor())
                {
                    this.UpdateTexture_Render();
                    this.fastForwardFrameCounter20FPS = 0;
                }
            }
            else
            {
                this.UpdateTexture_Render();
            }
        }
        if ((this.FF9Sys.attr & 12289u) != 0u || (this.FF9Sys.attr & 4097u) != 0u)
        {
            ff9.ff9ShutdownStateWorldMap();
            ff9.ff9ShutdownStateWorldSystem();
            if (this.FF9Sys.mode == 1)
            {
                AllSoundDispatchPlayer allSoundDispatchPlayer = SoundLib.GetAllSoundDispatchPlayer();
                allSoundDispatchPlayer.FF9SOUND_SNDEFFECTRES_STOPCURRENT();
                allSoundDispatchPlayer.FF9SOUND_SNDEFFECT_STOP_ALL(null);
                allSoundDispatchPlayer.FF9SOUND_STREAM_STOP();
                SceneDirector.Replace("FieldMap", SceneTransition.FadeOutToBlack_FadeIn, true);
            }
            else if (this.FF9Sys.mode == 2)
            {
                EventEngine eventEngine = PersistenSingleton <EventEngine> .Instance;
                Obj         objUID      = eventEngine.GetObjUID(250);
                PosObj      posObj      = (PosObj)objUID;
                EventInput.IsProcessingInput = false;
                SoundLib.StopAllSounds();
                SFX_Rush.SetCenterPosition(1);
                SceneDirector.Replace("BattleMap", SceneTransition.SwirlInBlack, true);
            }
            else if (this.FF9Sys.mode == 3)
            {
                SoundLib.StopAllSounds();
                SceneDirector.Replace("WorldMap", SceneTransition.FadeOutToBlack_FadeIn, true);
            }
        }
        if (!FF9StateSystem.World.IsBeeScene)
        {
            for (ObjList objList = ff9.GetActiveObjList(); objList != null; objList = objList.next)
            {
                Obj obj = objList.obj;
                if (PersistenSingleton <EventEngine> .Instance.isPosObj(obj))
                {
                    WMActor wmActor = ((Actor)obj).wmActor;
                    if (obj.cid == 4 && wmActor != (UnityEngine.Object)null)
                    {
                        wmActor.UpdateAnimationViaScript();
                    }
                }
            }
        }
        for (ObjList objList2 = this.World.ActorList; objList2 != null; objList2 = objList2.next)
        {
            if (objList2.obj.cid == 4)
            {
                WMActor wmActor2 = ((Actor)objList2.obj).wmActor;
                wmActor2.LateUpdateFunction();
            }
        }
    }
Example #8
0
 private void ChangeScene()
 {
     Application.LoadLevel("Loading");
     Resources.UnloadUnusedAssets();
     //GC.Collect();
     LoadNextScene();
     SoundLib.StopAllSoundEffects();
     if (this.CurrentScene != this.NextScene)
     {
         if (String.Equals(this.CurrentScene, "QuadMist"))
         {
             SceneDirector.FF9Wipe_FadeInEx(30);
         }
         if (String.Equals(this.NextScene, "MainMenu"))
         {
             SoundLib.StopAllSounds();
         }
         if (String.Equals(this.NextScene, SceneDirector.FieldMapSceneName))
         {
             FF9Snd.sndFuncPtr = new FF9Snd.SoundDispatchDelegate(FF9Snd.FF9FieldSoundDispatch);
             if (String.Equals(this.CurrentScene, SceneDirector.WorldMapSceneName))
             {
                 FF9Snd.HasJustChangedBetweenWorldAndField = true;
             }
         }
         else if (String.Equals(this.NextScene, SceneDirector.WorldMapSceneName))
         {
             AllSoundDispatchPlayer allSoundDispatchPlayer = SoundLib.GetAllSoundDispatchPlayer();
             allSoundDispatchPlayer.FF9SOUND_SNDEFFECTRES_STOPCURRENT();
             allSoundDispatchPlayer.FF9SOUND_SNDEFFECT_STOP_ALL(new HashSet <Int32>
             {
                 1261
             });
             allSoundDispatchPlayer.FF9SOUND_STREAM_STOP();
             FF9Snd.sndFuncPtr = new FF9Snd.SoundDispatchDelegate(FF9Snd.FF9WorldSoundDispatch);
             if (String.Equals(this.CurrentScene, SceneDirector.FieldMapSceneName))
             {
                 FF9Snd.HasJustChangedBetweenWorldAndField = true;
             }
         }
         else if (!String.Equals(this.NextScene, SceneDirector.BattleMapSceneName))
         {
             if (String.Equals(this.NextScene, "QuadMist"))
             {
                 FF9Snd.sndFuncPtr = new FF9Snd.SoundDispatchDelegate(FF9Snd.FF9MiniGameSoundDispatch);
             }
             else
             {
                 FF9Snd.sndFuncPtr = new FF9Snd.SoundDispatchDelegate(FF9Snd.FF9AllSoundDispatch);
             }
         }
         if (String.IsNullOrEmpty(this.PendingCurrentScene))
         {
             this.LastScene = this.CurrentScene;
         }
         else
         {
             this.LastScene           = this.PendingCurrentScene;
             this.PendingCurrentScene = String.Empty;
         }
         this.CurrentScene = this.NextScene;
         global::Debug.Log("---------- Current Scene : " + PersistenSingleton <SceneDirector> .Instance.CurrentScene + " ----------");
     }
     this.NextScene = String.Empty;
     SceneDirector.SetTargetFrameRateForCurrentScene();
 }
Example #9
0
	private void ff9InitStateFieldMap(Int32 MapNo)
	{
		FF9StateFieldMap map = this.FF9Field.loc.map;
		map.ff9ResetStateFieldMap();
		this.FF9Sys.attr &= 4294966512u;
		this.FF9Field.attr |= 4u;
		FF9StateFieldSystem ff9Field = FF9StateSystem.Field.FF9Field;
		this.FF9Field.playerID = 0;
		map.nextMapNo = (this.FF9.fldMapNo = (Int16)MapNo);
		for (Int32 i = 1; i >= 0; i--)
		{
			for (Int32 j = 3; j >= 0; j--)
			{
				FieldMap.FF9FieldAttr.ff9[i, j] = 0;
				FieldMap.FF9FieldAttr.field[i, j] = 0;
			}
		}
		String text = FF9DBAll.EventDB[MapNo];
		map.evtPtr = EventEngineUtils.loadEventData(text, EventEngineUtils.ebSubFolderField);
		AnimationFactory.LoadAnimationUseInEvent(text);
		vib.LoadVibData(text);
		map.mcfPtr = MapConfiguration.LoadMapConfigData(text);
		GameObject gameObject = GameObject.Find("FieldMap Root");
		GameObject gameObject2 = new GameObject("FieldMap");
		gameObject2.transform.parent = gameObject.transform;
		PersistenSingleton<EventEngine>.Instance.fieldmap = gameObject2.AddComponent<FieldMap>();
		GameObject gameObject3 = new GameObject("FieldMap SPS");
		gameObject3.transform.parent = gameObject.transform;
		PersistenSingleton<EventEngine>.Instance.fieldSps = gameObject3.AddComponent<FieldSPSSystem>();
		PersistenSingleton<EventEngine>.Instance.fieldSps.Init(PersistenSingleton<EventEngine>.Instance.fieldmap);
		if (MapNo >= 3000 && MapNo <= 3012)
		{
			FF9StateSystem.Settings.CallBoosterButtonFuntion(BoosterType.BattleAssistance, false);
			FF9StateSystem.Settings.CallBoosterButtonFuntion(BoosterType.HighSpeedMode, false);
			FF9StateSystem.Settings.CallBoosterButtonFuntion(BoosterType.Attack9999, false);
			FF9StateSystem.Settings.CallBoosterButtonFuntion(BoosterType.NoRandomEncounter, false);
			PersistenSingleton<UIManager>.Instance.Booster.SetBoosterHudIcon(BoosterType.BattleAssistance, false);
			PersistenSingleton<UIManager>.Instance.Booster.SetBoosterHudIcon(BoosterType.HighSpeedMode, false);
			PersistenSingleton<UIManager>.Instance.Booster.SetBoosterHudIcon(BoosterType.Attack9999, false);
			PersistenSingleton<UIManager>.Instance.Booster.SetBoosterHudIcon(BoosterType.NoRandomEncounter, false);
			PersistenSingleton<UIManager>.Instance.SetUIPauseEnable(false);
			PersistenSingleton<UIManager>.Instance.ChangeUIState(UIManager.UIState.PreEnding);
		}
		else
		{
			PersistenSingleton<UIManager>.Instance.SetUIPauseEnable(true);
		}
		AllSoundDispatchPlayer allSoundDispatchPlayer = SoundLib.GetAllSoundDispatchPlayer();
		Int32 suspendSongID = allSoundDispatchPlayer.GetSuspendSongID();
		Int32 sndEffectResSoundID = allSoundDispatchPlayer.GetSndEffectResSoundID(0);
		Int32 sndEffectResSoundID2 = allSoundDispatchPlayer.GetSndEffectResSoundID(1);
		FF9Snd.BGMFieldSongCounter = 0;
		this.ee.StartEvents(map.evtPtr);
		FF9StateSystem.Field.SetTwistAD((Int32)this.ee.GetTwistA(), (Int32)this.ee.GetTwistD());
		PersistenSingleton<EventEngine>.Instance.eTb.InitMessage();
		PersistenSingleton<EventEngine>.Instance.eTb.InitMovieHitPoint(MapNo);
		this.FF9.npcCount = (Byte)this.ee.GetNumberNPC();
		this.fieldmap = GameObject.Find("FieldMap").GetComponent<FieldMap>();
		this.ee.updateModelsToBeAdded();
		Int32 suspendSongID2 = allSoundDispatchPlayer.GetSuspendSongID();
		Int32 sndEffectResSoundID3 = allSoundDispatchPlayer.GetSndEffectResSoundID(0);
		Int32 sndEffectResSoundID4 = allSoundDispatchPlayer.GetSndEffectResSoundID(1);
		if (suspendSongID != -1 && suspendSongID2 != -1 && suspendSongID == suspendSongID2)
		{
			FF9Snd.ff9fldsnd_song_restore();
		}
		if (FF9Snd.LatestWorldPlayedSong != -1 && FF9Snd.LatestWorldPlayedSong == SoundLib.GetAllSoundDispatchPlayer().GetCurrentMusicId() && FF9Snd.BGMFieldSongCounter == 0)
		{
			SoundLib.GetAllSoundDispatchPlayer().FF9SOUND_SONG_STOPCURRENT();
		}
		FF9Snd.LatestWorldPlayedSong = -1;
		FF9Snd.BGMFieldSongCounter = 0;
		if ((sndEffectResSoundID != -1 || sndEffectResSoundID2 != -1) && (sndEffectResSoundID3 != -1 || sndEffectResSoundID4 != -1) && sndEffectResSoundID == sndEffectResSoundID3 && sndEffectResSoundID2 == sndEffectResSoundID4)
		{
			FF9Snd.ff9fieldSoundRestoreAllResidentSndEffect();
		}
	}