public bool RemoveResource(string szResourceFullPath) { string szlowerResourcePath = AssetBundleResourceInfo.GetRemoveExtPath(szResourceFullPath).ToLower(); if (m_ResourceList.ContainsKey(szlowerResourcePath) == false) { return(false); } AssetBundleResourceInfo resource = m_ResourceList[szlowerResourcePath]; AssetBundleInfo assetbundleinfo = m_AssetBundleList[resource.m_AssetBundleKey]; if (assetbundleinfo != null) { assetbundleinfo.m_ResourceList.Remove(szlowerResourcePath); if (assetbundleinfo.m_ResourceList.Count == 0) { m_AssetBundleList.Remove(assetbundleinfo.GetBundleMidPath() + assetbundleinfo.m_szAssetRealBundleName); } } else { Debug.LogError("assetbundle info is null"); } resource.Clear(); m_ResourceList.Remove(szlowerResourcePath); return(true); }
public bool UpdateResource(string szResourceFullPath) { if (File.Exists(szResourceFullPath) == false) { return(false); } string szlowerResourcePath = AssetBundleResourceInfo.GetRemoveExtPath(szResourceFullPath).ToLower(); if (m_ResourceList.ContainsKey(szlowerResourcePath) == false) { return(false); } AssetBundleResourceInfo resource = m_ResourceList[szlowerResourcePath]; AssetBundleInfo bundleInfo = m_AssetBundleList[resource.m_AssetBundleKey]; if (bundleInfo == null) { Debug.LogError("assetbundle info is null : @" + resource.m_AssetBundleKey); } FileInfo fileInfo = new FileInfo(szResourceFullPath); resource.m_dateResource = fileInfo.LastWriteTime; resource.m_lResourceSize = fileInfo.Length; FileInfo metaFileInfo = new FileInfo(szResourceFullPath + @".meta"); resource.m_dateMetaResource = metaFileInfo.LastWriteTime; resource.m_lMetaResourceSize = metaFileInfo.Length; return(true); }
/// <summary> /// skeleton setting /// </summary> public void SetSkeleton() { if (transformList.Count <= 0) { EACharacterInfo characterInfo = transform.GetComponent <EACharacterInfo>(); if (characterInfo != null) { Transform[] transforms = characterInfo.Bones; string[] BoneNames = characterInfo.BoneNames; for (int i = 0; i < transforms.Length; ++i) { int key = CRC32.GetHashForAnsi(BoneNames[i]); transformList.Add(key, transforms[i]); } } else { Debug.LogError("SetSkeleton - EACharacterInfo is null : " + gameObject.name); Transform[] transforms = transform.GetComponentsInChildren <Transform>(); for (int i = 0; i < transforms.Length; ++i) { int key = CRC32.GetHashForAnsi(transforms[i].name); Transform value = null; if (!transformList.TryGetValue(key, out value)) { transformList.Add(key, transforms[i]); } } } } Transform mesh = GetTransform("mesh"); if (mesh != null) { mesh.transform.parent = null; GameObject.Destroy(mesh.gameObject); } GameObject _mesh = EAFrameUtil.AddChild(gameObject, "mesh"); if (_mesh != null) { AddTransform("mesh", _mesh.transform); } }
static string Translate(string key) { string msg = ""; try { msg = ""; } catch (System.Exception ex) { Debug.LogError(ex.ToString()); } return(msg); }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="tableKey"></param> /// <returns></returns> public T GetData <T>(string tableKey) where T : DataInfo { DataTable table = null; string tableName = typeof(T).Name; int key = CRC32.GetHashForAnsi(tableName); _dicDataTables.TryGetValue(key, out table); if (table != null) { return((T)table.FindByKey(tableKey)); } Debug.LogError("not find data type " + typeof(T) + " key=" + tableKey); return(default(T)); }
void _OnTweenComplete(TweenEvent te) { if (onComplete != null) { Event e = new Event(); e.number = _number; e.parms = te.parms; try { onComplete(e); } catch (MissingReferenceException) { // When GameObject is destroyed during Tween Update. } catch (Exception ex) { Debug.LogError(ex.ToString()); } } }
void Update() { // CloseCurrScene -> WaitOldSceneCloseWait -> WaitOldSceneClose -> WaitUnloadUnusedAssets -> StartAsync -> OnSyncLoading -> OnSyncLoadingWait // -> Finalize switch (_state) { case State.CloseCurrScene: { Debug.Log("SceneLoadingManager - CloseCurrScene"); _state = State.WaitOldSceneCloseWait; } break; case State.WaitOldSceneCloseWait: { if (EASceneLogic.instance != null) { EASceneLogic.instance.Destroy(); _state = State.WaitOldSceneClose; } } break; case State.WaitOldSceneClose: { Debug.Log("SceneLoadingManager - WaitOldSceneClose"); // Wait for the previous scene to end. _unloadAsync = Resources.UnloadUnusedAssets(); _state = State.WaitUnloadUnusedAssets; } break; case State.WaitUnloadUnusedAssets: { Debug.Log("SceneLoadingManager - WaitUnloadUnusedAssets"); if (_unloadAsync == null || _unloadAsync.isDone) { _unloadAsync = null; System.GC.Collect(); _state = State.StartAsync; } } break; case State.StartAsync: { Debug.Log("SceneLoadingManager - StartAsync "); _async = Application_LoadLevelAsync(_sceneNameToLoad); if (_async == null) { Debug.LogError("Cannot load scene: " + _sceneNameToLoad); break; } _state = State.OnSyncLoading; } break; case State.OnSyncLoading: { Debug.Log("SceneLoadingManager - OnSyncLoading"); if (_async.isDone && EASceneLogic.instance != null) { _state = State.OnSyncLoadingWait; EASceneLogic.instance.Init(); if (isPassFadeInEffect == false) { _state = State.Finalize; } else { _state = State.Finalize; } } } break; case State.OnSyncLoadingWait: break; case State.Finalize: { FinalizeLevelAsync(_sceneNameToLoad); Debug.Log("SceneLoadingManager - Finalize"); if (EASceneLogic.instance != null) { EASceneLogic.instance.DoPostInit(); _async = null; _state = State.None; _currSceneId = _sceneNameToLoad; } } break; } }
public static bool EntitySetting(EA_CObjectBase pSetObject, ObjectInfo SetObjinfo) { if (null == pSetObject) { Debug.Log("EntitySetting pSetObject is null :" + SetObjinfo.m_strGameName); return(false); } if (eObjectState.CS_SETENTITY != SetObjinfo.m_eObjState) { return(false); } string poolType = SetObjinfo.m_ModelTypeIndex; GameObject pGameObject = CObjResourcePoolingManager.instance.Spwan(poolType); pSetObject.SetLinkEntity(pGameObject); if (pGameObject == null) { Debug.LogError("EntitySetting Game object is invalid. type : " + poolType + ", name : " + pSetObject.GetObjInfo().m_strGameName); return(false); } // Modify class creation logic [3/30/2018 puos] if (SetObjinfo.m_objClassType != default(Type)) { if (pGameObject.GetComponent(SetObjinfo.m_objClassType) == null) { pGameObject.AddComponent(SetObjinfo.m_objClassType); } } // Create around object table switch (SetObjinfo.m_eObjType) { case eObjectType.CT_NPC: case eObjectType.CT_MONSTER: case eObjectType.CT_PLAYER: case eObjectType.CT_MYPLAYER: { EAActor actor = pGameObject.GetComponent <EAActor>(); if (actor == null) { actor = pGameObject.AddComponent <EAActor>(); SetObjinfo.m_objClassType = typeof(EAActor); } ((EA_CCharBPlayer)pSetObject).SetLinkActor(actor); } break; case eObjectType.CT_MAPOBJECT: { EAMapObject mapObject = pGameObject.GetComponent <EAMapObject>(); if (mapObject == null) { mapObject = pGameObject.AddComponent <EAMapObject>(); SetObjinfo.m_objClassType = typeof(EAMapObject); } ((EA_CMapObject)pSetObject).SetLinkMapObject(mapObject); } break; case eObjectType.CT_ITEMOBJECT: { EAItem itemObject = pGameObject.GetComponent <EAItem>(); if (itemObject == null) { itemObject = pGameObject.AddComponent <EAItem>(); SetObjinfo.m_objClassType = typeof(EAItem); } ((EA_CItem)pSetObject).SetLinkItem(itemObject); } break; } //Debug.Log("EntitySetting pSetObject :" + SetObjinfo.m_ModelTypeIndex); return(true); }