public static FResManager getInstance() { if (m_inst == null) { m_inst = new FResManager(); } return(m_inst); }
public override void stop() { UnityEngine.Object prefab = FResManager.getInstance().getRes(FResID.PREFAB); if (prefab == null) { Debug.LogError("请先执行" + typeof(FLoadAsset).FullName + "(FResID.PREFAB)"); return; } GameObject go = GameObject.Instantiate(prefab, m_parent) as GameObject; FResManager.getInstance().setRes(FResID.GAMEOBJECT, go); }
public override void stop() { GameObject go = new GameObject("genTexture"); go.transform.parent = m_parent; go.transform.localPosition = Vector3.zero; go.transform.localEulerAngles = Vector3.zero; go.transform.localScale = Vector3.one; Sprite sprite = FResManager.getInstance().getRes(FResID.SPRITE) as Sprite; if (sprite == null) { Debug.LogError("请先执行" + typeof(FLoadAsset).FullName + "(FResID.SPRITE)"); return; } Image imgCtrl = go.AddComponent <Image> (); imgCtrl.sprite = sprite; imgCtrl.SetNativeSize(); }
public override void stop() { UnityEngine.Object res = FResManager.getInstance().getRes(m_resId); switch (m_resId) { case FResID.ASSETBUNDLE: (res as UnityEngine.AssetBundle).Unload(false); break; case FResID.PREFAB: // UnloadAsset may only be used on individual assets and can not be used on GameObject's / Components or AssetBundles break; case FResID.TEXTURE: UnityEngine.Resources.UnloadAsset(res); break; case FResID.SPRITE: UnityEngine.Resources.UnloadAsset(res); break; case FResID.FONT: UnityEngine.Resources.UnloadAsset(res); break; case FResID.AUDIO: UnityEngine.Resources.UnloadAsset(res); break; case FResID.FX: UnityEngine.Resources.UnloadAsset(res); break; default: UnityEngine.Resources.UnloadAsset(res); break; } FResManager.getInstance().setRes(m_resId, null); }
public void pushPanel(string uiName, loaded_callback loaded) { FSequence seq = new FSequence(); seq.addAction(new FLoadAsset(FResID.PREFAB, "gui/" + uiName)); seq.addAction(new FGenGameObject(m_canvas.transform)); seq.addAction(new FUnloadAsset(FResID.PREFAB)); seq.addAction(new FCallFunc(delegate() { GameObject go = FResManager.getInstance().getRes(FResID.GAMEOBJECT) as GameObject; go.name = uiName; FLuaBehaviour luaBehaviour = go.GetComponent <FLuaBehaviour> (); if (luaBehaviour == null) { luaBehaviour = go.AddComponent <FLuaBehaviour> (); } if (loaded != null) { loaded(go); } })); this.runAction(seq); }
public override void stop() { FResManager.getInstance().setRes(FResID.ASSETBUNDLE, m_request.assetBundle); }
public override void stop() { FResManager.getInstance().setRes(m_resId, m_request.asset); }
public override void start(System.Object obj) { UnityEngine.AssetBundle bundle = FResManager.getInstance().getRes(FResID.ASSETBUNDLE) as UnityEngine.AssetBundle; m_request = bundle.LoadAssetAsync(m_resPath.ToLower()); // AssetBundle中所有资源名称和路径都是小写 }