コード例 #1
0
        /// <summary>
        /// Combine the provided DefinitionCollections, replacing earlier copies
        /// of duplicate definitions with later ones.
        /// </summary>
        /// <param name="dictionaries">The dictionaries to combine.</param>
        /// <returns>A new DefinitionDictionary built from the input list, with
        /// every unique definition from each dictionary present and accounted
        /// for, but duplicate definitions represented by whichever copy is
        /// found in the dictionary with the highest index in the input list.</returns>
        public static DefinitionDictionary Stack(this List <DefinitionDictionary> dictionaries)
        {
            var stacked = new DefinitionDictionary();

            foreach (var dictionary in dictionaries)
            {
                foreach (var definition in dictionary.Values)
                {
                    var updated = new Definition(definition)
                    {
                        DefinitionCollection = stacked
                    };

                    if (stacked.ContainsKey(definition.ClassName))
                    {
                        stacked[definition.ClassName] = updated;
                    }
                    else
                    {
                        stacked.Add(definition.ClassName, updated);
                    }
                }
            }

            return(stacked);
        }
コード例 #2
0
ファイル: Map.cs プロジェクト: MarkWilds/Arbatel
        public Map(Stream stream, DefinitionDictionary definitions)
        {
            if (stream is FileStream f)
            {
                AbsolutePath = f.Name;
            }

            Definitions = definitions;
        }
コード例 #3
0
ファイル: QuakeMapObject.cs プロジェクト: MarkWilds/Arbatel
        public QuakeMapObject(Block block, DefinitionDictionary definitions, TextureDictionary textures) :
            base(block, definitions, textures)
        {
            QuakeBlock quakeBlock;

            if (block is QuakeBlock)
            {
                quakeBlock = block as QuakeBlock;
            }
            else
            {
                throw new ArgumentException("Provided Block isn't actually a QuakeBlock!");
            }

            KeyVals = new Dictionary <string, Option>(quakeBlock.KeyVals);

            if (definitions.ContainsKey(KeyVals["classname"].Value))
            {
                Definition = definitions[KeyVals["classname"].Value];
            }
            else
            {
                Definition = new Definition();
            }

            Saveability = Definition.Saveability;

            TextureCollection = textures;

            foreach (Block child in quakeBlock.Children)
            {
                if (child.KeyVals.Count > 0)
                {
                    Children.Add(new QuakeMapObject(child, definitions, textures));
                }
                else
                {
                    ExtractRenderables(child);
                }
            }

            ExtractRenderables(quakeBlock);

            UpdateBounds();

            Position = Aabb.Center;

            if (KeyVals.ContainsKey("origin"))
            {
                Position = KeyVals["origin"].Value.ToVector3();
            }
            else if (Definition.ClassName == "worldspawn")
            {
                Position = new Vector3(0, 0, 0);
            }
        }
コード例 #4
0
ファイル: Map.cs プロジェクト: MarkWilds/Arbatel
        public Map(Stream stream, DefinitionDictionary definitions, TextureDictionary textures)
        {
            if (stream is FileStream f)
            {
                AbsolutePath = f.Name;
            }

            Definitions = definitions;

            _textures = textures;
        }
コード例 #5
0
ファイル: Map.cs プロジェクト: MarkWilds/Arbatel
 public Map(Map map)
 {
     Raw                  = map.Raw;
     Aabb                 = new Aabb(map.Aabb);
     AbsolutePath         = map.AbsolutePath;
     OpenDelimiter        = map.OpenDelimiter;
     CloseDelimiter       = map.CloseDelimiter;
     Definitions          = new DefinitionDictionary(map.Definitions);
     MapObjects           = new List <MapObject>(map.MapObjects);
     InitializedInBackEnd = false;
     _textures            = new TextureDictionary(map.Textures);
 }
コード例 #6
0
 public Definition(Definition d)
 {
     BaseNames                  = new List <string>(d.BaseNames);
     ClassName                  = d.ClassName;
     ClassType                  = d.ClassType;
     Color                      = new Color4(d.Color.R, d.Color.G, d.Color.B, d.Color.A);
     DefinitionCollection       = d.DefinitionCollection;
     Description                = d.Description;
     Flags                      = new Dictionary <string, Spawnflag>(d.Flags);
     KeyValsTemplate            = new Dictionary <string, Option>(d.KeyValsTemplate);
     Offset                     = new Vector3(d.Offset);
     RenderableSources          = new Dictionary <RenderableSource, string>(d.RenderableSources);
     RenderableTransformability = d.RenderableTransformability;
     Saveability                = d.Saveability;
     Size = d.Size != null ? new Aabb(d.Size) : null;
 }
コード例 #7
0
ファイル: Loader.cs プロジェクト: MarkWilds/Arbatel
        public static DefinitionDictionary LoadDefinitionDictionary(string fileName)
        {
            DefinitionDictionary definitions;

            // TODO: This is hardly, shall we say, robust. Find a better way.
            bool isQuake = Path.GetExtension(fileName).ToLower() == ".fgd";

            if (isQuake)
            {
                definitions = new QuakeFgd(fileName);
            }
            else
            {
                definitions = new DefinitionDictionary(fileName);
            }

            return(definitions);
        }
コード例 #8
0
ファイル: MapObject.cs プロジェクト: MarkWilds/Arbatel
 public MapObject(Block block, DefinitionDictionary definitions, TextureDictionary textures) : this()
 {
 }
コード例 #9
0
ファイル: MapObject.cs プロジェクト: MarkWilds/Arbatel
 public MapObject(Block block, DefinitionDictionary definitions) : this()
 {
 }
コード例 #10
0
        /// <summary>
        /// Combine the provided DefinitionCollections, blending duplicate
        /// definitions by combining their key/values.
        /// </summary>
        /// <param name="collections">The DefinitionCollections to combine.</param>
        /// <returns>A new DefinitionCollection built from the input list, with
        /// every unique definition from each collection present and accounted
        /// for, and duplicate definitions blended together. Duplicate key/value
        /// pairs will be represented by the one from the collection that has
        /// the highest index in the input list.</returns>
        public static DefinitionDictionary Blend(this List <DefinitionDictionary> collections)
        {
            var blended = new DefinitionDictionary();

            return(blended);
        }
コード例 #11
0
 public DefinitionDictionary(DefinitionDictionary definitions) : base(definitions)
 {
     TransformTypeOverrides = new Dictionary <string, TransformType>(definitions.TransformTypeOverrides);
     TransformTypes         = new Dictionary <string, TransformType>(definitions.TransformTypes);
 }
コード例 #12
0
ファイル: QuakeMapObject.cs プロジェクト: MarkWilds/Arbatel
 public QuakeMapObject(Block block, DefinitionDictionary definitions) :
     this(block, definitions, new TextureDictionary())
 {
 }