//获取Unity解析Dict形式Json所需要的keys public string UnityGetKeyString(Data.RowNode dataRowNode) { JsonCellNodeWriter cellNodeWrite = new JsonCellNodeWriter(); if (dataRowNode.getCellNodeList().Count == 0 || dataRowNode.getCellNodeList()[0] == null) { return(null); } return(GlobalData.getJsonRowBlock() + " " + '"' + dataRowNode.getCellNodeList()[0].getData() + '"'); }
public string ObjectString(Data.RowNode dataRowNode) { string returnStr; int count = 0; LuaCellNodeWriter cellNodeWrite = new LuaCellNodeWriter(); if (dataRowNode.getCellNodeList().Count == 0 || dataRowNode.getCellNodeList()[0] == null) { return(null); } string key = dataRowNode.getCellNodeList()[0].getData().ToString(); if (key == int.Parse(key).ToString()) { returnStr = GlobalData.getLuaRowBlock() + "{"; } else { returnStr = GlobalData.getLuaRowBlock() + dataRowNode.getCellNodeList()[0].getData() + " = {"; } for (int i = 1; i < dataRowNode.getCellNodeList().Count; i++) { if (dataRowNode.getCellNodeList()[i] == null) { continue; } returnStr = returnStr + ((count == 0) ? "\r\n" : ",\r\n") + cellNodeWrite.getString(dataRowNode.getCellNodeList()[i]); count++; } returnStr = returnStr + "\r\n" + GlobalData.getLuaRowBlock() + " " + "}"; return(returnStr); }
//获取Unity解析Dict形式Json所需要的keys public string UnityGetValueString(Data.RowNode dataRowNode) { string returnStr; int count = 0; JsonCellNodeWriter cellNodeWrite = new JsonCellNodeWriter(); if (dataRowNode.getCellNodeList().Count == 0 || dataRowNode.getCellNodeList()[0] == null) { return(null); } returnStr = GlobalData.getJsonRowBlock() + " " + "{"; for (int i = 1; i < dataRowNode.getCellNodeList().Count; i++) { if (dataRowNode.getCellNodeList()[i] == null) { continue; } returnStr = returnStr + ((count == 0) ? "\r\n" : ",\r\n") + " " + cellNodeWrite.getString(dataRowNode.getCellNodeList()[i]); count++; } returnStr = returnStr + "\r\n" + GlobalData.getJsonRowBlock() + " " + " " + "}"; return(returnStr); }