예제 #1
0
        public static Visual GetVisual(string gothicDir, string gothicVersion, ref string[] lines)
        {
            Visual item;

            try
            {
                string str       = VisualFactory.ReadType(ref lines);
                string item1     = VisualFactory.ReadFileName(ref lines);
                string extension = Path.GetExtension(item1);
                if (str.EndsWith("oCItem:zCVob"))
                {
                    if (item1 == "")
                    {
                        string str1 = VisualFactory.ReadItemInstance(ref lines, gothicVersion);
                        if (!Item.Instances[gothicVersion].ContainsKey(str1))
                        {
                            item = null;
                            return(item);
                        }
                        else
                        {
                            item1 = Item.Instances[gothicVersion][str1];
                        }
                    }
                    item = new Item(item1, VisualFactory.ReadPosition(ref lines), VisualFactory.ReadRotation(ref lines), VisualFactory.ReadVisible(ref lines));
                }
                else if (!str.EndsWith("oCMOB:zCVob") || (item1 == ""))
                {
                    if (str.Contains("zCVobLevelCompo"))
                    {
                        item = new Level(item1, VisualFactory.ReadPosition(ref lines), VisualFactory.ReadRotation(ref lines), true);
                        return(item);
                    }
                    else if (str.EndsWith("zCVob") && item1 != "" && extension != "")
                    {
                        if (extension == ".TGA")
                        {
                            item = new Decal(item1, VisualFactory.ReadPosition(ref lines), VisualFactory.ReadRotation(ref lines), VisualFactory.ReadDimensions(ref lines, gothicVersion), VisualFactory.ReadVisible(ref lines));
                            return(item);
                        }
                        else if (extension != ".PFX")
                        {
                            item = new Vob(item1, VisualFactory.ReadPosition(ref lines), VisualFactory.ReadRotation(ref lines), VisualFactory.ReadVisible(ref lines));
                            return(item);
                        }
                    }
                    item = null;
                }
                else
                {
                    item = new Mob(item1, VisualFactory.ReadPosition(ref lines), VisualFactory.ReadRotation(ref lines), VisualFactory.ReadVisible(ref lines));
                }
            }
            catch
            {
                item = null;
            }
            return(item);
        }
예제 #2
0
        public List <Visual> GetVisualsFromZen(string zen)
        {
            string[]      strArrays = File.ReadAllLines(zen);
            List <Visual> visuals   = new List <Visual>();

            for (int i = 0; i < (int)strArrays.Length; i++)
            {
                if (Parser.RegVisualType.IsMatch(strArrays[i]))
                {
                    string str = strArrays[i].Substring(0, strArrays[i].Length - strArrays[i].TrimStart(Array.Empty <char>()).Length);
                    int    num = i;
                    while (num < (int)strArrays.Length)
                    {
                        if (strArrays[num] != string.Concat(str, "[]"))
                        {
                            num++;
                        }
                        else
                        {
                            string[] strArrays1 = strArrays.SubArray <string>(i, num - i + 1);
                            Visual   visual     = VisualFactory.GetVisual(this.GothicDir, this.GothicVersion, ref strArrays1);
                            if (visual == null || this.SkipInvisible && !visual.Visible)
                            {
                                break;
                            }
                            visuals.Add(visual);
                            break;
                        }
                    }
                }
            }
            return((
                       from x in visuals
                       orderby x.FileName
                       select x).ToList <Visual>());
        }