@Initialize { SetAutoDeleteObject(true); LoadReplayList(); TBackground(); TReplaySelectScene(); SetScriptResult(""); } @MainLoop { yield; } @Finalize { } function CreateTextObject( float mx, my, size, string text, font, int colorTop, colorBottom, int borderColor, borderWidth, int renderPriority ){ let obj = ObjText_Create(); ObjText_SetText(obj, text); ObjText_SetFontSize(obj, size); ObjText_SetFontType(obj, font); ObjText_SetFontColorTop(obj, colorTop); ObjText_SetFontColorBottom(obj, colorBottom); ObjText_SetFontBorderType(obj, BORDER_FULL); ObjText_SetFontBorderColor(obj, borderColor); ObjText_SetFontBorderWidth(obj, borderWidth); Obj_SetRenderPriorityI(obj, renderPriority); ObjRender_SetX(obj, mx); ObjRender_SetY(obj, my); return obj; } function _Create2DImage(imgpath, int[] rectarray){ int imgname = ObjPrim_Create(OBJ_SPRITE_2D); ObjPrim_SetTexture(imgname, imgpath); ObjSprite2D_SetSourceRect(imgname, rectarray); ObjSprite2D_SetDestCenter(imgname); //ObjRender_SetPosition(imgname, positionstart) return imgname; } task TBackground() { //背景 int image = _Create2DImage("script/game/PackageLib/PlaceholderTitleImage_Player.png", [0, 0, 1920, 1080]); LoadTextureEx(image, true, true); Obj_SetRenderPriorityI(image, 1); ObjRender_SetAlpha(image, 80); ObjSprite2D_SetDestRect(image, 0, 0, 1920, 1080); //タイトル文字列 let objText = ObjText_Create(); ObjText_SetText(objText, "Journals of the Strongest Fairy"); ObjText_SetFontType(objText, "Connecting Chain Handserif"); ObjText_SetFontSize(objText, 96); ObjText_SetFontBold(objText, true); ObjText_SetFontColorTop(objText, 128, 128, 255); ObjText_SetFontColorBottom(objText, 64, 64, 255); ObjText_SetFontBorderType(objText, BORDER_FULL); ObjText_SetFontBorderColor(objText,255, 255, 255); ObjText_SetFontBorderWidth(objText, 2); Obj_SetRenderPriorityI(objText, 30); ObjRender_SetX(objText, 32); ObjRender_SetY(objText, 32); let objWarning = CreateTextObject( GetScreenWidth()/2, 11*GetScreenHeight()/12, [35, 40][GetCommonData("Language", 0)], ["Press X/Cancel to return to the menu.", "X/CANCEL:メニューに帰る"][GetCommonData("Language", 0)], "コーポレート・ロゴ(ラウンド) ver2 Bold", 0xFFFFFF, 0xFFFFFF, 0x5800BB, 35/10, 2 ); ObjText_SetHorizontalAlignment(objWarning, ALIGNMENT_CENTER); } //---------------------------------------------------- // リプレイ選択 //---------------------------------------------------- task TReplaySelectScene { LoadReplayList(); let listValidReplayIndex = GetValidReplayIndices(); let cursorY = 0; let page = 0; let countMaxItem = length(listValidReplayIndex); let countItemPerPage = 20; let pageMax = trunc((countMaxItem - 1) / countItemPerPage); pageMax = max(pageMax, 0); let lastPageMaxCursorY = trunc(countMaxItem % countItemPerPage); if(countMaxItem % countItemPerPage == 0) { lastPageMaxCursorY = countItemPerPage; } task TMenuItem(let itemY) { let objText = CreateTextObject(32, 120 + 50 * itemY, 40, ""); ObjText_SetFontBorderWidth(objText, 2); let objSelect = CreateTextObject(32, 120 + 50 * itemY, 40, ""); ObjText_SetFontBorderWidth(objSelect, 2); ObjRender_SetAlpha(objText, 150); ObjRender_SetAlpha(objSelect, 120); ObjRender_SetBlendType(objSelect, BLEND_ADD_ARGB); let oldPage = -1; loop { if(page != oldPage) { let text = ""; let indexList = page * countItemPerPage + itemY; if(indexList < countMaxItem) { let indexReplay = listValidReplayIndex[indexList]; if(IsValidReplayIndex(indexReplay)) { text = rtos("00", indexReplay) ~ " "; text = text ~ vtos("-8s", GetReplayInfo(indexReplay, REPLAY_USER_NAME)) ~ " "; text = text ~ GetReplayInfo(indexReplay, REPLAY_DATE_TIME) ~ " "; text = text ~ rtos("000000000000", trunc(GetReplayInfo(indexReplay, REPLAY_TOTAL_SCORE))*10) ~ " "; text = text ~ GetReplayInfo(indexReplay, REPLAY_PLAYER_NAME) ~ " "; if(GetReplayUserData(indexReplay, "Difficulty") == "Normal"){ text = text ~ "Normal"; } else if(GetReplayUserData(indexReplay, "Difficulty") == "Hard"){ text = text ~ "Hard"; } else if(GetReplayUserData(indexReplay, "Difficulty") == "Lunatic"){ text = text ~ "Lunatic"; } else{ text = text ~ "Standard"; } } } ObjText_SetText(objText, text); ObjText_SetText(objSelect, text); oldPage = page; } if(page == pageMax && itemY >= lastPageMaxCursorY) { Obj_SetVisible(objText, false); Obj_SetVisible(objSelect, false); } else { Obj_SetVisible(objText, true); Obj_SetVisible(objSelect, itemY == cursorY); } yield; } Obj_Delete(objText); Obj_Delete(objSelect); } ascent(let iItem in 0 .. countItemPerPage) { TMenuItem(iItem); } //キー状態がリセットされるまで待機 while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;} //キー処理 let frameKeyHold = 0;//キー押しっぱなしフレーム数 loop { //決定 if(GetVirtualKeyState(VK_OK) == KEY_PULL) { let indexList = page * countItemPerPage + cursorY; if(indexList < countMaxItem) { let indexReplay = listValidReplayIndex[indexList]; let pathReplay = GetReplayInfo(indexReplay, REPLAY_FILE_PATH); SetScriptResult(indexReplay); CloseScript(GetOwnScriptID()); break; } } if(GetVirtualKeyState(VK_CANCEL) == KEY_PULL) { //キャンセル // XDDDDDDDDDD SetScriptResult(99999999*69420); CloseScript(GetOwnScriptID()); break; } //カーソル移動 if(GetVirtualKeyState(VK_UP) == KEY_PUSH || GetVirtualKeyState(VK_UP) == KEY_HOLD) { frameKeyHold++; if(GetVirtualKeyState(VK_UP) == KEY_PUSH || frameKeyHold == 20 || (frameKeyHold > 20 && (frameKeyHold % 5 == 0))) { cursorY--; } } else if(GetVirtualKeyState(VK_DOWN) == KEY_PUSH || GetVirtualKeyState(VK_DOWN) == KEY_HOLD) { frameKeyHold++; if(GetVirtualKeyState(VK_DOWN) == KEY_PUSH || frameKeyHold == 20 || (frameKeyHold > 20 && (frameKeyHold % 5 == 0))) { cursorY++; } } else if(GetVirtualKeyState(VK_LEFT) == KEY_PUSH || GetVirtualKeyState(VK_LEFT) == KEY_HOLD) { frameKeyHold++; if(GetVirtualKeyState(VK_LEFT) == KEY_PUSH || frameKeyHold == 20 || (frameKeyHold > 20 && (frameKeyHold % 5 == 0))) { page--; } } else if(GetVirtualKeyState(VK_RIGHT) == KEY_PUSH || GetVirtualKeyState(VK_RIGHT) == KEY_HOLD) { frameKeyHold++; if(GetVirtualKeyState(VK_RIGHT) == KEY_PUSH || frameKeyHold == 20 || (frameKeyHold > 20 && (frameKeyHold % 5 == 0))) { page++; } } else { frameKeyHold = 0; } if(page < 0) { page = pageMax; } else if(page > pageMax) { page = 0; } if(page != pageMax) { if(cursorY < 0) { cursorY = countItemPerPage - 1; } else if(cursorY >= countItemPerPage) { cursorY = 0; } } else { if(cursorY < 0) { cursorY = lastPageMaxCursorY - 1; } else if(cursorY >= lastPageMaxCursorY) { cursorY = 0; } } yield; } } //---------------------------------------------------- // ユーティリティ //---------------------------------------------------- function CreateTextObject(let mx, let my, let size, let text) { let obj = ObjText_Create(); ObjText_SetText(obj, text); ObjText_SetFontType(obj, "Unispace"); ObjText_SetFontSize(obj, size); ObjText_SetFontBold(obj, true); ObjText_SetFontColorTop(obj, 0xBC55FF); ObjText_SetFontColorBottom(obj, 0xECD0FF); ObjText_SetFontBorderType(obj, BORDER_FULL); ObjText_SetFontBorderColor(obj, 255, 255, 255); ObjText_SetFontBorderWidth(obj, 2); Obj_SetRenderPriorityI(obj, 40); ObjRender_SetX(obj, mx); ObjRender_SetY(obj, my); return obj; }