705 lines
25 KiB
Plaintext
705 lines
25 KiB
Plaintext
/*
|
|
文件名:Tuguan.nut
|
|
路径:Plugins/Tuguan/Tuguan.nut
|
|
创建日期:2022-12-15 07:09
|
|
文件用途:土罐的袖珍罐
|
|
*/
|
|
class TuguanButton // obj -- 按钮名称 -- 鼠标对象 -- X坐标 -- Y坐标 -- 宽度 -- 高度 -- Ani调用路径 -- Ani宽度 -- Ani高度 -- AniRGB --
|
|
{
|
|
obj = null;
|
|
buttonName = null;
|
|
IMouse = null;
|
|
x = null;
|
|
y = null;
|
|
width = null;
|
|
length = null;
|
|
aniFileName = null;
|
|
BoxStetu = null;
|
|
Mobj = null; //鼠标对象
|
|
|
|
constructor(gObj, gButtonName, gIMouse, gX, gY, gWidth, gLength, ganiFileName) {
|
|
obj = gObj;
|
|
buttonName = gButtonName;
|
|
IMouse = gIMouse;
|
|
x = gX;
|
|
y = gY;
|
|
width = gWidth;
|
|
length = gLength;
|
|
aniFileName = ganiFileName;
|
|
BoxStetu = BoxStetu;
|
|
|
|
if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
|
|
}
|
|
|
|
function drawButtonImage() {
|
|
if (isDown())
|
|
y++;
|
|
|
|
if (isInRect()) {
|
|
local buttonAniEff = obj.getVar().GetAnimationMap(buttonName + "rect", aniFileName.tostring() + "_2.ani");
|
|
sq_AnimationProc(buttonAniEff);
|
|
sq_drawCurrentFrame(buttonAniEff, x, y, true);
|
|
}
|
|
if (!isInRect()) {
|
|
local buttonAni = obj.getVar().GetAnimationMap(buttonName, aniFileName.tostring() + "_1.ani");
|
|
sq_AnimationProc(buttonAni);
|
|
sq_drawCurrentFrame(buttonAni, x, y, true);
|
|
}
|
|
}
|
|
|
|
|
|
//悬停状态
|
|
function isInRect() {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 5, 5, x, y, width, length)) return true;
|
|
else return false;
|
|
}
|
|
//左键按下状态
|
|
function isDown() {
|
|
if (isInRect() && Mobj.Lb == 1) return true;
|
|
else return false;
|
|
}
|
|
//左键弹起状态
|
|
function isLBUp() {
|
|
if (isInRect() && Mobj.Lb == 0) return true;
|
|
else return false;
|
|
}
|
|
|
|
//左键单击状态
|
|
function isActive() {
|
|
if (isInRect() && Mobj.LbEvent) return true;
|
|
else return false;
|
|
}
|
|
|
|
}
|
|
|
|
class TuguanTextButton // obj -- 按钮名称 -- 鼠标对象 -- X坐标 -- Y坐标 -- 宽度 -- 高度 -- Ani调用路径 -- Ani宽度 -- Ani高度 -- AniRGB --
|
|
{
|
|
obj = null;
|
|
IMouse = null;
|
|
x = null;
|
|
y = null;
|
|
width = null;
|
|
length = null;
|
|
BoxStetu = null;
|
|
str = null;
|
|
type = null;
|
|
mb = null;
|
|
rgb = null;
|
|
irgb = null;
|
|
Mobj = null; //鼠标对象
|
|
|
|
constructor(gObj, gIMouse, gX, gY, gWidth, gLength, gstr, grgba, girgba, gtype, gmb) {
|
|
obj = gObj;
|
|
IMouse = gIMouse;
|
|
x = gX;
|
|
y = gY;
|
|
width = gWidth;
|
|
length = gLength;
|
|
BoxStetu = BoxStetu;
|
|
str = gstr;
|
|
type = gtype;
|
|
mb = gmb;
|
|
rgb = grgba;
|
|
irgb = girgba;
|
|
|
|
if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
|
|
}
|
|
|
|
function draw() {
|
|
if (isDown())
|
|
y++;
|
|
|
|
if (isInRect()) {
|
|
L_sq_DrawCode(str, x, y, irgb, type, mb);
|
|
}
|
|
if (!isInRect()) {
|
|
L_sq_DrawCode(str, x, y, rgb, type, mb);
|
|
}
|
|
}
|
|
|
|
//悬停状态
|
|
function isInRect() {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 5, 5, x, y, width, length)) return true;
|
|
else return false;
|
|
}
|
|
//左键按下状态
|
|
function isDown() {
|
|
if (isInRect() && Mobj.Lb == 1) return true;
|
|
else return false;
|
|
}
|
|
//左键弹起状态
|
|
function isLBUp() {
|
|
if (isInRect() && Mobj.Lb == 0) return true;
|
|
else return false;
|
|
}
|
|
|
|
//左键单击状态
|
|
function isActive() {
|
|
if (isInRect() && Mobj.LbEvent) return true;
|
|
else return false;
|
|
}
|
|
}
|
|
|
|
class TuguanSystem extends BasicsDrawTool {
|
|
|
|
State = 0;
|
|
MainSoundsSw = 0;
|
|
ASoundSw = 0;
|
|
SSoundSw = 0;
|
|
|
|
SelectModel = 0;
|
|
BoxName = null;
|
|
BoxId = null;
|
|
BoxNameXpos = null;
|
|
BoxNameYpos = null;
|
|
BoxCount = null;
|
|
ProbabilityTab = null;
|
|
AniType = null;
|
|
|
|
//Ani对象
|
|
P1_01 = null;
|
|
P2_01 = null;
|
|
P3_01 = null;
|
|
P4_02 = null;
|
|
MainEffAni = null;
|
|
MainEffAniArr = null;
|
|
|
|
|
|
//奖励包对象
|
|
RewardObj = null;
|
|
|
|
RewardObjTen = null;
|
|
|
|
SendBackChunk = null;
|
|
|
|
|
|
//ItemInfo
|
|
ItemInfoObject = null;
|
|
ItemInfoDrawS = null;
|
|
|
|
//界面回包
|
|
function TuguanOpenCallBack(Chunk) {
|
|
local Jso = Json.Decode(Chunk);
|
|
if (State == 0) {
|
|
BoxName = Jso.BoxName;
|
|
BoxId = Jso.BoxId;
|
|
BoxNameXpos = Jso.BoxNameXpos;
|
|
BoxNameYpos = Jso.BoxNameYpos;
|
|
BoxCount = Jso.BoxCount;
|
|
ProbabilityTab = Jso.ProbabilityTab;
|
|
State = 1;
|
|
}
|
|
|
|
if (!ItemInfoObject.rawin(BoxId)) {
|
|
local arr = [BoxId];
|
|
local T = {
|
|
op = 20231010,
|
|
realop = 20008668,
|
|
itemId = arr,
|
|
Type = 2,
|
|
}
|
|
SendPack(T);
|
|
}
|
|
|
|
}
|
|
|
|
//抽奖回包
|
|
function TuguanRewardCallBack(Chunk) {
|
|
|
|
local Jso = Json.Decode(Chunk);
|
|
|
|
AniType = Jso.AniType;
|
|
BoxCount = Jso.BoxCount;
|
|
RewardObj = Jso.RewardObj;
|
|
State = 3;
|
|
|
|
local ItemGetArray = {};
|
|
foreach(P, V in RewardObj.ItemBuffer) {
|
|
for (local i = 0; i< 2; i++) {
|
|
local ItemId = V["itemid" + i];
|
|
if (!ItemInfoObject.rawin(ItemId)) {
|
|
if (!ItemGetArray.rawin(ItemId))
|
|
ItemGetArray.rawset(ItemId, true);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if (ItemGetArray.len() > 0) {
|
|
local arr = [];
|
|
foreach(Key, Value in ItemGetArray) {
|
|
arr.append(Key);
|
|
}
|
|
local T = {
|
|
op = 20231010,
|
|
realop = 20008668,
|
|
itemId = arr,
|
|
Type = 2,
|
|
}
|
|
SendPack(T);
|
|
}
|
|
|
|
}
|
|
|
|
function SendCallBackChunk(Chunk) {
|
|
local RootTab = getroottable();
|
|
if (RootTab.rawin("TuguanObj")) {
|
|
local Tobj = RootTab["TuguanObj"];
|
|
Tobj.SendBackChunk = Chunk;
|
|
Tobj.State = 3;
|
|
}
|
|
}
|
|
|
|
function GetItemInfoCallBack(Chunk) {
|
|
local Jso = Json.Decode(Chunk);
|
|
|
|
foreach(Pos, Value in Jso.itemInfo) {
|
|
if (Value.Name2.len() == 0)
|
|
Value.Name2 = "Yosin-Team";
|
|
ItemInfoObject.rawset(Jso.itemId[Pos], Value);
|
|
}
|
|
}
|
|
|
|
constructor() {
|
|
MainEffAniArr = {};
|
|
ItemInfoObject = {};
|
|
|
|
Pack_Control.rawset(20008002, TuguanOpenCallBack.bindenv(this));
|
|
Pack_Control.rawset(20008004, TuguanRewardCallBack.bindenv(this));
|
|
Pack_Control.rawset(20008666, SendCallBackChunk.bindenv(this));
|
|
Pack_Control.rawset(20008668, GetItemInfoCallBack.bindenv(this));
|
|
}
|
|
|
|
//退出
|
|
function Exit() {
|
|
State = 0;
|
|
MainEffAniArr.rawset("P1_01", P1_01);
|
|
MainEffAniArr.rawset("P2_01", P2_01);
|
|
MainEffAniArr.rawset("P3_01", P3_01);
|
|
MainEffAniArr.rawset("P4_02", P4_02);
|
|
ResetRewardMainAni();
|
|
}
|
|
|
|
//打开窗口
|
|
function OpenWindow(obj) {
|
|
//窗口关闭
|
|
if (!sq_GetPopupWindowMainCotrol(267)) {
|
|
L_NewWindows("Lenheart", 267, 0x65535); //打开土罐窗口
|
|
State = 2;
|
|
}
|
|
}
|
|
|
|
//重置特效Ani
|
|
function ResetRewardMainAni() {
|
|
foreach(Pos, value in MainEffAniArr) {
|
|
sq_Rewind(value);
|
|
}
|
|
MainEffAniArr = null;
|
|
MainEffAniArr = {};
|
|
|
|
}
|
|
|
|
//绘制抽奖动画
|
|
function DrawRewardAni(obj) {
|
|
|
|
//停止斗篷风声
|
|
obj.stopSound(2022121701);
|
|
|
|
P1_01 = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/" + AniType + "/" + AniType + "1_01.ani", X + 20, Y + 30, "TuguanSystemDrawReward" + AniType + "1_01");
|
|
//土罐眼睛闪光
|
|
if (P1_01 && sq_GetAnimationFrameIndex(P1_01) == 13) {
|
|
if (AniType == "a" || AniType == "s") obj.sq_PlaySound("DANJIN_START_AS");
|
|
else obj.sq_PlaySound("DANJIN_START_N");
|
|
}
|
|
|
|
if (P1_01 && sq_IsEnd(P1_01)) P2_01 = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/" + AniType + "/" + AniType + "2_01.ani", X + 20, Y + 30, "TuguanSystemDrawReward" + AniType + "2_01");
|
|
if (P2_01 && sq_GetAnimationFrameIndex(P2_01) == 0) {
|
|
if (AniType == "b") obj.sq_PlaySound("DANJIN_SUMMON_B");
|
|
else if (AniType == "a") obj.sq_PlaySound("DANJIN_SUMMON_A");
|
|
else if (AniType == "s") obj.sq_PlaySound("DANJIN_SUMMON_S");
|
|
}
|
|
if (P2_01 && sq_GetAnimationFrameIndex(P2_01) == 8) {
|
|
if (AniType == "b") obj.sq_PlaySound("DANJIN_GAMBLE_B");
|
|
else if (AniType == "a") obj.sq_PlaySound("DANJIN_GAMBLE_A");
|
|
else if (AniType == "s") obj.sq_PlaySound("DANJIN_GAMBLE_S");
|
|
}
|
|
|
|
if (P2_01 && sq_IsEnd(P2_01)) P3_01 = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/" + AniType + "/" + AniType + "3_01.ani", X + 20, Y + 30, "TuguanSystemDrawReward" + AniType + "3_01");
|
|
if (P3_01 && sq_IsEnd(P3_01)) P4_02 = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/" + AniType + "/" + AniType + "4_02.ani", X + 20, Y + 30, "TuguanSystemDrawReward" + AniType + "4_02");
|
|
|
|
if (P4_02 && sq_IsEnd(P4_02)) {
|
|
|
|
MainEffAniArr.rawset("P1_01", P1_01);
|
|
MainEffAniArr.rawset("P2_01", P2_01);
|
|
MainEffAniArr.rawset("P3_01", P3_01);
|
|
MainEffAniArr.rawset("P4_02", P4_02);
|
|
|
|
sq_Rewind(P1_01);
|
|
sq_Rewind(P2_01);
|
|
sq_Rewind(P3_01);
|
|
sq_Rewind(P4_02);
|
|
// ResetRewardMainAni();
|
|
|
|
obj.sq_PlaySound("DANJIN_GAMBLE_FIN");
|
|
|
|
State = 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//绘制奖励列表
|
|
function DrawRewardItem(obj) {
|
|
//单抽
|
|
if (SelectModel == 1) {
|
|
T_DrawStayAni(obj, "common/tuguan/main.ani", X + 20, Y + 30, 5, "TuguanRewardMain");
|
|
L_sq_DrawCode("最后结果", (X - 195) + 377, (Y - 100) + 182, sq_RGBA(255, 177, 0, 250), 1, 1);
|
|
T_DrawStayAni(obj, "common/tuguan/main.ani", X + 20 + 141, Y + 30 + 91, 7, "TuguanRewardMainOneX");
|
|
|
|
for (local z = 0; z< 2; z++) {
|
|
//绘制槽
|
|
T_DrawStayAni(obj, "common/tuguan/main.ani", X + 20 + 141 + 9 + (z * 34), Y + 30 + 91 + 9, 8, "TuguanRewardMainOneXx");
|
|
}
|
|
for (local x = 0; x< 2; x++) {
|
|
//品级背景光
|
|
local Rarity = RewardObj.ItemBuffer[0]["itemrarity" + x];
|
|
switch (Rarity) {
|
|
case 2:
|
|
T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/light_iconslot.ani", X + 20 + 141 + 9 + (x * 34), Y + 30 + 91 + 9, "TuguanRewardMainoieff" + Rarity);
|
|
break;
|
|
case 3:
|
|
T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/light_iconslot_1.ani", X + 20 + 141 + 9 + (x * 34), Y + 30 + 91 + 9, "TuguanRewardMainoieff" + Rarity);
|
|
break;
|
|
}
|
|
}
|
|
|
|
ItemInfoDrawS = null;
|
|
for (local i = 0; i< 2; i++) {
|
|
local ItemId = RewardObj.ItemBuffer[0]["itemid" + i];
|
|
local ItemCount = RewardObj.ItemBuffer[0]["itemcount" + i];
|
|
//绘制物品
|
|
L_Sq_DrawItem(X + 20 + 141 + 9 + (i * 34) + 3, Y + 30 + 91 + 9 + 3, ItemId, ItemCount, 0, 0, 0);
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + 20 + 141 + 9 + (i * 34) + 3, Y + 30 + 91 + 9 + 3, 24, 24)) {
|
|
ItemInfoDrawS = {};
|
|
ItemInfoDrawS.X <- X + 20 + 141 + 9 + (i * 34) + 3;
|
|
ItemInfoDrawS.Y <- Y + 30 + 91 + 9 + 3;
|
|
ItemInfoDrawS.ItemId <- ItemId;
|
|
}
|
|
|
|
//物品刷新光
|
|
local Ani = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/common_excute_icon_front_a.ani", X + 20 + 141 + 13 + (i * 34), Y + 30 + 91 + 12, "TuguanRewardMainoieff" + i);
|
|
MainEffAniArr.rawset("TuguanRewardMainoieff" + i, Ani);
|
|
|
|
//品级闪烁光
|
|
local Rarity = RewardObj.ItemBuffer[0]["itemrarity" + i];
|
|
switch (Rarity) {
|
|
case 2:
|
|
if (ASoundSw == 0) {
|
|
obj.sq_PlaySound("DANJIN_GAMBLE_CLASS_A");
|
|
ASoundSw = 1;
|
|
}
|
|
local RAni = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/iconslot_00.ani", X + 20 + 141 + 13 + (i * 34), Y + 30 + 91 + 12, "TuguanRewardMainoreff" + 2);
|
|
MainEffAniArr.rawset("TuguanRewardMainoreff" + 2, RAni);
|
|
break;
|
|
case 3:
|
|
if (SSoundSw == 0) {
|
|
obj.sq_PlaySound("DANJIN_GAMBLE_FANFARE");
|
|
SSoundSw = 1;
|
|
}
|
|
local RAni = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/iconslot_01.ani", X + 20 + 141 + 13 + (i * 34), Y + 30 + 91 + 12, "TuguanRewardMainoreff" + 3);
|
|
MainEffAniArr.rawset("TuguanRewardMainoreff" + 3, RAni);
|
|
break;
|
|
}
|
|
}
|
|
|
|
L_sq_DrawCode("祝你发大财!", (X - 195) + 371, (Y - 100) + 320, sq_RGBA(255, 177, 0, 250), 1, 1);
|
|
}
|
|
//10连抽
|
|
else if (SelectModel == 10) {
|
|
T_DrawStayAni(obj, "common/tuguan/main.ani", X + 20, Y + 30, 6, "TuguanRewardMainT");
|
|
L_sq_DrawCode("最后结果", (X - 195) + 377, (Y - 100) + 142, sq_RGBA(255, 177, 0, 250), 1, 1);
|
|
//T_DrawStayAni(obj, "common/tuguan/main.ani", X + 20 + 141, Y + 30 + 91, 7, "TuguanRewardMainTenX");
|
|
ItemInfoDrawS = null;
|
|
for (local i = 0; i< 10; i++) {
|
|
local ofs = i;
|
|
if (i > 7) ofs += 1;
|
|
T_DrawStayAni(obj, "common/tuguan/main.ani", (X - 195) + 198 + 30 + ((ofs % 4) * 86), Y + 62 + ((ofs / 4) * 50), 7, "TuguanRewardMainTenX");
|
|
|
|
for (local y = 0; y< 2; y++) {
|
|
//绘制槽
|
|
T_DrawStayAni(obj, "common/tuguan/main.ani", (X - 195) + 198 + 30 + 9 + ((ofs % 4) * 86) + (y * 34), Y + 62 + 9 + ((ofs / 4) * 50), 8, "TuguanRewardMainOneXx");
|
|
}
|
|
|
|
for (local x = 0; x< 2; x++) {
|
|
//品级背景光
|
|
local Rarity = RewardObj.ItemBuffer[i]["itemrarity" + x];
|
|
switch (Rarity) {
|
|
case 2:
|
|
T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/light_iconslot.ani", (X - 195) + 198 + 30 + 10 + ((ofs % 4) * 86) + (x * 34), Y + 62 + 10 + ((ofs / 4) * 50), "TuguanRewardMainoieff" + Rarity);
|
|
break;
|
|
case 3:
|
|
T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/light_iconslot_1.ani", (X - 195) + 198 + 30 + 10 + ((ofs % 4) * 86) + (x * 34), Y + 62 + 10 + ((ofs / 4) * 50), "TuguanRewardMainoieff" + Rarity);
|
|
break;
|
|
}
|
|
}
|
|
|
|
for (local z = 0; z< 2; z++) {
|
|
local ItemId = RewardObj.ItemBuffer[i]["itemid" + z];
|
|
local ItemCount = RewardObj.ItemBuffer[i]["itemcount" + z];
|
|
//绘制物品
|
|
L_Sq_DrawItem((X - 195) + 198 + 30 + 9 + ((ofs % 4) * 86) + (z * 34) + 3, Y + 62 + 9 + ((ofs / 4) * 50) + 3, ItemId, ItemCount, 0, 0, 0);
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, (X - 195) + 198 + 30 + 9 + ((ofs % 4) * 86) + (z * 34) + 3, Y + 62 + 9 + ((ofs / 4) * 50) + 3, 24, 24)) {
|
|
ItemInfoDrawS = {};
|
|
ItemInfoDrawS.X <- (X - 195) + 198 + 30 + 9 + ((ofs % 4) * 86) + (z * 34) + 3;
|
|
ItemInfoDrawS.Y <- Y + 62 + 9 + ((ofs / 4) * 50) + 3;
|
|
ItemInfoDrawS.ItemId <- ItemId;
|
|
}
|
|
|
|
//物品刷新光
|
|
local Ani = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/common_excute_icon_front_a.ani", (X - 195) + 198 + 30 + 13 + ((ofs % 4) * 86) + (z * 34), Y + 62 + 12 + ((ofs / 4) * 50), "TuguanRewardMainoieff" + z);
|
|
MainEffAniArr.rawset("TuguanRewardMainoieff" + z, Ani);
|
|
|
|
//品级闪烁光
|
|
local Rarity = RewardObj.ItemBuffer[i]["itemrarity" + z];
|
|
switch (Rarity) {
|
|
case 2:
|
|
if (ASoundSw == 0) {
|
|
obj.sq_PlaySound("DANJIN_GAMBLE_CLASS_A");
|
|
ASoundSw = 1;
|
|
}
|
|
local RAni = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/iconslot_00.ani", (X - 195) + 198 + 30 + 13 + ((ofs % 4) * 86) + (z * 34), Y + 62 + 12 + ((ofs / 4) * 50), "TuguanRewardMainoreff" + 2);
|
|
MainEffAniArr.rawset("TuguanRewardMainoreff" + 2, RAni);
|
|
break;
|
|
case 3:
|
|
if (SSoundSw == 0) {
|
|
obj.sq_PlaySound("DANJIN_GAMBLE_FANFARE");
|
|
SSoundSw = 1;
|
|
}
|
|
local RAni = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/iconslot_01.ani", (X - 195) + 198 + 30 + 13 + ((ofs % 4) * 86) + (z * 34), Y + 62 + 12 + ((ofs / 4) * 50), "TuguanRewardMainoreff" + 3);
|
|
MainEffAniArr.rawset("TuguanRewardMainoreff" + 3, RAni);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
L_sq_DrawCode("祝你发大财!", (X - 195) + 371, (Y - 100) + 336, sq_RGBA(255, 177, 0, 250), 1, 1);
|
|
}
|
|
MainEffAni = T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/background_excute_front_supreme.ani", X + 20, Y + 30, "TuguanSystemDrawRewardMainAniL");
|
|
MainEffAniArr.rawset("TuguanSystemDrawRewardMainAniL", MainEffAni);
|
|
}
|
|
|
|
//播放主界面音效
|
|
function PlayMainSounds(obj) {
|
|
if (State == 2 && MainSoundsSw == 0) {
|
|
obj.sq_PlaySound("DANJIN_START_LOOP", 2022121701);
|
|
MainSoundsSw = 1;
|
|
}
|
|
if (State != 2 && State != 3) {
|
|
obj.stopSound(2022121701);
|
|
MainSoundsSw = 0;
|
|
}
|
|
if (State != 4) {
|
|
SSoundSw = 0;
|
|
ASoundSw = 0;
|
|
}
|
|
}
|
|
|
|
//绘制主界面
|
|
function DrawMain(obj) {
|
|
//窗口
|
|
T_DrawStayAni(obj, "common/tuguan/main.ani", X, Y, 0, "TuguanSystemMain");
|
|
//标题
|
|
L_sq_DrawCode(BoxName, X + BoxNameXpos, Y + BoxNameYpos, sq_RGBA(230, 200, 155, 250), 1, 1);
|
|
//动画
|
|
if (State == 2) T_DrawDynamicAni(obj, "common/tuguan/0510_danjinjar/lobby/lobby_wait_rank_1step_1_step_common_0510_danjin_body.ani", X + 20, Y + 30, "TuguanSystemMainbackgroundeff");
|
|
//抽奖动画
|
|
if (State == 3) {
|
|
|
|
DrawRewardAni(obj);
|
|
|
|
}
|
|
//奖励列表
|
|
if (State == 4) {
|
|
DrawRewardItem(obj);
|
|
if (SendBackChunk) {
|
|
L_sq_SendPackType(130);
|
|
L_sq_SendPackWChar(SendBackChunk);
|
|
L_sq_SendPack();
|
|
SendBackChunk = null;
|
|
}
|
|
}
|
|
//遮罩
|
|
T_DrawStayAni(obj, "common/tuguan/main.ani", X + 17, Y + 26, 1, "TuguanSystemMainbackgroundblack");
|
|
//图标框
|
|
T_DrawStayAni(obj, "common/tuguan/main.ani", X + 187, Y + 26 + 250, 3, "TuguanSystemMainbackgrounditem");
|
|
//盒子数量
|
|
L_Sq_DrawItem(X + 187 + 3, Y + 26 + 250 + 3, BoxId, BoxCount, 0, 0, 0);
|
|
if (State == 2) ItemInfoDrawS = null;
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + 187 + 3, Y + 26 + 250, 24, 24)) {
|
|
ItemInfoDrawS = {};
|
|
ItemInfoDrawS.X <- X + 187 + 3;
|
|
ItemInfoDrawS.Y <- Y + 26 + 250;
|
|
ItemInfoDrawS.ItemId <- BoxId;
|
|
}
|
|
|
|
//绘制模式字体
|
|
L_sq_DrawCode("开启1个", X + 90, Y + 287, sq_RGBA(230, 200, 155, 250), 0, 1);
|
|
L_sq_DrawCode("开启10个", X + 90 + 200, Y + 287, sq_RGBA(230, 200, 155, 250), 0, 1);
|
|
|
|
|
|
//单抽按钮
|
|
local OneButton = TuguanButton(obj, "TuguanOneButton", IMouse, X + 68, Y + 286, 72, 20, "common/tuguan/db_newani_sel");
|
|
OneButton.drawButtonImage();
|
|
if (OneButton.isActive() && (State == 2 || State == 4)) //单抽按钮按下
|
|
{
|
|
SelectModel = 1;
|
|
State = 2;
|
|
}
|
|
|
|
//单抽按钮
|
|
local TenButton = TuguanButton(obj, "TuguanTenButton", IMouse, X + 68 + 201, Y + 286, 72, 20, "common/tuguan/db_newani_sel");
|
|
TenButton.drawButtonImage();
|
|
if (TenButton.isActive() && (State == 2 || State == 4)) //单抽按钮按下
|
|
{
|
|
SelectModel = 10;
|
|
State = 2;
|
|
}
|
|
|
|
if (SelectModel != 0) {
|
|
local Box_Statu_Button_Offset = 0;
|
|
if (SelectModel == 10) Box_Statu_Button_Offset = 201;
|
|
T_DrawStayAni(obj, "common/tuguan/db_newani_sel_3.ani", X + 68 + Box_Statu_Button_Offset, Y + 286, 0, "TuguanSelectModelp");
|
|
T_DrawStayAni(obj, "common/tuguan/main.ani", X + 68 + Box_Statu_Button_Offset - 41, Y + 286 - 6, 4, "TuguanSystemMainbackgrounditem");
|
|
}
|
|
|
|
local ProbabilityButton = TuguanTextButton(obj, IMouse, X + 68 - 46, Y + 286 + 40, 62, 18, "※查看概率", sq_RGBA(230, 200, 155, 150), sq_RGBA(230, 200, 155, 250), 1, 1);
|
|
ProbabilityButton.draw();
|
|
if (ProbabilityButton.isActive()) {
|
|
L_Cmd(ProbabilityTab);
|
|
}
|
|
|
|
local doselectbutton = TuguanButton(obj, "Tuguandoselectbutton", IMouse, X + 68 + 98, Y + 347, 72, 20, "common/tuguan/open");
|
|
doselectbutton.drawButtonImage();
|
|
if (doselectbutton.isActive()) {
|
|
if (SelectModel != 0 && (State == 2 || State == 4)) {
|
|
//抽奖包
|
|
local TuguanDoselectPack = Json_STL("TuguanDoselectPack");
|
|
TuguanDoselectPack.Put("op", 20008003);
|
|
TuguanDoselectPack.Put("doselect", SelectModel);
|
|
TuguanDoselectPack.Put("itemindex", BoxId);
|
|
local str = TuguanDoselectPack.GetString();
|
|
L_sq_SendPackType(130);
|
|
L_sq_SendPackWChar(str);
|
|
L_sq_SendPack();
|
|
TuguanDoselectPack.Delete();
|
|
} else if (State == 3) {
|
|
MainEffAniArr.rawset("P1_01", P1_01);
|
|
MainEffAniArr.rawset("P2_01", P2_01);
|
|
MainEffAniArr.rawset("P3_01", P3_01);
|
|
MainEffAniArr.rawset("P4_02", P4_02);
|
|
ResetRewardMainAni();
|
|
State = 4;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
ItemObject = null;
|
|
|
|
function DrawItemInfo(obj) {
|
|
if (ItemInfoDrawS) {
|
|
if (!ItemInfoObject.rawin(ItemInfoDrawS.ItemId)) return;
|
|
if (!ItemObject) {
|
|
local ItemId = ItemInfoDrawS.ItemId;
|
|
ItemObject = ItemInfoClass(ItemInfoObject[ItemId]);
|
|
}
|
|
ItemObject.Show(ItemInfoDrawS.X, ItemInfoDrawS.Y - ItemObject.PageLength);
|
|
} else {
|
|
ItemObject = null;
|
|
}
|
|
}
|
|
|
|
|
|
function DrawAMain(obj) {
|
|
//如果是打开状态
|
|
if (State >= 2) {
|
|
//窗口被关闭类状态写回未开启
|
|
if (KeyPressNB.isKeyPress(48, "TuguanFucCloseKey")) {
|
|
MainState = false;
|
|
Exit();
|
|
}
|
|
//播放主界面音效
|
|
PlayMainSounds(obj);
|
|
//绘制主界面
|
|
DrawMain(obj);
|
|
//绘制道具信息
|
|
DrawItemInfo(obj);
|
|
}
|
|
}
|
|
|
|
X = 195;
|
|
Y = 100;
|
|
MainState = false;
|
|
WindowObj = null;
|
|
//运行主函数
|
|
function Run(obj) {
|
|
if (State == 1) {
|
|
MainState = true;
|
|
State = 2;
|
|
}
|
|
|
|
if (MainState) {
|
|
if (WindowObj) {
|
|
|
|
DrawAMain(obj);
|
|
WindowObj.Show(obj);
|
|
X = WindowObj.X;
|
|
Y = WindowObj.Y;
|
|
} else {
|
|
WindowObj = LenheartWindow(X, Y, 405, 372, 28); //坐标 大小 标题栏高度
|
|
// WindowObj.DeBugMode = true;
|
|
|
|
L_NewWindows("Lenheart", 170, 0x65535);
|
|
local W = sq_GetPopupWindowMainCotrol(170);
|
|
W.SetVisible(false);
|
|
W.SetEnable(false);
|
|
}
|
|
} else {
|
|
if (WindowObj && WindowObj.YMouseSw == false) {
|
|
IMouse.ReleaseMouseClick();
|
|
WindowObj.YMouseSw = true;
|
|
WindowObj = null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
function TuguanFuc(obj) {
|
|
local RootTab = getroottable();
|
|
if (sq_GetCurrentModuleType() == 1) {
|
|
if (!RootTab.rawin("TuguanObj")) {
|
|
local Cobj = TuguanSystem();
|
|
RootTab.rawset("TuguanObj", Cobj);
|
|
} else {
|
|
RootTab["TuguanObj"].Run(obj);
|
|
}
|
|
} else {
|
|
if (RootTab.rawin("TuguanObj")) {
|
|
RootTab.rawdelete("TuguanObj");
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if (getroottable().rawin("LenheartFuncTab")) {
|
|
getroottable()["LenheartFuncTab"].rawset("TuguanFucFunc", TuguanFuc);
|
|
} else {
|
|
local T = {};
|
|
T.rawset("TuguanFucFunc", TuguanFuc);
|
|
getroottable().rawset("LenheartFuncTab", T);
|
|
} |