1433 lines
49 KiB
Plaintext
1433 lines
49 KiB
Plaintext
/*
|
|
文件名:Ptst.nut
|
|
路径:Plugins/Ptst/Ptst.nut
|
|
创建日期:2023-03-15 13:50
|
|
文件用途:护石系统
|
|
*/
|
|
|
|
|
|
//TabTextButtonPro按钮类
|
|
class PtstTabTextButtonPro extends BasicsDrawTool // obj -- 按钮名称 -- X坐标 -- Y坐标 -- Ani调用路径 -- 宽度 -- 高度
|
|
{
|
|
obj = null; //Obj对象
|
|
State = 0; //按钮状态
|
|
ClickEnble = false; //点击效果
|
|
ButtonDynamic = false; //动态按钮效果
|
|
SwitchState = false; //复选框是否选中
|
|
str = null;
|
|
strx = null;
|
|
stry = null;
|
|
|
|
CustomClickEnble = false; //自定义点击效果
|
|
CustomClickAnifile = null; //自定义点击效果Ani路径
|
|
CustomButtonName = null; //自定义点击效果名称
|
|
CustomClickFrame = null; //自定义点击效果Ani编号
|
|
CustomClickx = null; //自定义点击效果X坐标
|
|
CustomClicky = null; //自定义点击效果Y坐标
|
|
|
|
|
|
RectEnble = false; //悬停效果
|
|
RectButtonName = null; //悬停名称
|
|
RectBaseAnifile = null; //悬停Ani路径
|
|
RectFrame = null; //非动态按钮的悬停调用Ani编号
|
|
Rectx = null; //悬停X坐标
|
|
Recty = null; //悬停Y坐标
|
|
|
|
|
|
ButtonName = null; //按钮名称
|
|
x = null; //X坐标
|
|
y = null; //Y坐标
|
|
BaseAnifile = null; //调用Ani路径
|
|
BaseAnifileFrame = null; //调用的Ani帧数
|
|
width = null; //可点击宽度
|
|
length = null; //可点击高度
|
|
|
|
Mobj = null; //鼠标对象
|
|
//构造函数
|
|
constructor(gObj, gButtonName, gX, gY, gAnifile, gBaseAnifileFrame, gWidth, gLength, gstr, gstrx, gstry) {
|
|
obj = gObj;
|
|
ButtonName = gButtonName;
|
|
x = gX;
|
|
y = gY;
|
|
BaseAnifile = gAnifile;
|
|
BaseAnifileFrame = gBaseAnifileFrame;
|
|
width = gWidth;
|
|
length = gLength;
|
|
str = gstr;
|
|
strx = gstrx;
|
|
stry = gstry;
|
|
if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
|
|
}
|
|
//绘制按钮
|
|
function Show() {
|
|
if (ClickEnble) //是否开启点击效果
|
|
{
|
|
if (isLBDown() && State == 0) //按下左键并且按钮处于弹起状态
|
|
{
|
|
State = 1; //按键进入按下状态
|
|
//++y;
|
|
}
|
|
if (!isLBDown() && State == 1) //按下左键并且按钮处于弹起状态
|
|
{
|
|
State = 0; //按键进入弹起状态
|
|
//--y;
|
|
}
|
|
}
|
|
|
|
if (CustomClickEnble) //是否开启自定义点击效果
|
|
{
|
|
if (isLBDown() && SwitchState == false) //按下左键并且按钮处于弹起状态
|
|
{
|
|
if (!ButtonDynamic) T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName);
|
|
else T_DrawDynamicAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomButtonName);
|
|
L_sq_DrawCode(str, CustomClickx + strx, CustomClicky + stry, sq_RGBA(255, 255, 184, 250), 1, 1);
|
|
}
|
|
}
|
|
|
|
if (RectEnble && SwitchState == false) //开启悬停效果时
|
|
{
|
|
if ((isInRect()) || (isInRect() && !CustomClickEnble)) //如果鼠标悬停的时候 并且没有点击的时候
|
|
{
|
|
//IMouse.SetMouseTask(44);
|
|
if (!ButtonDynamic) T_DrawStayAni(obj, RectBaseAnifile, Rectx, Recty, RectFrame, RectButtonName);
|
|
else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName);
|
|
L_sq_DrawCode(str, CustomClickx + strx, CustomClicky + stry, sq_RGBA(255, 255, 184, 250), 1, 1);
|
|
}
|
|
}
|
|
|
|
if (!isInRect() && !SwitchState) //如果鼠标没有悬停的时候
|
|
{
|
|
//IMouse.SetMouseTask(0);
|
|
if (!ButtonDynamic) T_DrawStayAni(obj, BaseAnifile, x, y, BaseAnifileFrame, ButtonName);
|
|
else T_DrawDynamicAni(obj, BaseAnifile, x, y, ButtonName);
|
|
L_sq_DrawCode(str, CustomClickx + strx, CustomClicky + stry, sq_RGBA(221, 197, 147, 250), 1, 1);
|
|
}
|
|
|
|
if (SwitchState) {
|
|
if (!ButtonDynamic) T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName);
|
|
else T_DrawDynamicAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomButtonName);
|
|
L_sq_DrawCode(str, CustomClickx + strx, CustomClicky + stry, sq_RGBA(255, 255, 184, 250), 1, 1);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
//设置自定义点击效果
|
|
function SetCustomClickEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) {
|
|
CustomClickEnble = bool; //自定义点击效果
|
|
CustomClickAnifile = gAnifile; //自定义点击效果Ani路径
|
|
CustomButtonName = gButtonName; //自定义点击效果名称
|
|
CustomClickFrame = gFrame; //自定义点击效果Ani编号
|
|
CustomClickx = gX; //自定义点击效果X坐标
|
|
CustomClicky = gY; //自定义点击效果Y坐标
|
|
}
|
|
|
|
//设置悬停效果
|
|
function SetRectEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) {
|
|
RectEnble = bool; //悬停效果
|
|
RectButtonName = gButtonName; //悬停名称
|
|
RectBaseAnifile = gAnifile; //悬停Ani路径
|
|
RectFrame = gFrame; //非动态按钮的悬停调用Ani编号
|
|
Rectx = gX; //悬停X坐标
|
|
Recty = gY; //悬停Y坐标
|
|
}
|
|
|
|
//设置动态按钮
|
|
function SetClickEnble(bool) {
|
|
ButtonDynamic = bool;
|
|
}
|
|
|
|
//设置点击效果
|
|
function SetClickEnble(bool) {
|
|
ClickEnble = bool;
|
|
}
|
|
|
|
//悬停状态
|
|
function isInRect() {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 5, 5, x, y, width, length)) return true;
|
|
else return false;
|
|
}
|
|
//左键按下状态
|
|
function isLBDown() {
|
|
if (isInRect() && Mobj.Lb == 1) return true;
|
|
else return false;
|
|
}
|
|
//左键弹起状态
|
|
function isLBUp() {
|
|
if (isInRect() && Mobj.Lb == 0) return true;
|
|
else return false;
|
|
}
|
|
|
|
//左键单击状态
|
|
function isLBActive() {
|
|
if (isInRect() && Mobj.LbEvent) return true;
|
|
else return false;
|
|
}
|
|
//左键双击状态
|
|
function IsLBDoubleClick() {
|
|
if (isInRect() && IMouse.GetLButton() == 64) return true;
|
|
else return false;
|
|
}
|
|
}
|
|
|
|
//HudPro按钮类
|
|
class PtstButtonPro extends BasicsDrawTool // obj -- 按钮名称 -- X坐标 -- Y坐标 -- Ani调用路径 -- 宽度 -- 高度
|
|
{
|
|
obj = null; //Obj对象
|
|
State = 0; //按钮状态
|
|
ClickEnble = false; //点击效果
|
|
ButtonDynamic = false; //动态按钮效果
|
|
BaseFrame = null;
|
|
|
|
CustomClickEnble = false; //自定义点击效果
|
|
CustomClickAnifile = null; //自定义点击效果Ani路径
|
|
CustomButtonName = null; //自定义点击效果名称
|
|
CustomClickFrame = null; //自定义点击效果Ani编号
|
|
CustomClickx = null; //自定义点击效果X坐标
|
|
CustomClicky = null; //自定义点击效果Y坐标
|
|
|
|
|
|
RectEnble = false; //悬停效果
|
|
RectButtonName = null; //悬停名称
|
|
RectBaseAnifile = null; //悬停Ani路径
|
|
RectFrame = null; //非动态按钮的悬停调用Ani编号
|
|
Rectx = null; //悬停X坐标
|
|
Recty = null; //悬停Y坐标
|
|
|
|
|
|
ButtonName = null; //按钮名称
|
|
x = null; //X坐标
|
|
y = null; //Y坐标
|
|
BaseAnifile = null; //调用Ani路径
|
|
width = null; //可点击宽度
|
|
length = null; //可点击高度
|
|
|
|
Mobj = null; //鼠标对象
|
|
//构造函数
|
|
constructor(gObj, gButtonName, gX, gY, gAnifile, gWidth, gLength, gBaseFrame) {
|
|
obj = gObj;
|
|
ButtonName = gButtonName;
|
|
x = gX;
|
|
y = gY;
|
|
BaseAnifile = gAnifile;
|
|
width = gWidth;
|
|
length = gLength;
|
|
BaseFrame = gBaseFrame;
|
|
if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
|
|
}
|
|
//绘制按钮
|
|
function Show() {
|
|
if (ClickEnble) //是否开启点击效果
|
|
{
|
|
if (isLBDown() && State == 0) //按下左键并且按钮处于弹起状态
|
|
{
|
|
State = 1; //按键进入按下状态
|
|
++y;
|
|
}
|
|
if (!isLBDown() && State == 1) //按下左键并且按钮处于弹起状态
|
|
{
|
|
State = 0; //按键进入弹起状态
|
|
--y;
|
|
}
|
|
}
|
|
|
|
if (CustomClickEnble) //是否开启自定义点击效果
|
|
{
|
|
if (isLBDown()) //按下左键并且按钮处于弹起状态
|
|
{
|
|
if (!ButtonDynamic) T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName);
|
|
else T_DrawDynamicAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomButtonName);
|
|
}
|
|
}
|
|
|
|
if (RectEnble) //开启悬停效果时
|
|
{
|
|
if ((isInRect() && !isLBDown()) || (isInRect() && !CustomClickEnble)) //如果鼠标悬停的时候 并且没有点击的时候
|
|
{
|
|
//IMouse.SetMouseTask(44);
|
|
if (!ButtonDynamic) T_DrawStayAni(obj, RectBaseAnifile, Rectx, Recty, RectFrame, RectButtonName);
|
|
else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName);
|
|
}
|
|
}
|
|
if (!isInRect()) //如果鼠标没有悬停的时候
|
|
{
|
|
//IMouse.SetMouseTask(0);
|
|
if (!ButtonDynamic) T_DrawStayAni(obj, BaseAnifile, x, y, BaseFrame, ButtonName);
|
|
else T_DrawDynamicAni(obj, BaseAnifile, x, y, ButtonName);
|
|
}
|
|
}
|
|
|
|
//设置自定义点击效果
|
|
function SetCustomClickEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) {
|
|
CustomClickEnble = bool; //自定义点击效果
|
|
CustomClickAnifile = gAnifile; //自定义点击效果Ani路径
|
|
CustomButtonName = gButtonName; //自定义点击效果名称
|
|
CustomClickFrame = gFrame; //自定义点击效果Ani编号
|
|
CustomClickx = gX; //自定义点击效果X坐标
|
|
CustomClicky = gY; //自定义点击效果Y坐标
|
|
}
|
|
|
|
//设置悬停效果
|
|
function SetRectEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) {
|
|
RectEnble = bool; //悬停效果
|
|
RectButtonName = gButtonName; //悬停名称
|
|
RectBaseAnifile = gAnifile; //悬停Ani路径
|
|
RectFrame = gFrame; //非动态按钮的悬停调用Ani编号
|
|
Rectx = gX; //悬停X坐标
|
|
Recty = gY; //悬停Y坐标
|
|
}
|
|
|
|
//设置动态按钮
|
|
function SetClickEnble(bool) {
|
|
ButtonDynamic = bool;
|
|
}
|
|
|
|
//设置点击效果
|
|
function SetClickEnble(bool) {
|
|
ClickEnble = bool;
|
|
}
|
|
|
|
//悬停状态
|
|
function isInRect() {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 5, 5, x, y, width, length)) return true;
|
|
else return false;
|
|
}
|
|
//左键按下状态
|
|
function isLBDown() {
|
|
if (isInRect() && Mobj.Lb == 1) return true;
|
|
else return false;
|
|
}
|
|
//左键弹起状态
|
|
function isLBUp() {
|
|
if (isInRect() && Mobj.Lb == 0) return true;
|
|
else return false;
|
|
}
|
|
|
|
//左键单击状态
|
|
function isLBActive() {
|
|
if (isInRect() && Mobj.LbEvent) return true;
|
|
else return false;
|
|
}
|
|
//左键双击状态
|
|
function IsLBDoubleClick() {
|
|
if (isInRect() && IMouse.GetLButton() == 64) return true;
|
|
else return false;
|
|
}
|
|
}
|
|
|
|
class PtstItem extends BasicsDrawTool {
|
|
X = null;
|
|
Y = null;
|
|
ItemId = null;
|
|
Attribute = null;
|
|
MCount = 0;
|
|
Rarity = null;
|
|
Explain = null;
|
|
TabName = ["名称: ",
|
|
"强化等级: ",
|
|
"力量 +",
|
|
"体力 +",
|
|
"智力 +",
|
|
"精神 +",
|
|
"独立攻击力 +",
|
|
"物理攻击力 +",
|
|
"魔法攻击力 +",
|
|
"物理防御 +",
|
|
"魔法防御 +",
|
|
"移动速度 +",
|
|
"攻击速度 +",
|
|
"释放速度 +",
|
|
"物理暴击 +",
|
|
"魔法暴击 +",
|
|
"命中率 +",
|
|
"光属性强化 +",
|
|
"暗属性强化 +",
|
|
"水属性强化 +",
|
|
"火属性强化 +",
|
|
"全属性强化 +"
|
|
]
|
|
|
|
constructor(Id, attribute, rarity, explain) {
|
|
ItemId = Id;
|
|
Attribute = attribute;
|
|
Rarity = rarity;
|
|
Explain = explain.tostring();
|
|
}
|
|
|
|
//获取字符串行数
|
|
function GetStrLine(str) {
|
|
local line = 0;
|
|
local Bpos = 0;
|
|
while (true) {
|
|
local Npos = str.find("\n", Bpos);
|
|
if (!Npos) {
|
|
++line;
|
|
break;
|
|
}
|
|
++line;
|
|
Bpos = Npos + 1;
|
|
}
|
|
return line;
|
|
}
|
|
|
|
//高级绘制文字(带换行)
|
|
function L_sq_DrawCode_Ex(str, x, y, rgba, mb, jc, hl) {
|
|
local strarr = [];
|
|
if (str.find("\n") == null) L_sq_DrawCode(str, x, y, rgba, mb, jc);
|
|
else {
|
|
local Bpos = 0;
|
|
while (true) {
|
|
local Npos = str.find("\n", Bpos);
|
|
if (!Npos) {
|
|
local strbuff = str.slice(Bpos, str.len());
|
|
strarr.append(strbuff);
|
|
break;
|
|
}
|
|
local strbuff = str.slice(Bpos, Npos);
|
|
strarr.append(strbuff);
|
|
Bpos = Npos + 1;
|
|
}
|
|
for (local z = 0; z < strarr.len(); z++) {
|
|
L_sq_DrawCode(strarr[z], x, y + (z * 14), rgba, mb, jc);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
//绘制悬停
|
|
function DrawHover(obj) {
|
|
local dx;
|
|
local dy;
|
|
local line = Attribute.len() - 3; //减去名字 强化之类的偏移
|
|
|
|
//悬停界面总高度计算
|
|
{
|
|
local X1 = 0; //防御力线偏移
|
|
local X2 = 0; //四维和三攻线偏移
|
|
local X3 = 0; //三速线偏移
|
|
local X4 = 0; //属强线偏移
|
|
local X5 = 0; //全属强线偏移
|
|
MCount = 0;
|
|
for (local y = 0; y < Attribute.len(); y++) {
|
|
local gType = Attribute[y][0];
|
|
//防御力
|
|
if (gType == 9 || gType == 10) X1 = 1;
|
|
//四维和三攻
|
|
if (gType >= 2 && gType <= 8) X2 = 1;
|
|
//三速
|
|
if (gType >= 11 && gType <= 16) X3 = 1;
|
|
//属强
|
|
if (gType >= 17 && gType <= 20) X4 = 1;
|
|
//全属强
|
|
if (gType == 21) X5 = 1;
|
|
//守护珠数量
|
|
if (gType >= 22 && gType <= 25) MCount++;
|
|
}
|
|
local ExplainLine = GetStrLine(Explain);
|
|
line = line + X1 + X2 + X3 + X4 + X5 + 1 - MCount + ExplainLine; //总共需要的长度
|
|
}
|
|
|
|
//界面是否靠近边界偏移计算
|
|
{
|
|
if ((800 - X) >= 216) dx = X;
|
|
else dx = X - (216 - (800 - X));
|
|
local needY = 19 + (line * 14) + 19;
|
|
if ((600 - Y) >= needY) dy = Y;
|
|
else dy = Y - (needY - (600 - Y));
|
|
dx += 45;
|
|
dy -= 25;
|
|
}
|
|
|
|
//主界面绘制
|
|
{
|
|
//绘制顶
|
|
T_DrawStayAni(obj, "common/ptst/main.ani", dx, dy, 25, "PtstItemInfoMainTopa");
|
|
|
|
//绘制线
|
|
T_DrawStayAni(obj, "common/ptst/main.ani", dx, dy + 19, 26, "PtstItemInfoMainXiana");
|
|
|
|
//绘制中
|
|
for (local i = 0; i < line; i++) {
|
|
T_DrawStayAni(obj, "common/ptst/main.ani", dx, dy + 19 + 14 + (i * 14), 27, "PtstItemInfoMainZhong");
|
|
}
|
|
//绘制底
|
|
T_DrawStayAni(obj, "common/ptst/main.ani", dx, dy + 19 + 14 + (line * 14), 28, "PtstItemInfoMainDi");
|
|
|
|
if (MCount > 0) L_sq_DrawCode("[ 已镶嵌守护珠: " + MCount + " ]", dx + 6, dy + 19 + 16 + (line * 14), sq_RGBA(255, 177, 0, 250), 1, 1);
|
|
}
|
|
|
|
|
|
//获取颜色
|
|
local Colorobj = getroottable()["PtstObj"].ColorArr[Rarity];
|
|
local RGBADATA = sq_RGBA(Colorobj[0], Colorobj[1], Colorobj[2], Colorobj[3]);
|
|
|
|
//绘制名字
|
|
L_sq_DrawCode(Attribute[0][1], dx + 6, dy + 6, RGBADATA, 1, 1);
|
|
|
|
//绘制描述
|
|
L_sq_DrawCode_Ex("" + Explain, dx + 6, dy + 6 + 30, sq_RGBA(255, 255, 255, 250), 1, 1, 20);
|
|
|
|
|
|
//绘制强化等级
|
|
if (Attribute[1][1] != 0) L_sq_DrawCode("强化等级: " + Attribute[1][1], dx + 140, dy + 6, sq_RGBA(255, 177, 0, 250), 1, 1);
|
|
|
|
//线的数量
|
|
local XianCount = 0;
|
|
|
|
local FYS = false; //防御属性是否绘制判断
|
|
local SWS = false; //四维属性是否绘制判断
|
|
local SGS = false; //三攻属性是否绘制判断
|
|
local SSS = false; //三速属性是否绘制判断
|
|
local SQS = false; //属强属性是否绘制判断
|
|
|
|
local cx = dx + 6; //起始点偏移(要从名字下面的线开始绘制)
|
|
local cy = dy + 20; //起始点偏移(要从名字下面的线开始绘制)
|
|
|
|
local o = 2; //属性剔除前2无用属性
|
|
local RGBA; //根据不同的属性绘制不同颜色字体
|
|
|
|
//防御属性
|
|
for (; o < Attribute.len(); o++) {
|
|
local gType = Attribute[o][0];
|
|
//如果不属于防御属性就终止
|
|
if (gType != 9 && gType != 10) break;
|
|
|
|
RGBA = sq_RGBA(119, 110, 95, 250);
|
|
local gTabName = TabName[gType];
|
|
local gValue = Attribute[o][1];
|
|
L_sq_DrawCode(gTabName + gValue.tostring(), cx, cy + ((o - 1) * 15), RGBA, 1, 1);
|
|
FYS = true;
|
|
if (o == (Attribute.len() - 1 - MCount)) return;
|
|
}
|
|
|
|
//绘制线
|
|
if (FYS) {
|
|
T_DrawStayAni(obj, "common/ptst/main.ani", dx, cy + ((o - 1) * 15) + (XianCount * 14), 29, "PtstItemInfoMainXianT");
|
|
XianCount++;
|
|
}
|
|
|
|
//四维属性
|
|
for (; o < Attribute.len(); o++) {
|
|
local gType = Attribute[o][0];
|
|
//如果不属于四维属性就终止
|
|
if (gType < 2 || gType > 5) break;
|
|
|
|
RGBA = sq_RGBA(141, 140, 109, 250);
|
|
local gTabName = TabName[gType];
|
|
local gValue = Attribute[o][1];
|
|
L_sq_DrawCode(gTabName + gValue.tostring(), cx, cy + (XianCount * 14) + ((o - 1) * 15), RGBA, 1, 1);
|
|
SWS = true;
|
|
if (o == (Attribute.len() - 1 - MCount)) return;
|
|
}
|
|
|
|
//三攻属性
|
|
for (; o < Attribute.len(); o++) {
|
|
local gType = Attribute[o][0];
|
|
//如果不属于三攻属性就终止
|
|
if (gType < 6 || gType > 8) break;
|
|
|
|
RGBA = sq_RGBA(255, 255, 216, 200);
|
|
local gTabName = TabName[gType];
|
|
local gValue = Attribute[o][1];
|
|
L_sq_DrawCode(gTabName + gValue.tostring(), cx, cy + (XianCount * 14) + ((o - 1) * 15), RGBA, 1, 1);
|
|
SGS = true;
|
|
if (o == (Attribute.len() - 1 - MCount)) return;
|
|
}
|
|
|
|
if ((SGS || SWS) && (o < Attribute.len())) {
|
|
//绘制线
|
|
T_DrawStayAni(obj, "common/ptst/main.ani", dx, cy + (XianCount * 14) + ((o - 1) * 15), 29, "PtstItemInfoMainXianT");
|
|
XianCount++;
|
|
}
|
|
|
|
//三速属性
|
|
for (; o < Attribute.len(); o++) {
|
|
local gType = Attribute[o][0];
|
|
//如果不属于三速属性就终止
|
|
if (gType < 11 || gType > 16) break;
|
|
|
|
RGBA = sq_RGBA(166, 215, 136, 250);
|
|
local gTabName = TabName[gType];
|
|
local gValue = Attribute[o][1].tofloat() / 10.0;
|
|
L_sq_DrawCode(gTabName + gValue.tostring() + "%", cx, cy + (XianCount * 14) + ((o - 1) * 15), RGBA, 1, 1);
|
|
SSS = true;
|
|
if (o == (Attribute.len() - 1 - MCount)) return;
|
|
}
|
|
|
|
if (SSS) {
|
|
//绘制线
|
|
T_DrawStayAni(obj, "common/ptst/main.ani", dx, cy + (XianCount * 14) + ((o - 1) * 15), 29, "PtstItemInfoMainXianT");
|
|
XianCount++;
|
|
}
|
|
|
|
//属强属性
|
|
for (; o < Attribute.len(); o++) {
|
|
local gType = Attribute[o][0];
|
|
//如果不属于属强属性就终止
|
|
if (gType < 17 || gType > 20) break;
|
|
|
|
RGBA = sq_RGBA(240, 230, 135, 250);
|
|
local gTabName = TabName[gType];
|
|
local gValue = Attribute[o][1];
|
|
L_sq_DrawCode(gTabName + gValue.tostring(), cx, cy + (XianCount * 14) + ((o - 1) * 15), RGBA, 1, 1);
|
|
SQS = true;
|
|
if (o == (Attribute.len() - 1 - MCount)) return;
|
|
}
|
|
|
|
if (SQS) XianCount++;
|
|
|
|
//全属强属性
|
|
for (; o < Attribute.len(); o++) {
|
|
local gType = Attribute[o][0];
|
|
//如果不属于全属强属性就终止
|
|
if (gType != 21) break;
|
|
|
|
RGBA = sq_RGBA(255, 177, 0, 250);
|
|
local gTabName = TabName[gType];
|
|
local gValue = Attribute[o][1];
|
|
L_sq_DrawCode(gTabName + gValue.tostring(), cx, cy + (XianCount * 14) + ((o - 1) * 15), RGBA, 1, 1);
|
|
if (o == (Attribute.len() - 1 - MCount)) return;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
function Run(x, y) {
|
|
X = x;
|
|
Y = y;
|
|
L_Sq_DrawItem(x, y, ItemId, 1, 0, 0, 0);
|
|
}
|
|
}
|
|
|
|
class PtstSlot extends BasicsDrawTool {
|
|
|
|
Type = null;
|
|
X = null;
|
|
Y = null;
|
|
Item = null;
|
|
ItemM = null;
|
|
Select = false;
|
|
SlotName = null;
|
|
|
|
Tobj = null;
|
|
|
|
Mobj = null;
|
|
|
|
constructor(type) {
|
|
Type = type;
|
|
local RootTab = getroottable();
|
|
Tobj = RootTab["PtstObj"];
|
|
if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
|
|
}
|
|
|
|
function IsHover() {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 28, 28)) {
|
|
//因为拖拽的时候会有两个重叠 所以要判断不是当前拿着的物品
|
|
if (Tobj.MoveModel != SlotName) Tobj.HoverModel = SlotName;
|
|
return true;
|
|
} else return false;
|
|
}
|
|
|
|
|
|
//左键按下状态
|
|
function isLBDown(obj) {
|
|
if (IsHover() && Mobj.Lb == 1) {
|
|
obj.getVar(SlotName + "L").setBool(1, true);
|
|
return true;
|
|
} else return false;
|
|
}
|
|
|
|
//左键弹起状态
|
|
function isLBUp(obj) {
|
|
if (Mobj.Lb == 0) {
|
|
obj.getVar(SlotName + "L").setBool(1, false);
|
|
return true;
|
|
} else return false;
|
|
}
|
|
|
|
//右键按下状态
|
|
function isRBDown(obj) {
|
|
if (IsHover() && Mobj.Rb == 1) {
|
|
obj.getVar(SlotName + "R").setBool(1, true);
|
|
return true;
|
|
} else return false;
|
|
}
|
|
|
|
//右键单击状态
|
|
function isRBActive(obj) {
|
|
if (IsHover() && Mobj.RbEvent && obj.getVar(SlotName + "R").getBool(1) == true) {
|
|
obj.getVar(SlotName + "R").setBool(1, false);
|
|
return true;
|
|
} else return false;
|
|
}
|
|
|
|
function DrawHover(obj) {
|
|
if (SlotName >= 30 && SlotName <= 38) {
|
|
//绘制悬停槽蓝光
|
|
if (Item) {
|
|
T_DrawStayAni(obj, "common/ptst/main.ani", X + 7, Y + 7, Type, "PtstSlotHover" + Type);
|
|
}
|
|
} else {
|
|
//绘制悬停槽蓝光
|
|
T_DrawStayAni(obj, "common/ptst/main.ani", X, Y, Type, "PtstSlotHover" + Type);
|
|
}
|
|
|
|
}
|
|
|
|
//第一图层
|
|
function Show(obj, x, y, slot) {
|
|
|
|
SlotName = slot;
|
|
|
|
if (Tobj.MoveModel != SlotName) {
|
|
X = x;
|
|
Y = y;
|
|
} else {
|
|
X = IMouse.GetXPos() - 14;
|
|
Y = IMouse.GetYPos() - 14;
|
|
}
|
|
|
|
|
|
if (slot >= 30 && slot <= 38) {
|
|
if (Item) {
|
|
T_DrawStayAni(obj, "common/ptst/main.ani", x, y, 6, "PtstSystemMainSlot2");
|
|
T_DrawDynamicAni(obj, "common/ptst/ani/" + slot + ".ani", 114 + (X * 0.05).tointeger(), 69 + (Y * 0.05).tointeger(), "PtstSystemgx" + slot);
|
|
} else {
|
|
|
|
//T_DrawStayAni(obj, "common/ptst/main.ani", x, y, 6, "PtstSystemMainSlot2");
|
|
}
|
|
//T_DrawDynamicAni(obj, "common/ptst/ani/" + slot + ".ani", X - 46, Y - 24, "PtstSystemgx" + slot);
|
|
|
|
if (Item && Tobj.MoveModel != SlotName) Item.Run(X + 7, Y + 6);
|
|
} else {
|
|
//如果有勋章对象则执行
|
|
if (Item && Tobj.MoveModel != SlotName) Item.Run(X, Y);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//如果悬停
|
|
if (IsHover()) {
|
|
//绘制背景蓝光 移动时绘制蓝光要在图标底下
|
|
if (Tobj.MoveModel != SlotName) DrawHover(obj);
|
|
|
|
|
|
isRBDown(obj);
|
|
//如果右键穿戴
|
|
if (Item && isRBActive(obj)) {
|
|
local UsePtstPack = Json_STL("UsePtstPack");
|
|
UsePtstPack.Put("op", 29991003);
|
|
UsePtstPack.Put("sel_type", Tobj.State);
|
|
|
|
UsePtstPack.Put("old_slot", slot);
|
|
|
|
|
|
|
|
if (slot <= 24) UsePtstPack.Put("new_slot", 88);
|
|
//if (slot > 88) UsePtstPack.Put("new_slot", 999999);
|
|
if (slot > 24) UsePtstPack.Put("new_slot", 999999);
|
|
|
|
|
|
|
|
UsePtstPack.Put("page", Tobj.NowPage);
|
|
UsePtstPack.Put("type", Tobj.State);
|
|
local str = UsePtstPack.GetString();
|
|
|
|
L_sq_SendPackType(130);
|
|
L_sq_SendPackWChar(str);
|
|
L_sq_SendPack();
|
|
UsePtstPack.Delete();
|
|
}
|
|
}
|
|
|
|
//如果左键按下 写入可移动状态
|
|
if (Item && isLBDown(obj) && Tobj.MoveModel == null && slot < 88) {
|
|
Tobj.MoveModel = SlotName;
|
|
}
|
|
|
|
//如果左键弹起 写入静止状态
|
|
if (isLBUp(obj) && Tobj.MoveModel != null) {
|
|
local MovePtstPack = Json_STL("MovePtstPack");
|
|
MovePtstPack.Put("op", 29991003);
|
|
MovePtstPack.Put("sel_type", Tobj.State);
|
|
|
|
MovePtstPack.Put("old_slot", Tobj.MoveModel.tointeger());
|
|
MovePtstPack.Put("new_slot", Tobj.HoverModel.tointeger());
|
|
MovePtstPack.Put("page", Tobj.NowPage);
|
|
local str = MovePtstPack.GetString();
|
|
L_sq_SendPackType(130);
|
|
L_sq_SendPackWChar(str);
|
|
L_sq_SendPack();
|
|
MovePtstPack.Delete();
|
|
|
|
Tobj.MoveModel = null;
|
|
}
|
|
}
|
|
|
|
//第二图层
|
|
function ItemShow(obj) {
|
|
|
|
if (IsHover() && Tobj.MoveModel == null) {
|
|
if (Item) Item.DrawHover(obj);
|
|
}
|
|
}
|
|
|
|
//第三图层 拖动物品时的最高图层绘制
|
|
function ItemMoveShow(obj) {
|
|
if (Item && Tobj.MoveModel == SlotName) Item.Run(X, Y);
|
|
}
|
|
}
|
|
|
|
|
|
class PtstWindow extends BasicsDrawTool {
|
|
//宽度
|
|
Width = null;
|
|
//高度
|
|
Height = null;
|
|
//标题高度
|
|
TitleH = null;
|
|
|
|
//X坐标
|
|
X = null;
|
|
B_X = null;
|
|
//Y坐标
|
|
Y = null;
|
|
B_Y = null;
|
|
|
|
YMouseSw = true;
|
|
DeBugMode = false;
|
|
|
|
Mobj = null;
|
|
M_Xpos = null;
|
|
M_Ypos = null;
|
|
|
|
|
|
constructor(gX, gY, gWidth, gHeight, gTitleH) {
|
|
//宽度
|
|
Width = gWidth;
|
|
//高度
|
|
Height = gHeight;
|
|
//标题高度
|
|
TitleH = gTitleH;
|
|
|
|
//X坐标
|
|
X = gX;
|
|
//Y坐标
|
|
Y = gY;
|
|
|
|
if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
|
|
}
|
|
|
|
//设定鼠标逻辑
|
|
function LockMouse() {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, Width, Height)) {
|
|
IMouse.LockMouseClick();
|
|
YMouseSw = false;
|
|
} else {
|
|
if (YMouseSw == false && sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 0, 0, 800, 600)) {
|
|
IMouse.ReleaseMouseClick();
|
|
YMouseSw = true;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
//设定窗口拖动逻辑
|
|
function MoveWindow() {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, Width, TitleH)) {
|
|
|
|
if (Mobj.Lb == 1) {
|
|
if (!M_Xpos) M_Xpos = IMouse.GetXPos(); //原始鼠标位置数据
|
|
if (!M_Ypos) M_Ypos = IMouse.GetYPos();
|
|
if (!B_X) B_X = X; //原始窗口位置
|
|
if (!B_Y) B_Y = Y;
|
|
|
|
X = B_X - (M_Xpos - IMouse.GetXPos());
|
|
Y = B_Y - (M_Ypos - IMouse.GetYPos());
|
|
|
|
} else if (Mobj.Lb == 0) {
|
|
M_Xpos = null;
|
|
M_Ypos = null;
|
|
B_X = null;
|
|
B_Y = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
function Show(obj) {
|
|
if (DeBugMode) sq_DrawBox(X, Y, Width, Height, 0xffffffff);
|
|
|
|
//设定鼠标逻辑
|
|
LockMouse();
|
|
|
|
//设定窗口拖动逻辑
|
|
MoveWindow();
|
|
|
|
}
|
|
}
|
|
|
|
class PtstC extends BasicsDrawTool {
|
|
WindowObj = null; //窗口对象
|
|
MainState = false; //主状态
|
|
X = 120;
|
|
Y = 50;
|
|
|
|
|
|
Sw = true;
|
|
|
|
State = 24;
|
|
CheckGetMyPtstInfo = false;
|
|
PtstButton = null;
|
|
PtstButtonSwitch = true;
|
|
BeadButton = null;
|
|
BeadButtonSwitch = false;
|
|
|
|
BuffSet = false;
|
|
|
|
//背包格子
|
|
SlotB = null;
|
|
//移动对象
|
|
MoveModel = null;
|
|
//悬停对象
|
|
HoverModel = null;
|
|
|
|
//最大页数 Json获取
|
|
MaxPage = 5;
|
|
//当前页数 Json获取
|
|
NowPage = 1;
|
|
//颜色
|
|
ColorArr = null;
|
|
|
|
C_Slot0 = null;
|
|
C_Slot1 = null;
|
|
C_Slot2 = null;
|
|
C_Slot3 = null;
|
|
C_Slot4 = null;
|
|
C_Slot5 = null;
|
|
C_Slot6 = null;
|
|
C_Slot7 = null;
|
|
C_Slot8 = null;
|
|
|
|
A_Slot0 = null;
|
|
A_Slot1 = null;
|
|
A_Slot2 = null;
|
|
|
|
|
|
constructor() {
|
|
//注册配置类信息回调
|
|
Pack_Control.rawset(29991998, SetBaseInfoCallBack);
|
|
//请求配置信息
|
|
GetBaseInfo();
|
|
SlotB = [];
|
|
SlotB.resize(24);
|
|
|
|
//注册获取背包信息回调
|
|
Pack_Control.rawset(29991002, GetMyPtstInfoCallBack);
|
|
|
|
//注册穿戴回调
|
|
Pack_Control.rawset(29991012, GetMyWearPtstCallBack);
|
|
|
|
//初始请求背包信息
|
|
F_GetMyPtstInfo(24, 1);
|
|
}
|
|
|
|
//穿戴信息回调
|
|
function GetMyWearPtstCallBack(Chunk) {
|
|
//收到打开包
|
|
|
|
local Buffer = Json_STL("GetMyPtstInfoBuffer");
|
|
Buffer.Parse(Chunk, 0, false);
|
|
local RootTab = getroottable();
|
|
|
|
if (RootTab.rawin("PtstObj")) {
|
|
local Tobj = RootTab["PtstObj"];
|
|
|
|
//清空勋章对象
|
|
Tobj.A_Slot0.Item = null;
|
|
Tobj.A_Slot1.Item = null;
|
|
Tobj.A_Slot2.Item = null;
|
|
|
|
Tobj.C_Slot0.Item = null;
|
|
Tobj.C_Slot1.Item = null;
|
|
Tobj.C_Slot2.Item = null;
|
|
Tobj.C_Slot3.Item = null;
|
|
Tobj.C_Slot4.Item = null;
|
|
Tobj.C_Slot5.Item = null;
|
|
Tobj.C_Slot6.Item = null;
|
|
Tobj.C_Slot7.Item = null;
|
|
Tobj.C_Slot8.Item = null;
|
|
|
|
|
|
/*
|
|
//清空守护珠对象组
|
|
for (local w = 0; w < 4; w++) {
|
|
Tobj.WearSlotB[w].Item = null;
|
|
}
|
|
*/
|
|
|
|
for (local w = 0; w < 3; w++) {
|
|
local dataarrsize = Buffer.Get("data->" + w + "->dataarrsize");
|
|
|
|
if (dataarrsize) {
|
|
local dataarr = [];
|
|
for (local z = 0; z < dataarrsize; z++) {
|
|
local arrbuufer = [];
|
|
local a = Buffer.Get("data->" + w + "->stk_ab->" + z + "->0");
|
|
local b = Buffer.Get("data->" + w + "->stk_ab->" + z + "->1");
|
|
arrbuufer.append(a);
|
|
arrbuufer.append(b);
|
|
dataarr.append(arrbuufer);
|
|
}
|
|
local rarity = Buffer.Get("data->" + w + "->rarity");
|
|
local explain = Buffer.Get("data->" + w + "->explain");
|
|
local slot = Buffer.Get("data->" + w + "->slot");
|
|
if (slot == 0) Tobj.A_Slot0.Item = PtstItem(Buffer.Get("data->" + w + "->stk_id"), dataarr, rarity, explain);
|
|
if (slot == 1) Tobj.A_Slot1.Item = PtstItem(Buffer.Get("data->" + w + "->stk_id"), dataarr, rarity, explain);
|
|
if (slot == 2) Tobj.A_Slot2.Item = PtstItem(Buffer.Get("data->" + w + "->stk_id"), dataarr, rarity, explain);
|
|
}
|
|
}
|
|
|
|
for (local u = 0; u < 9; u++) {
|
|
local dataarrsize = Buffer.Get("fdata->" + u + "->dataarrsize");
|
|
|
|
if (dataarrsize) {
|
|
local dataarr = [];
|
|
for (local z = 0; z < dataarrsize; z++) {
|
|
local arrbuufer = [];
|
|
local a = Buffer.Get("fdata->" + u + "->stk_ab->" + z + "->0");
|
|
local b = Buffer.Get("fdata->" + u + "->stk_ab->" + z + "->1");
|
|
arrbuufer.append(a);
|
|
arrbuufer.append(b);
|
|
dataarr.append(arrbuufer);
|
|
}
|
|
local rarity = Buffer.Get("fdata->" + u + "->rarity");
|
|
local explain = Buffer.Get("fdata->" + u + "->explain");
|
|
local slot = Buffer.Get("fdata->" + u + "->slot");
|
|
if (slot == 0) Tobj.C_Slot0.Item = PtstItem(Buffer.Get("fdata->" + u + "->stk_id"), dataarr, rarity, explain);
|
|
if (slot == 1) Tobj.C_Slot1.Item = PtstItem(Buffer.Get("fdata->" + u + "->stk_id"), dataarr, rarity, explain);
|
|
if (slot == 2) Tobj.C_Slot2.Item = PtstItem(Buffer.Get("fdata->" + u + "->stk_id"), dataarr, rarity, explain);
|
|
if (slot == 3) Tobj.C_Slot3.Item = PtstItem(Buffer.Get("fdata->" + u + "->stk_id"), dataarr, rarity, explain);
|
|
if (slot == 4) Tobj.C_Slot4.Item = PtstItem(Buffer.Get("fdata->" + u + "->stk_id"), dataarr, rarity, explain);
|
|
if (slot == 5) Tobj.C_Slot5.Item = PtstItem(Buffer.Get("fdata->" + u + "->stk_id"), dataarr, rarity, explain);
|
|
if (slot == 6) Tobj.C_Slot6.Item = PtstItem(Buffer.Get("fdata->" + u + "->stk_id"), dataarr, rarity, explain);
|
|
if (slot == 7) Tobj.C_Slot7.Item = PtstItem(Buffer.Get("fdata->" + u + "->stk_id"), dataarr, rarity, explain);
|
|
if (slot == 8) Tobj.C_Slot8.Item = PtstItem(Buffer.Get("fdata->" + u + "->stk_id"), dataarr, rarity, explain);
|
|
}
|
|
}
|
|
|
|
local obj = sq_GetMyMasterCharacter();
|
|
if (obj)
|
|
Tobj.SetSkillData(obj);
|
|
}
|
|
}
|
|
|
|
//请求配置信息
|
|
function GetBaseInfo() {
|
|
local GetBaseInfoPack = Json_STL("GetBaseInfoPack");
|
|
GetBaseInfoPack.Put("op", 29991997);
|
|
local str = GetBaseInfoPack.GetString();
|
|
L_sq_SendPackType(130);
|
|
L_sq_SendPackWChar(str);
|
|
L_sq_SendPack();
|
|
GetBaseInfoPack.Delete();
|
|
}
|
|
|
|
//配置类信息回调
|
|
function SetBaseInfoCallBack(Chunk) {
|
|
|
|
local Buffer = Json_STL("GetMyPtstInfoBuffer");
|
|
Buffer.Parse(Chunk, 0, false);
|
|
local RootTab = getroottable();
|
|
if (RootTab.rawin("PtstObj")) {
|
|
local Tobj = RootTab["PtstObj"];
|
|
Tobj.MaxPage = Buffer.Get("slotpage");
|
|
Tobj.ColorArr = [];
|
|
for (local i = 0; i < 8; i++) {
|
|
local arrbuffer = []
|
|
arrbuffer.append(Buffer.Get("color" + i + "->0"));
|
|
arrbuffer.append(Buffer.Get("color" + i + "->1"));
|
|
arrbuffer.append(Buffer.Get("color" + i + "->2"));
|
|
arrbuffer.append(250);
|
|
Tobj.ColorArr.append(arrbuffer);
|
|
}
|
|
}
|
|
}
|
|
|
|
//首次获取背包信息
|
|
function F_GetMyPtstInfo(Type, Page) {
|
|
local GetMyMedalInfoPack = Json_STL("GetMyMedalInfoPack");
|
|
GetMyMedalInfoPack.Put("op", 29991001);
|
|
GetMyMedalInfoPack.Put("sel_type", Type);
|
|
GetMyMedalInfoPack.Put("page", Page);
|
|
GetMyMedalInfoPack.Put("wear", true);
|
|
local str = GetMyMedalInfoPack.GetString();
|
|
L_sq_SendPackType(130);
|
|
L_sq_SendPackWChar(str);
|
|
L_sq_SendPack();
|
|
GetMyMedalInfoPack.Delete();
|
|
}
|
|
|
|
//获取背包信息回调
|
|
function GetMyPtstInfoCallBack(Chunk) {
|
|
//收到打开包
|
|
|
|
local Buffer = Json_STL("GetMyPtstInfoBuffer");
|
|
Buffer.Parse(Chunk, 0, false);
|
|
local RootTab = getroottable();
|
|
|
|
if (RootTab.rawin("PtstObj")) {
|
|
local Tobj = RootTab["PtstObj"];
|
|
|
|
{ //同步页面(勋章或守护珠)
|
|
local SelType = Buffer.Get("sel_type");
|
|
Tobj.State = SelType;
|
|
if (SelType == 24) {
|
|
Tobj.PtstButtonSwitch = true;
|
|
Tobj.BeadButtonSwitch = false;
|
|
} else if (SelType == 23) {
|
|
Tobj.PtstButtonSwitch = false;
|
|
Tobj.BeadButtonSwitch = true;
|
|
}
|
|
}
|
|
|
|
//Tobj.SlotArr = [];
|
|
local Count = Buffer.Get("count");
|
|
|
|
for (local z = 0; z < 24; z++) {
|
|
Tobj.SlotB[z].Item = null;
|
|
}
|
|
for (local i = 0; i < Count; i++) {
|
|
local SlotPos = Buffer.Get("data->" + i + "->slot");
|
|
local dataarrsize = Buffer.Get("data->" + i + "->dataarrsize");
|
|
local dataarr = [];
|
|
for (local z = 0; z < dataarrsize; z++) {
|
|
local arrbuufer = [];
|
|
local a = Buffer.Get("data->" + i + "->stk_ab->" + z + "->0");
|
|
local b = Buffer.Get("data->" + i + "->stk_ab->" + z + "->1");
|
|
|
|
|
|
arrbuufer.append(a);
|
|
arrbuufer.append(b);
|
|
dataarr.append(arrbuufer);
|
|
}
|
|
local rarity = Buffer.Get("data->" + i + "->rarity");
|
|
local explain = Buffer.Get("data->" + i + "->explain");
|
|
//Tobj.SlotB[SlotPos].Item = PtstItem(Buffer.Get("data->" + i + "->stk_id"), dataarr, rarity,explain,explainlen);
|
|
Tobj.SlotB[SlotPos].Item = PtstItem(Buffer.Get("data->" + i + "->stk_id"), dataarr, rarity, explain);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
//获取背包信息
|
|
function GetMyPtstInfo(Type, Page) {
|
|
local GetMyPtstInfoPack = Json_STL("GetMyPtstInfoPack");
|
|
GetMyPtstInfoPack.Put("op", 29991001);
|
|
GetMyPtstInfoPack.Put("sel_type", Type);
|
|
GetMyPtstInfoPack.Put("page", Page);
|
|
GetMyPtstInfoPack.Put("wear", false);
|
|
local str = GetMyPtstInfoPack.GetString();
|
|
L_sq_SendPackType(130);
|
|
L_sq_SendPackWChar(str);
|
|
L_sq_SendPack();
|
|
GetMyPtstInfoPack.Delete();
|
|
}
|
|
|
|
//绘制主界面
|
|
function DrawMain(obj) {
|
|
{ //底图层绘制
|
|
//窗口
|
|
T_DrawStayAni(obj, "common/ptst/main.ani", X - 120 + 120, Y - 50 + 50, 0, "PtstSystemMain");
|
|
//T_DrawStayAni(obj, "common/ptst/main.ani", X - 120 + 380, Y - 50 + 50, 1, "PtstSystemMain2");
|
|
|
|
T_DrawDynamicAni(obj, "common/ptst/mainjg.ani", X - 120 + 126, Y - 50 + 77, "PtstSystemMain4")
|
|
}
|
|
|
|
{ //勋章和守护珠切换按钮
|
|
PtstButton = PtstTabTextButtonPro(obj, "小护石Tab", X - 120 + 5 + 129, Y - 50 + 253 + 69, "common/Ptst/main.ani", 2, 48, 21, " 护石", 8, 5);
|
|
PtstButton.SwitchState = PtstButtonSwitch;
|
|
PtstButton.SetRectEnble(true, "a护石Tab", X - 120 + 5 + 1 + 129, Y - 50 + 253 + 69, "common/Ptst/main.ani", 3);
|
|
PtstButton.SetCustomClickEnble(true, "a护石Tab", X - 120 + 5 + 129, Y - 50 + 253 + 69, "common/Ptst/main.ani", 4);
|
|
|
|
//勋章
|
|
PtstButton.Show();
|
|
if (PtstButton.isLBActive()) {
|
|
//PtstButton.SwitchState = true;
|
|
PtstButtonSwitch = true;
|
|
//BeadButton.SwitchState = false;
|
|
BeadButtonSwitch = false;
|
|
State = 24;
|
|
//清空槽对象
|
|
SlotB = [];
|
|
SlotB = null;
|
|
//还原页码
|
|
NowPage = 1;
|
|
GetMyPtstInfo(State, NowPage);
|
|
}
|
|
|
|
BeadButton = PtstTabTextButtonPro(obj, "小符文Tab", X - 120 + 5 + 50 + 129, Y - 50 + 253 + 69, "common/Ptst/main.ani", 2, 48, 21, " 符文", 8, 5);
|
|
BeadButton.SwitchState = BeadButtonSwitch;
|
|
BeadButton.SetRectEnble(true, "a符文Tab", X - 120 + 5 + 51 + 129, Y - 50 + 253 + 69, "common/Ptst/main.ani", 3);
|
|
BeadButton.SetCustomClickEnble(true, "a符文Tab", X - 120 + 5 + 50 + 129, Y - 50 + 253 + 69, "common/Ptst/main.ani", 4);
|
|
//守护珠
|
|
BeadButton.Show();
|
|
if (BeadButton.isLBActive()) {
|
|
PtstButton.SwitchState = false;
|
|
PtstButtonSwitch = false;
|
|
BeadButton.SwitchState = true;
|
|
BeadButtonSwitch = true;
|
|
State = 23;
|
|
//清空槽对象
|
|
SlotB = [];
|
|
SlotB = null;
|
|
//还原页码
|
|
NowPage = 1;
|
|
GetMyPtstInfo(State, NowPage);
|
|
}
|
|
}
|
|
|
|
{ //翻页
|
|
local LeftButton = PtstButtonPro(obj, "PtstLeftButton", X - 120 + 150 + 39 + 110, Y - 50 + 260 + 68, "common/Ptst/main.ani", 13, 9, 11);
|
|
LeftButton.SetRectEnble(true, "PtstLeftButtonr", X - 120 + 150 + 39 + 110, Y - 50 + 260 + 68, "common/Ptst/main.ani", 13);
|
|
LeftButton.SetCustomClickEnble(true, "PtstLeftButtonc", X - 120 + 150 + 39 + 110, Y - 50 + 260 + 68, "common/Ptst/main.ani", 12);
|
|
LeftButton.Show();
|
|
|
|
if (LeftButton.isLBActive()) {
|
|
//页码减少
|
|
if (NowPage > 1) NowPage--;
|
|
//清空槽对象
|
|
SlotB = [];
|
|
SlotB = null;
|
|
GetMyPtstInfo(State, NowPage);
|
|
}
|
|
|
|
local RightButton = PtstButtonPro(obj, "PtstRightButton", X - 120 + 200 + 39 + 110, Y - 50 + 260 + 68, "common/Ptst/main.ani", 13, 9, 7);
|
|
RightButton.SetRectEnble(true, "PtstRightButtonr", X - 120 + 200 + 39 + 110, Y - 50 + 260 + 68, "common/Ptst/main.ani", 9);
|
|
RightButton.SetCustomClickEnble(true, "PtstRightButtonc", X - 120 + 200 + 39 + 110, Y - 50 + 260 + 68, "common/Ptst/main.ani", 8);
|
|
RightButton.Show();
|
|
|
|
if (RightButton.isLBActive()) {
|
|
//页码增加
|
|
if (NowPage < MaxPage) NowPage++;
|
|
//清空槽对象
|
|
SlotB = [];
|
|
SlotB = null;
|
|
GetMyPtstInfo(State, NowPage);
|
|
}
|
|
|
|
L_sq_DrawCode(NowPage + "/" + MaxPage, X - 120 + 175 + 39 + 110, Y - 50 + 258 + 68, sq_RGBA(230, 200, 155, 250), 1, 1);
|
|
}
|
|
|
|
|
|
{ //背包格子
|
|
|
|
//绘制
|
|
{
|
|
if (!SlotB || SlotB.len() <= 0) return;
|
|
//第一图层
|
|
for (local q = 0; q < 24; q++) {
|
|
SlotB[q].Show(obj, X - 120 + 137 + ((q % 8) * 28), Y - 50 + 346 + ((q / 8) * 31), q);
|
|
}
|
|
|
|
C_Slot0.Show(obj, X - 120 + 118 + 56, Y - 50 + 48 + 55, 30);
|
|
C_Slot1.Show(obj, X - 120 + 118 + 110, Y - 50 + 48 + 37, 31);
|
|
C_Slot2.Show(obj, X - 120 + 118 + 164, Y - 50 + 48 + 55, 32);
|
|
C_Slot3.Show(obj, X - 120 + 118 + 205, Y - 50 + 48 + 127, 33);
|
|
C_Slot4.Show(obj, X - 120 + 118 + 194, Y - 50 + 48 + 182, 34);
|
|
C_Slot5.Show(obj, X - 120 + 118 + 152, Y - 50 + 48 + 220, 35);
|
|
C_Slot6.Show(obj, X - 120 + 118 + 68, Y - 50 + 48 + 220, 36);
|
|
C_Slot7.Show(obj, X - 120 + 118 + 26, Y - 50 + 48 + 182, 37);
|
|
C_Slot8.Show(obj, X - 120 + 118 + 15, Y - 50 + 48 + 127, 38);
|
|
|
|
A_Slot0.Show(obj, X - 120 + 120 + 115, Y - 50 + 50 + 110, 90);
|
|
A_Slot1.Show(obj, X - 120 + 120 + 90, Y - 50 + 50 + 153, 91);
|
|
A_Slot2.Show(obj, X - 120 + 120 + 140, Y - 50 + 50 + 153, 92);
|
|
|
|
//第二图层
|
|
for (local u = 0; u < 24; u++) {
|
|
SlotB[u].ItemShow(obj);
|
|
}
|
|
C_Slot0.ItemShow(obj);
|
|
C_Slot1.ItemShow(obj);
|
|
C_Slot2.ItemShow(obj);
|
|
C_Slot3.ItemShow(obj);
|
|
C_Slot4.ItemShow(obj);
|
|
C_Slot5.ItemShow(obj);
|
|
C_Slot6.ItemShow(obj);
|
|
C_Slot7.ItemShow(obj);
|
|
C_Slot8.ItemShow(obj);
|
|
|
|
A_Slot0.ItemShow(obj);
|
|
A_Slot1.ItemShow(obj);
|
|
A_Slot2.ItemShow(obj);
|
|
|
|
for (local z = 0; z < 24; z++) {
|
|
SlotB[z].ItemMoveShow(obj);
|
|
}
|
|
C_Slot0.ItemMoveShow(obj);
|
|
C_Slot1.ItemMoveShow(obj);
|
|
C_Slot2.ItemMoveShow(obj);
|
|
C_Slot3.ItemMoveShow(obj);
|
|
C_Slot4.ItemMoveShow(obj);
|
|
C_Slot5.ItemMoveShow(obj);
|
|
C_Slot6.ItemMoveShow(obj);
|
|
C_Slot7.ItemMoveShow(obj);
|
|
C_Slot8.ItemMoveShow(obj);
|
|
|
|
|
|
A_Slot0.ItemMoveShow(obj);
|
|
A_Slot1.ItemMoveShow(obj);
|
|
A_Slot2.ItemMoveShow(obj);
|
|
}
|
|
}
|
|
}
|
|
|
|
//设置技能数据
|
|
function SetSkillData(obj) {
|
|
obj = sq_ObjectToSQRCharacter(obj);
|
|
ClearTalismanData();
|
|
if (A_Slot0.Item && getroottable().rawin("LenheartTalisman_" + A_Slot0.Item.ItemId)) {
|
|
local Func = getroottable()["LenheartTalisman_" + A_Slot0.Item.ItemId];
|
|
Func(obj);
|
|
}
|
|
if (A_Slot1.Item && getroottable().rawin("LenheartTalisman_" + A_Slot1.Item.ItemId)) {
|
|
local Func = getroottable()["LenheartTalisman_" + A_Slot1.Item.ItemId];
|
|
Func(obj);
|
|
}
|
|
if (A_Slot2.Item && getroottable().rawin("LenheartTalisman_" + A_Slot2.Item.ItemId)) {
|
|
local Func = getroottable()["LenheartTalisman_" + A_Slot2.Item.ItemId];
|
|
Func(obj);
|
|
}
|
|
if (C_Slot0.Item && getroottable().rawin("LenheartTalisman_" + C_Slot0.Item.ItemId)) {
|
|
local Func = getroottable()["LenheartTalisman_" + C_Slot0.Item.ItemId];
|
|
Func(obj);
|
|
}
|
|
if (C_Slot1.Item && getroottable().rawin("LenheartTalisman_" + C_Slot1.Item.ItemId)) {
|
|
local Func = getroottable()["LenheartTalisman_" + C_Slot1.Item.ItemId];
|
|
Func(obj);
|
|
}
|
|
if (C_Slot2.Item && getroottable().rawin("LenheartTalisman_" + C_Slot2.Item.ItemId)) {
|
|
local Func = getroottable()["LenheartTalisman_" + C_Slot2.Item.ItemId];
|
|
Func(obj);
|
|
}
|
|
if (C_Slot3.Item && getroottable().rawin("LenheartTalisman_" + C_Slot3.Item.ItemId)) {
|
|
local Func = getroottable()["LenheartTalisman_" + C_Slot3.Item.ItemId];
|
|
Func(obj);
|
|
}
|
|
if (C_Slot4.Item && getroottable().rawin("LenheartTalisman_" + C_Slot4.Item.ItemId)) {
|
|
local Func = getroottable()["LenheartTalisman_" + C_Slot4.Item.ItemId];
|
|
Func(obj);
|
|
}
|
|
if (C_Slot5.Item && getroottable().rawin("LenheartTalisman_" + C_Slot5.Item.ItemId)) {
|
|
local Func = getroottable()["LenheartTalisman_" + C_Slot5.Item.ItemId];
|
|
Func(obj);
|
|
}
|
|
if (C_Slot6.Item && getroottable().rawin("LenheartTalisman_" + C_Slot6.Item.ItemId)) {
|
|
local Func = getroottable()["LenheartTalisman_" + C_Slot6.Item.ItemId];
|
|
Func(obj);
|
|
}
|
|
if (C_Slot7.Item && getroottable().rawin("LenheartTalisman_" + C_Slot7.Item.ItemId)) {
|
|
local Func = getroottable()["LenheartTalisman_" + C_Slot7.Item.ItemId];
|
|
Func(obj);
|
|
}
|
|
if (C_Slot8.Item && getroottable().rawin("LenheartTalisman_" + C_Slot8.Item.ItemId)) {
|
|
local Func = getroottable()["LenheartTalisman_" + C_Slot8.Item.ItemId];
|
|
Func(obj);
|
|
}
|
|
}
|
|
|
|
//开启界面回调
|
|
function OpenClassCallBack() {
|
|
|
|
L_NewWindows("Lenheart", 170, 0x65535);
|
|
local W = sq_GetPopupWindowMainCotrol(170);
|
|
W.SetVisible(false);
|
|
W.SetEnable(false);
|
|
|
|
//初始请求背包信息
|
|
F_GetMyPtstInfo(24, 1);
|
|
}
|
|
|
|
//绘制入口
|
|
function Draw(obj) {
|
|
if (MainState) {
|
|
if (WindowObj) {
|
|
DrawMain(obj);
|
|
WindowObj.Show(obj);
|
|
X = WindowObj.X;
|
|
Y = WindowObj.Y;
|
|
} else {
|
|
WindowObj = PtstWindow(X, Y, 258, 408, 28); //坐标 大小 标题栏高度
|
|
//WindowObj.DeBugMode = true;
|
|
}
|
|
} else {
|
|
if (WindowObj && WindowObj.YMouseSw == false) {
|
|
IMouse.ReleaseMouseClick();
|
|
WindowObj.YMouseSw = true;
|
|
WindowObj = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
//逻辑入口
|
|
function Proc(obj) {
|
|
if (KeyPressNB.isKeyPress(48, "PtstCloseKey")) {
|
|
MainState = false;
|
|
}
|
|
|
|
//初始化槽和道具对象
|
|
if (SlotB == null) {
|
|
SlotB = [];
|
|
SlotB.resize(24);
|
|
}
|
|
for (local i = 0; i < 24; i++) {
|
|
if (SlotB[i] == null) SlotB[i] = PtstSlot(5);
|
|
}
|
|
|
|
{
|
|
if (C_Slot0 == null) C_Slot0 = PtstSlot(5);
|
|
if (C_Slot1 == null) C_Slot1 = PtstSlot(5);
|
|
if (C_Slot2 == null) C_Slot2 = PtstSlot(5);
|
|
if (C_Slot3 == null) C_Slot3 = PtstSlot(5);
|
|
if (C_Slot4 == null) C_Slot4 = PtstSlot(5);
|
|
if (C_Slot5 == null) C_Slot5 = PtstSlot(5);
|
|
if (C_Slot6 == null) C_Slot6 = PtstSlot(5);
|
|
if (C_Slot7 == null) C_Slot7 = PtstSlot(5);
|
|
if (C_Slot8 == null) C_Slot8 = PtstSlot(5);
|
|
|
|
if (A_Slot0 == null) A_Slot0 = PtstSlot(5);
|
|
if (A_Slot1 == null) A_Slot1 = PtstSlot(5);
|
|
if (A_Slot2 == null) A_Slot2 = PtstSlot(5);
|
|
}
|
|
|
|
if (sq_GetCurrentModuleType() == 3) {
|
|
if (!BuffSet) {
|
|
SetSkillData(obj);
|
|
BuffSet = true;
|
|
}
|
|
} else {
|
|
if (BuffSet) BuffSet = false;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function Ptst(obj) {
|
|
local RootTab = getroottable();
|
|
if (!RootTab.rawin("PtstObj")) {
|
|
local Cobj = PtstC();
|
|
RootTab.rawset("PtstObj", Cobj);
|
|
EventIcon("护石系统", 120, 120, Cobj);
|
|
} else {
|
|
RootTab["PtstObj"].Proc(obj);
|
|
RootTab["PtstObj"].Draw(obj);
|
|
}
|
|
}
|
|
|
|
|