| | |
| | | using UnityEngine;
|
| | |
|
| | | using System.Collections.Generic;
|
| | | using System;
|
| | |
|
| | | public class UI3DModelFactory
|
| | | {
|
| | |
|
| | | static UI3DModelFactory()
|
| | | {
|
| | | GlobalTimeEvent.Instance.minuteEvent += OnPerMinute;
|
| | | }
|
| | |
|
| | | static Dictionary<int, GameObject> jobModels = new Dictionary<int, GameObject>();
|
| | |
|
| | | public static void LoadCreateRole(int job, Action<bool, UnityEngine.Object> _callBack)
|
| | | {
|
| | | if (jobModels.ContainsKey(job))
|
| | | {
|
| | | if (_callBack != null)
|
| | | {
|
| | | _callBack(true, jobModels[job]);
|
| | | }
|
| | |
|
| | | return;
|
| | | }
|
| | |
|
| | | Action<bool, UnityEngine.Object> assetCallBack = (bool _ok, UnityEngine.Object _asset) =>
|
| | | {
|
| | | GameObject instance = null;
|
| | | if (_ok)
|
| | | {
|
| | | instance = GameObject.Instantiate(_asset) as GameObject;
|
| | | if (instance != null)
|
| | | {
|
| | | jobModels[job] = instance;
|
| | | }
|
| | | }
|
| | |
|
| | | if (_callBack != null)
|
| | | {
|
| | | _callBack(_ok && instance != null, instance);
|
| | | }
|
| | | };
|
| | |
|
| | | InstanceResourcesLoader.LoadCreateRole(job, assetCallBack);
|
| | | }
|
| | |
|
| | | public static void ReleaseCreateRole(int job)
|
| | | {
|
| | | if (jobModels.ContainsKey(job))
|
| | | {
|
| | | jobModels[job].gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | public static void ClearCreateRole()
|
| | | {
|
| | | jobModels.Clear();
|
| | |
|
| | | if (!AssetSource.mobFromEditor)
|
| | | {
|
| | | AssetBundleUtility.Instance.UnloadAssetBundle("mob/createrole", true, false);
|
| | | }
|
| | | }
|
| | |
|
| | | public static GameObject LoadUINPC(int id)
|