public static ICollection <byte> FsmRectToByteArray(FsmRect fsmRect) { if (fsmRect == null) { fsmRect = new FsmRect(); } List <byte> list = new List <byte>(); list.AddRange(RectToByteArray(fsmRect.Value)); list.AddRange(BitConverter.GetBytes(fsmRect.UseVariable)); list.AddRange(StringToByteArray(fsmRect.Name)); return(list); }
public static FsmRect ByteArrayToFsmRect(Fsm fsm, byte[] bytes, int startIndex, int totalLength) { string @string = Encoding.GetString(bytes, startIndex + 17, totalLength - 17); if (@string != string.Empty) { return(fsm.GetFsmRect(@string)); } FsmRect fsmRect = new FsmRect(); fsmRect.Value = ByteArrayToRect(bytes, startIndex); fsmRect.UseVariable = BitConverter.ToBoolean(bytes, startIndex + 16); return(fsmRect); }
public void ResetParameters() { BoolParameter = false; FloatParameter = 0f; IntParameter = 0; StringParameter = ""; GameObjectParameter = new FsmGameObject(""); Vector2Parameter = new FsmVector2(); Vector3Parameter = new FsmVector3(); RectParamater = new FsmRect(); QuaternionParameter = new FsmQuaternion(); ObjectParameter = new FsmObject(); MaterialParameter = new FsmMaterial(); TextureParameter = new FsmTexture(); ColorParameter = new FsmColor(); EnumParameter = new FsmEnum(); ArrayParameter = new FsmArray(); }
public FunctionCall(FunctionCall source) { FunctionName = source.FunctionName; parameterType = source.parameterType; BoolParameter = new FsmBool(source.BoolParameter); FloatParameter = new FsmFloat(source.FloatParameter); IntParameter = new FsmInt(source.IntParameter); GameObjectParameter = new FsmGameObject(source.GameObjectParameter); ObjectParameter = source.ObjectParameter; StringParameter = new FsmString(source.StringParameter); Vector2Parameter = new FsmVector2(source.Vector2Parameter); Vector3Parameter = new FsmVector3(source.Vector3Parameter); RectParamater = new FsmRect(source.RectParamater); QuaternionParameter = new FsmQuaternion(source.QuaternionParameter); MaterialParameter = new FsmMaterial(source.MaterialParameter); TextureParameter = new FsmTexture(source.TextureParameter); ColorParameter = new FsmColor(source.ColorParameter); EnumParameter = new FsmEnum(source.EnumParameter); ArrayParameter = new FsmArray(source.ArrayParameter); }
public FsmProperty(FsmProperty source) { setProperty = source.setProperty; TargetObject = new FsmObject(source.TargetObject); TargetTypeName = source.TargetTypeName; TargetType = source.TargetType; PropertyName = source.PropertyName; PropertyType = source.PropertyType; BoolParameter = new FsmBool(source.BoolParameter); FloatParameter = new FsmFloat(source.FloatParameter); IntParameter = new FsmInt(source.IntParameter); GameObjectParameter = new FsmGameObject(source.GameObjectParameter); StringParameter = new FsmString(source.StringParameter); Vector2Parameter = new FsmVector2(source.Vector2Parameter); Vector3Parameter = new FsmVector3(source.Vector3Parameter); RectParamater = new FsmRect(source.RectParamater); QuaternionParameter = new FsmQuaternion(source.QuaternionParameter); ObjectParameter = new FsmObject(source.ObjectParameter); MaterialParameter = new FsmMaterial(source.MaterialParameter); TextureParameter = new FsmTexture(source.TextureParameter); ColorParameter = new FsmColor(source.ColorParameter); EnumParameter = new FsmEnum(source.EnumParameter); ArrayParameter = new FsmArray(source.ArrayParameter); }
public void SetVariable(NamedVariable variable) { if (variable == null) { ResetParameters(); return; } switch (variable.VariableType) { case VariableType.Float: FloatParameter = variable as FsmFloat; break; case VariableType.Int: IntParameter = variable as FsmInt; break; case VariableType.Bool: BoolParameter = variable as FsmBool; break; case VariableType.GameObject: GameObjectParameter = variable as FsmGameObject; break; case VariableType.String: StringParameter = variable as FsmString; break; case VariableType.Vector2: Vector2Parameter = variable as FsmVector2; break; case VariableType.Vector3: Vector3Parameter = variable as FsmVector3; break; case VariableType.Color: ColorParameter = variable as FsmColor; break; case VariableType.Rect: RectParamater = variable as FsmRect; break; case VariableType.Material: MaterialParameter = variable as FsmMaterial; break; case VariableType.Texture: TextureParameter = variable as FsmTexture; break; case VariableType.Quaternion: QuaternionParameter = variable as FsmQuaternion; break; case VariableType.Object: ObjectParameter = variable as FsmObject; break; case VariableType.Array: ArrayParameter = variable as FsmArray; break; case VariableType.Enum: EnumParameter = variable as FsmEnum; break; default: throw new ArgumentOutOfRangeException(); case VariableType.Unknown: break; } }