コード例 #1
0
        public void AddDFFFiles(IEnumerable <string> fileNames)
        {
            foreach (ObjectEntry o in LayoutEditorSystem.GetAllObjectEntries())
            {
                if (o.ModelNames != null)
                {
                    foreach (string[] s2 in o.ModelNames)
                    {
                        foreach (string s in s2)
                        {
                            if (!ObjectDFFNames.Contains(s))
                            {
                                ObjectDFFNames.Add(s);
                            }
                        }
                    }
                }
            }

            foreach (string s in fileNames)
            {
                if (!File.Exists(s))
                {
                    MessageBox.Show("Error: file not found: " + s, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    continue;
                }

                if (!filePaths.Contains(s))
                {
                    filePaths.Add(s);
                }

                AddDFFFiles(s);
            }

            foreach (var v in mainForm.LayoutEditors)
            {
                v.UpdateAllMatrices();
            }

            mainForm.ReapplyTextures();
        }
コード例 #2
0
        public static List <SetObjectHeroes> ConvertSASetToHeroes(string filePath)
        {
            byte[] file = File.ReadAllBytes(filePath);

            int objCount = BitConverter.ToInt32(file, 0);
            var objs     = new List <SASetObject>();

            for (int i = 1; i < objCount; i++)
            {
                objs.Add(new SASetObject(file, 32 + i * 32));
            }

            var outObjs = new List <SetObjectHeroes>();

            filePath = filePath.ToLower();

            foreach (var obj in objs)
            {
                List <SetObjectHeroes> newObjs = new List <SetObjectHeroes>();

                if (filePath.Contains("set01"))
                {
                    newObjs.AddRange(ConvertObjectsEmeraldCoast(obj));
                }
                else if (filePath.Contains("set02"))
                {
                    newObjs.AddRange(ConvertObjectsWindyValley(obj));
                    if (filePath.Contains("set0200"))
                    {
                        foreach (var newObj in newObjs)
                        {
                            newObj.Position = new SharpDX.Vector3(newObj.Position.X, newObj.Position.Y, newObj.Position.Z - 5000);
                        }
                    }
                    if (filePath.Contains("set0201"))
                    {
                        foreach (var newObj in newObjs)
                        {
                            newObj.Position = new SharpDX.Vector3(newObj.Position.X, newObj.Position.Y + 1000, newObj.Position.Z);
                        }
                    }
                }
                //else if (filePath.Contains("set0013"))
                //	newObj = ConvertObjectsCityEscape(obj);
                //else if (filePath.Contains("set0003"))
                //	newObj = ConvertObjectsGreenForest(obj);
                else
                {
                    continue;
                }

                foreach (var newObj in newObjs)
                {
                    if (newObj.List == 0 && newObj.Type == 0)
                    {
                        continue;
                    }

                    newObj.SetObjectEntry(LayoutEditorSystem.heroesObjectEntry(newObj.List, newObj.Type));
                    newObj.CreateTransformMatrix();

                    outObjs.Add(newObj);
                }
            }

            return(outObjs);
        }