예제 #1
0
        private void DrawTrackBar(int x, int y, string lwLabel, string hiLabel, double rate, Action <double> changed, Action pulse = null)
        {
            DDDraw.DrawBegin(Ground.I.Picture.TrackBar, x, y);
            DDCrash drawedCrash = DDDraw.DrawGetCrash();

            DDDraw.DrawEnd();

            DDPrint.SetPrint(x - Ground.I.Picture.TrackBar.Get_W() / 2 - lwLabel.Length * 32, y - 15);
            DDPrint.Print(lwLabel);

            DDPrint.SetPrint(x + Ground.I.Picture.TrackBar.Get_W() / 2, y - 15);
            DDPrint.Print(hiLabel);

            double span = Ground.I.Picture.TrackBar.Get_W() - Ground.I.Picture.TrackBar_つまみ.Get_W();

            span /= 2;
            double xMin = x - span;
            double xMax = x + span;

            double xつまみ = DDUtils.AToBRate(xMin, xMax, rate);

            DDDraw.DrawCenter(Ground.I.Picture.TrackBar_つまみ, xつまみ, y);

            if (drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y))))
            {
                this.LastHoveringTrackBar = drawedCrash;
            }
            if (
                this.LastActiveTrackBar != null &&
                this.LastActiveTrackBar.Value.IsCrashed(DDCrashUtils.Point(new D2Point(x, y)))
                )
            {
                double rateNew = DDUtils.RateAToB(xMin, xMax, DDMouse.X);
                DDUtils.ToRange(ref rateNew, 0.0, 1.0);

                if (SCommon.MICRO < Math.Abs(rate - rateNew))
                {
                    changed(rateNew);
                }

                if (pulse != null)
                {
                    const int PULSE_FRM = 60;

                    if (DDEngine.ProcFrame % PULSE_FRM == 0)
                    {
                        pulse();
                    }
                }
            }
        }
예제 #2
0
        private void DrawButton(int x, int y, DDPicture picture, bool activeFlag)
        {
            DDDraw.SetAlpha(activeFlag ? 1.0 : 0.5);
            DDDraw.DrawBegin(picture, x, y);
            DDCrash drawedCrash = DDDraw.DrawGetCrash();

            DDDraw.DrawEnd();
            DDDraw.Reset();

            if (drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y))))
            {
                this.LastHoveringButton     = picture;
                this.LastButtonHoveringFlag = true;
            }
            else
            {
                this.LastButtonHoveringFlag = false;
            }
        }
예제 #3
0
        public override IEnumerable <bool> E_Draw()
        {
            Game.I.SkipMode = false;

            for (; ;)
            {
                //Game.I.CancelSkipAutoMode();

                if (
                    this.Options.Count < GameConsts.SELECT_OPTION_MIN ||
                    this.Options.Count > GameConsts.SELECT_OPTION_MAX
                    )
                {
                    throw new DDError("選択肢の個数に問題があります。");
                }

                // ---- 入力ここから

                if (!Game.I.BacklogMode)
                {
                    int moving = 0;

                    if (DDInput.DIR_8.IsPound())
                    {
                        moving = -1;
                    }

                    if (DDInput.DIR_2.IsPound())
                    {
                        moving = 1;
                    }

                    if (moving != 0)
                    {
                        int optIndex = this.GetMouseFocusedIndex();

                        if (optIndex == -1)
                        {
                            optIndex = 0;
                        }
                        else
                        {
                            optIndex += this.Options.Count + moving;
                            optIndex %= this.Options.Count;
                        }

                        DDMouse.X =
                            GameConsts.SELECT_FRAME_L +
                            Ground.I.Picture.MessageFrame_Button2.Get_W() * 2 -
                            10;
                        DDMouse.Y =
                            GameConsts.SELECT_FRAME_T + GameConsts.SELECT_FRAME_T_STEP * optIndex +
                            Ground.I.Picture.MessageFrame_Button2.Get_H() * 2 -
                            10;

                        DDMouse.PosChanged();
                    }
                }

                // ---- ここから描画

                if (!Hide)
                {
                    for (int index = 0; index < GameConsts.SELECT_FRAME_NUM; index++)
                    {
                        DDPicture picture = Ground.I.Picture.MessageFrame_Button;

                        if (index < this.Options.Count)
                        {
                            picture = Ground.I.Picture.MessageFrame_Button2;

                            if (this.Options[index].MouseFocused)
                            {
                                picture = Ground.I.Picture.MessageFrame_Button3;
                            }
                        }

                        DDDraw.DrawBeginRect(
                            picture,
                            GameConsts.SELECT_FRAME_L,
                            GameConsts.SELECT_FRAME_T + GameConsts.SELECT_FRAME_T_STEP * index,
                            picture.Get_W() * 2.0,
                            picture.Get_H() * 2.0
                            );
                        DDCrash drawedCrash = DDDraw.DrawGetCrash();
                        DDDraw.DrawEnd();

                        // フォーカスしている選択項目を再設定
                        {
                            if (index < this.Options.Count)
                            {
                                bool mouseIn = drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y)));

                                this.Options[index].MouseFocused = mouseIn;
                            }
                        }
                    }
                    for (int index = 0; index < this.Options.Count; index++)
                    {
                        const int title_x = 160;
                        const int title_y = 56;

                        DDFontUtils.DrawString(
                            GameConsts.SELECT_FRAME_L + title_x,
                            GameConsts.SELECT_FRAME_T + GameConsts.SELECT_FRAME_T_STEP * index + title_y,
                            this.Options[index].Title,
                            DDFontUtils.GetFont("Kゴシック", 32),
                            false,
                            new I3Color(110, 100, 90)
                            );
                    }
                }

                // 隠しているなら選択出来ない。
                if (Hide)
                {
                    foreach (OptionInfo option in this.Options)
                    {
                        option.MouseFocused = false;
                    }
                }

                yield return(true);
            }
        }
