public void Shuffle <T>(T[] arr) { for (int index = arr.Length; 2 <= index; index--) { SCommon.Swap(arr, this.GetInt(index), index - 1); } }
public void Swap(int a, int b) { this.CheckIndex(a); this.CheckIndex(b); SCommon.Swap(this.Inner, a, b); }
private IEnumerable <bool> E_SortSurfaces() { for (; ;) { for (int index = 1; index < Game.I.Status.Surfaces.Count; index++) { if (0 < SS_Comp(Game.I.Status.Surfaces[index - 1], Game.I.Status.Surfaces[index])) { SCommon.Swap(Game.I.Status.Surfaces, index - 1, index); if (1 < index) { index--; } } yield return(true); } yield return(true); // ループ内で実行されない場合を想定 } }
/// <summary> /// ポーズメニュー /// </summary> private void Pause() { DDMain.KeepMainScreen(); SCommon.Swap(ref DDGround.KeptMainScreen, ref Pause_KeptMainScreen); DDSimpleMenu simpleMenu = new DDSimpleMenu() { BorderColor = new I3Color(0, 64, 128), WallDrawer = () => { DDDraw.DrawSimple(Pause_KeptMainScreen.ToPicture(), 0, 0); DDDraw.SetAlpha(0.5); DDDraw.SetBright(0, 0, 0); DDDraw.DrawRect(Ground.I.Picture.WhiteBox, 0, DDConsts.Screen_H / 4, DDConsts.Screen_W, DDConsts.Screen_H / 2); DDDraw.Reset(); }, }; DDEngine.FreezeInput(); int selectIndex = 0; for (; ;) { selectIndex = simpleMenu.Perform( 100, 180, 50, 24, "システムメニュー", new string[] { "設定", "タイトルに戻る", "ゲームに戻る", }, selectIndex, true ); switch (selectIndex) { case 0: using (new SettingMenu() { SimpleMenu = new DDSimpleMenu() { BorderColor = new I3Color(0, 64, 128), WallDrawer = () => { DDDraw.DrawSimple(Pause_KeptMainScreen.ToPicture(), 0, 0); DDCurtain.DrawCurtain(-0.7); }, }, }) { SettingMenu.I.Perform(); } break; case 1: if (new Confirm() { BorderColor = new I3Color(0, 0, 200), }.Perform("タイトル画面に戻ります。", "はい", "いいえ") == 0) { this.Pause_ReturnToTitleMenu = true; goto endLoop; } break; case 2: goto endLoop; default: throw null; // never } //DDEngine.EachFrame(); // 不要 } endLoop: DDEngine.FreezeInput(); DDInput.A.FreezeInputUntilRelease = true; DDInput.B.FreezeInputUntilRelease = true; }
private IEnumerable <bool> DrawString(int x, int y, string text, int frameMax = 600) { DDSubScreen subScreenTmp = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H, true); DDSubScreen subScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H, true); SubScreens.Add(subScreenTmp); SubScreens.Add(subScreen); using (subScreenTmp.Section()) { DX.ClearDrawScreen(); DDFontUtils.DrawString_XCenter(x, y, text, DDFontUtils.GetFont("K\u30b4\u30b7\u30c3\u30af", 30)); ぼかし効果.Perform(0.01); } for (int c = 0; c < 3; c++) { using (subScreen.Section()) { DX.ClearDrawScreen(); for (int d = 0; d < 30; d++) { DDDraw.SetBlendAdd(1.0); DDDraw.DrawSimple(subScreenTmp.ToPicture(), 0, 0); DDDraw.Reset(); } ぼかし効果.Perform(0.01); } SCommon.Swap(ref subScreen, ref subScreenTmp); } using (subScreen.Section()) { DX.ClearDrawScreen(); DDDraw.SetBright(0.0, 0.1, 0.2); DDDraw.DrawSimple(subScreenTmp.ToPicture(), 0, 0); DDDraw.Reset(); DDFontUtils.DrawString_XCenter(x, y, text, DDFontUtils.GetFont("K\u30b4\u30b7\u30c3\u30af", 30)); } double a = 0.0; double aTarg = 1.0; foreach (DDScene scene in DDSceneUtils.Create(frameMax)) { if (scene.Numer == scene.Denom - 300) { aTarg = 0.0; } DDUtils.Approach(ref a, aTarg, 0.985); DDDraw.SetAlpha(a); DDDraw.DrawSimple(subScreen.ToPicture(), 0, 0); DDDraw.Reset(); yield return(true); } }