public void Init(int dataCount) { if (scrollRect == null || content == null || goItemPrefab == null) { TTLoger.LogError("异常:请检测<" + gameObject.name + ">对象上UIWarpContent对应ScrollRect、Content、GoItemPrefab 是否存在值...." + scrollRect + " _" + content + "_" + goItemPrefab); return; } if (dataCount < 0) { return; } setDataCount(dataCount); if (arrangement == Arrangement.Page) { scrollRect.inertia = false; } //移除 for (int i = listItem.Count - 1; i >= 0; i--) { UIWarpContentItem item = listItem[i]; item.Index = -1; unUseItem.Enqueue(item); } listItem.Clear(); setUpdateRectItem(getCurScrollPerLineIndex()); }
public static void CopyGOPath() { GameObject obj = Selection.gameObjects[0]; List <string> strList = new List <string>(); strList.Add(obj.name); Transform trans = obj.transform; while (trans.parent != null) { strList.Add(trans.parent.name); trans = trans.parent; } strList.Reverse(); StringBuilder sb = new StringBuilder(); for (int i = 1; i < strList.Count; i++) { sb.Append(strList[i]); if (i != strList.Count - 1) { sb.Append("."); } } TTLoger.LogError(sb.ToString()); }
static void LogError(StreamReader streamReader) { string s = streamReader.ReadToEnd(); if (string.IsNullOrEmpty(s)) { return; } TTLoger.LogError(s); }
// 资源清单检查 bool CheckRes(GameResType type, string name, out GameBundleInfo data) { data = GameTable.GetGameBundleRes(type, name); if (data == null) { TTLoger.LogError("资源清单未找到资源 : " + name + ",请检查resBundle"); return(false); } return(true); }
public void OnUpdateDownloadStart(WWW www) { TTLoger.LogError("开始下载:" + www.url); this.startTime = TimeKit.GetMillisTime(); if (OnStartDownload != null) { OnStartDownload(www); } }
public void OnUpdateDownloadEnd(WWW www) { TTLoger.LogError("完成下载:" + www.url); ++currentDownloaded; if (OnEndDownload != null) { OnEndDownload(www); } }
public void OnUpdateDownloading(WWW www) { TTLoger.LogError(string.Format("下载中({0}):{1}", www.bytesDownloaded, www.url)); long nowTime = TimeKit.GetMillisTime(); downloadSpeed = 1000.0f / 1024 / 1024 * www.bytesDownloaded / (nowTime - startTime); if (OnDownloading != null) { OnDownloading(www); } }
/** * @des:实例化预设对象 、添加实例化对象到指定的子对象下 */ private GameObject addChild(GameObject goPrefab, Transform parent) { if (goPrefab == null || parent == null) { TTLoger.LogError("异常。UIWarpContent.cs addChild(goPrefab = null || parent = null)"); return(null); } GameObject goChild = GameObject.Instantiate(goPrefab) as GameObject; goChild.layer = parent.gameObject.layer; goChild.transform.SetParent(parent, false); goChild.SetActive(true); return(goChild); }
static void OpenFile() { string logFolder = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf('/') + 1) + "Log"; if (!Directory.Exists(logFolder)) { TTLoger.LogError("当前没有任何日志!"); return; } var path = EditorUtility.OpenFilePanel( "选择一个日志", logFolder, "log"); if (!string.IsNullOrEmpty(path)) { OpenWindow(path); } }
public LuaTable InitLuaController(object param = null) { // 先执行lua脚本得到管理器 #if UNITY_EDITOR if (string.IsNullOrEmpty(this.scriptName)) { TTLoger.LogError("未指定界面管理器函数 : " + this.gameObject.name); return(null); } #endif LuaFunction func = Lua.GetFunction(scriptName); #if UNITY_EDITOR if (func == null) { TTLoger.LogError("未找到界面管理器函数 :" + scriptName); return(null); } #endif func.BeginPCall(); func.Push(param); func.Push(this.gameObject); func.PCall(); luaController = func.CheckLuaTable(); func.EndPCall(); #if UNITY_EDITOR if (luaController == null) { TTLoger.LogError("无效的界面管理器函数 : " + scriptName + "(" + this.gameObject.name + ")"); return(null); } #endif IntPtr L = Lua.state.L; // 赋个gameObject luaController["gameObject"] = this.gameObject; luaController["transform"] = this.transform; // 先导出子导出器 InitSubController(L); // 如果没有导出控件就完事了 if (exportNames == null || exportNames.Count == 0) { return(luaController); } // 准备导出控件 int oldTop = LuaDLL.lua_gettop(L); Lua.state.Push(luaController); // 出现多个同名导出控件,转成table形式 HashSet <string> tabled = new HashSet <string>(); // 转table标记 for (int i = 0; i < exportNames.Count; ++i) { // 说明已经导出过了 if (tabled.Contains(exportNames[i])) { continue; } // push 控件名 LuaDLL.lua_pushstring(L, exportNames[i]); // 检查如果后面有同名的就一起以table形式导出 int n = 1; for (int j = i + 1; j < exportNames.Count; ++j) { if (exportNames[i].Equals(exportNames[j])) { if (!tabled.Contains(exportNames[i])) { LuaDLL.lua_newtable(L); tabled.Add(exportNames[i]); Lua.state.Push(exportWrappers[i]); LuaDLL.lua_rawseti(L, -2, n++); } Lua.state.Push(exportWrappers[j]); LuaDLL.lua_rawseti(L, -2, n++); } } if (!tabled.Contains(exportNames[i])) { Lua.state.Push(exportWrappers[i]); } LuaDLL.lua_settable(L, -3); } LuaDLL.lua_settop(L, oldTop); return(luaController); }
public void OnUpdateDownloadError(WWW www) { TTLoger.LogError("下载失败:" + www.url); }