internal void loadSplineParameter(ConfigNode node, string name, ParameterOverride <Spline> param) { Log.debug("Loading spline for: " + GetType() + " with name: " + name); ConfigNode splineNode = node.GetNode("SPLINE", "name", name); Log.debug("Node: " + splineNode); if (splineNode == null) { Log.debug("Node was null..."); return; } string[] keys = splineNode.GetValues("key"); List <Keyframe> frames = new List <Keyframe>(); int len = keys.Length; for (int i = 0; i < len; i++) { float[] vals = Utils.safeParseFloatArray(keys[i]); Keyframe frame = new Keyframe(vals[0], vals[1], vals[2], vals[3], vals[4], vals[5]); frames.Add(frame); } frames.Sort((a, b) => { return(a.time.CompareTo(b.time)); }); float zero = splineNode.GetFloatValue("zero"); bool loop = splineNode.GetBoolValue("loop"); Spline spline = new Spline(new AnimationCurve(frames.ToArray()), zero, loop, new Vector2(0f, 1f)); param.Override(spline); }
internal void loadColorParameter(ConfigNode node, string name, ParameterOverride <Color> param) { if (node.HasValue(name)) { param.Override(node.getColor(name)); } }
internal void loadVector4Parameter(ConfigNode node, string name, ParameterOverride <Vector4> param) { if (node.HasValue(name)) { param.Override(ConfigNode.ParseVector4(node.GetValue(name))); } }
internal void loadEnumParameter <T>(ConfigNode node, string name, ParameterOverride <T> param, Type enumType) { if (node.HasValue(name)) { param.Override((T)Enum.Parse(enumType, node.GetStringValue(name))); } }
internal void loadFloatParameter(ConfigNode node, string name, ParameterOverride <float> param) { if (node.HasValue(name)) { param.Override(node.GetFloatValue(name)); } }
internal void loadBoolParameter(ConfigNode node, string name, ParameterOverride <bool> param) { if (node.HasValue(name)) { param.Override(node.GetBoolValue(name)); } }
internal void loadTextureParameter(ConfigNode node, string name, ParameterOverride <Texture> param) { if (!node.HasValue(name)) { return; } string texName = node.GetStringValue(name); Texture2D texture = null; texture = GameDatabase.Instance.GetTexture(texName, false); if (texture != null) { param.Override(texture); } }
internal void loadTextureParameter(ConfigNode node, string name, ParameterOverride <Texture> param) { if (!node.HasValue(name)) { return; } string texName = node.GetValue(name); Texture2D texture = null; if (texName.StartsWith("BUILTIN:")) { texName = texName.Substring(8); texture = TexturesUnlimitedFXLoader.INSTANCE.getTexture(texName); } else { texName = texName.Substring(7); texture = GameDatabase.Instance.GetTexture(texName, false); } if (texture != null) { param.Override(texture); } }