public override void OnEnter() { IntFieldDesigner intFieldDesigner = Node["Frames"].Field as IntFieldDesigner; Frames = intFieldDesigner.Value; CurFrames = 0; }
public override void OnEnter() { IntFieldDesigner intFieldDesigner = Node["LoopTimes"].Field as IntFieldDesigner; LoopTimes = intFieldDesigner.Value; CurTimes = 0; }
public override void OnEnter() { IntFieldDesigner intFieldDesigner = Node["Duration"].Field as IntFieldDesigner; Duration = intFieldDesigner.Value; CurTime = 0; }
public static BTData.BaseField CreateVariableField(VariableFieldDesigner variableFieldData) { BTData.BaseField data = null; switch (variableFieldData.VariableFieldType) { case FieldType.IntField: BTData.IntField intField = new BTData.IntField(); IntFieldDesigner intFieldDesigner = variableFieldData.Value as IntFieldDesigner; intField.FieldName = variableFieldData.VariableFieldName; intField.Value = intFieldDesigner.Value; data = intField; break; case FieldType.LongField: BTData.LongField longField = new BTData.LongField(); LongFieldDesigner longFieldDesigner = variableFieldData.Value as LongFieldDesigner; longField.FieldName = variableFieldData.VariableFieldName; longField.Value = longFieldDesigner.Value; data = longField; break; case FieldType.FloatField: BTData.FloatField floatField = new BTData.FloatField(); FloatFieldDesigner floatFieldDesigner = variableFieldData.Value as FloatFieldDesigner; floatField.FieldName = variableFieldData.VariableFieldName; floatField.Value = floatFieldDesigner.Value; data = floatField; break; case FieldType.DoubleField: BTData.DoubleField doubleField = new BTData.DoubleField(); DoubleFieldDesigner doubleFieldDesigner = variableFieldData.Value as DoubleFieldDesigner; doubleField.FieldName = variableFieldData.VariableFieldName; doubleField.Value = doubleFieldDesigner.Value; data = doubleField; break; case FieldType.StringField: BTData.StringField stringField = new BTData.StringField(); StringFieldDesigner stringFieldDesigner = variableFieldData.Value as StringFieldDesigner; stringField.FieldName = variableFieldData.VariableFieldName; stringField.Value = stringFieldDesigner.Value; data = stringField; break; case FieldType.BooleanField: BTData.BooleanField booleanField = new BTData.BooleanField(); BooleanFieldDesigner booleanFieldDesigner = variableFieldData.Value as BooleanFieldDesigner; booleanField.FieldName = variableFieldData.VariableFieldName; booleanField.Value = booleanFieldDesigner.Value; data = booleanField; break; } return(data); }
public override void OnEnter() { time = 0; IntFieldDesigner intFieldDesigner = Node["Millisecond"].Field as IntFieldDesigner; if (intFieldDesigner == null) { Status = DebugNodeStatus.Error; return; } WaitTime = intFieldDesigner.Value; }
public static BTData.BaseField CreateField(FieldDesigner fieldData) { BTData.BaseField data = null; switch (fieldData.FieldType) { case FieldType.IntField: BTData.IntField intField = new BTData.IntField(); IntFieldDesigner intFieldDesigner = fieldData.Field as IntFieldDesigner; intField.FieldName = fieldData.FieldName; intField.Value = intFieldDesigner.Value; data = intField; break; case FieldType.LongField: BTData.LongField longField = new BTData.LongField(); LongFieldDesigner longFieldDesigner = fieldData.Field as LongFieldDesigner; longField.FieldName = fieldData.FieldName; longField.Value = longFieldDesigner.Value; data = longField; break; case FieldType.FloatField: BTData.FloatField floatField = new BTData.FloatField(); FloatFieldDesigner floatFieldDesigner = fieldData.Field as FloatFieldDesigner; floatField.FieldName = fieldData.FieldName; floatField.Value = floatFieldDesigner.Value; data = floatField; break; case FieldType.DoubleField: BTData.DoubleField doubleField = new BTData.DoubleField(); DoubleFieldDesigner doubleFieldDesigner = fieldData.Field as DoubleFieldDesigner; doubleField.FieldName = fieldData.FieldName; doubleField.Value = doubleFieldDesigner.Value; data = doubleField; break; case FieldType.StringField: BTData.StringField stringField = new BTData.StringField(); StringFieldDesigner stringFieldDesigner = fieldData.Field as StringFieldDesigner; stringField.FieldName = fieldData.FieldName; stringField.Value = stringFieldDesigner.Value; data = stringField; break; case FieldType.ColorField: BTData.ColorField colorField = new BTData.ColorField(); ColorFieldDesigner colorFieldDesigner = fieldData.Field as ColorFieldDesigner; colorField.FieldName = fieldData.FieldName; colorField.Value |= colorFieldDesigner.R << 24; colorField.Value |= colorFieldDesigner.G << 16; colorField.Value |= colorFieldDesigner.B << 8; colorField.Value |= colorFieldDesigner.A; data = colorField; break; case FieldType.Vector2: BTData.Vector2Field vector2Field = new BTData.Vector2Field(); Vector2FieldDesigner vector2FieldDesigner = fieldData.Field as Vector2FieldDesigner; vector2Field.FieldName = fieldData.FieldName; vector2Field.X = vector2FieldDesigner.X; vector2Field.Y = vector2FieldDesigner.Y; data = vector2Field; break; case FieldType.Vector3: BTData.Vector3Field vector3Field = new BTData.Vector3Field(); Vector3FieldDesigner vector3FieldDesigner = fieldData.Field as Vector3FieldDesigner; vector3Field.FieldName = fieldData.FieldName; vector3Field.X = vector3FieldDesigner.X; vector3Field.Y = vector3FieldDesigner.Y; vector3Field.Z = vector3FieldDesigner.Z; data = vector3Field; break; case FieldType.EnumField: BTData.EnumField enumField = new BTData.EnumField(); EnumFieldDesigner enumFieldDesigner = fieldData.Field as EnumFieldDesigner; enumField.FieldName = fieldData.FieldName; enumField.Value = enumFieldDesigner.ValueInt; data = enumField; break; case FieldType.BooleanField: BTData.BooleanField booleanField = new BTData.BooleanField(); BooleanFieldDesigner booleanFieldDesigner = fieldData.Field as BooleanFieldDesigner; booleanField.FieldName = fieldData.FieldName; booleanField.Value = booleanFieldDesigner.Value; data = booleanField; break; case FieldType.RepeatIntField: BTData.RepeatIntField repeatIntField = new BTData.RepeatIntField(); RepeatIntFieldDesigner repeatIntFieldDesigner = fieldData.Field as RepeatIntFieldDesigner; repeatIntField.FieldName = fieldData.FieldName; if (repeatIntFieldDesigner.Value.Count > 0) { repeatIntField.Value = new List <int>(); for (int i = 0; i < repeatIntFieldDesigner.Value.Count; i++) { repeatIntField.Value.Add(repeatIntFieldDesigner.Value[i]); } } data = repeatIntField; break; case FieldType.RepeatLongField: BTData.RepeatLongField repeatLongField = new BTData.RepeatLongField(); RepeatLongFieldDesigner repeatLongFieldDesigner = fieldData.Field as RepeatLongFieldDesigner; repeatLongField.FieldName = fieldData.FieldName; if (repeatLongFieldDesigner.Value.Count > 0) { repeatLongField.Value = new List <long>(); for (int i = 0; i < repeatLongFieldDesigner.Value.Count; i++) { repeatLongField.Value.Add(repeatLongFieldDesigner.Value[i]); } } data = repeatLongField; break; case FieldType.RepeatFloatField: BTData.RepeatFloatField repeatFloatField = new BTData.RepeatFloatField(); RepeatFloatFieldDesigner repeatFloatFieldDesigner = fieldData.Field as RepeatFloatFieldDesigner; repeatFloatField.FieldName = fieldData.FieldName; if (repeatFloatFieldDesigner.Value.Count > 0) { repeatFloatField.Value = new List <float>(); for (int i = 0; i < repeatFloatFieldDesigner.Value.Count; i++) { repeatFloatField.Value.Add(repeatFloatFieldDesigner.Value[i]); } } data = repeatFloatField; break; case FieldType.RepeatVector2Field: BTData.RepeatVector2Field repeatVector2Field = new BTData.RepeatVector2Field(); RepeatVector2FieldDesigner repeatVector2FieldDesigner = fieldData.Field as RepeatVector2FieldDesigner; repeatVector2Field.FieldName = fieldData.FieldName; if (repeatVector2FieldDesigner.Value.Count > 0) { for (int i = 0; i < repeatVector2FieldDesigner.Value.Count; i++) { Vector2 vector2 = repeatVector2FieldDesigner.Value[i]; BTData.Vector2 temp = new BTData.Vector2(); temp.X = vector2.X; temp.Y = vector2.Y; repeatVector2Field.Value.Add(temp); } } data = repeatVector2Field; break; case FieldType.RepeatVector3Field: BTData.RepeatVector3Field repeatVector3Field = new BTData.RepeatVector3Field(); RepeatVector3FieldDesigner repeatVector3FieldDesigner = fieldData.Field as RepeatVector3FieldDesigner; repeatVector3Field.FieldName = fieldData.FieldName; for (int i = 0; i < repeatVector3FieldDesigner.Value.Count; i++) { Vector3 vector3 = repeatVector3FieldDesigner.Value[i]; BTData.Vector3 temp = new BTData.Vector3(); temp.X = vector3.X; temp.Y = vector3.Y; temp.Z = vector3.Z; repeatVector3Field.Value.Add(temp); } data = repeatVector3Field; break; case FieldType.RepeatStringField: BTData.RepeatStringField repeatStringField = new BTData.RepeatStringField(); RepeatStringFieldDesigner repeatStringFieldDesigner = fieldData.Field as RepeatStringFieldDesigner; repeatStringField.FieldName = fieldData.FieldName; if (repeatStringFieldDesigner.Value.Count > 0) { repeatStringField.Value = new List <string>(); for (int i = 0; i < repeatStringFieldDesigner.Value.Count; i++) { repeatStringField.Value.Add(repeatStringFieldDesigner.Value[i]); } } data = repeatStringField; break; } return(data); }
/// <summary> /// 通过节点模板创建FieldDesigner /// </summary> /// <param name="nodeField">节点模板</param> /// <returns></returns> public static FieldDesigner CreateFieldByNodeField(NodeField nodeField) { FieldDesigner field = new FieldDesigner(); field.FieldName = nodeField.FieldName; field.Label = nodeField.Label; field.FieldType = nodeField.FieldType; field.Describe = nodeField.Describe; switch (nodeField.FieldType) { case FieldType.IntField: IntFieldDesigner intFieldDesigner = field.Field as IntFieldDesigner; IntDefaultValue intDefaultValue = nodeField.DefaultValue as IntDefaultValue; intFieldDesigner.Value = intDefaultValue.DefaultValue; break; case FieldType.LongField: LongFieldDesigner longFieldDesigner = field.Field as LongFieldDesigner; LongDefaultValue longDefaultValue = nodeField.DefaultValue as LongDefaultValue; longFieldDesigner.Value = longDefaultValue.DefaultValue; break; case FieldType.FloatField: FloatFieldDesigner floatFieldDesigner = field.Field as FloatFieldDesigner; FloatDefaultValue floatDefaultValue = nodeField.DefaultValue as FloatDefaultValue; floatFieldDesigner.Value = floatDefaultValue.DefaultValue; break; case FieldType.DoubleField: DoubleFieldDesigner doubleFieldDesigner = field.Field as DoubleFieldDesigner; DoubleDefaultValue doubleDefaultValue = nodeField.DefaultValue as DoubleDefaultValue; doubleFieldDesigner.Value = doubleDefaultValue.DefaultValue; break; case FieldType.StringField: StringFieldDesigner stringFieldDesigner = field.Field as StringFieldDesigner; StringDefaultValue stringDefaultValue = nodeField.DefaultValue as StringDefaultValue; stringFieldDesigner.Value = stringDefaultValue.DefaultValue; break; case FieldType.ColorField: ColorFieldDesigner colorFieldDesigner = field.Field as ColorFieldDesigner; ColorDefaultValue colorDefaultValue = nodeField.DefaultValue as ColorDefaultValue; colorFieldDesigner.R = colorDefaultValue.R; colorFieldDesigner.G = colorDefaultValue.G; colorFieldDesigner.B = colorDefaultValue.B; colorFieldDesigner.A = colorDefaultValue.A; break; case FieldType.Vector2: Vector2FieldDesigner vector2FieldDesigner = field.Field as Vector2FieldDesigner; Vector2DefaultValue vector2DefaultValue = nodeField.DefaultValue as Vector2DefaultValue; vector2FieldDesigner.X = vector2DefaultValue.X; vector2FieldDesigner.Y = vector2DefaultValue.Y; break; case FieldType.Vector3: Vector3FieldDesigner vector3FieldDesigner = field.Field as Vector3FieldDesigner; Vector3DefaultValue vector3DefaultValue = nodeField.DefaultValue as Vector3DefaultValue; vector3FieldDesigner.X = vector3DefaultValue.X; vector3FieldDesigner.Y = vector3DefaultValue.Y; vector3FieldDesigner.Z = vector3DefaultValue.Z; break; case FieldType.EnumField: EnumFieldDesigner enumFieldDesigner = field.Field as EnumFieldDesigner; EnumDefaultValue enumDefaultValue = nodeField.DefaultValue as EnumDefaultValue; enumFieldDesigner.EnumType = enumDefaultValue.EnumType; enumFieldDesigner.Value = enumDefaultValue.DefaultValue; break; case FieldType.BooleanField: BooleanFieldDesigner booleanFieldDesigner = field.Field as BooleanFieldDesigner; BooleanDefaultValue booleanDefaultValue = nodeField.DefaultValue as BooleanDefaultValue; booleanFieldDesigner.Value = booleanDefaultValue.DefaultValue; break; case FieldType.RepeatIntField: break; case FieldType.RepeatLongField: break; case FieldType.RepeatFloatField: break; case FieldType.RepeatVector2Field: break; case FieldType.RepeatVector3Field: break; case FieldType.RepeatStringField: break; } return(field); }