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); }
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()); }
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()); }
public PropSet() { _fullProps = new Prop[PropId.MAX]; for (int id = 0; id < PropId.MAX; id++) { _fullProps[id] = Prop.CreateInstance(id, 0f); } }
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()); }
public Prop GetProp(params object[] args) { float value = Formula.CallFloal(formula, args); return(Prop.CreateInstance(id, value)); }