public void GenerateConnections() { for (int i = 0; i < vertSize; i++) { VertexStruct vertex = vertices[i]; int ConnectionOffset = vertex.Unk2 - 1; if (ConnectionOffset != -1) { bool bEndOfArray = false; ConnectionStruct CurConnection = connections[ConnectionOffset]; while (CurConnection.NodeID == i && !bEndOfArray) { VertexStruct ConnectedVertex = vertices[CurConnection.ConnectedNodeID]; vertex.OutgoingConnections.Add(ConnectedVertex); ConnectedVertex.IncomingConnections.Add(vertex); ConnectionOffset++; if (ConnectionOffset >= connections.Length) { bEndOfArray = true; } else { CurConnection = connections[ConnectionOffset]; } } } } }
private void Save(string fName) { dialogueObject = CreateDialogueObject.Create(fName); if (dialogueObject) { dialogueObject.dialogueid = 5; dialogueObject.ConversationSet = (GenerateDictionaryFromNode()); // dialogueObject.noders = nodes; foreach (Connections c in connections) { ConnectionStruct cs = new ConnectionStruct(c.inPoint, c.outPoint, c.OnClickRemoveConnection); dialogueObject.connectionList.Add(cs); } foreach (DialogNode node in nodes) { NodeInformation nNode = new NodeInformation(node.nodeID, node.rect, node.inPoint.id, node.outPoint.id, node.conversationText, node.isRoot); dialogueObject.nodeInfoList.Add(nNode); } } }
public void ReadFromFile(BinaryReader reader) { unk0 = reader.ReadInt32(); fileIDHPD = reader.ReadInt32(); unk3HPD = reader.ReadInt32(); bitFlagsHPD = reader.ReadInt32(); vertSize = reader.ReadInt32(); triSize = reader.ReadInt32(); //writer.WriteLine(string.Format("{0}, ) StreamWriter writer = File.CreateText("NAV_AI_OBJ_DATA_" + fileIDHPD + ".txt"); writer.WriteLine(string.Format("{0} {1} {2} {3}", unk0, fileIDHPD, unk3HPD, bitFlagsHPD)); //List<string> data = new List<string>(); List <Vector3> Points = new List <Vector3>(); vertices = new VertexStruct[vertSize]; for (int i = 0; i < vertSize; i++) { VertexStruct vertex = new VertexStruct(); vertex.Unk7 = reader.ReadUInt32() & 0x7FFFFFFF; vertex.Position = Vector3Extenders.ReadFromFile(reader); Vector3 pos = vertex.Position; float y = pos.Y; pos.Y = -pos.Z; pos.Z = y; vertex.Position = pos; //writer.WriteLine(vertex.Position); vertex.Unk0 = reader.ReadSingle(); vertex.Unk1 = reader.ReadSingle(); vertex.Unk2 = reader.ReadInt32(); vertex.Unk3 = reader.ReadInt16(); vertex.Unk4 = reader.ReadInt16(); vertex.Unk5 = reader.ReadInt32(); vertex.Unk6 = reader.ReadInt32(); vertices[i] = vertex; Points.Add(vertex.Position); } writer.WriteLine(""); connections = new ConnectionStruct[triSize]; for (int i = 0; i < triSize; i++) { ConnectionStruct connection = new ConnectionStruct(); connection.Flags = reader.ReadUInt32() & 0x7FFFFFFF; connection.NodeID = reader.ReadUInt32() & 0x7FFFFFFF; connection.ConnectedNodeID = reader.ReadUInt32() & 0x7FFFFFFF; connections[i] = connection; //writer.WriteLine(string.Format("{0} {1} {2}", connection.Flags, connection.NodeID, connection.ConnectedNodeID)); } //Read KynogonRuntimeMesh runtimeMesh = new KynogonRuntimeMesh(); runtimeMesh.ReadFromFile(reader, writer); }
private void CreateConnection(string param) { _connStr = new ConnectionStruct(); switch (param) { case "-ic": _connStr.ConnectionString = Decrypt(ConfigurationManager.AppSettings["Internet_Connection"], "24Denis03") + _connectionTimeOut; _connStr.ConnectionName = "»нтернет"; break; //case "-lc": // _connStr.ConnectionString = // Decrypt(ConfigurationManager.AppSettings["Local_Connection"], "24Denis03") + _connectionTimeOut; // _connStr.ConnectionName = "Ћокальна¤ сеть"; // break; case "-lc": _connStr.ConnectionString = @"Server = 192.168.1.145; Port = 3306; Uid = test; Pwd = Franc1961;" + _connectionTimeOut; //_connStr.ConnectionString = Decrypt(ConfigurationManager.AppSettings["MyServer_Connection"], "24Denis03") + _connectionTimeOut; _connStr.ConnectionName = "MyServerConnection"; break; } }
public void ReadFromFile(BinaryReader reader) { unk0 = reader.ReadInt32(); fileIDHPD = reader.ReadInt32(); unk3HPD = reader.ReadInt32(); bitFlagsHPD = reader.ReadInt32(); vertSize = reader.ReadInt32(); triSize = reader.ReadInt32(); List <Vector3> Points = new List <Vector3>(); vertices = new VertexStruct[vertSize]; for (int i = 0; i < vertSize; i++) { VertexStruct vertex = new VertexStruct(); vertex.Unk7 = reader.ReadUInt32(); // ^ 0x80000000 vertex.Position = Vector3Utils.ReadFromFile(reader); // TODO: Construct KynogonUtils to accomodate this Vector3 pos = vertex.Position; float y = pos.Y; pos.Y = -pos.Z; pos.Z = y; vertex.Position = pos; vertex.Unk0 = reader.ReadSingle(); vertex.Unk1 = reader.ReadSingle(); vertex.Unk2 = reader.ReadInt32(); vertex.Unk3 = reader.ReadInt16(); vertex.Unk4 = reader.ReadInt16(); vertex.Unk5 = reader.ReadInt32(); vertex.Unk6 = reader.ReadInt32(); vertices[i] = vertex; Points.Add(vertex.Position); } connections = new ConnectionStruct[triSize]; for (int i = 0; i < triSize; i++) { ConnectionStruct connection = new ConnectionStruct(); connection.Flags = reader.ReadUInt32() ^ 0x80000000; connection.NodeID = reader.ReadUInt32(); connection.ConnectedNodeID = reader.ReadUInt32(); connections[i] = connection; } //Read KynogonRuntimeMesh runtimeMesh = new KynogonRuntimeMesh(); runtimeMesh.ReadFromFile(reader); // read footer /*if (!runtimeMesh.bDEBUG_HASEXTRADATA) * { * Name = StringHelpers.ReadString(reader); * uint SizeofName = reader.ReadUInt32(); * uint Header = reader.ReadUInt32(); * }*/ Footer = reader.ReadBytes((int)(reader.BaseStream.Length - reader.BaseStream.Position)); GenerateConnections(); DumpToASCII("NAV_OBJ_DATA_" + fileIDHPD + ".txt"); }