protected void Init(string fileName) { CFileManager file = CFileManager.GetInstance; Stream ms = file.LoadFile(fileName); if (ms == null) { return; } StreamReader sr = new StreamReader(ms); while (!sr.EndOfStream) { sr.ReadLine(); m_LineMaxNum++; } ms.Seek(0, SeekOrigin.Begin); m_Line = new string[m_LineMaxNum]; for (int i = 0; i < m_LineMaxNum; i++) { m_Line[i] = sr.ReadLine(); } m_CurrentLine = m_Line[m_LineIndex++].Split(m_DivValue, System.StringSplitOptions.None); m_ValueMaxNum = (uint)m_CurrentLine.GetLength(0); }
public bool LoadStage() { if (null == m_Filename) { return(false); } Release(); string filepath = m_Forder + m_Filename + m_Ext; CFileManager tFile = CFileManager.GetInstance; // load stream Stream ms = tFile.LoadFile(filepath); if (null == ms) { return(false); } BinaryReader br = new BinaryReader(ms); // MapTri int count = 0; int count2 = 0; count = br.ReadInt32(); CTRI tri = null; for (int i = 0; i < count; i++) { tri = new CTRI(); for (int j = 0; j < 3; j++) { tri._arrv3PT[j].x = br.ReadSingle(); tri._arrv3PT[j].y = br.ReadSingle(); tri._arrv3PT[j].z = br.ReadSingle(); tri._arriIV[j] = br.ReadInt32(); } tri._v3TriNormal.x = br.ReadSingle(); tri._v3TriNormal.y = br.ReadSingle(); tri._v3TriNormal.z = br.ReadSingle(); tri._arrEdgeLength[0] = br.ReadSingle(); tri._arrEdgeLength[1] = br.ReadSingle(); tri._arrEdgeLength[2] = br.ReadSingle(); AddTriangle(tri); } // MapArrageBase count = br.ReadInt32(); CBASE__ towerArrange = null; for (int i = 0; i < count; i++) { towerArrange = new CBASE__(); count2 = br.ReadInt32(); for (int j = 0; j < count2; j++) { towerArrange._listIdxTris.Add(br.ReadInt32()); } count2 = br.ReadInt32(); for (int j = 0; j < count2; j++) { Vector3 vec = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle()); towerArrange._listv3Pnts.Add(vec); } // 중앙포지션 towerArrange._v3PositionCenter.x = br.ReadSingle(); towerArrange._v3PositionCenter.y = br.ReadSingle(); towerArrange._v3PositionCenter.z = br.ReadSingle(); // 삼각형 정보 count2 = br.ReadInt32(); for (int j = 0; j < count2; j++) { Vector3 vec = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle()); towerArrange._listv3PntsSrc.Add(vec); } AddBaseTower(towerArrange); m_BaseTowerMeshIndex.Add(towerArrange._listIdxTris[0], i); m_BaseTowerMeshIndex.Add(towerArrange._listIdxTris[1], i); } // MainCoreList count = br.ReadInt32(); BaseInfo core; for (int i = 0; i < count; i++) { core = new BaseInfo(); core.CoreLoad(br); AddMainCore(core); } // SubCoreList count = br.ReadInt32(); for (int i = 0; i < count; i++) { core = new BaseInfo(); core.CoreLoad(br); AddSubCore(core); } // StartBaseList count = br.ReadInt32(); for (int i = 0; i < count; i++) { core = new BaseInfo(); core.CoreLoad(br); AddStartBase(core); } // BlockBaseList count = br.ReadInt32(); for (int i = 0; i < count; i++) { core = new BaseInfo(); core.CoreLoad(br); AddBlockBase(core); } // GoalPoint count = br.ReadInt32(); for (int i = 0; i < count; i++) { AddGoalPoint(br.ReadInt32()); } // GroundMonster_StartPoint count = br.ReadInt32(); for (int i = 0; i < count; i++) { AddGroundStartPoint(br.ReadInt32()); } // BlockPoint count = br.ReadInt32(); for (int i = 0; i < count; i++) { AddGroundBlockPoint(br.ReadInt32()); } // BlockRoadPoint count = br.ReadInt32(); for (int i = 0; i < count; i++) { AddGroundBlockRoadPoint(br.ReadInt32()); } // flyPath list count = br.ReadInt32(); CSplineGenerator path = null; for (int i = 0; i < count; i++) { path = new CSplineGenerator(); path.SetTypeSplineCurve((E_TYPE_SPLINE)br.ReadUInt32()); path.SetDivisionWeight(br.ReadSingle()); count2 = br.ReadInt32(); for (int j = 0; j < count2; j++) { Vector3 vec = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle()); path.SetNewCurvePoint_spline(vec); } AddFlyPath(path); } // 파일포인터 맨처음으로 ms.Seek(0, SeekOrigin.Begin); return(true); }