예제 #1
0
        //=========================================================================================
        /// <summary> 
        /// In this function each derived class should read its own data from
        /// the given XML node representing this object and its attributes. Base methods should 
        /// also be called as part of this process.
        /// </summary>
        /// 
        /// <param name="data"> 
        /// An object representing the xml data for this XMLObject. Data values should be 
        /// read from here.
        /// </param>
        //=========================================================================================
        public override void ReadXml( XmlObjectData data )
        {
            // Call base class function

            base.ReadXml(data);

            data.ReadString ( "Font"    , ref m_font_name   , "Content\\Fonts\\Game_16px.xml"   );
            data.ReadBool   ( "Center"  , ref m_center      , false                             );

            // Read in font:

            m_font = new Font(m_font_name);
        }
        //=========================================================================================
        /// <summary> 
        /// In this function each derived class should read its own data from
        /// the given XML node representing this object and its attributes. Base methods should 
        /// also be called as part of this process.
        /// </summary>
        /// 
        /// <param name="data"> 
        /// An object representing the xml data for this XMLObject. Data values should be 
        /// read from here.
        /// </param>
        //=========================================================================================
        public override void ReadXml( XmlObjectData data )
        {
            // Call base class function

            base.ReadXml(data);

            // Read font:

            data.ReadString ( "Font" , ref m_font_name , "Content\\Fonts\\Game_16px.xml" );

            // Read all other data

            data.ReadString ( "String1st"                   , ref m_string_1st                      , "no_string"   );
            data.ReadString ( "String2nd"                   , ref m_string_2nd                      , "no_string"   );
            data.ReadString ( "String3rd"                   , ref m_string_3rd                      , "no_string"   );
            data.ReadFloat  ( "ScoreFadeInTime"             , ref m_score_fade_in_time              , 0.25f         );
            data.ReadFloat  ( "NewHighScoreThrobTime"       , ref m_new_high_score_throb_time       , 0.25f         );
            data.ReadFloat  ( "NewHighScoreThrobExpansion"  , ref m_new_high_score_throb_expansion  , 8             );
            data.ReadFloat  ( "NewHighScoreThrobColorR"     , ref m_new_high_score_throb_color.X    , 1             );
            data.ReadFloat  ( "NewHighScoreThrobColorG"     , ref m_new_high_score_throb_color.Y    , 1             );
            data.ReadFloat  ( "NewHighScoreThrobColorB"     , ref m_new_high_score_throb_color.Z    , 1             );
            data.ReadFloat  ( "NewHighScoreThrobColorA"     , ref m_new_high_score_throb_color.W    , 1             );

            // Create font:

            m_font = new Font(m_font_name);

            // Reset this

            m_time_since_creation = 0;
        }
