赛丽亚的热忱

This commit is contained in:
Lenheart 2025-12-10 14:34:46 +08:00
parent c5194dfee6
commit 345ac1400d
3 changed files with 214 additions and 15 deletions

View File

@ -756,6 +756,7 @@ class LenheartNewUI_CommonUi extends LenheartNewUI_BaseWindow {
ObjectId = null;
Visible = true;
State = 0;
TopCallBackFunc = null;
@ -784,6 +785,7 @@ class LenheartNewUI_CommonUi extends LenheartNewUI_BaseWindow {
}
//鼠标左键按下回调
function OnMouseLbDown(MousePos_X, MousePos_Y) {
if(!Visible || State == 8)return;
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) {
isLBDown = true;
if (!OnClickSound) {

View File

@ -93,7 +93,7 @@ class ItemFusionC extends LenheartNewUI_Windows {
// NoWindow = true;
//是否可见
// Visible = false;
Visible = false;
Slot = null;

View File

@ -12,11 +12,23 @@ class SeriaZealC extends LenheartNewUI_Windows {
// NoWindow = true;
//是否可见
// Visible = false;
Visible = false;
Img = Rindro_Image("interface2/guidesystem/welcome.img");
//使命信息集合
QuestInfo = null;
//使命按钮
QuestBtn = null;
//累计信息集合
AccumInfo = null;
//累计按钮
AccumBtn = null;
//累计次数文本
AccumStr = ["5", "10", "15", "20", "30"];
//已完成的累计次数
AccumCount = 0;
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
Childrens = [];
@ -24,16 +36,158 @@ class SeriaZealC extends LenheartNewUI_Windows {
RegisterWidget();
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
QuestInfo = [{
State = 1,
Name = "登录游戏",
CurC = 1,
MaxC = 1
},
{
State = 0,
Name = "消耗150点疲劳值",
CurC = 75,
MaxC = 150
},
{
State = 0,
Name = "通关 <魂·比尔马克帝国试验场> 3次",
CurC = 0,
MaxC = 3
},
{
State = 0,
Name = "通关 <魂·悲鸣洞穴> 3次",
CurC = 2,
MaxC = 3
},
{
State = 2,
Name = "完成每日任务 <改变命运的钥匙> 1次",
CurC = 1,
MaxC = 1
},
];
Pack_Control.rawset(20101002, function(Chunk) {
local Jso = Json.Decode(Chunk);
AccumCount = Jso.num;
AccumInfo = [];
foreach(value in Jso.jls) {
local T = {
Item = value.itemId,
Count = value.itemNum,
Str = value.needNum.tostring(),
State = value.state
}
AccumInfo.append(T);
}
QuestInfo = [];
foreach(value in Jso.rws) {
local T = {
State = value.state,
Name = value.name,
CurC = value.dqnum,
MaxC = value.num
}
QuestInfo.append(T);
}
}.bindenv(this));
SendPackEx({
op = 20101001
});
}
function RegisterWidget() {
// //关闭按钮
// local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276);
// CloseButton.OnClick = function() {
// this.Visible = false;
// }.bindenv(this);
// Childrens.append(CloseButton);
//关闭按钮
local CloseButton = LenheartNewUI_BaseButton(682, 4, 11, 12, "interface/lenheartwindowcommon.img", 276);
CloseButton.OnClick = function() {
this.Visible = false;
}.bindenv(this);
Childrens.append(CloseButton);
QuestBtn = [];
AccumBtn = [];
for (local i = 0; i< 5; i++) {
//确认按钮
local ButtonBuffer = LenheartNewUI_ButtonText(582, 177 + (i * 47), 15, "完成");
ButtonBuffer.DWidth = -4;
ButtonBuffer.Width = 52;
ButtonBuffer.Data = i;
ButtonBuffer.OnClickEx = function(Btn) {
if (!Btn.Visible || Btn.State == 8) return;
if (!QuestInfo) return;
if (QuestInfo[Btn.Data].State == 2) {
SendPackEx({
op = 20101003,
index = Btn.Data
});
}
}.bindenv(this);
ButtonBuffer.SetCallBackFunc(function(Btn) {
if (!QuestInfo) return;
if (QuestInfo[Btn.Data].State == 2) {
Btn.SetTextOffset(-4, 1);
Btn.TextStr = "完成";
Btn.Visible = true;
Btn.State = 0;
} else if (QuestInfo[Btn.Data].State == 0) {
Btn.SetTextOffset(-10, 2);
Btn.TextStr = "未完成";
Btn.State = 8;
} else if (QuestInfo[Btn.Data].State == 1) {
Btn.SetTextOffset(-10, 2);
Btn.TextStr = "已完成";
Btn.State = 8;
Btn.Visible = true;
}
}.bindenv(this));
QuestBtn.append(ButtonBuffer);
AddChild(ButtonBuffer);
local AccmButton = LenheartNewUI_ButtonText(310 + (i * 70), 492, 15, "完成");
AccmButton.DWidth = -4;
AccmButton.Width = 52;
AccmButton.Data = i;
AccmButton.OnClickEx = function(Btn) {
if (!Btn.Visible || Btn.State == 8) return;
if (!AccumInfo) return;
if (AccumInfo[Btn.Data].State == 2) {
SendPackEx({
op = 20101005,
index = Btn.Data
});
}
}.bindenv(this);
AccmButton.SetCallBackFunc(function(Btn) {
if (!AccumInfo) return;
if (AccumInfo[Btn.Data].State == 2) {
Btn.SetTextOffset(-4, 1);
Btn.TextStr = "领取";
Btn.Visible = true;
} else if (AccumInfo[Btn.Data].State == 0) {
Btn.SetTextOffset(-10, 2);
Btn.TextStr = "未达成";
Btn.State = 8;
} else if (AccumInfo[Btn.Data].State == 1) {
Btn.SetTextOffset(-10, 2);
Btn.TextStr = "已领取";
Btn.State = 8;
Btn.Visible = true;
}
}.bindenv(this));
AccumBtn.append(AccmButton);
AddChild(AccmButton);
}
//关闭按钮
local CloseButton = LenheartNewUI_BaseButton(682, 4, 11, 12, "interface/lenheartwindowcommon.img", 276);
CloseButton.OnClick = function() {
this.Visible = false;
}.bindenv(this);
Childrens.append(CloseButton);
}
//绘制主界面
@ -50,15 +204,55 @@ class SeriaZealC extends LenheartNewUI_Windows {
//背景
Img.DrawPng(0, X + 8, Y + 32);
if (!AccumInfo) return;
local YOffset = -18;
//赛丽亚的热忱文字
Img.DrawPng(5, X + 314, Y + 68);
L_sq_DrawCode("你好,亲爱的冒险家,我是赛丽亚。", X + 350, Y + 118, sq_RGBA(230, 200, 155, 255), 0, 1);
L_sq_DrawCode("我为来到阿拉德的冒险家准备了一些小礼物。", X + 350, Y + 132, sq_RGBA(230, 200, 155, 255), 0, 1);
Img.DrawPng(5, X + 314, Y + 68 + YOffset);
L_sq_DrawCode("你好,亲爱的冒险家,我是赛丽亚。", X + 350, Y + 118 + YOffset, sq_RGBA(230, 200, 155, 255), 0, 1);
L_sq_DrawCode("我为来到阿拉德的冒险家准备了一些小礼物。", X + 350, Y + 132 + YOffset, sq_RGBA(230, 200, 155, 255), 0, 1);
//使命框
Img.DrawPng(6, X + 290, Y + 150 + YOffset);
//累计次数奖励框
Img.DrawPng(53, X + 291, Y + 430 + YOffset);
Img.DrawPng(6, X + 290, Y + 150);
Img.DrawPng(7, X + 305, Y + 189);
for (local i = 0; i< 5; i++) {
//使命描述
L_sq_DrawCode(QuestInfo[i].Name, X + 352, Y + 190 + (i * 47) + YOffset, sq_RGBA(230, 200, 155, 255), 0, 1);
//使命进度条
if (QuestInfo[i].CurC == QuestInfo[i].MaxC) Img.DrawPng(8, X + 351, Y + 214 + (i * 47) + YOffset);
else {
local Rate = QuestInfo[i].CurC.tofloat() / QuestInfo[i].MaxC.tofloat();
setClip(X + 351, Y + 214 + (i * 47) + YOffset, X + 351 + (222 * Rate).tointeger(), Y + 222 + (i * 47) + YOffset);
Img.DrawPng(9, X + 351, Y + 214 + (i * 47) + YOffset);
releaseClip();
}
//使命进度文字
L_sq_DrawCode(QuestInfo[i].CurC + "/" + QuestInfo[i].MaxC, X + 352 + 222 / 2 - LenheartTextClass.GetStringLength(QuestInfo[i].CurC + "/" + QuestInfo[i].MaxC) / 2, Y + 212 + (i * 47) + YOffset, sq_RGBA(230, 200, 155, 255), 0, 1);
//完成使命的这遮罩框
if (QuestInfo[i].State == 1) {
Img.DrawPng(7, X + 305, Y + 189 + (i * 47) + YOffset);
}
}
for (local i = 0; i< 5; i++) {
local ImgIndex = 62;
if (i >= 2) ImgIndex = 63;
//累计奖励Item框
Img.DrawPng(ImgIndex, X + 320 + (i * 70), Y + 460 + YOffset);
L_sq_DrawCode(AccumInfo[i].Str + "次", X + 338 + (i * 70) - LenheartTextClass.GetStringLength(AccumInfo[i].Str + "次") / 2, Y + 461 + YOffset, sq_RGBA(230, 200, 155, 255), 0, 1);
DrawItemBase(X + 322 + (i * 70), Y + 475 + YOffset, AccumInfo[i].Item, AccumInfo[i].Count);
}
L_sq_DrawCode("已累计完成使命次数: " + AccumCount, X + 302, Y + 438 + YOffset, sq_RGBA(230, 200, 155, 255), 0, 1);
}
function Show(obj) {
@ -73,9 +267,12 @@ class SeriaZealC extends LenheartNewUI_Windows {
}
function OpenCallBack() {
Visible = true;
SendPackEx({
op = 20101001
});
}
}
@ -89,7 +286,7 @@ function Lenheart_SeriaZeal_Fun(obj) {
local RootTab = getroottable();
if (!RootTab.rawin("SeriaZeal_Obj")) {
RootTab.rawset("SeriaZeal_Obj", true);
local Win = LenheartNewUI_CreateWindow(SeriaZealC, "赛丽亚的热忱窗口", ((getroottable().Rindro_Scr_Width - 700) / 2).tointeger(), 30, 700, 544, 28);
local Win = LenheartNewUI_CreateWindow(SeriaZealC, "赛丽亚的热忱窗口", ((getroottable().Rindro_Scr_Width - 700) / 2).tointeger(), 30, 700, 544, 28);
EventList_Obj.AddEvent("赛丽亚的热忱", 256, Win, "interface2/hud/information_button/information_button_cn.img");