Example #1
0
        private void update_worldmap_command()
        {
            switch (Phase)
            {
            case Worldmap_Phases.Fade_In:
                switch (Timer)
                {
                default:
                    // If autoselecting a chapter with no world map event
                    if (MenuData.AutoSelectChapter && GetWorldmapEvent() == null)
                    {
                        // If hard mode is blocked, nevermind
                        if (!IsBlockedHardMode(MenuData.ChapterId))
                        {
                            MenuManager = null;
                            start_chapter();
                            break;
                        }
                    }

                    if (Fade_Timer > 0)
                    {
                        Fade_Timer--;
                    }
                    if (Fade_Timer == Constants.WorldMap.WORLDMAP_FADE_TIME / 4)
                    {
                        if (!MenuData.AutoSelectChapter)
                        {
                            Global.Audio.PlayBgm(Constants.WorldMap.WORLDMAP_THEME);
                        }
                    }
                    if (Fade_Timer == 0)
                    {
                        Phase = Worldmap_Phases.Command_Process;
                    }
                    break;
                }
                break;

            case Worldmap_Phases.Command_Process:
                if (MenuData.AutoSelectChapter)
                {
                    select_chapter_fade();
                }
                break;

            case Worldmap_Phases.Controls_Fade:
                if (Hard_Mode_Blocked_Window != null)
                {
                    Hard_Mode_Blocked_Window.update();
                    if (Hard_Mode_Blocked_Window.is_ready)
                    {
                        if (Hard_Mode_Blocked_Window.selected_index().IsSomething)
                        {
                            Global.game_system.play_se(System_Sounds.Confirm);
                            Hard_Mode_Blocked_Window = null;
                        }
                    }
                }
                else
                {
                    if (Fade_Timer > 0)
                    {
                        Fade_Timer--;
                        MenuOffset += new Vector2(-1, 0);
                    }
                    if (Fade_Timer == 0 && !scrolling)
                    {
                        MenuManager = null;
                        start_chapter_worldmap_event();
                    }
                }
                break;

            case Worldmap_Phases.Worldmap_Event:
                if (!Global.game_system.is_interpreter_running)
                {
                    Phase      = Worldmap_Phases.Fade_Out;
                    Fade_Timer = Constants.WorldMap.WORLDMAP_FADE_TIME;
                    Global.Audio.BgmFadeOut(Constants.WorldMap.WORLDMAP_FADE_TIME);
                }
                break;

            case Worldmap_Phases.Fade_Out:
                if (Fade_Timer > 0)
                {
                    Fade_Timer--;
                }
                if (Fade_Timer == 0)
                {
                    start_chapter();
                }
                break;

            case Worldmap_Phases.Return_To_Title:
                if (Fade_Timer > 0)
                {
                    Fade_Timer--;
                }
                if (Fade_Timer == 0)
                {
                    Global.scene_change("Scene_Title_Load");
                    MenuManager = null;
                }
                break;
            }
        }
Example #2
0
        public override void draw(SpriteBatch sprite_batch, Vector2 draw_offset = default(Vector2))
        {
            if (texture != null)
            {
                if (visible)
                {
                    if (palette_exists)
                    {
                        Effect effect = Global.effect_shader();
                        if (effect != null)
                        {
                            Texture2D palette_texture = Global.palette_pool.get_palette();
                            palette_texture.SetData <Color>(Palette);
#if __ANDROID__
                            // There has to be a way to do this for both
                            effect.Parameters["Palette"].SetValue(palette_texture);
#else
                            sprite_batch.GraphicsDevice.Textures[2] = palette_texture;
#endif
                            sprite_batch.GraphicsDevice.SamplerStates[2] = SamplerState.PointClamp;
                            effect.CurrentTechnique = effect.Techniques["Palette1"];
                            effect.Parameters["color_shift"].SetValue(new Vector4(0, 0, 0, 0));
                            effect.Parameters["opacity"].SetValue(1f);
                        }
                        sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, effect);
                    }
                    else
                    {
                        sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    }

                    Rectangle src_rect = this.src_rect;
                    Vector2   offset   = this.offset;
                    if (mirrored)
                    {
                        offset.X = src_rect.Width - offset.X;
                    }

                    if (Dest_Rect != null)
                    {
                        sprite_batch.Draw(texture, (Rectangle)Dest_Rect,
                                          src_rect, tint, angle, offset,
                                          mirrored ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Z);
                    }
                    else
                    {
                        sprite_batch.Draw(texture, this.loc + draw_vector() - draw_offset,
                                          src_rect, tint, angle, offset, scale,
                                          mirrored ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Z);
                    }

                    sprite_batch.End();
#if __ANDROID__
                    // There has to be a way to do this for both
                    if (Global.effect_shader() != null)
                    {
                        Global.effect_shader().Parameters["Palette"].SetValue((Texture2D)null);
                    }
#else
                    sprite_batch.GraphicsDevice.Textures[2] = null;
#endif
                }
            }
        }