예제 #3
0
        //=========================================================================================
        /// <summary> 
        /// In this function each derived class should read its own data from
        /// the given XML node representing this object and its attributes. Base methods should 
        /// also be called as part of this process.
        /// </summary>
        /// 
        /// <param name="data"> 
        /// An object representing the xml data for this XMLObject. Data values should be 
        /// read from here.
        /// </param>
        //=========================================================================================
        public override void ReadXml( XmlObjectData data )
        {
            // Call base class function

            base.ReadXml(data);

            // Read all data:

            data.ReadEffect ( "Effect"              , ref m_effect_name                 , ref m_effect                  , "Effects\\textured"   );
            data.ReadEffect ( "StringWobbleEffect"  , ref m_string_wobble_effect_name   , ref m_string_wobble_effect    , "Effects\\textured"   );
            data.ReadTexture( "FillTexture"         , ref m_fill_texture_name           , ref m_fill_texture            , "Graphics\\default"   );
            data.ReadTexture( "BarTexture"          , ref m_bar_texture_name            , ref m_bar_texture             , "Graphics\\default"   );

            data.ReadString ( "Font"                        , ref m_font_name                   , "Content\\Fonts\\Game_16px.xml"   );
            data.ReadString ( "StringName"                  , ref m_string_name                 , "No_String"                       );
            data.ReadFloat  ( "StringOffsetY"               , ref m_string_offset_y             , 32                                );
            data.ReadFloat  ( "FillPaddingX"                , ref m_fill_padding.X              , 0                                 );
            data.ReadFloat  ( "FillPaddingY"                , ref m_fill_padding.Y              , 0                                 );
            data.ReadFloat  ( "MinimumValue"                , ref m_minimum_value               , 0.0f                              );
            data.ReadFloat  ( "MaximumValue"                , ref m_maximum_value               , 1.0f                              );
            data.ReadFloat  ( "CurrentValue"                , ref m_current_value               , 0.5f                              );
            data.ReadFloat  ( "ChangeSpeed"                 , ref m_change_speed                , 1.0f                              );
            data.ReadFloat  ( "SizeX"                       , ref m_size.X                      , 128                               );
            data.ReadFloat  ( "SizeY"                       , ref m_size.Y                      , 32                                );
            data.ReadFloat  ( "ExpandTime"                  , ref m_expand_time                 , 1                                 );
            data.ReadFloat  ( "ExpansionX"                  , ref m_expansion.X                 , 16                                );
            data.ReadFloat  ( "ExpansionY"                  , ref m_expansion.Y                 , 4                                 );
            data.ReadFloat  ( "StringExpansion"             , ref m_string_expansion            , 0                                 );
            data.ReadFloat  ( "HighlightWobbleSpeed"        , ref m_highlight_wobble_speed      , 0.01f                             );
            data.ReadFloat  ( "HighlightWobbleIntensity"    , ref m_highlight_wobble_intensity  , 8                                 );
            data.ReadString ( "ValueChangedEvent"           , ref m_value_changed_event         , ""                                );
            data.ReadString ( "BackEvent"                   , ref m_back_event                  , ""                                );
            data.ReadString ( "FocusSound"                  , ref m_focus_sound                 , ""                                );
            data.ReadString ( "UseSound"                    , ref m_use_sound                   , ""                                );

            // If the minimum value is bigger the max then swap:

            if ( m_minimum_value > m_maximum_value )
            {
                float t = m_minimum_value; m_minimum_value = m_maximum_value; m_maximum_value = t;
            }

            // Fill in the color and texture coordinates of the vertices for rendering:

            m_vertices[0].Color = Color.White;
            m_vertices[1].Color = Color.White;
            m_vertices[2].Color = Color.White;
            m_vertices[3].Color = Color.White;
            m_vertices[4].Color = Color.White;
            m_vertices[5].Color = Color.White;

            m_vertices[0].TextureCoordinate = Vector2.Zero;
            m_vertices[1].TextureCoordinate = Vector2.UnitY;
            m_vertices[2].TextureCoordinate = Vector2.UnitX;
            m_vertices[3].TextureCoordinate = Vector2.One;
            m_vertices[4].TextureCoordinate = Vector2.Zero;
            m_vertices[5].TextureCoordinate = Vector2.UnitY;

            // Read in font:

            m_font = new Font(m_font_name);
        }
