private IEnumerable <bool> DrawString(int x, int y, string text, int frameMax = 600) { double b = 0.0; double bTarg = 1.0; foreach (DDScene scene in DDSceneUtils.Create(frameMax)) { if (scene.Numer == scene.Denom - 300) { bTarg = 0.0; } DDUtils.Approach(ref b, bTarg, 0.99); I3Color color = new I3Color( SCommon.ToInt(b * 255), SCommon.ToInt(b * 255), SCommon.ToInt(b * 255) ); DDFontUtils.DrawString(x, y, text, DDFontUtils.GetFont("03\u711a\u706b-Regular", 30), false, color); yield return(true); } }
private void PrintPadButtonKeySetting(bool キー設定Flag, int padButtonIndex, string title, DDInput.Button button) { int y = 230 + padButtonIndex * 90; string setting; if (キー設定Flag) { setting = string.Join(" , ", button.KeyIds.Select(keyId => DDSimpleMenu.GetKeyName(keyId))); } else { setting = string.Join(" , ", button.BtnIds.Select(btnId => DDSimpleMenu.GetPadButtonName(btnId))); } this.DrawButton(300, y + 25, Ground.I.Picture.SettingButton_変更, true); if (this.LastButtonHoveringFlag && DDMouse.L.GetInput() == -1) { InputPadButtonKeySetting(キー設定Flag, title, button); } DDFontUtils.DrawString( 550, y, "「" + title + "」 = " + setting, DDFontUtils.GetFont("Kゴシック", 50), false, キー設定Flag ? new I3Color(192, 255, 128) : new I3Color(255, 192, 128), キー設定Flag ? new I3Color(50, 100, 0) : new I3Color(100, 50, 0) ); }
public static void Print(string line) { if (P_X == -1) { throw new DDError(); } DDFontUtils.DrawString(P_X, P_Y, line, DDFontUtils.GetFont(P_FontName, P_FontSize)); P_Y += P_YStep; }
private void InputPadButtonKeySetting(bool キー設定Flag, string title, DDInput.Button button) { DDEngine.FreezeInput(); for (; ;) { if ( //DDInput.A.GetInput() == 1 || // ... 現在の割り当てボタン・キーに反応してしまうんでない? //DDInput.B.GetInput() == 1 || DDMouse.R.GetInput() == -1 ) { break; } if (CheckInputPadButtonKey(キー設定Flag, button)) { DDEngine.FreezeInput(GameConsts.LONG_INPUT_SLEEP); // 決定・キャンセルを変更した場合を考慮して、長めにフリーズしておく break; } this.DrawWall(); DDDraw.DrawSimple(Ground.I.Picture.詳細設定枠, 0, 0); if (キー設定Flag) { DrawTabTitle(480, 70, "キーボードのキー設定 / 変更", true); } else { DrawTabTitle(400, 70, "ゲームパッドのボタン設定 / 変更", true); } DDFontUtils.DrawString( 100, 520, "「" + title + "」に割り当てる" + (キー設定Flag ? "キー" : "ボタン") + "を押して下さい。", DDFontUtils.GetFont("Kゴシック", 50), false, new I3Color(255, 255, 255), new I3Color(100, 100, 0) ); this.DrawButton(1630, 950, Ground.I.Picture.SettingButton_キャンセル, true); if (this.LastButtonHoveringFlag && DDMouse.L.GetInput() == -1) { break; } DDEngine.EachFrame(); } DDEngine.FreezeInput(); }
private void DrawPrompt(int x, int y, string line) { DDFontUtils.DrawString( x, y, line, DDFontUtils.GetFont("Kゴシック", 50), false, new I3Color(255, 255, 255), new I3Color(0, 0, 100) ); }
private void DrawTabTitle(int x, int y, string line, bool activeFlag) { DDFontUtils.DrawString( x, y, line, DDFontUtils.GetFont("Kゴシック", 70), false, activeFlag ? new I3Color(100, 255, 255) : new I3Color(150, 150, 150), activeFlag ? new I3Color(50, 100, 100) : new I3Color(100, 100, 100) ); }
public override IEnumerable <bool> E_Draw() { for (; ;) { DDUtils.Approach(ref this.A, this.IsVisible ? 1.0 : 0.0, 0.9); DDUtils.Approach(ref this.X_Zure, 0.0, 0.93); DDUtils.Approach(ref this.Y_Zure, 0.0, 0.93); DDDraw.SetAlpha(this.A); DDDraw.DrawBegin( this.Thinking ? Ground.I.Picture.Novel_吹き出しThink : Ground.I.Picture.Novel_吹き出し, this.X + this.X_Zure, this.Y + this.Y_Zure ); DDDraw.DrawZoom_X(1.2); DDDraw.DrawZoom_X(this.Mirrored ? -1 : 1); DDDraw.DrawEnd(); DDDraw.Reset(); #if false // 廃止 // サブタイトル文字列 { int dispSubtitleLength = Math.Min(Novel.I.DispSubtitleCharCount, Novel.I.CurrPage.Subtitle.Length); string dispSubtitle = Novel.I.CurrPage.Subtitle.Substring(0, dispSubtitleLength); DDFontUtils.DrawString(10, 413, dispSubtitle, DDFontUtils.GetFont("Kゴシック", 16)); } #endif // シナリオのテキスト文字列 if (this.IsVisible) { int dispTextLength = Math.Min(Novel.I.DispCharCount, Novel.I.CurrPage.Text.Length); string dispText = Novel.I.CurrPage.Text.Substring(0, dispTextLength); string[] dispLines = dispText.Split('\n'); for (int index = 0; index < dispLines.Length; index++) { double x = this.X - 240; double y = this.Y - 60 + index * 30; x += this.X_Zure; y += this.Y_Zure; DDFontUtils.DrawString((int)x, (int)y, dispLines[index], DDFontUtils.GetFont("Kゴシック", 16), false, new I3Color(110, 100, 90)); } } yield return(true); } }
private IEnumerable <bool> GetLayer03(string imgFile) { DDPicture img = DDPictureLoaders.Standard(imgFile); // g double a = 0.0; double z = 2.0; double t1x = 100; double t2x = 100; double t3x = 100; for (int frmcnt = 0; ; frmcnt++) { DDDraw.DrawBegin(img, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(1.353); DDDraw.SetAlpha(a); DDDraw.DrawEnd(); DDDraw.DrawBegin(img, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2); DDDraw.DrawZoom(1.353 * z); DDDraw.SetAlpha(a / 2.0); DDDraw.DrawEnd(); I3Color color = new I3Color((int)(255 * a), (int)(255 * a), (int)(255 * a)); if (10 < frmcnt) { DDFontUtils.DrawString((int)(1000 + t1x), 620, "TOKYO", DDFontUtils.GetFont("Ink Free", 100), false, color); DDUtils.Approach(ref t1x, 0.0, 0.8); } if (15 < frmcnt) { DDFontUtils.DrawString((int)(1200 + t2x), 720, "LOVE", DDFontUtils.GetFont("Ink Free", 200), false, color); DDUtils.Approach(ref t2x, 0.0, 0.8); } if (20 < frmcnt) { DDFontUtils.DrawString((int)(1000 + t3x), 900, "STORY 1991", DDFontUtils.GetFont("Ink Free", 100), false, color); DDUtils.Approach(ref t3x, 0.0, 0.8); } DDUtils.Approach(ref a, 1.0, 0.98); DDUtils.Approach(ref z, 1.0, 0.98); yield return(true); } }
public override IEnumerable <bool> E_Draw() { const int h = 136; for (; ;) { DDUtils.Approach(ref this.A, Hide ? 0.0 : 1.0, 0.9); DDDraw.SetAlpha(this.A); DDDraw.DrawRect(Ground.I.Picture.MessageFrame_Message, 0, DDConsts.Screen_H - h, DDConsts.Screen_W, h); DDDraw.Reset(); if (!Hide) { // サブタイトル文字列 { int dispSubtitleLength = Math.Min(Novel.I.DispSubtitleCharCount, Novel.I.CurrPage.Subtitle.Length); string dispSubtitle = Novel.I.CurrPage.Subtitle.Substring(0, dispSubtitleLength); DDFontUtils.DrawString( 10, 413, dispSubtitle, DDFontUtils.GetFont("Kゴシック", 16) ); } // シナリオのテキスト文字列 { int dispTextLength = Math.Min(Novel.I.DispCharCount, Novel.I.CurrPage.Text.Length); string dispText = Novel.I.CurrPage.Text.Substring(0, dispTextLength); string[] dispLines = dispText.Split('\n'); for (int index = 0; index < dispLines.Length; index++) { DDFontUtils.DrawString( 10, 450 + index * 30, dispLines[index], DDFontUtils.GetFont("Kゴシック", 16), false, new I3Color(110, 100, 90) ); } } } yield return(true); } }
/// <summary> /// 選択肢表示テスト /// </summary> public void Test01() { for (; ;) { DDCurtain.DrawCurtain(); // メッセージ枠 { const int h = 136; DDDraw.SetAlpha(0.9); DDDraw.DrawRect(Ground.I.Picture.MessageFrame29_Message, 0, DDConsts.Screen_H - h, DDConsts.Screen_W, h); DDDraw.Reset(); } // 選択項目 x3 { const int x = 290; const int y = 70; const int yStep = 100; DDDraw.DrawSimple(Ground.I.Picture.MessageFrame29_Button2, x, y + yStep * 0); DDDraw.DrawSimple(Ground.I.Picture.MessageFrame29_Button2, x, y + yStep * 1); DDDraw.DrawSimple(Ground.I.Picture.MessageFrame29_Button2, x, y + yStep * 2); string[] items = new string[] { "ここに最初の選択肢の文字列を表示します。", "ここに真ん中の選択肢の文字列を表示します。", "ここに最後の選択肢の文字列を表示します。", }; const int item_x = 80; const int item_y = 28; DDFontUtils.DrawString(x + item_x, y + yStep * 0 + item_y, items[0], DDFontUtils.GetFont("Kゴシック", 16), false, new I3Color(110, 100, 90)); DDFontUtils.DrawString(x + item_x, y + yStep * 1 + item_y, items[1], DDFontUtils.GetFont("Kゴシック", 16), false, new I3Color(110, 100, 90)); DDFontUtils.DrawString(x + item_x, y + yStep * 2 + item_y, items[2], DDFontUtils.GetFont("Kゴシック", 16), false, new I3Color(110, 100, 90)); } DDEngine.EachFrame(); } }
private void PrintPadButtonKeySetting(bool キー設定Flag, int padButtonIndex, string title, DDInput.Button button) { int y = 230 + padButtonIndex * 90; Func <DDInput.Button, string> getSetting; { Func <string, string> w = s => Common.FirstNotEmpty(s, "割り当てナシ"); if (キー設定Flag) { getSetting = btn => w(string.Join(" , ", btn.KeyIds.Select(keyId => DDSimpleMenu.GetKeyName(keyId)))); } else { getSetting = btn => w(string.Join(" , ", btn.BtnIds.Select(btnId => DDSimpleMenu.GetPadButtonName(btnId)))); } } this.DrawButton(300, y + 25, Ground.I.Picture.SettingButton_変更, true); if (this.LastButtonHoveringFlag && DDMouse.L.GetInput() == -1) { InputPadButtonKeySetting(キー設定Flag, title, button, getSetting); } DDFontUtils.DrawString( 550, y, "「" + title + "」 = " + getSetting(button), DDFontUtils.GetFont("Kゴシック", 50), false, キー設定Flag ? new I3Color(192, 255, 128) : new I3Color(255, 192, 128), キー設定Flag ? new I3Color(50, 100, 0) : new I3Color(100, 50, 0) ); }
/// <summary> /// 過去ログ /// </summary> private void BackLog() { List <string> logLines = new List <string>(); for (int index = 0; index < this.Status.CurrPageIndex; index++) { foreach (string line in this.Status.Scenario.Pages[index].Lines) { logLines.Add(line); } } DDEngine.FreezeInput(NovelConsts.SHORT_INPUT_SLEEP); int backIndex = 0; for (; ;) { if ( DDMouse.L.GetInput() == -1 || DDInput.A.GetInput() == 1 ) { break; } if ( DDInput.DIR_8.IsPound() || 0 < DDMouse.Rot ) { backIndex++; } if ( DDInput.DIR_2.IsPound() || DDMouse.Rot < 0 ) { backIndex--; } if ( DDInput.DIR_6.GetInput() == 1 ) { backIndex = -1; } DDUtils.ToRange(ref backIndex, -1, logLines.Count - 1); if (backIndex < 0) { break; } this.DrawSurfaces(); DDCurtain.DrawCurtain(-0.8); for (int c = 1; c <= 17; c++) { int i = logLines.Count - backIndex - c; if (0 <= i) { DDFontUtils.DrawString(8, DDConsts.Screen_H - c * 30 - 8, logLines[i], DDFontUtils.GetFont("Kゴシック", 16)); } } DDEngine.EachFrame(); } DDEngine.FreezeInput(NovelConsts.SHORT_INPUT_SLEEP); }
private void InputPadButtonKeySetting(bool キー設定Flag, string title, DDInput.Button button, Func <DDInput.Button, string> getSetting) { DDEngine.FreezeInput(); button.Backup(); if (キー設定Flag) { button.KeyIds = new int[0]; } else { button.BtnIds = new int[0]; } for (; ;) { CheckInputPadButtonKey(キー設定Flag, button); this.DrawWall(); DDDraw.DrawSimple(Ground.I.Picture.詳細設定枠, 0, 0); if (キー設定Flag) { DrawTabTitle(480, 70, "キーボードのキー設定 / 変更", true); } else { DrawTabTitle(400, 70, "ゲームパッドのボタン設定 / 変更", true); } DDFontUtils.DrawString( 100, 400, "「" + title + "」に割り当てる" + (キー設定Flag ? "キー" : "ボタン") + "を押して下さい。(複数可)", DDFontUtils.GetFont("Kゴシック", 50), false, new I3Color(255, 255, 255), new I3Color(100, 100, 0) ); DDFontUtils.DrawString( 100, 475, "入力が終わったら「決定」をクリックして下さい。", DDFontUtils.GetFont("Kゴシック", 50), false, new I3Color(255, 255, 255), new I3Color(100, 100, 0) ); DDFontUtils.DrawString( 100, 600, "現在の割り当て:" + getSetting(button), DDFontUtils.GetFont("Kゴシック", 50), false, new I3Color(255, 255, 255), new I3Color(100, 0, 100) ); bool inputDone; if (キー設定Flag) { inputDone = 1 <= button.KeyIds.Length; } else { inputDone = 1 <= button.BtnIds.Length; } this.DrawButton(1200, 950, Ground.I.Picture.SettingButton_決定, inputDone); if (this.LastButtonHoveringFlag && DDMouse.L.GetInput() == -1 && inputDone) { break; } this.DrawButton(1630, 950, Ground.I.Picture.SettingButton_キャンセル, true); if (this.LastButtonHoveringFlag && DDMouse.L.GetInput() == -1 || DDMouse.R.GetInput() == -1) { button.Restore(); break; } DDEngine.EachFrame(); } DDEngine.FreezeInput(); }
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); } }
public void Perform() { DDCurtain.SetCurtain(0, -1.0); DDCurtain.SetCurtain(); restartCurrPage: this.CurrPage = this.Status.Scenario.Pages[this.Status.CurrPageIndex]; foreach (ScenarioCommand command in this.CurrPage.Commands) { command.Invoke(); } int dispSubtitleCharCount = 0; int dispCharCount = 0; int dispPageEndedCount = 0; bool dispFastMode = false; DDEngine.FreezeInput(); for (; ;) { DDMouse.UpdatePos(); // キー押下は 1 マウス押下は -1 で判定する。 // 入力:シナリオを進める。 if ( DDMouse.L.GetInput() == -1 || DDInput.A.GetInput() == 1 || DDKey.GetInput(DX.KEY_INPUT_SPACE) == 1 || DDKey.GetInput(DX.KEY_INPUT_RETURN) == 1 ) { if (dispPageEndedCount < NEXT_PAGE_KEY_INTERVAL) // ? ページ表示_未完了 -> ページ表示_高速化 { dispFastMode = true; } else // ? ページ表示_完了 -> 次ページ { this.Status.CurrPageIndex++; if (this.Status.Scenario.Pages.Count <= this.Status.CurrPageIndex) { break; } goto restartCurrPage; } } if ( this.CurrPage.Subtitle.Length < dispSubtitleCharCount && this.CurrPage.Text.Length < dispCharCount ) { dispPageEndedCount++; } if (dispFastMode) { dispSubtitleCharCount += 2; dispCharCount += 2; } else { if (DDEngine.ProcFrame % 2 == 0) { dispSubtitleCharCount++; } if (DDEngine.ProcFrame % 3 == 0) { dispCharCount++; } } DDUtils.ToRange(ref dispSubtitleCharCount, 0, IntTools.IMAX); DDUtils.ToRange(ref dispCharCount, 0, IntTools.IMAX); // ==== // 描画ここから // ==== this.DrawSurfaces(); // メッセージ枠 { const int h = 136; DDDraw.SetAlpha(0.9); DDDraw.DrawRect(Ground.I.Picture.MessageFrame_Message, 0, DDConsts.Screen_H - h, DDConsts.Screen_W, h); DDDraw.Reset(); } // システムボタン { const double BUTTON_L = 530.5; // 素材の幅が奇数なので n + 0.5 const double BUTTON_T = 412.5; // 素材の高さも奇数なので n + 0.5 const double BUTTON_X_STEP = 78.0; DDPicture[] buttons = new DDPicture[] { Ground.I.Picture.MessageFrame_Save, Ground.I.Picture.MessageFrame_Load, Ground.I.Picture.MessageFrame_Skip, Ground.I.Picture.MessageFrame_Auto, Ground.I.Picture.MessageFrame_Log, Ground.I.Picture.MessageFrame_Menu, //Ground.I.Picture.MessageFrame_Close, //Ground.I.Picture.MessageFrame_Config, //Ground.I.Picture.MessageFrame_QLoad, //Ground.I.Picture.MessageFrame_QSave, //Ground.I.Picture.MessageFrame_Screen, //Ground.I.Picture.MessageFrame_Title, }; for (int index = 0; index < buttons.Length; index++) { DDDraw.DrawCenter(buttons[index], BUTTON_L + index * BUTTON_X_STEP, BUTTON_T); } } // サブタイトル文字列 { int dispSubtitleLength = Math.Min(dispCharCount, this.CurrPage.Subtitle.Length); string dispSubtitle = this.CurrPage.Subtitle.Substring(0, dispSubtitleLength); DDFontUtils.DrawString(120, 320, dispSubtitle, DDFontUtils.GetFont("Kゴシック", 16)); } // シナリオのテキスト文字列 { int dispTextLength = Math.Min(dispCharCount, this.CurrPage.Text.Length); string dispText = this.CurrPage.Text.Substring(0, dispTextLength); string[] dispLines = dispText.Split('\n'); for (int index = 0; index < dispLines.Length; index++) { DDFontUtils.DrawString(10, 450 + index * 30, dispLines[index], DDFontUtils.GetFont("Kゴシック", 16), false, new I3Color(110, 100, 90)); } } DDEngine.EachFrame(); } DDCurtain.SetCurtain(30, -1.0); DDMusicUtils.Fade(); foreach (DDScene scene in DDSceneUtils.Create(40)) { this.DrawSurfaces(); DDEngine.EachFrame(); } DDEngine.FreezeInput(); }
public void Draw(double[] spectra) { if (spectra.Length != 90) { throw null; // souteigai !!! } if (this.ShadowSpectra == null) { this.ShadowSpectra = new ShadowSpectraData(); } this.ShadowSpectra.Projection(spectra); DDSubScreenUtils.ChangeDrawScreen(this.GraphScreen); DX.ClearDrawScreen(); for (int c = 0; c < 30; c++) { double v = this.ShadowSpectra.ShadowSpectra[c * 3 + 0] + this.ShadowSpectra.ShadowSpectra[c * 3 + 1] + this.ShadowSpectra.ShadowSpectra[c * 3 + 2]; v /= 3.0; int x1 = c * 30; int x2 = x1 + 10; int y1 = (int)((1.0 - v) * 600); int y2 = 600; if (y1 + 1 < y2) { DDDraw.SetBright(0.4, 0.5, 0.6); DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, x1, y1, x2 - x1, y2 - y1); DDDraw.Reset(); } } for (int c = 0; c < 30; c++) { double v = spectra[c * 3 + 0] + spectra[c * 3 + 1] + spectra[c * 3 + 2]; v /= 3.0; int x1 = c * 30; int x2 = x1 + 10; int y1 = (int)((1.0 - v) * 600); int y2 = 600; if (y1 + 1 < y2) { DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, x1, y1, x2 - x1, y2 - y1); } } DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, 0, 620, 880, 10); DDFontUtils.DrawString(0, 640, "小田和正", DDFontUtils.GetFont("メイリオ", 80)); DDFontUtils.DrawString(270, 740, "ラブ・ストーリーは突然に", DDFontUtils.GetFont("メイリオ", 50)); DDFontUtils.DrawString(30, 840, "『 東京ラブストーリー ( 1991 ) 』 主題歌", DDFontUtils.GetFont("メイリオ", 40)); DDSubScreenUtils.ChangeDrawScreen(this.Screen); DX.ClearDrawScreen(); DDDraw.DrawBegin(DDPictureLoaders2.Wrapper(this.GraphScreen), 500, 500); DDDraw.SetBright(0, 0, 0); DDDraw.DrawEnd(); DDDraw.Reset(); DX.GraphFilter(this.Screen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000); DDDraw.DrawCenter(DDPictureLoaders2.Wrapper(this.GraphScreen), 500, 500); DDSubScreenUtils.RestoreDrawScreen(); }