Ejemplo n.º 1
0
        public static Prop[] ParseCompactPropFields(string[] fields, PropConfig[] configs, int start, int end)
        {
            if (start >= fields.Length)
            {
                return(new Prop[0]);
            }

            if (end > fields.Length)
            {
                end = fields.Length;
            }

            int count = end - start;

            Prop[] props = new Prop[count];

            for (int i = 0; i < count; i++)
            {
                float      value  = fields[start + i].ToSingle();
                PropConfig config = configs[i];
                Prop       prop   = Prop.CreateInstance(config, value);

                props[i] = prop;
            }

            return(props);
        }
Ejemplo n.º 2
0
        public static Prop[] ParsePropFields(string[] fields, int start, int end)
        {
            if (start >= fields.Length)
            {
                return(new Prop[0]);
            }

            if (end > fields.Length)
            {
                end = fields.Length;
            }

            int         count = end - start;
            List <Prop> list  = new List <Prop>();

            for (int i = 0; i < count; i++)
            {
                string[] segs = fields[start + i].Split(',');

                if (segs.Length < 2)
                {
                    continue;
                }

                int   id    = segs[0].ToInt32();
                float value = segs[1].ToSingle();

                Prop prop = Prop.CreateInstance(id, value);
                list.Add(prop);
            }

            return(list.ToArray());
        }
Ejemplo n.º 3
0
        public static Prop[] ParsePropFields3(string[] fields, int start, int end)
        {
            if (start >= fields.Length)
            {
                return(new Prop[0]);
            }

            if (end > fields.Length)
            {
                end = fields.Length;
            }

            int         count = end - start;
            List <Prop> list  = new List <Prop>();

            for (int i = 0; i < count; i += 3)
            {
                if (count - i < 3)
                {
                    break;
                }

                int   id    = fields[start + i + 1].ToInt32();
                float value = fields[start + i + 2].ToSingle();

                Prop prop = Prop.CreateInstance(id, value);
                list.Add(prop);
            }

            return(list.ToArray());
        }
Ejemplo n.º 4
0
        public PropSet()
        {
            _fullProps = new Prop[PropId.MAX];

            for (int id = 0; id < PropId.MAX; id++)
            {
                _fullProps[id] = Prop.CreateInstance(id, 0f);
            }
        }
Ejemplo n.º 5
0
        public static Prop[] FilterZero(this float[] src)
        {
            List <Prop> list = new List <Prop>();

            for (int i = 0; i < src.Length; i++)
            {
                if (src[i] != 0)
                {
                    Prop prop = Prop.CreateInstance(i, src[i]);
                    list.Add(prop);
                }
            }

            return(list.ToArray());
        }
Ejemplo n.º 6
0
        public Prop GetProp(params object[] args)
        {
            float value = Formula.CallFloal(formula, args);

            return(Prop.CreateInstance(id, value));
        }