public void Init(Row row) { ScriptID = row.GetField(0).GetInt(); QuestIdx = row.GetField(1).GetInt(); Jiangli = row.GetField(2).GetInt(); ChengFa = row.GetField(3).GetInt(); DuiHua = row.GetField(4).GetInt(); FaBuRen = row.GetField(5).GetInt(); FaBuRenId = row.GetField(6).GetInt(); JieShouRen = row.GetField(7).GetInt(); JieShouRenId = row.GetField(8).GetString(); TargetScene = row.GetField(9).GetFloat(); TargetX = row.GetField(10).GetInt(); TargetZ = row.GetField(11).GetInt(); }
public bool Write(Schema schema, Row[] rows) { bool res = false; res = WriteSchema(schema, rows.Length); if (!res) { //Debug.Log("Write Error"); return false; } res = WriteData(rows, schema); if (res) { m_stream.Close(); m_stream = null; m_Writer.Close(); m_Writer = null; } return res; }
//load Data To Reader. void LoadData() { if (m_Schema == null) { return; } for (int i = 0; i < m_recordsNumber; ++i) { Row tempRow = new Row(m_Schema); for (int j = 0; j < m_Schema.Count; ++j) { FieldDefine tempDefine = m_Schema.GetDefine(j); Field tempField = null; switch (tempDefine.FieldType) { case FIELD_TYPE.T_INT: int tempInt = m_Reader.ReadInt32(); tempField = new Field(tempInt); break; case FIELD_TYPE.T_FLOAT: float tempFloat = m_Reader.ReadSingle(); tempField = new Field(tempFloat); break; case FIELD_TYPE.T_STRING: string tempString = m_Reader.ReadString(); tempField = new Field(tempString); break; default: tempField = new Field(0); //Debug.Log("Undefined Field Type"); break; } tempRow.m_Fields.Add(tempField); } mRowList.Add(tempRow); } }
bool WriteData(Row[] a_rows, Schema a_schema) { if (!InitWriter()) { return false; } foreach (Row row in a_rows) { for (int i = 0; i < a_schema.Count; ++i) { FieldDefine define = a_schema.GetDefine(i); switch (define.FieldType) { case FIELD_TYPE.T_INT: m_Writer.Write((int)row.GetField(i).m_Value); break; case FIELD_TYPE.T_FLOAT: m_Writer.Write((float)row.GetField(i).m_Value); break; case FIELD_TYPE.T_STRING: m_Writer.Write(row.GetField(i).m_Value.ToString()); break; case FIELD_TYPE.T_INVALID: //Debug.LogError("Wrong Field Type."); break; default: break; } } } return true; }