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 Ô¤¼ÓÔØÅöײµã¼°Õ¹Ê¾µã
|
||
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);
|
||
}
|
||
} |