private static void _translate(ExcelMapData v_src, LuaTable v_dst, bool v_bSingleKey = false) { List <KeyValue <ExcelMapData> > childDatas = v_src.GetKeyValues(); for (int i = 0; i < childDatas.Count; i++) { KeyValue <ExcelMapData> child = childDatas[i]; Key key = child.key; ExcelMapData data = child.val; switch (data.Type) { case EExcelMapDataType.indexMap: LuaMap indexMap = new LuaMap(); indexMap.init(true, ExportSheetBin.ROW_MAX_ELEMENT); v_dst.addData(key, indexMap); _translate(data, indexMap, v_bSingleKey); indexMap.Note = data.Note; break; case EExcelMapDataType.rowData: LuaMap rowData = new LuaMap(); rowData.init(false, ExportSheetBin.ROW_MAX_ELEMENT); rowData.Single_value_hide_key = v_bSingleKey; v_dst.addData(key, rowData); _translate(data, rowData, v_bSingleKey); rowData.Note = data.Note; break; case EExcelMapDataType.cellTable: LuaTable cellTable; if (data.IsArray) { cellTable = new LuaArray(); ((LuaArray)cellTable).init(false, true, ExportSheetBin.ROW_MAX_ELEMENT); } else { cellTable = new LuaMap(); ((LuaMap)cellTable).init(false, ExportSheetBin.ROW_MAX_ELEMENT); } v_dst.addData(key, cellTable); _translate(data, cellTable); cellTable.Note = data.Note; break; case EExcelMapDataType.cellData: LuaValue leafVal = data.LeafVal.GetLuaValue(); v_dst.addData(key, leafVal); leafVal.Note = data.Note; break; } } }
protected override LuaValue _OnGetLuaValue() { if (_isEmpty) { LuaArray rtn = new LuaArray(); rtn.init(_isStretch, false, ExportSheetBin.ROW_MAX_ELEMENT); return(rtn); } if (m_successInit) { LuaArray rtn = new LuaArray(); rtn.init(_isStretch, false, ExportSheetBin.ROW_MAX_ELEMENT); for (int i = 0; i < _data.Length; i++) { rtn.addData(_data[i].GetLuaValue()); } return(rtn); } else { return(new LuaNil()); } }