45 lines
1.0 KiB
C#
45 lines
1.0 KiB
C#
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using System.Linq;
|
|||
|
|
using UnityEngine.Events;
|
|||
|
|
|
|||
|
|
public class GameLoaderX : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
public static GameLoaderX Instance;
|
|||
|
|
|
|||
|
|
private void Awake()
|
|||
|
|
{
|
|||
|
|
Instance = this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region Ԥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD>㼰չʾ<EFBFBD><EFBFBD>
|
|||
|
|
public Transform tranMainScene;
|
|||
|
|
|
|||
|
|
private void Start()
|
|||
|
|
{
|
|||
|
|
Invoke("LoadSpots", 0.5f);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void LoadSpots()
|
|||
|
|
{
|
|||
|
|
LoadGame("Spots", "Spots", OnBundleLoaded);
|
|||
|
|
LoadGame("TipPoints", "TipPoints", OnBundleLoaded);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void OnBundleLoaded()
|
|||
|
|
{
|
|||
|
|
BundleLoader.CurrentBundleObject.transform.parent = tranMainScene;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
public void LoadGame(string gameName, string bundleName=null, UnityAction BundleLoaded = null)
|
|||
|
|
{
|
|||
|
|
if(bundleName == null)
|
|||
|
|
{
|
|||
|
|
bundleName = gameName;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
BundleLoader.Instance.LoadBundle( CommonData.DataServer + "/Bundles/" + bundleName + ".assetbundle", gameName, BundleLoaded);
|
|||
|
|
}
|
|||
|
|
}
|