ScarletBlackMarket/script/ExRumia/ExRumia_Package_ReplaySelec...

310 lines
15 KiB
Plaintext
Raw Permalink Normal View History

2022-08-20 05:42:00 +00:00
<EFBFBD><EFBFBD>@Initialize
{
SetAutoDeleteObject(true);
2022-08-23 09:48:09 +00:00
LoadReplayList();
2022-08-20 05:42:00 +00:00
TBackground();
TReplaySelectScene();
SetScriptResult("");
}
@MainLoop
{
yield;
}
@Finalize
{
}
2022-08-23 09:48:09 +00:00
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 <int> _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;
}
2022-08-20 05:42:00 +00:00
task TBackground()
{
//̀of
2022-08-23 09:48:09 +00:00
int image = _Create2DImage("script/game/PackageLib/PlaceholderTitleImage_Empty.png", [0, 0, 1920, 1080]);
LoadTextureEx(image, true, true);
Obj_SetRenderPriorityI(image, 1);
ObjRender_SetAlpha(image, 80);
ObjSprite2D_SetDestRect(image, 0, 0, 1920, 1080);
2022-08-20 05:42:00 +00:00
//<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>eW[R
let objText = ObjText_Create();
2022-08-23 09:48:09 +00:00
ObjText_SetText(objText, "Recall Stories of the Market");
ObjText_SetFontType(objText, "Connecting Chain Handserif");
ObjText_SetFontSize(objText, 96);
2022-08-20 05:42:00 +00:00
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);
2022-08-23 09:48:09 +00:00
ObjRender_SetX(objText, 32);
ObjRender_SetY(objText, 32);
2022-08-20 05:42:00 +00:00
}
//----------------------------------------------------
// <00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0x<30><78>b
//----------------------------------------------------
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)
{
2022-08-23 09:48:09 +00:00
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);
2022-08-20 05:42:00 +00:00
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) ~ " ";
2022-08-23 09:48:09 +00:00
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";
}
if(GetReplayUserData(indexReplay, "Difficulty") == "Lunatic"){
text = text ~ "Lunatic";
}
2022-08-20 05:42:00 +00:00
}
}
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);
}
//<00>0<EFBFBD>0<EFBFBD>rKaL0<4C>0<EFBFBD>0<EFBFBD>0<EFBFBD>0U0<55>0<EFBFBD>0~0g0<67>__j
while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}
//<00>0<EFBFBD>0<EFBFBD>Qt
let frameKeyHold = 0;//<00>0<EFBFBD>0<EFBFBD>bW0c0q0j0W0<57>0<EFBFBD>0<EFBFBD>0<EFBFBD>0pe
loop
{
//zl<7A>[
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);
2022-08-23 09:48:09 +00:00
SetScriptResult(indexReplay);
2022-08-20 05:42:00 +00:00
CloseScript(GetOwnScriptID());
break;
}
}
if(GetVirtualKeyState(VK_CANCEL) == KEY_PULL)
{
//<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
2022-08-23 09:48:09 +00:00
// XDDDDDDDDDD
SetScriptResult(99999999*69420);
2022-08-20 05:42:00 +00:00
CloseScript(GetOwnScriptID());
break;
}
//<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>y<EFBFBD>R
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;
}
}
//----------------------------------------------------
// <00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
//----------------------------------------------------
function CreateTextObject(let mx, let my, let size, let text)
{
let obj = ObjText_Create();
ObjText_SetText(obj, text);
2022-08-23 09:48:09 +00:00
ObjText_SetFontType(obj, "Unispace");
2022-08-20 05:42:00 +00:00
ObjText_SetFontSize(obj, size);
ObjText_SetFontBold(obj, true);
2022-08-23 09:48:09 +00:00
ObjText_SetFontColorTop(obj, 0xBC55FF);
ObjText_SetFontColorBottom(obj, 0xECD0FF);
2022-08-20 05:42:00 +00:00
ObjText_SetFontBorderType(obj, BORDER_FULL);
2022-08-23 09:48:09 +00:00
ObjText_SetFontBorderColor(obj, 255, 255, 255);
2022-08-20 05:42:00 +00:00
ObjText_SetFontBorderWidth(obj, 2);
Obj_SetRenderPriorityI(obj, 40);
ObjRender_SetX(obj, mx);
ObjRender_SetY(obj, my);
return obj;
}