Files
TaiWan/Assets/Roaming/Scripts/Loader/GameLoader.cs
2025-10-31 15:20:38 +08:00

45 lines
1.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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);
}
}