예제 #4
0
파일: Core.cs 프로젝트: jeromebyrne/Ninja
        //=========================================================================================
        /// <summary>
        /// Initiliazes the game and loads all it's content.
        /// </summary>
        //=========================================================================================
        protected override void Initialize()
        {
            // Initialise everything

            base.Initialize();

            // Create the graphics system object

            s_graphics_system = new GraphicsSystem( s_graphics_device_manager , Content );

            // Create the audio systems:

            s_effects_audio_system = new AudioSystem
            (
                CONTENT_FOLDER + "\\Sounds\\NinjaGame_Sounds.xgs" ,
                CONTENT_FOLDER + "\\Sounds\\NinjaGame_Sounds.xwb" ,
                CONTENT_FOLDER + "\\Sounds\\NinjaGame_Sounds.xsb" ,
                false
            );

            s_music_audio_system = new AudioSystem
            (
                CONTENT_FOLDER + "\\Sounds\\NinjaGame_Music.xgs"  ,
                CONTENT_FOLDER + "\\Sounds\\NinjaGame_Music.xwb"  ,
                CONTENT_FOLDER + "\\Sounds\\NinjaGame_Music.xsb"  ,
                false
            );

            // Apply all default preferences:

            CorePreferences.ApplyAllSettings();

            // Create the timing system:

            s_timing_system = new TimingSystem();

            // Create the level and gui:

            s_level = new Level(); s_gui = new Gui();

            // On debug load the debug font and debug shader:

            #if DEBUG

                // Load the font

                s_debug_font = new Font("Content\\Fonts\\Game_24px.xml");

                // Load the shader:

                s_debug_shader = s_graphics_system.LoadEffect("Effects\\colored");

                // Windows debug specific:

                #if WINDOWS_DEBUG

                    // Also allow window to be resized:

                    Window.AllowUserResizing = true;

                    // Set to 640x480

                    Graphics.DeviceManager.PreferredBackBufferWidth     = 640;
                    Graphics.DeviceManager.PreferredBackBufferHeight    = 480;

                    Graphics.DeviceManager.ApplyChanges();

                    // Add debug console commands for core game

                    DebugCore.AddDebugCommands();

                #endif

            #endif

            // Load the main menu

            s_gui.Load("Content\\Guis\\Boot.xml");
        }
예제 #5
0
        //=========================================================================================
        /// <summary> 
        /// In this function each derived class should read its own data from
        /// the given XML node representing this object and its attributes. Base methods should 
        /// also be called as part of this process.
        /// </summary>
        /// 
        /// <param name="data"> 
        /// An object representing the xml data for this XMLObject. Data values should be 
        /// read from here.
        /// </param>
        //=========================================================================================
        public override void ReadXml( XmlObjectData data )
        {
            // Call base function

            base.ReadXml(data);

            // Read all attributes

            data.ReadString( "Font"            , ref m_font_name       , "Content\\Fonts\\Game_16px.xml"    );
            data.ReadFloat ( "FloatSpeed"      , ref m_float_speed     , 0.25f                              );
            data.ReadFloat ( "ScoreLiveTime"   , ref m_score_live_time , 2.0f                               );

            // Load the given font:

            m_font = new Font(m_font_name);
        }
예제 #6
0
        //=========================================================================================
        /// <summary> 
        /// In this function each derived class should read its own data from
        /// the given XML node representing this object and its attributes. Base methods should 
        /// also be called as part of this process.
        /// </summary>
        /// 
        /// <param name="data"> 
        /// An object representing the xml data for this XMLObject. Data values should be 
        /// read from here.
        /// </param>
        //=========================================================================================
        public override void ReadXml( XmlObjectData data )
        {
            // Call base class function

            base.ReadXml(data);

            data.ReadString ( "Font"            , ref m_font_name           , "Content\\Fonts\\Game_16px.xml"   );
            data.ReadString ( "PhaseStringName" , ref m_phase_string_name   , "No_String_Specified"             );
            data.ReadString ( "ReadyStringName" , ref m_ready_string_name   , "No_String_Specified"             );
            data.ReadBool   ( "Center"          , ref m_center              , false                             );
            data.ReadFloat  ( "FontEnlarge"     , ref m_font_enlarge        , 64.0f                             );

            // Read in font:

            m_font = new Font(m_font_name);
        }
예제 #7
0
        //=========================================================================================
        /// <summary> 
        /// In this function each derived class should read its own data from
        /// the given XML node representing this object and its attributes. Base methods should 
        /// also be called as part of this process.
        /// </summary>
        /// 
        /// <param name="data"> 
        /// An object representing the xml data for this XMLObject. Data values should be 
        /// read from here.
        /// </param>
        //=========================================================================================
        public override void ReadXml( XmlObjectData data )
        {
            // Call base class function

            base.ReadXml(data);

            data.ReadString ( "Font"        , ref m_font_name   , "Content\\Fonts\\Game_16px.xml"   );
            data.ReadString ( "StringName"  , ref m_string_name , "No_String_Specified"             );

            // Read alignment:

            string alignment = ""; data.ReadString("Alignment" , ref alignment );

            // See what alignment we have:

            alignment = alignment.ToLower();

            if ( alignment.Equals("center") )
            {
                // Text is centered

                m_alignment = Alignment.CENTER;
            }
            else if ( alignment.Equals("right") )
            {
                // Right align

                m_alignment = Alignment.RIGHT;
            }
            else
            {
                // Left align

                m_alignment = Alignment.LEFT;
            }

            // Read in font:

            m_font = new Font(m_font_name);
        }
