diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 35d028c2f..8593775e6 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -192,6 +192,7 @@ namespace HeavenStudio Debug.Log("ASYNC loading assetbundle for game " + gameName); StartCoroutine(inf.LoadCommonAssetBundleAsync()); StartCoroutine(inf.LoadLocalizedAssetBundleAsync()); + StartCoroutine(inf.LoadVersionAssetBundleAsync()); } currentPreSwitch++; } @@ -212,6 +213,7 @@ namespace HeavenStudio Debug.Log("ASYNC loading assetbundle for game " + gameName); StartCoroutine(inf.LoadCommonAssetBundleAsync()); StartCoroutine(inf.LoadLocalizedAssetBundleAsync()); + StartCoroutine(inf.LoadVersionAssetBundleAsync()); } } currentPreEvent++; diff --git a/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs b/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs index b2414c9b1..2fe68f352 100644 --- a/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs +++ b/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs @@ -41,6 +41,27 @@ namespace HeavenStudio.Games.Loaders }, inactiveFunction = delegate { SpaceSoccer.Voice(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"]); } }, + new GameAction("set bg color", "Set Background Color") + { + function = delegate { var e = eventCaller.currentEntity; SpaceSoccer.instance.ChangeBackgroundColor(0f, e["type"], e["color"]); }, + defaultLength = 0.5f, + parameters = new List() + { + new Param("type", SpaceSoccer.BackgroundColors.Ver0, "Backgrounds", "The normal backgrounds used in the game"), + new Param("color", SpaceSoccer.ver0BgColor, "Custom Color", "Custom background color"), + } + }, + new GameAction("fade bg color", "Fade Background Color") + { + function = delegate { var e = eventCaller.currentEntity; SpaceSoccer.instance.ChangeBackgroundColor(e.length, e["type"], e["color"]); }, + defaultLength = 1f, + resizable = true, + parameters = new List() + { + new Param("type", SpaceSoccer.BackgroundColors.Ver0, "Backgrounds", "The normal backgrounds used in the game"), + new Param("color", SpaceSoccer.ver1BgColor, "Background Color", "Changes the background color"), + } + }, // This is still here for "backwards-compatibility" but is hidden in the editor (it does absolutely nothing however) new GameAction("keep-up", "") { @@ -50,8 +71,9 @@ namespace HeavenStudio.Games.Loaders }, }, new List() {"ntr", "keep"}, - "ntrlifting", "jp", - new List() {"en", "jp", "ko"} + "ntrlifting", "jp", Minigames.Version, //"remix6", + new List() {"en", "jp", "ko"}, + new List() {"ver0", "ver2", "remix6"} ); } } @@ -59,6 +81,7 @@ namespace HeavenStudio.Games.Loaders namespace HeavenStudio.Games { + using DG.Tweening; using Scripts_SpaceSoccer; public class SpaceSoccer : Minigame @@ -73,6 +96,13 @@ namespace HeavenStudio.Games Toe, } + public enum BackgroundColors + { + Ver0, + Ver1, + Custom + } + [Header("Components")] [SerializeField] private GameObject ballRef; [SerializeField] private List kickers; @@ -82,8 +112,30 @@ namespace HeavenStudio.Games [Header("Properties")] [SerializeField] private bool ballDispensed; //unused - public static SpaceSoccer instance { get; private set; } + [Header("Backgrounds")] + public SpriteRenderer bg; + Tween bgColorTween; + + public static SpaceSoccer instance { get; private set; } + private static Color _ver0BgColor; + public static Color ver0BgColor + { + get + { + ColorUtility.TryParseHtmlString("#FF7D27", out _ver0BgColor); + return _ver0BgColor; + } + } + private static Color _ver1BgColor; + public static Color ver1BgColor + { + get + { + ColorUtility.TryParseHtmlString("#010161", out _ver1BgColor); + return _ver1BgColor; + } + } private void Awake() { instance = this; @@ -167,6 +219,36 @@ namespace HeavenStudio.Games string[] VoiceClips = { "down", "and", "andAlt", "kick", "highkicktoe1", "highkicktoe3" }; Jukebox.PlayOneShotGame("spaceSoccer/" + VoiceClips[type], forcePlay:true); } + + public void ChangeBackgroundColor(float beats, int type, Color color) + { + var seconds = Conductor.instance.secPerBeat * beats; + var newColor = color; + + if (bgColorTween != null) + bgColorTween.Kill(true); + + switch (type) + { + case (int) BackgroundColors.Ver0: + newColor = _ver0BgColor; + break; + case (int) BackgroundColors.Ver1: + newColor = _ver1BgColor; + break; + default: + break; + } + + if (seconds == 0) + { + bg.color = newColor; + } + else + { + bgColorTween = bg.DOColor(newColor, seconds); + } + } } } \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/Editor.cs b/Assets/Scripts/LevelEditor/Editor.cs index c7acd495f..4e2b3617d 100644 --- a/Assets/Scripts/LevelEditor/Editor.cs +++ b/Assets/Scripts/LevelEditor/Editor.cs @@ -518,7 +518,7 @@ namespace HeavenStudio.Editor private void UpdateEditorStatus(bool updateTime) { if (discordDuringTesting || !Application.isEditor) - DiscordRPC.DiscordRPC.UpdateActivity("リミックスを作っている", $"{remixName}", updateTime);//("In Editor", $"{remixName}", updateTime); + DiscordRPC.DiscordRPC.UpdateActivity("In Editor", $"{remixName}", updateTime); } public string GetJson() diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index c9f08e2f3..2529927ce 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -19,7 +19,6 @@ namespace HeavenStudio public class Minigames { - public string cueLanguage; public class Minigame { public string name; @@ -32,12 +31,15 @@ namespace HeavenStudio public List tags; public string defaultLocale = "en"; + public string defaultVersion = "ver0"; public string wantAssetBundle = ""; public List supportedLocales; + public List gameVersions; public bool usesAssetBundle => (wantAssetBundle != ""); public bool hasLocales => (supportedLocales.Count > 0); - public bool AssetsLoaded => (((hasLocales && localeLoaded && currentLoadedLocale == defaultLocale) || (!hasLocales)) && commonLoaded); + public bool hasVersions => (gameVersions.Count > 0); + public bool AssetsLoaded => (((hasLocales && localeLoaded && currentLoadedLocale == defaultLocale) || (hasVersions && versionLoaded && currentLoadedVersion == defaultVersion) || (!hasLocales || !hasVersions)) && commonLoaded); private AssetBundle bundleCommon = null; private bool commonLoaded = false; @@ -46,8 +48,12 @@ namespace HeavenStudio private AssetBundle bundleLocalized = null; private bool localeLoaded = false; private bool localePreloaded = false; + private string currentLoadedVersion = ""; + private AssetBundle bundleVersion = null; + private bool versionLoaded = false; + private bool versionPreloaded = false; - public Minigame(string name, string displayName, string color, bool threeD, bool fxOnly, List actions, List tags = null, string assetBundle = "", string defaultLocale = "en", List supportedLocales = null) + public Minigame(string name, string displayName, string color, bool threeD, bool fxOnly, List actions, List tags = null, string assetBundle = "", string defaultLocale = "en", string defaultVersion = "ver0", List supportedLocales = null, List gameVersions = null) { this.name = name; this.displayName = displayName; @@ -60,6 +66,23 @@ namespace HeavenStudio this.wantAssetBundle = assetBundle; this.defaultLocale = defaultLocale; this.supportedLocales = supportedLocales ?? new List(); + this.defaultVersion = defaultVersion; + this.gameVersions = gameVersions; + } + + public AssetBundle GetVariationAssetBundle() + { + if (!hasVersions) return null; + if (!usesAssetBundle) return null; + if (bundleVersion == null || currentLoadedVersion != defaultVersion) //TEMPORARY: use the game's default locale until we add localization support + { + if (versionLoaded) return bundleVersion; + // TODO: try/catch for missing assetbundles + currentLoadedVersion = defaultVersion; + bundleLocalized = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, wantAssetBundle + "/ver." + defaultVersion)); + versionLoaded = true; + } + return bundleVersion; } public AssetBundle GetLocalizedAssetBundle() @@ -133,6 +156,29 @@ namespace HeavenStudio currentLoadedLocale = defaultLocale; localeLoaded = true; } + + public IEnumerator LoadVersionAssetBundleAsync() + { + if (versionPreloaded) yield break; + versionPreloaded = true; + if (!hasVersions) yield break; + if (!usesAssetBundle) yield break; + if (versionLoaded && bundleVersion != null && currentLoadedVersion == defaultVersion) yield break; + + AssetBundleCreateRequest asyncBundleRequest = AssetBundle.LoadFromFileAsync(Path.Combine(Application.streamingAssetsPath, wantAssetBundle + "/ver." + defaultVersion)); + if (versionLoaded && bundleVersion != null && currentLoadedVersion == defaultVersion) yield break; + yield return asyncBundleRequest; + + AssetBundle localAssetBundle = asyncBundleRequest.assetBundle; + if (versionLoaded && bundleVersion != null && currentLoadedVersion == defaultVersion) yield break; + yield return localAssetBundle; + + if (localAssetBundle == null) yield break; + + bundleVersion = localAssetBundle; + currentLoadedVersion = defaultVersion; + versionLoaded = true; + } } public class GameAction @@ -234,8 +280,10 @@ namespace HeavenStudio } + public static string Version = "remix6"; public static void Init(EventCaller eventCaller) { + Version = "remix6"; eventCaller.minigames = new List() { new Minigame("gameManager", "Game Manager", "", false, true, new List() @@ -264,13 +312,6 @@ namespace HeavenStudio GameManager.instance.ToggleInputs(eventCaller.currentEntity["toggle"]); } ), - //new GameAction("cueLanguage", "Cue Language", 0.5f, false, - // new List() - // { - // new Param("type", SoundEffects.Langauges.English, "Language", "The language the cues will be in") - // }, - // delegate { SoundEffects.LanguageChange(this, eventCaller.currentEntity["type"]); } - //), // These are still here for backwards-compatibility but are hidden in the editor new GameAction("flash", "", 1f, true, diff --git a/Assets/Scripts/SoundEffects.cs b/Assets/Scripts/SoundEffects.cs index 641b07cff..2589e68ea 100644 --- a/Assets/Scripts/SoundEffects.cs +++ b/Assets/Scripts/SoundEffects.cs @@ -99,12 +99,6 @@ namespace HeavenStudio sound += "2"; Jukebox.PlayOneShot(sound); } - - public static void LanguageChange(Minigames minigame, int lang) - { - string[] languages = { "en", "jp", "ko" }; - minigame.cueLanguage = languages[lang]; - } } } \ No newline at end of file