Cirno2022/script/default_system/Default_Pause.txt

197 lines
9.0 KiB
Plaintext
Raw Normal View History

2022-09-14 15:23:27 +00:00
<EFBFBD><EFBFBD>//NBf\Pbk-N<>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
@Initialize
{
SetAutoDeleteObject(true);
TBackground();
TMenu();
}
@MainLoop
{
yield;
}
@Finalize
{
}
task TBackground
{
task TVertex(var index, var left, var top, var right, var bottom)
{
ObjPrim_SetVertexPosition(obj, index + 0, left, top, 0);
ObjPrim_SetVertexPosition(obj, index + 1, left, bottom, 0);
ObjPrim_SetVertexPosition(obj, index + 2, right, top, 0);
ObjPrim_SetVertexPosition(obj, index + 3, right, top, 0);
ObjPrim_SetVertexPosition(obj, index + 4, left, bottom, 0);
ObjPrim_SetVertexPosition(obj, index + 5, right, bottom, 0);
ObjPrim_SetVertexUVT(obj, index + 0, left, top);
ObjPrim_SetVertexUVT(obj, index + 1, left, bottom);
ObjPrim_SetVertexUVT(obj, index + 2, right, top);
ObjPrim_SetVertexUVT(obj, index + 3, right, top);
ObjPrim_SetVertexUVT(obj, index + 4, left, bottom);
ObjPrim_SetVertexUVT(obj, index + 5, right, bottom);
//STG<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>Qn00<7F>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
if(left >= 32 && right <= 416 && top >=16 && bottom <= 464)
{
let alpha = 255;
while(alpha >= 128)
{
ObjPrim_SetVertexAlpha(obj, index + 0, alpha);
ObjPrim_SetVertexAlpha(obj, index + 1, alpha/2);
ObjPrim_SetVertexAlpha(obj, index + 2, alpha/2);
ObjPrim_SetVertexAlpha(obj, index + 3, alpha/2);
ObjPrim_SetVertexAlpha(obj, index + 4, alpha/2);
ObjPrim_SetVertexAlpha(obj, index + 5, alpha);
alpha -= 255 / frame;
yield;
}
}
}
//RrR-<2D><>[
let frame = 30;
let countH = 20; //RrRpe
let countV = 30;
let width = 640 / countH;
let height = 480 / countV;
let target = GetTransitionRenderTargetName();
let obj = ObjPrim_Create(OBJ_PRIMITIVE_2D); //2D<02><>p<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0ub
ObjPrim_SetPrimitiveType(obj, PRIMITIVE_TRIANGLELIST);
ObjPrim_SetVertexCount(obj, countH * countV * 6);
Obj_SetRenderPriorityI(obj, 0); //<00>c;u*QHQ<48>^<5E>0-<2D><>[
ObjPrim_SetTexture(obj, target); //<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0-<2D><>[
ascent(ix in 0.. countH)
{
ascent(iy in 0.. countV)
{
let index = (ix + iy * countH) * 6;
let left = ix * width;
let right = left + width;
let top = iy * height;
let bottom = top + height;
TVertex(index, left, top, right, bottom);
}
}
}
task TMenu
{
let selectIndex = 0;//x<><78>bMOn
task TMenuItem(let index, let mx, let my, let text)
{
function CreateTextObject(let mx, let my, let text)
{
let obj = ObjText_Create();
ObjText_SetText(obj, text);
ObjText_SetFontSize(obj, 20);
ObjText_SetFontBold(obj, true);
ObjText_SetFontColorTop(obj, 128, 128, 255);
ObjText_SetFontColorBottom(obj, 64, 64, 255);
ObjText_SetFontBorderType(obj, BORDER_FULL);
ObjText_SetFontBorderColor(obj,255, 255, 255);
ObjText_SetFontBorderWidth(obj, 2);
Obj_SetRenderPriorityI(obj, 10);
ObjRender_SetX(obj, mx);
ObjRender_SetY(obj, my);
return obj;
}
let objText = CreateTextObject(mx, my, text);
let objSelect = CreateTextObject(mx, my, text);
ObjRender_SetBlendType(objSelect, BLEND_ADD_RGB);
loop
{
Obj_SetVisible(objSelect, index == selectIndex);
yield;
}
}
//<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0M<30>n
let mx = 48;
let my = 32;
let texts = ["<00>Q<EFBFBD><51>", "<00>QuB}<7D>N", "gRK0<4B>0<EFBFBD>0<EFBFBD>0<EFBFBD>vY0"];
var countMenu = length(texts);
ascent(var iText in 0 .. countMenu)
{
TMenuItem(iText, mx, my, texts[iText]);
my += 32;
}
//<00>0<EFBFBD>0<EFBFBD>rKaL0<4C>0<EFBFBD>0<EFBFBD>0<EFBFBD>0U0<55>0<EFBFBD>0~0g0<67>__j
while(GetVirtualKeyState(VK_PAUSE) != KEY_FREE){yield;}
//<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0x<30><78>b<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 listResult = [RESULT_CANCEL, RESULT_END, RESULT_RETRY];
SetScriptResult(listResult[selectIndex]);
CloseScript(GetOwnScriptID());
return;
}
//<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
if(GetVirtualKeyState(VK_CANCEL) == KEY_PULL || GetVirtualKeyState(VK_PAUSE) == KEY_PULL)
{
SetScriptResult(RESULT_CANCEL);
CloseScript(GetOwnScriptID());
return;
}
//<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>y<EFBFBD>R
if(GetVirtualKeyState(VK_UP) == KEY_PUSH)
{
selectIndex--;
}
else if(GetVirtualKeyState(VK_DOWN) == KEY_PUSH)
{
selectIndex++;
}
else if(GetVirtualKeyState(VK_UP) == KEY_HOLD)
{
frameKeyHold++;
if(frameKeyHold == 30 || (frameKeyHold > 30 && (frameKeyHold % 10 == 0)))
{
selectIndex--;
}
}
else if(GetVirtualKeyState(VK_DOWN) == KEY_HOLD)
{
frameKeyHold++;
if(frameKeyHold == 30 || (frameKeyHold > 30 && (frameKeyHold % 10 == 0)))
{
selectIndex++;
}
}
else
{
frameKeyHold = 0;
}
if(selectIndex < 0)
{
selectIndex = countMenu - 1;
}
else
{
selectIndex %= countMenu;
}
yield;
}
}