| #region XML Data |
| private bool is_active; |
| [ContentSerializer(Optional = true)] |
| public bool Is_Active |
| { |
| get { return is_active; } |
| set { is_active = value; } |
| } |
| |
| /// <summary> |
| /// Holds the RGBA values for colour of the chat bubble |
| /// </summary> |
| private Vector4 v4_chat_bubble_color; |
| /// <summary> |
| /// Property for "v4_chat_bubble_color" |
| /// Holds the RGBA values for colour of the chat bubble |
| /// </summary> |
| [ContentSerializer(Optional = true)] |
| public Vector4 V4_Chat_Bubble_Color |
| { |
| get { return v4_chat_bubble_color; } |
| set { v4_chat_bubble_color = value; } |
| } |
| |
| /// <summary> |
| /// Holds data about progressive difficulty in stages |
| /// </summary> |
| private List<stage_data> stages; |
| /// <summary> |
| /// Property for : stages |
| /// Which : Holds data about progressive difficulty in stages |
| /// </summary> |
| [ContentSerializer(Optional = true)] |
| public List<stage_data> Stages |
| { |
| get { return stages; } |
| set { stages = value; } |
| } |
|
| #endregion |
|
| #region Class Data |
| /// <summary> |
| /// Holds the colour of the chat bubble |
| /// </summary> |
| private Color color_chat_bubble; |
| /// <summary> |
| /// Property for : "color_chat_bubble" |
| /// Holds the colour of the chat bubble |
| /// </summary> |
| [ContentSerializerIgnore] |
| public Color Color_Chat_Bubble |
| { |
| get { return color_chat_bubble; } |
| set { color_chat_bubble = value; } |
| } |
| #endregion |
|
| #region Content Type Reader |
| |
| public class Idea_CatchReader : ContentTypeReader<Idea_Catch> |
| { |
| protected override Idea_Catch Read(ContentReader input, Idea_Catch existingInstance) |
| { |
| Idea_Catch temp = new Idea_Catch(); |
| |
| temp.Is_Active = input.ReadBoolean(); |
| if (!temp.Is_Active) |
| return null; |
| temp.V4_Chat_Bubble_Color = input.ReadVector4(); |
| temp.V4_Chat_Bubble_Color /= 255; |
| temp.Stages = input.ReadObject<List<stage_data>>(); |
| |
| temp.Color_Chat_Bubble = new Color(temp.V4_Chat_Bubble_Color); |
| |
| return temp; |
| |
| } |
| } |
|
| #endregion |
|
| #region Stages |
| public class stage_data |
| { |
| |
| /// <summary> |
| /// Holds the difficulty factor for time to add bubbles |
| /// </summary> |
| private double add_time_scale; |
| /// <summary> |
| /// Property for : add_time_scale |
| /// Which : Holds the difficulty factor for time to add bubbles |
| /// </summary> |
| [ContentSerializer(Optional = true)] |
| public double Add_Time |
| { |
| get { return add_time_scale; } |
| set { add_time_scale = value; } |
| } |
| |
| /// <summary> |
| /// Holds the difficulty factor for the speed of falling bubbles |
| /// </summary> |
| private double speed_scale; |
| /// <summary> |
| /// Property for : speed_scale |
| /// Which : Holds the difficulty factor for the speed of falling bubbles |
| /// </summary> |
| [ContentSerializer(Optional = true)] |
| public double Speed |
| { |
| get { return speed_scale; } |
| set { speed_scale = value; } |
| } |
|
| #region Content Type Reader |
| |
| public class stage_dataReader : ContentTypeReader<stage_data> |
| { |
| protected override stage_data Read(ContentReader input, stage_data existingInstance) |
| { |
| stage_data temp = new stage_data(); |
| |
| temp.Add_Time = input.ReadDouble(); |
| temp.Speed = input.ReadDouble(); |
| |
| return temp; |
| } |
| } |
|
| #endregion |
| } |
|
| #endregion |
| |
| } |
| |
| The Writers |
|
| #region Idea Game Writer |
| |
| /// <summary> |
| /// This class will be instantiated by the XNA Framework Content Pipeline |
| /// to write the specified data type into binary .xnb format. |
| /// |
| /// This should be part of a Content Pipeline Extension Library project. |
| /// </summary> |
| [ContentTypeWriter] |
| public class IdeaGameWriter : ContentTypeWriter<Idea_Catch> |
| { |
| protected override void Write(ContentWriter output, Idea_Catch value) |
| { |
| output.Write(value.Is_Active); |
| output.Write(value.V4_Chat_Bubble_Color); |
| output.WriteObject<List<DataProcessors.Minigame.Idea_Catch.stage_data>>(value.Stages); |
| } |
| |
| public override string GetRuntimeReader(TargetPlatform targetPlatform) |
| { |
| return typeof(Idea_Catch.Idea_CatchReader).AssemblyQualifiedName; |
| } |
| } |
| |
| #endregion |
|
| #region Stage Data Writer |
| |
| /// <summary> |
| /// This class will be instantiated by the XNA Framework Content Pipeline |
| /// to write the specified data type into binary .xnb format. |
| /// |
| /// This should be part of a Content Pipeline Extension Library project. |
| /// </summary> |
| [ContentTypeWriter] |
| public class stage_dataWriter : ContentTypeWriter<stage_data> |
| { |
| protected override void Write(ContentWriter output, stage_data value) |
| { |
| output.Write(value.Add_Time); // Write out the add time scaling factor |
| output.Write(value.Speed); // Write out the Speed scaling factor |
| } |
| |
| public override string GetRuntimeReader(TargetPlatform targetPlatform) |
| { |
| return typeof(stage_data.stage_dataReader).AssemblyQualifiedName; |
| } |
| } |
|
| #endregion |