예제 #4
0
        private bool ControlSkipMode = false;         // ? コントロールキー押下によるスキップモード中

        public override IEnumerable <bool> E_Draw()
        {
            for (; ;)
            {
                // 入力:スキップモード・オートモード_解除
                if (
                    DDMouse.Rot != 0 ||
                    DDMouse.L.GetInput() == -1 && Game.I.SelectedSystemButtonIndex == -1 ||                     // システムボタン以外を左クリック
                    DDMouse.R.GetInput() == -1 ||
                    DDInput.A.GetInput() == 1
                    )
                {
                    Game.I.CancelSkipAutoMode();
                }

                // 入力:スキップモード
                if (1 <= DDInput.L.GetInput())
                {
                    Game.I.SkipMode      = true;
                    this.ControlSkipMode = true;
                }
                else
                {
                    if (this.ControlSkipMode)
                    {
                        Game.I.SkipMode      = false;
                        this.ControlSkipMode = false;
                    }
                }

                // ---- ここから描画

                DDUtils.Approach(ref this.A, Hide ? 0.0 : 1.0, 0.9);

                var buttons = new[]
                {
                    // p: 画像, fp: フォーカス時の画像, oh: オプショナル・ハイライト
                    new { p = Ground.I.Picture.MessageFrame_Save, fp = Ground.I.Picture.MessageFrame_Save2, oh = false },
                    new { p = Ground.I.Picture.MessageFrame_Load, fp = Ground.I.Picture.MessageFrame_Load2, oh = false },
                    new { p = Ground.I.Picture.MessageFrame_Skip, fp = Ground.I.Picture.MessageFrame_Skip2, oh = Game.I.SkipMode },
                    new { p = Ground.I.Picture.MessageFrame_Auto, fp = Ground.I.Picture.MessageFrame_Auto2, oh = Game.I.AutoMode },
                    new { p = Ground.I.Picture.MessageFrame_Log, fp = Ground.I.Picture.MessageFrame_Log2, oh = false },
                    new { p = Ground.I.Picture.MessageFrame_Menu, fp = Ground.I.Picture.MessageFrame_Menu2, oh = false },
                };

                int selSysBtnIdx = -1;

                for (int index = 0; index < buttons.Length; index++)
                {
                    bool focused = index == Game.I.SelectedSystemButtonIndex;

                    DDDraw.SetAlpha(this.A * (focused ? 1.0 : Ground.I.MessageWindow_A_Pct / 100.0));
                    DDDraw.DrawBegin(
                        focused || buttons[index].oh ? buttons[index].fp : buttons[index].p,
                        GameConsts.SYSTEM_BUTTON_X + index * GameConsts.SYSTEM_BUTTON_X_STEP,
                        GameConsts.SYSTEM_BUTTON_Y
                        );
                    DDDraw.DrawZoom(2.0);
                    DDCrash drawedCrash = DDDraw.DrawGetCrash();
                    DDDraw.DrawEnd();
                    DDDraw.Reset();

                    if (drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y))))
                    {
                        selSysBtnIdx = index;
                    }
                }
                Game.I.SelectedSystemButtonIndex = selSysBtnIdx;

                // 隠しているなら選択出来ない。
                if (Hide)
                {
                    Game.I.SelectedSystemButtonIndex = -1;
                }

                yield return(true);
            }
        }
예제 #5
0
        private int SelectedSaveDataSlotIndex = -1;                    // -1 == 未選択

        private SaveDataSlot Perform(Action a_drawWall, bool saveMode) // ret: null == セーブモード || (ロードモード && キャンセルした)
        {
            this.DrawWall = a_drawWall;

            DDHashedData thumbnail = saveMode ? this.MakeThumbnail() : null;
            SaveDataSlot ret       = null;

            DDEngine.FreezeInput();

            for (; ;)
            {
                // ====
                // 入力判定ここから
                // ====

                if (
                    DDInput.A.GetInput() == 1 ||
                    DDInput.B.GetInput() == 1 ||
                    DDMouse.R.GetInput() == -1
                    )
                {
                    break;
                }

                if (DDMouse.L.GetInput() == -1)
                {
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_前へ)
                    {
                        this.PageIndex--;
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_次へ)
                    {
                        this.PageIndex++;
                    }

                    DDUtils.ToRange(ref this.PageIndex, 0, PAGE_NUM - 1);

                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_戻る)
                    {
                        break;
                    }
                    if (this.SelectedSaveDataSlotIndex != -1)
                    {
                        SaveDataSlot sdSlot = Ground.I.SaveDataSlots[this.SelectedSaveDataSlotIndex];

                        if (saveMode)                         // ? セーブモード
                        {
                            if (new Confirm()
                            {
                                BorderColor =
                                    sdSlot.SerializedGameStatus != null ?
                                    new I3Color(255, 0, 0) :
                                    new I3Color(150, 150, 50)
                            }
                                .Perform(
                                    sdSlot.SerializedGameStatus != null ?
                                    "スロット " + (this.SelectedSaveDataSlotIndex + 1) + " のデータを上書きします。" :
                                    "スロット " + (this.SelectedSaveDataSlotIndex + 1) + " にセーブします。", "はい", "いいえ") == 0)
                            {
                                sdSlot.SerializedGameStatus = Game.I.Status.Serialize();
                                sdSlot.SavedTime            = new SCommon.SimpleDateTime(SCommon.TimeStampToSec.ToSec(DateTime.Now));
                                sdSlot.Thumbnail            = thumbnail;
                            }
                        }
                        else                                         // ? ロードモード
                        {
                            if (sdSlot.SerializedGameStatus != null) // ロードする。
                            {
                                if (new Confirm()
                                {
                                    BorderColor = new I3Color(50, 100, 200)
                                }
                                    .Perform("スロット " + (this.SelectedSaveDataSlotIndex + 1) + " のデータをロードします。", "はい", "いいえ") == 0)
                                {
                                    ret = sdSlot;
                                    break;
                                }
                            }
                        }
                    }
                }

                // ====
                // 入力判定ここまで
                // ====

                // ====
                // 描画ここから
                // ====

                this.LastHoveringButton = null;                 // 不使用
                this.DrawWall();

                DDDraw.DrawSimple(Ground.I.Picture.詳細設定枠, 0, 0);

                DrawTabTitle(855, 70, saveMode ? "セーブ" : "ロード", true);

                int selSDSlotIndex = -1;
                int sdSlotIndex    = this.PageIndex * 10;

                for (int y = 0; y < 2; y++)
                {
                    for (int x = 0; x < 5; x++)
                    {
                        bool         selected = this.SelectedSaveDataSlotIndex == sdSlotIndex;
                        SaveDataSlot sdSlot   = Ground.I.SaveDataSlots[sdSlotIndex];

                        int slotX = 260 + x * 350;
                        int slotY = 360 + y * 350;

                        DDDraw.SetAlpha(selected ? 1.0 : 0.3);
                        DDDraw.DrawBegin(Ground.I.Picture.SaveDataSlot, slotX, slotY);
                        DDCrash drawedCrash = DDDraw.DrawGetCrash();
                        DDDraw.DrawEnd();
                        DDDraw.Reset();

                        if (drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y))))
                        {
                            selSDSlotIndex = sdSlotIndex;
                        }

                        DDDraw.DrawCenter(DDHashedResource.GetPicture(sdSlot.Thumbnail), slotX, slotY);

                        DDPrint.SetBorder(new I3Color(0, 0, 150));
                        DDPrint.SetPrint(slotX - 140, slotY - 145);
                        DDPrint.Print("" + (sdSlotIndex + 1));

                        DDPrint.SetBorder(new I3Color(0, 0, 150));
                        DDPrint.SetPrint(slotX - 150, slotY + 120);
                        DDPrint.Print(sdSlot.SavedTime.Year == 1 ?
                                      "----/--/--(--)--:--"
                                      //"----/--/-- --:--:--"
                                                        : sdSlot.SavedTime.ToString(
                                          "{0:D4}/{1:D2}/{2:D2}({3}){4:D2}:{5:D2}"
                                          //"{0:D4}/{1:D2}/{2:D2} {4:D2}:{5:D2}:{6:D2}"
                                          ));

                        sdSlotIndex++;
                    }
                }
                this.SelectedSaveDataSlotIndex = selSDSlotIndex;

                this.DrawButton(800, 950, Ground.I.Picture.SettingButton_前へ, 0 < this.PageIndex);
                this.DrawButton(1120, 950, Ground.I.Picture.SettingButton_次へ, this.PageIndex < PAGE_NUM - 1);
                this.DrawButton(1630, 950, Ground.I.Picture.SettingButton_戻る, true);

                // ====
                // 描画ここまで
                // ====

                DDEngine.EachFrame();
            }
            DDEngine.FreezeInput();

            DDHashedResource.ClearPicture();

            return(ret);
        }