예제 #8
0
        //=========================================================================================
        /// <summary> 
        /// In this function each derived class should read its own data from
        /// the given XML node representing this object and its attributes. Base methods should 
        /// also be called as part of this process.
        /// </summary>
        /// 
        /// <param name="data"> 
        /// An object representing the xml data for this XMLObject. Data values should be 
        /// read from here.
        /// </param>
        //=========================================================================================
        public override void ReadXml( XmlObjectData data )
        {
            // Call base class function

            base.ReadXml(data);

            // Read all data:

            data.ReadString ( "Font"            , ref m_font_name           , "Content\\Fonts\\Game_48px.xml"   );
            data.ReadFloat  ( "PictureSizeX"    , ref m_picture_size.X      , 128                               );
            data.ReadFloat  ( "PictureSizeY"    , ref m_picture_size.Y      , 128                               );
            data.ReadFloat  ( "StringOffsetY"   , ref m_string_offset_y     , 0                                 );
            data.ReadFloat  ( "FadeTime"        , ref m_fade_time           , 0.25f                             );
            data.ReadFloat  ( "DisplayTime"     , ref m_display_time        , 2                                 );
            data.ReadInt    ( "StoryPartCount"  , ref m_story_part_count    , 1                                 );

            // Read story data:

            if ( m_story_part_count > 0 )
            {
                // Declare arrays for all the story pictures and strings:

                m_pictures      = new Texture2D [ m_story_part_count ];
                m_picture_names = new string    [ m_story_part_count ];
                m_story_strings = new string    [ m_story_part_count ];

                // Read each part of the story: the string and texture

                for ( int i = 0 ; i < m_story_part_count ; i++ )
                {
                    // Story part texture

                    data.ReadTexture
                    (
                        "StoryPicture" + (i+1).ToString()   ,
                        ref m_picture_names[i]              ,
                        ref m_pictures[i]                   ,
                        "Graphics\\default"
                    );

                    // Story part string

                    data.ReadString
                    (
                        "StoryString" + (i+1).ToString()    ,
                        ref m_story_strings[i]              ,
                        "No_String"
                    );
                }
            }
            else
            {
                // No story:

                m_pictures      = null;
                m_picture_names = null;
                m_story_strings = null;
            }

            // Read in font:

            m_font = new Font(m_font_name);

            // Fading in to current part:

            m_transition_state      = TransitionState.SHOWING;
            m_current_state_time    = 0;
            m_current_story_part    = 0;
        }
예제 #9
0
        //=========================================================================================
        /// <summary> 
        /// In this function each derived class should read its own data from
        /// the given XML node representing this object and its attributes. Base methods should 
        /// also be called as part of this process.
        /// </summary>
        /// 
        /// <param name="data"> 
        /// An object representing the xml data for this XMLObject. Data values should be 
        /// read from here.
        /// </param>
        //=========================================================================================
        public override void ReadXml( XmlObjectData data )
        {
            // Call base class function

            base.ReadXml(data);

            // Read all data:

            data.ReadString( "GameLostString"   , ref m_game_lost_string    ,  "No_string"                      );
            data.ReadString( "GameWonString"    , ref m_game_won_string     ,  "No_string"                      );
            data.ReadString( "MessageFont"      , ref m_message_font_name   ,  "Content\\Fonts\\Game_32px.xml"  );
            data.ReadString( "GameWonGui"       , ref m_game_won_gui        ,  ""                               );
            data.ReadString( "GameLostGui"      , ref m_game_lost_gui       ,  ""                               );

            // Load the message font:

            m_message_font = new Font( m_message_font_name );
        }