Space Soccer, Minigames
Adds background changing, and adds the new ver stuff, add game versions to the Asset Bundle stuff (and remove some testing code)
This commit is contained in:
parent
ae44bebf90
commit
a360735531
|
@ -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++;
|
||||
|
|
|
@ -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<Param>()
|
||||
{
|
||||
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<Param>()
|
||||
{
|
||||
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<string>() {"ntr", "keep"},
|
||||
"ntrlifting", "jp",
|
||||
new List<string>() {"en", "jp", "ko"}
|
||||
"ntrlifting", "jp", Minigames.Version, //"remix6",
|
||||
new List<string>() {"en", "jp", "ko"},
|
||||
new List<string>() {"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<Kicker> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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()
|
||||
|
|
|
@ -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<string> tags;
|
||||
public string defaultLocale = "en";
|
||||
public string defaultVersion = "ver0";
|
||||
public string wantAssetBundle = "";
|
||||
public List<string> supportedLocales;
|
||||
public List<string> 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<GameAction> actions, List<string> tags = null, string assetBundle = "", string defaultLocale = "en", List<string> supportedLocales = null)
|
||||
public Minigame(string name, string displayName, string color, bool threeD, bool fxOnly, List<GameAction> actions, List<string> tags = null, string assetBundle = "", string defaultLocale = "en", string defaultVersion = "ver0", List<string> supportedLocales = null, List<string> 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<string>();
|
||||
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<Minigame>()
|
||||
{
|
||||
new Minigame("gameManager", "Game Manager", "", false, true, new List<GameAction>()
|
||||
|
@ -264,13 +312,6 @@ namespace HeavenStudio
|
|||
GameManager.instance.ToggleInputs(eventCaller.currentEntity["toggle"]);
|
||||
}
|
||||
),
|
||||
//new GameAction("cueLanguage", "Cue Language", 0.5f, false,
|
||||
// new List<Param>()
|
||||
// {
|
||||
// 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,
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue