public static void sys_bg_png(VNNeoController game, string param = "") { string pngInDefault; // set background png, param = png file name var pngName = param.Trim(); if (pngName != "") { if (!pngName.ToLower().EndsWith(".png")) { pngName += ".png"; } // load png in game scene folder if existed var pngInScene = combine_path(game.get_scene_dir(), game.sceneDir, pngName); if (File.Exists(pngInScene)) { game.scene_set_bg_png(pngName); return; } // load png in game default background folder if existed pngInDefault = Path.GetFullPath(combine_path(Application.dataPath, "..", "UserData", "bg", pngName)); if (File.Exists(pngInDefault)) { game.scene_set_bg_png_orig(pngName); return; } } // remove if param == "" or file not existed game.scene_set_bg_png_orig(""); }
public static void sys_wav(VNNeoController game, Wav_s param) { string wavRevPath; // set outside wav sound, param = (wav file, play, repeat) var wavName = param.fileName.Trim(); if (wavName != "") { if (!wavName.ToLower().EndsWith(".wav")) { wavName += ".wav"; } // load wav in game scene folder if existed var wavInScene = combine_path(game.get_scene_dir(), game.sceneDir, wavName); if (File.Exists(wavInScene)) { wavRevPath = combine_path("..", "studio", "scene", game.sceneDir, wavName); if (game.studio.outsideSoundCtrl.fileName != wavRevPath) { game.studio.outsideSoundCtrl.Play(wavRevPath); } } else { // load wav in game default audio folder if existed var wavInDefault = Path.GetFullPath(combine_path(Application.dataPath, "..", "UserData", "audio", wavName)); if (File.Exists(wavInDefault)) { if (game.studio.outsideSoundCtrl.fileName != wavName) { game.studio.outsideSoundCtrl.Play(wavName); } } } } if (game.studio.outsideSoundCtrl.play != param.play || wavName == "") { if (param.play) { game.studio.outsideSoundCtrl.Play(); } else { game.studio.outsideSoundCtrl.Stop(); } } if (param.repeat) { game.studio.outsideSoundCtrl.repeat = BGMCtrl.Repeat.All; } else { game.studio.outsideSoundCtrl.repeat = BGMCtrl.Repeat.None; } }