Exemple #1
0
        public void Parse(AssetsFile file, AssetsObject owner, AssetsReader reader)
        {
            var count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                TexEnvs.Add(new Map <string, TexEnv>(reader.ReadString(), new TexEnv(file, owner, reader)));
            }
            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                Floats.Add(new Map <string, Single>(reader.ReadString(), reader.ReadSingle()));
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                Colors.Add(new Map <string, Color>(reader.ReadString(), new Color(reader)));
            }
        }
Exemple #2
0
        public Args(Engine engine, string args)
        {
            this.engine = engine;
            var items  = args.Split(new[] { ' ' });
            var others = new List <string>();

            foreach (var item in items)
            {
                if (engine.Markers.ContainsKey(item))
                {
                    Markers.Add(engine.Markers[item]);
                }
                else if (engine.Rects.ContainsKey(item))
                {
                    Rects.Add(engine.Rects[item]);
                }
                else if (engine.Strings.ContainsKey(item))
                {
                    Strings.Add(engine.Strings[item]);
                }
                else if (engine.Floats.ContainsKey(item))
                {
                    Floats.Add(engine.Floats[item]);
                }
                else if (float.TryParse(item, out float f))
                {
                    Floats.Add(f);
                }
                else
                {
                    others.Add(item);
                }
            }
            if (others.Count > 0)
            {
                Text = string.Join(" ", others);
            }
        }