static int _m_LogGreen_xlua_st_(RealStatePtr L) { try { { #if UNITY_EDITOR string text = LuaAPI.lua_tostring(L, 1); GameDebug.LogGreen(text); #else LuaAPI.lua_tostring_noret(L, 1); #endif return(0); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
public bool FromJson(string json) { GameDebug.LogGreen("解析JSON:" + json); Hashtable jsonObj = MiniJSON.JsonDecode(json) as Hashtable; if (jsonObj == null || jsonObj["result"] == null) { result = -1; GameDebug.LogError("游戏公告解析失败" + json); return(false); } result = int.Parse(jsonObj["result"].ToString()); if (result != 1) { result = -1; GameDebug.LogError("游戏公告解析失败" + json); return(false); } Hashtable args = jsonObj["args"] as Hashtable; if (args == null) { result = -1; GameDebug.LogError("游戏公告参数解析失败" + json); return(false); } ArrayList notice_list = args["notice_list"] as ArrayList; if (notice_list == null) { GameDebug.LogError("游戏公告解析失败 notice_list " + json); return(false); } this.allNotice.Clear(); for (int i = 0; i < notice_list.Count; i++) { var tbl = notice_list[i] as Hashtable; int type = 0; if (tbl["tag"] != null) { type = int.Parse(tbl["tag"].ToString()); } if (type == 0) { type = 1;//活动 } else if (type == 1) { type = 2;//公告 } else { type = 0; } int openType = 0; if (tbl["type"] != null) { openType = int.Parse(tbl["type"].ToString()); } int status = 1; if (tbl["status"] != null) { status = int.Parse(tbl["status"].ToString()); } int noticeOrder = 0; if (tbl["notice_order"] != null) { noticeOrder = int.Parse(tbl["notice_order"].ToString()); } bool isNew = false; if (tbl["icon_status"] != null && tbl["icon_status"].ToString() != "null" && (int.Parse(tbl["icon_status"].ToString()) == 1)) { isNew = true; } string title = tbl["title"] == null ? "" : tbl["title"].ToString(); string content = tbl["content"] == null ? "" : tbl["content"].ToString(); List <string> titles = new List <string>(); List <string> contents = new List <string>(); titles.Add(title); contents.Add(content); if (tbl["sub_content"] != null && tbl["sub_content"] is ArrayList) { var subList = tbl["sub_content"] as ArrayList; for (int j = 0; j < subList.Count; j++) { var c = subList[j] as Hashtable; titles.Add(c["title"].ToString()); contents.Add(c["content"].ToString()); } } var item = GetItemInfo(type, isNew, titles, contents, openType, status, noticeOrder); //无效的不管 if (item.status != 1) { allNotice.Add(item); } } allNotice.Sort(CompareFunc); this.type = 0; foreach (var notice in allNotice) { if (notice.openType == 1) { this.type = 1; } else { this.type = 0; } } return(true); }