infer gameswitches from json (#381)
This commit is contained in:
parent
1f407aae85
commit
be78d1567e
|
@ -356,7 +356,7 @@ namespace HeavenStudio
|
|||
if (game == null)
|
||||
{
|
||||
Debug.LogWarning($"Unknown game {gameName} found in remix.json! Adding game...");
|
||||
game = new Minigames.Minigame(gameName, DisplayName(gameName) + " \n<color=#eb5454>[inferred from remix.json]</color>", "", false, true, new List<Minigames.GameAction>());
|
||||
game = new Minigames.Minigame(gameName, DisplayName(gameName) + " \n<color=#eb5454>[inferred from remix.json]</color>", "", false, false, new List<Minigames.GameAction>(), inferred: true);
|
||||
EventCaller.instance.minigames.Add(game);
|
||||
if (Editor.Editor.instance != null)
|
||||
Editor.Editor.instance.AddIcon(game);
|
||||
|
|
|
@ -709,18 +709,13 @@ namespace HeavenStudio
|
|||
{
|
||||
if (gameInfo.fxOnly)
|
||||
{
|
||||
var gameEntities = Beatmap.entities.FindAll(c => {
|
||||
var gameName = c.datamodel.Split(0);
|
||||
var newGameInfo = GetGameInfo(gameName);
|
||||
if (newGameInfo == null)
|
||||
return false;
|
||||
else
|
||||
return !newGameInfo.fxOnly;
|
||||
}).ToList();
|
||||
if (gameEntities.Count != 0)
|
||||
name = gameEntities[0].datamodel.Split(0);
|
||||
else
|
||||
name = "noGame";
|
||||
var gameInfos = Beatmap.entities
|
||||
.Select(x => x.datamodel.Split(0))
|
||||
.Select(x => GetGameInfo(x))
|
||||
.Where(x => x != null)
|
||||
.Where(x => !x.fxOnly)
|
||||
.Select(x => x.LoadableName);
|
||||
name = gameInfos.FirstOrDefault() ?? "noGame";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -729,6 +724,7 @@ namespace HeavenStudio
|
|||
//game is packed in an assetbundle, load from that instead
|
||||
return gameInfo.GetCommonAssetBundle().LoadAsset<GameObject>(name);
|
||||
}
|
||||
name = gameInfo.LoadableName;
|
||||
}
|
||||
}
|
||||
return Resources.Load<GameObject>($"Games/{name}");
|
||||
|
|
|
@ -33,11 +33,13 @@ namespace HeavenStudio
|
|||
public string defaultLocale = "en";
|
||||
public string wantAssetBundle = "";
|
||||
public List<string> supportedLocales;
|
||||
public bool inferred;
|
||||
|
||||
public bool usesAssetBundle => (wantAssetBundle != "");
|
||||
public bool hasLocales => (supportedLocales.Count > 0);
|
||||
public bool AssetsLoaded => (((hasLocales && localeLoaded && currentLoadedLocale == defaultLocale) || (!hasLocales)) && commonLoaded);
|
||||
public bool SequencesPreloaded => soundSequences != null;
|
||||
public string LoadableName => inferred ? "noGame" : name;
|
||||
|
||||
private AssetBundle bundleCommon = null;
|
||||
private bool commonLoaded = false;
|
||||
|
@ -55,7 +57,7 @@ namespace HeavenStudio
|
|||
set => soundSequences = value;
|
||||
}
|
||||
|
||||
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", List<string> supportedLocales = null, bool inferred = false)
|
||||
{
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
|
@ -68,6 +70,7 @@ namespace HeavenStudio
|
|||
this.wantAssetBundle = assetBundle;
|
||||
this.defaultLocale = defaultLocale;
|
||||
this.supportedLocales = supportedLocales ?? new List<string>();
|
||||
this.inferred = inferred;
|
||||
}
|
||||
|
||||
public AssetBundle GetLocalizedAssetBundle()
|
||||
|
|
Loading…
Reference in a new issue