protected void update_scroll_offset()
        {
            // come up with a better name for this method //Debug
            int target_y = this.RowSize * Scroll;

            if (Math.Abs(Offset.Y - target_y) <= this.RowSize / 4)
            {
                Offset.Y = target_y;
            }
            if (Math.Abs(Offset.Y - target_y) <= this.RowSize)
            {
                Offset.Y = Additional_Math.int_closer((int)Offset.Y, target_y, this.RowSize / 4);
            }
            else
            {
                Offset.Y = ((int)(Offset.Y + target_y)) / 2;
            }

            if (Offset.Y != target_y && Scrollbar != null)
            {
                if (Offset.Y > target_y)
                {
                    Scrollbar.moving_up();
                }
                else
                {
                    Scrollbar.moving_down();
                }
            }
        }
示例#2
0
        protected void update_scroll_offset()
        {
            int target_y = 16 * Scroll;

            if (!ManualScroll)
            {
                if (Math.Abs(Offset.Y - target_y) <= 16 / 4)
                {
                    Offset.Y = target_y;
                }
                if (Math.Abs(Offset.Y - target_y) <= 16)
                {
                    Offset.Y = Additional_Math.int_closer((int)Offset.Y, target_y, 16 / 4);
                }
                else
                {
                    Offset.Y = ((int)(Offset.Y + target_y)) / 2;
                }
            }

            if (Offset.Y != target_y && Scrollbar != null)
            {
                if (Offset.Y > target_y)
                {
                    Scrollbar.moving_up();
                }
                else
                {
                    Scrollbar.moving_down();
                }
            }
        }
示例#3
0
        protected override void UpdateMenu(bool active)
        {
            update_map_sprite();
            Cursor.update();
            Counter.update();
            Left_Page_Arrow.update();
            Right_Page_Arrow.update();

            base.UpdateMenu(active);

            if (ChangingPage)
            {
                (PageLoc.X < target_page_loc.X ? Right_Page_Arrow : Left_Page_Arrow).twirling_update();
                float distance = Math.Abs(PageLoc.X - target_page_loc.X) / 2;
                distance  = MathHelper.Clamp(MathHelper.Lerp(0, distance, ChangingPageTime / 12f), 0, distance);
                distance  = Math.Min(distance, 32);
                distance  = Math.Max(distance, 1);
                distance  = (float)Math.Pow(2, Math.Round(Math.Log(distance, 2)));
                PageLoc.X = (float)Additional_Math.double_closer(PageLoc.X, target_page_loc.X, (int)distance);

                ChangingPageTime++;
                if (PageLoc.X == target_page_loc.X)
                {
                    ChangingPage = false;
                }
            }
        }
示例#4
0
        protected override void UpdateMenu(bool active)
        {
            active &= DataDisplayed;

            Message.update();
            if (Background != null)
            {
                Background.update();
            }
            if (Battler != null)
            {
                Battler.update();
            }

            if (active)
            {
                // Slide offscreen
                if (Confirming || ChangingSprite)
                {
                    if (BattlerOffset.X >= this.OffscreenOffset)
                    {
                        if (Confirming)
                        {
                            OnConfirmed(new EventArgs());
                        }
                        else
                        {
                            RefreshBattler();
                        }
                    }
                    else
                    {
                        BattlerOffset.X = Additional_Math.int_closer(
                            (int)BattlerOffset.X, this.OffscreenOffset, 12);
                    }
                }
                // Slide onscreen
                else
                {
                    BattlerOffset.X = Additional_Math.int_closer(
                        (int)BattlerOffset.X, 0, 12);
                }
            }

            active &= !Confirming;

            int index = Window.index;

            base.UpdateMenu(active);
            if (index != Window.index)
            {
                ChangeBattler();
            }
        }
示例#5
0
        public void Update(bool gameInactive)
        {
            GameInactive = gameInactive;

            if (Volume != TargetVolume)
            {
                Volume = (float)Additional_Math.double_closer(Volume, TargetVolume, 0.08f);
            }

            UpdateBgm();
            UpdateMusicEffect();

            // Play any tracks waiting to start
            PlayCuedTracks();
        }
        protected override void update_ui(bool input)
        {
            base.update_ui(input);

            if (!ManualScroll)
            {
                int target_y = 16 * Scroll;
                if (Math.Abs(ScrollOffset.Y - target_y) <= 4)
                {
                    ScrollOffset.Y = target_y;
                }
                if (Math.Abs(ScrollOffset.Y - target_y) <= 16)
                {
                    ScrollOffset.Y = Additional_Math.int_closer((int)ScrollOffset.Y, target_y, 4);
                }
                else
                {
                    ScrollOffset.Y = ((int)(ScrollOffset.Y + target_y)) / 2;
                }
            }
        }
示例#7
0
        protected void draw_letter(SpriteBatch sprite_batch, Texture2D texture, int index, Vector2 draw_offset, Vector2 temp_loc, Font_Data data)
        {
            Vector2 loc = (this.loc + draw_vector()) - draw_offset;

            // Sine wave
            if (false)
            {
                const float magnitude  = 3 / 16f;
                float       sineOffset = Global.game_system.play_time_sine_wave(
                    1f,
                    -(index + ((int)(loc.Y / 16) * Config.FRAME_RATE * 37 / 64)) * 2,
                    false);
                loc += new Vector2(0, (int)((magnitude * data.CharHeight) * sineOffset));
            }
            // Random shake
            else if (false)
            {
                const float magnitude = 1.025f / 16;
                double      random    = NoiseGen.noise(
                    Global.game_system.total_play_time / 2 +
                    index * 40 + ((int)(loc.Y / 16) * Config.WINDOW_WIDTH));
                Vector2 shake_offset = Additional_Math.from_polar(
                    (float)((random + 1) * MathHelper.TwoPi / 2),
                    magnitude * data.CharHeight);
                loc += new Vector2((int)shake_offset.X, (int)shake_offset.Y);
            }

            Rectangle src_rect = data.CharacterSrcRect(Text[index]);

            Vector2 offset = this.offset;

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

            sprite_batch.Draw(texture, loc, src_rect, tint, angle, offset - temp_loc, scale,
                              mirrored ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Z);
        }