1
This commit is contained in:
195
Project/MarrySystem/MarrySystem_OpenAuditoriumList.nut
Normal file
195
Project/MarrySystem/MarrySystem_OpenAuditoriumList.nut
Normal file
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
文件名:MarrySystem_OpenAuditoriumList.nut
|
||||
路径:Project/MarrySystem/MarrySystem_OpenAuditoriumList.nut
|
||||
创建日期:2024-10-05 13:20
|
||||
文件用途:打开礼堂列表
|
||||
*/
|
||||
class LenheartNewUI_MarrySystem_OpenAuditoriumListButton extends LenheartNewUI_CommonUi {
|
||||
State = 0;
|
||||
BaseIdx = 29;
|
||||
DWidth = null;
|
||||
Path = null;
|
||||
Idx = null;
|
||||
Info = null;
|
||||
|
||||
|
||||
constructor(X, Y, W, H, Path, Idx) {
|
||||
this.DWidth = W;
|
||||
this.Path = Path;
|
||||
this.Idx = Idx;
|
||||
LenheartNewUI_CommonUi.constructor(X, Y, W, H);
|
||||
|
||||
}
|
||||
|
||||
function SetFrame(gPath, gIdx) {
|
||||
if (gPath) Path = gPath;
|
||||
Idx = gIdx;
|
||||
}
|
||||
|
||||
function Show(obj) {
|
||||
//不可用
|
||||
if (State == 8) {
|
||||
L_sq_DrawImg(Path, Idx + 3, X, Y + 1);
|
||||
} else {
|
||||
//按下
|
||||
if (isLBDown) {
|
||||
L_sq_DrawImg(Path, Idx + 2, X, Y);
|
||||
}
|
||||
//悬停
|
||||
else if (isInRect) {
|
||||
L_sq_DrawImg(Path, Idx + 1, X, Y);
|
||||
}
|
||||
//普通
|
||||
else {
|
||||
L_sq_DrawImg(Path, Idx, X, Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
class MarrySystem_OpenAuditoriumListC extends LenheartNewUI_Windows {
|
||||
//调试模式
|
||||
// DeBugMode = true;
|
||||
|
||||
//不是窗口
|
||||
// NoWindow = true;
|
||||
|
||||
//是否可见
|
||||
Visible = false;
|
||||
|
||||
//包头
|
||||
OP = 20078000;
|
||||
|
||||
//列表
|
||||
List = null;
|
||||
|
||||
//滚动Flag
|
||||
WheelFalg = 0;
|
||||
|
||||
function Time2Str(Time) {
|
||||
if (Time< 0) return "已开始";
|
||||
local str = "";
|
||||
local minutes = Time / 60;
|
||||
local seconds = (Time % 60);
|
||||
str += minutes + "分";
|
||||
str += seconds + "秒";
|
||||
return str;
|
||||
}
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
Childrens = [];
|
||||
List = {};
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
|
||||
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
}
|
||||
|
||||
function RegisterWidget() {
|
||||
//关闭按钮
|
||||
local CloseButton = LenheartNewUI_BaseButton(458, 0, 11, 12, "interface/lenheartwindowcommon.img", 276);
|
||||
CloseButton.OnClick = function() {
|
||||
this.Visible = false;
|
||||
}.bindenv(this);
|
||||
Childrens.append(CloseButton);
|
||||
|
||||
for (local i = 0; i< 11; i++) {
|
||||
local ButtonBuf = LenheartNewUI_MarrySystem_OpenAuditoriumListButton(412, 112 + (i * 21), 51, 17, "interface2/wedding/weddingcardreceive.img", 7);
|
||||
ButtonBuf.Info = i;
|
||||
ButtonBuf.OnClickEx = function(Button) {
|
||||
local T = {
|
||||
op = OP + 15,
|
||||
room = List[Button.Info + WheelFalg][0]
|
||||
}
|
||||
SendPackEx(T);
|
||||
CloseWindow();
|
||||
}.bindenv(this);
|
||||
ButtonBuf.SetCallBackFunc(function(Button) {
|
||||
//有索引信息才显示
|
||||
if (Button.Info<(List.len() - WheelFalg)) {
|
||||
local DrawInfo = List[Button.Info + WheelFalg];
|
||||
//绘制举办者名字
|
||||
L_sq_DrawCode(DrawInfo[1], Button.X - 330 - LenheartTextClass.GetStringLength(DrawInfo[1]) / 2, Button.Y + 2, sq_RGBA(134, 120, 79, 255), 0, 1);
|
||||
L_sq_DrawImg("interface2/wedding/weddingreservationpopupui.img", 1, Button.X - 310, Button.Y + 2);
|
||||
L_sq_DrawCode(DrawInfo[5], Button.X - 285, Button.Y + 2, sq_RGBA(134, 120, 79, 255), 0, 1);
|
||||
|
||||
//绘制频道
|
||||
L_sq_DrawCode(DrawInfo[8], Button.X - 186, Button.Y + 2, sq_RGBA(134, 120, 79, 255), 0, 1);
|
||||
|
||||
//绘制举办时间
|
||||
local Time = Sq_Time();
|
||||
local TimeStr = Time2Str(DrawInfo[9] + ((DrawInfo[2] + 1) * 10 * 60) - Time);
|
||||
L_sq_DrawCode(TimeStr, Button.X - 100 - LenheartTextClass.GetStringLength(TimeStr) / 2, Button.Y + 2, sq_RGBA(134, 120, 79, 255), 0, 1);
|
||||
|
||||
//绘制人数
|
||||
local CountStr = DrawInfo[7].tostring();
|
||||
L_sq_DrawCode(CountStr, Button.X - 20 - LenheartTextClass.GetStringLength(CountStr) / 2, Button.Y + 2, sq_RGBA(134, 120, 79, 255), 0, 1);
|
||||
|
||||
Button.Visible = true;
|
||||
} else {
|
||||
Button.Visible = false;
|
||||
}
|
||||
}.bindenv(this));
|
||||
Childrens.append(ButtonBuf);
|
||||
}
|
||||
}
|
||||
|
||||
//绘制主界面
|
||||
function DrawMain(obj) {
|
||||
//Item信息框一般为211的宽度
|
||||
L_sq_DrawWindow(X, Y + 10, 540 * 0.85, 340 * 0.9, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
|
||||
L_sq_DrawWindow(X + 6, Y + 19, 528 * 0.85, 47, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
|
||||
L_sq_DrawWindow(X + 6, Y + 79, 528 * 0.85, 236, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
|
||||
|
||||
//标题栏
|
||||
L_sq_DrawButton(X - 1, Y, 466, "interface/lenheartwindowcommon.img", 609, 2, 7);
|
||||
|
||||
//绘制窗口名字
|
||||
L_sq_DrawCode("婚礼礼堂列表", X + 200, Y + 3, sq_RGBA(134, 120, 79, 255), 0, 1);
|
||||
|
||||
L_sq_DrawImg("interface2/wedding/weddingcardreceive.img", 10, X + 108, Y + 35);
|
||||
|
||||
sq_DrawBox(X + 10, Y + 87, 198, 17, sq_RGBA(134, 120, 79, 255), 1);
|
||||
L_sq_DrawCode("婚礼举办者", X + 80, Y + 90, sq_RGBA(221, 197, 147, 255), 0, 1);
|
||||
|
||||
sq_DrawBox(X + 210, Y + 87, 40, 17, sq_RGBA(134, 120, 79, 255), 1);
|
||||
L_sq_DrawCode("频道", X + 219, Y + 90, sq_RGBA(221, 197, 147, 255), 0, 1);
|
||||
|
||||
sq_DrawBox(X + 252, Y + 87, 122, 17, sq_RGBA(134, 120, 79, 255), 1);
|
||||
L_sq_DrawCode("举办时间", X + 289, Y + 90, sq_RGBA(221, 197, 147, 255), 0, 1);
|
||||
|
||||
|
||||
sq_DrawBox(X + 376, Y + 87, 32, 17, sq_RGBA(134, 120, 79, 255), 1);
|
||||
L_sq_DrawCode("人数", X + 380, Y + 90, sq_RGBA(221, 197, 147, 255), 0, 1);
|
||||
|
||||
sq_DrawBox(X + 410, Y + 87, 54, 17, sq_RGBA(134, 120, 79, 255), 1);
|
||||
L_sq_DrawCode("参加婚礼", X + 414, Y + 90, sq_RGBA(221, 197, 147, 255), 0, 1);
|
||||
|
||||
}
|
||||
|
||||
function Show(obj) {
|
||||
DrawMain(obj);
|
||||
LenheartNewUI_Windows.Show(obj);
|
||||
|
||||
}
|
||||
|
||||
//逻辑入口
|
||||
function Proc(obj) {
|
||||
LenheartNewUI_Windows.SyncPos(X, Y);
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标滚轮事件回调
|
||||
function OnMouseWheel(Flag, MousePos_X, MousePos_Y) {
|
||||
|
||||
if (Flag) {
|
||||
if (WheelFalg > 0) WheelFalg--;
|
||||
} else {
|
||||
if (WheelFalg<(List.len() - 11)) WheelFalg++;
|
||||
}
|
||||
|
||||
//调用原生方法
|
||||
LenheartNewUI_Windows.OnMouseWheel(Flag, MousePos_X, MousePos_Y);
|
||||
}
|
||||
|
||||
}
|
||||
getroottable().rawdelete("MarrySystem_Obj");
|
||||
Reference in New Issue
Block a user