private void OnLoadAssetError(string error) { IsReady = true; #if UNITY_EDITOR RTLog.LogErrorFormat(LogCat.Table, "Load Asset:{0} error:{1}", AssetPath, error); #endif }
public void Start() { if (!MainThread.IsInitilized) { RTLog.LogErrorFormat(LogCat.Table, "Can't start Table Loader \"{0}\" becaouse of no MainThread installized.", mThreadState.name); return; } if (!mThreadState.isAlive && mTaskQueue.Count > 0) { if (ThreadPool.QueueUserWorkItem(OnTableThread, mThreadState)) { mThreadState.isAlive = true; } } }
public bool Init <T>(T target) where T : MonoBehaviour { if (target == null) { return(false); } m_SuperName = target.name; bool ret = false; if (m_UseSubState) { var substat = target.transform.Find(m_StateName); m_SubFSM = substat == null ? null : substat.GetComponent <FStateMachineMono>(); if (m_SubFSM != null) { m_SubFSM.IsSubStateMachine = true; m_SubFSM.enabled = false; ret = true; } } if (!string.IsNullOrEmpty(m_BeginMethod)) { m_BeginDelegate = (System.Action)System.Delegate.CreateDelegate(typeof(System.Action), target, m_BeginMethod); ret = true; } if (!string.IsNullOrEmpty(m_TickMethod)) { m_TickDelegate = (System.Action)System.Delegate.CreateDelegate(typeof(System.Action), target, m_TickMethod); ret = true; } if (!string.IsNullOrEmpty(m_EndMethod)) { m_EndDelegate = (System.Action)System.Delegate.CreateDelegate(typeof(System.Action), target, m_EndMethod); ret = true; } #if UNITY_EDITOR if (!ret) { RTLog.LogErrorFormat(LogCat.AI, "\"{0}\" can't find {1}: {2}", target, m_UseSubState ? "sub state" : "state", m_StateName); } #endif return(ret); }
protected override T LoadAsset <T>(string assetPath) { if (typeof(T) == typeof(AssetBundle)) { var ab = GlobalUtil.Binsearch(mAbs, HashAssetID(assetPath)); #if UNITY_EDITOR if (ab == null || ab.assetBundle == null) { RTLog.LogErrorFormat(LogCat.Asset, "Faild to load AssetBundle[{0}], sync load ab only support for cached assets.", assetPath); } #endif return(ab == null ? null : ab.assetBundle as T); } else { var meta = GetOrNewMeta(assetPath); var holder = GetHandler(meta.Identify); if (holder != null) { #if UNITY_EDITOR RTLog.LogErrorFormat(LogCat.Asset, "Faild to load asset \"{0}\", because of another async loading of this asset.", assetPath); #endif return(null); } if (meta.assetInstence == null) { if (!meta.useAb) { meta.assetInstence = Resources.Load <T>(assetPath); } else if (meta.abData != null && meta.abData.assetBundle != null) { meta.assetInstence = meta.abData.assetBundle.LoadAsset <T>(assetPath); } #if UNITY_EDITOR RTLog.LogFormat(LogCat.Asset, "\"{0}\" was loaded(AssetBundle: {1}).", meta.assetPath, meta.abData == null ? "Unkown" : meta.abData.name); #endif } return(meta.assetInstence as T); } }
protected virtual void FindDomains() { var type = GetType(); var methods = type.GetMethods(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public); for (int i = 0; i < methods.Length; i++) { var mtd = methods[i]; if (mtd.ReturnType != typeof(ISitcomResult)) { continue; } var args = mtd.GetParameters(); if (args == null || args.Length != 4) { continue; } if (args[0].ParameterType != typeof(SitcomContext) || args[1].ParameterType != typeof(T) || args[2].ParameterType != typeof(string) || args[3].ParameterType != typeof(object[])) { RTLog.LogErrorFormat(LogCat.Game, " [SitcomDomain]\"{0}/{1}\" don't match args", type.Name, mtd.Name); continue; } var attr = mtd.GetCustomAttributes(typeof(SitcomDomainAttribute), true); if (attr == null || attr.Length == 0) { continue; } var call = (SitcomCall <T>)System.Delegate.CreateDelegate(typeof(SitcomCall <T>), this, mtd); for (int j = 0; j < attr.Length; j++) { var domain = attr[j] as SitcomDomainAttribute; if (domain == null) { continue; } AddDomain(domain.Name, domain.Args, call, domain.IsDefault); } } }