cleaner code
This commit is contained in:
parent
aef7744062
commit
1558b6a66b
|
@ -157,16 +157,17 @@ namespace HeavenStudio
|
||||||
|
|
||||||
public IEnumerator LoadAssetBundleAsync(string gameName)
|
public IEnumerator LoadAssetBundleAsync(string gameName)
|
||||||
{
|
{
|
||||||
string minigameBundle = GetGameInfo(gameName).wantAssetBundle;
|
string inf = GetGameInfo(gameName);
|
||||||
if (minigameBundle == null || minigameBundle == "")
|
if (!inf.usesAssetBundle)
|
||||||
{
|
{
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loadedAssetBundles.ContainsKey(gameName))
|
if (loadedAssetBundles.ContainsKey(gameName))
|
||||||
{
|
{
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
AssetBundleCreateRequest asyncBundleRequest = AssetBundle.LoadFromFileAsync(Path.Combine(Application.streamingAssetsPath, minigameBundle));
|
AssetBundleCreateRequest asyncBundleRequest = AssetBundle.LoadFromFileAsync(Path.Combine(Application.streamingAssetsPath, inf.wantAssetBundle));
|
||||||
yield return asyncBundleRequest;
|
yield return asyncBundleRequest;
|
||||||
|
|
||||||
if (loadedAssetBundles.ContainsKey(gameName))
|
if (loadedAssetBundles.ContainsKey(gameName))
|
||||||
|
@ -217,8 +218,8 @@ namespace HeavenStudio
|
||||||
{
|
{
|
||||||
string gameName = gameSwitchs[currentPreSwitch].datamodel.Split(2);
|
string gameName = gameSwitchs[currentPreSwitch].datamodel.Split(2);
|
||||||
Debug.Log("checking if assetbundle for game " + gameName);
|
Debug.Log("checking if assetbundle for game " + gameName);
|
||||||
string minigameBundle = GetGameInfo(gameName).wantAssetBundle;
|
string inf = GetGameInfo(gameName);
|
||||||
if (!(minigameBundle == null || minigameBundle == ""))
|
if (inf.usesAssetBundle)
|
||||||
{
|
{
|
||||||
if (!loadedAssetBundles.ContainsKey(gameName))
|
if (!loadedAssetBundles.ContainsKey(gameName))
|
||||||
{
|
{
|
||||||
|
@ -239,8 +240,8 @@ namespace HeavenStudio
|
||||||
{
|
{
|
||||||
string gameName = entitiesAtSameBeat[i].datamodel.Split('/')[0];
|
string gameName = entitiesAtSameBeat[i].datamodel.Split('/')[0];
|
||||||
Debug.Log("checking if assetbundle for game " + gameName);
|
Debug.Log("checking if assetbundle for game " + gameName);
|
||||||
string minigameBundle = GetGameInfo(gameName).wantAssetBundle;
|
string inf = GetGameInfo(gameName);
|
||||||
if (minigameBundle == null || minigameBundle == "")
|
if (!inf.usesAssetBundle)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -522,7 +523,7 @@ namespace HeavenStudio
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gameInfo.wantAssetBundle != "")
|
if (gameInfo.usesAssetBundle)
|
||||||
{
|
{
|
||||||
//game is packed in an assetbundle, load from that instead
|
//game is packed in an assetbundle, load from that instead
|
||||||
if (!loadedAssetBundles.ContainsKey(name))
|
if (!loadedAssetBundles.ContainsKey(name))
|
||||||
|
|
|
@ -29,6 +29,8 @@ namespace HeavenStudio
|
||||||
public List<string> tags;
|
public List<string> tags;
|
||||||
public string wantAssetBundle = "";
|
public string wantAssetBundle = "";
|
||||||
|
|
||||||
|
public bool usesAssetBundle => (wantAssetBundle != "");
|
||||||
|
|
||||||
public Minigame(string name, string displayName, string color, bool threeD, bool fxOnly, List<GameAction> actions, List<string> tags = null, string assetBundle = "")
|
public Minigame(string name, string displayName, string color, bool threeD, bool fxOnly, List<GameAction> actions, List<string> tags = null, string assetBundle = "")
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
Loading…
Reference in a new issue