1415 lines
52 KiB
Plaintext
1415 lines
52 KiB
Plaintext
/*
|
|
文件名:HorseGuessing.nut
|
|
路径:Plugins/HorseGuessing/HorseGuessing.nut
|
|
创建日期:2023-10-02 14:19
|
|
文件用途:
|
|
*/
|
|
|
|
//TabTextButtonPro按钮类
|
|
class HorseGuessingTabTextButtonPro 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; //鼠标对象
|
|
|
|
ex = 0;
|
|
ey = 0;
|
|
|
|
//构造函数
|
|
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) //按下左键并且按钮处于弹起状态
|
|
{
|
|
// T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName);
|
|
L_sq_DrawImg(CustomClickAnifile, CustomClickFrame, CustomClickx + ex, CustomClicky + ey);
|
|
}
|
|
}
|
|
|
|
if (RectEnble && SwitchState == false) //开启悬停效果时
|
|
{
|
|
if ((isInRect()) || (isInRect() && !CustomClickEnble)) //如果鼠标悬停的时候 并且没有点击的时候
|
|
{
|
|
//IMouse.SetMouseTask(44);
|
|
// T_DrawStayAni(obj, RectBaseAnifile, Rectx, Recty, RectFrame, RectButtonName);
|
|
L_sq_DrawImg(RectBaseAnifile, RectFrame, Rectx + ex, Recty + ey);
|
|
}
|
|
}
|
|
|
|
if (!isInRect() && !SwitchState) //如果鼠标没有悬停的时候
|
|
{
|
|
//IMouse.SetMouseTask(0);
|
|
// T_DrawStayAni(obj, BaseAnifile, x, y, BaseAnifileFrame, ButtonName);
|
|
L_sq_DrawImg(BaseAnifile, BaseAnifileFrame, x + ex, y + ey);
|
|
}
|
|
|
|
if (SwitchState) {
|
|
// T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName);
|
|
L_sq_DrawImg(CustomClickAnifile, CustomClickFrame, CustomClickx + ex, CustomClicky + ey);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
//设置自定义点击效果
|
|
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 + ex, y + ey, 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;
|
|
}
|
|
}
|
|
|
|
//HudPro按钮类
|
|
class HorseGuessingPro 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; //鼠标对象
|
|
|
|
Overturn = false; //翻转
|
|
|
|
|
|
//构造函数
|
|
constructor(gButtonName, gX, gY, gAnifile, gWidth, gLength, gBaseFrame) {
|
|
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;
|
|
}
|
|
}
|
|
|
|
local Xr = 1.0
|
|
local Xoffset = 0;
|
|
|
|
if (Overturn) {
|
|
Xr = -1.0;
|
|
Xoffset = width;
|
|
}
|
|
//L_sq_DrawImg("common/etc/combo.img", 0, 100, 100, 0, sq_RGBA(255, 255, 255, 250), 1.0, 1.0);
|
|
|
|
if (CustomClickEnble) //是否开启自定义点击效果
|
|
{
|
|
if (isLBDown()) //按下左键并且按钮处于弹起状态
|
|
{
|
|
if (!ButtonDynamic) L_sq_DrawImg(CustomClickAnifile, CustomClickFrame, CustomClickx + Xoffset, CustomClicky, 0, sq_RGBA(255, 255, 255, 250), Xr, 1.0);
|
|
else T_DrawDynamicAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomButtonName);
|
|
}
|
|
}
|
|
|
|
if (RectEnble) //开启悬停效果时
|
|
{
|
|
if ((isInRect() && !isLBDown()) || (isInRect() && !CustomClickEnble)) //如果鼠标悬停的时候 并且没有点击的时候
|
|
{
|
|
//IMouse.SetMouseTask(44);
|
|
if (!ButtonDynamic) L_sq_DrawImg(RectBaseAnifile, RectFrame, Rectx + Xoffset, Recty, 0, sq_RGBA(255, 255, 255, 250), Xr, 1.0);
|
|
else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName);
|
|
}
|
|
}
|
|
if (!isInRect()) //如果鼠标没有悬停的时候
|
|
{
|
|
//IMouse.SetMouseTask(0);
|
|
if (!ButtonDynamic) L_sq_DrawImg(BaseAnifile, BaseFrame, x + Xoffset, y, 0, sq_RGBA(255, 255, 255, 250), Xr, 1.0);
|
|
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;
|
|
}
|
|
}
|
|
|
|
class HorseGuessingWindow 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;
|
|
L_sq_WA(0x1b46898, 1);
|
|
} else {
|
|
if (YMouseSw == false && sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 0, 0, 800, 600)) {
|
|
IMouse.ReleaseMouseClick();
|
|
YMouseSw = true;
|
|
L_sq_WA(0x1b46898, 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
//设定窗口拖动逻辑
|
|
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 HorseGuessingC extends BasicsDrawTool {
|
|
|
|
Mobj = null; //鼠标对象
|
|
|
|
CompetitionState = null; //比赛状态
|
|
CompetitionStartAnimotion = null;
|
|
NotiState = false; //公告状态
|
|
NotiStr = null; //公告内容
|
|
NotiTime = null; //公告时间
|
|
|
|
ResidueCoin = 10000;
|
|
|
|
WindowObj = null; //窗口对象
|
|
MainState = false; //主状态
|
|
X = 13;
|
|
Y = 10;
|
|
|
|
//当前选择骑手资料
|
|
NowSelectRider = 0;
|
|
//投注道具
|
|
ItemId = null;
|
|
ItemInfo = null;
|
|
ItemObject = null;
|
|
ItemDrawState = false;
|
|
//骑手名称
|
|
RiderName = [
|
|
"伊撒尔",
|
|
"理查德",
|
|
"席恩",
|
|
"吉尔特",
|
|
"爱德华",
|
|
"罗兰",
|
|
"莱奥",
|
|
"贝奥武夫",
|
|
];
|
|
//InfoType
|
|
InfoType = 1;
|
|
//InfoTabButton
|
|
InfoTabButton1 = null;
|
|
InfoTabButton2 = null;
|
|
InfoTabButton3 = null;
|
|
//InfoContestLog
|
|
InfoContestLog = null;
|
|
|
|
|
|
Rider8T = null;
|
|
Rider4T = null;
|
|
Rider2T = null;
|
|
Rider1T = null;
|
|
|
|
RiderInfo = null;
|
|
|
|
RankInfo = null;
|
|
|
|
|
|
//获取基础配置包
|
|
function GetBaseInfo() {
|
|
local T = {
|
|
op = 20055079
|
|
};
|
|
SendPack(T);
|
|
}
|
|
|
|
//获取基础道具信息
|
|
function GetItemInfo() {
|
|
local T = {
|
|
realop = 20055200,
|
|
op = 2023100901,
|
|
ItemId = this.ItemId
|
|
};
|
|
SendPack(T);
|
|
}
|
|
|
|
//获取基础道具信息包回调
|
|
function GetItemInfoCallBack(Chunk) {
|
|
// Sout("收到包内容: %L", Chunk);
|
|
local Jso = Json.Decode(Chunk);
|
|
|
|
ItemInfo = Jso.item;
|
|
}
|
|
|
|
//获取基础配置包回调
|
|
function GetBaseInfoCallBack(Chunk) {
|
|
// Sout("收到包内容: %L", Chunk);
|
|
local Jso = Json.Decode(Chunk);
|
|
ItemId = Jso.itemId;
|
|
ItemInfo = Jso.itemInfo[0];
|
|
ItemInfo.Name2 = "Yosin-Team";
|
|
|
|
for (local i = 0; i< Jso.nameS.len(); i++) {
|
|
local NameBuf = Jso.nameS[i];
|
|
if (i == 0) {
|
|
RiderName = [];
|
|
}
|
|
RiderName.append(NameBuf);
|
|
}
|
|
}
|
|
|
|
//获取信息包
|
|
function GetInfo() {
|
|
local T = {
|
|
op = 20055001
|
|
};
|
|
SendPack(T);
|
|
}
|
|
|
|
//获取信息包回调
|
|
function GetInfoCallBack(Chunk) {
|
|
// Sout("收到包内容: %L", Chunk);
|
|
|
|
local Jso = Json.Decode(Chunk);
|
|
if (Jso.Rank.len() == 0) return;
|
|
|
|
ResidueCoin = Jso.ResidueCoin;
|
|
//同步状态
|
|
CompetitionState = Jso.state;
|
|
//获取8位
|
|
for (local i = 0; i< Jso.Rank.Top8.len(); i++) {
|
|
//获取赔率
|
|
local gOdds = Jso.Rank.Top8[i].SOdds;
|
|
local gcodeItem = Jso.codeItem[i];
|
|
|
|
if (i == 0) {
|
|
if (Rider8T == null);
|
|
Rider8T = [];
|
|
}
|
|
|
|
local T;
|
|
if (i< Rider8T.len()) {
|
|
T = Rider8T[i];
|
|
T.Odds <- gOdds;
|
|
T.CodeItem <- gcodeItem;
|
|
} else {
|
|
T = {
|
|
Odds = gOdds,
|
|
CodeItem = gcodeItem,
|
|
};
|
|
Rider8T.append(T);
|
|
}
|
|
}
|
|
|
|
//获取4位
|
|
for (local i = 0; i< Jso.Rank.Top4.len(); i++) {
|
|
//获取骑手信息
|
|
local gCode = Jso.Rank.Top4[i].code;
|
|
|
|
if (i == 0) {
|
|
if (Rider4T == null);
|
|
Rider4T = [];
|
|
}
|
|
|
|
local T;
|
|
if (i< Rider4T.len()) {
|
|
T = Rider4T[i];
|
|
T.Code <- gCode;
|
|
} else {
|
|
T = {
|
|
Code = gCode,
|
|
};
|
|
Rider4T.append(T);
|
|
}
|
|
}
|
|
|
|
//获取2位
|
|
for (local i = 0; i< Jso.Rank.Top2.len(); i++) {
|
|
//获取骑手信息
|
|
local gCode = Jso.Rank.Top2[i].code;
|
|
if (i == 0) {
|
|
if (Rider2T == null);
|
|
Rider2T = [];
|
|
}
|
|
|
|
local T;
|
|
if (i< Rider2T.len()) {
|
|
T = Rider2T[i];
|
|
T.Code <- gCode;
|
|
} else {
|
|
T = {
|
|
Code = gCode,
|
|
};
|
|
Rider2T.append(T);
|
|
}
|
|
}
|
|
|
|
//获取1位
|
|
for (local i = 0; i< Jso.Rank.Top1.len(); i++) {
|
|
//获取骑手信息
|
|
local gCode = Jso.Rank.Top1[i].code;
|
|
|
|
if (i == 0) {
|
|
if (Rider1T == null);
|
|
Rider1T = [];
|
|
}
|
|
|
|
local T;
|
|
if (i< Rider1T.len()) {
|
|
T = Rider1T[i];
|
|
T.Code <- gCode;
|
|
} else {
|
|
T = {
|
|
Code = gCode,
|
|
};
|
|
Rider1T.append(T);
|
|
}
|
|
}
|
|
}
|
|
|
|
//获取选手具体信息
|
|
function GetRiderInfo() {
|
|
local T = {
|
|
op = 20055003,
|
|
code = NowSelectRider,
|
|
}
|
|
SendPack(T);
|
|
}
|
|
|
|
//获取选手具体信息回调包
|
|
function GetRiderInfoCallBack(Chunk) {
|
|
// Sout("收到包内容: %L", Chunk);
|
|
|
|
local Jso = Json.Decode(Chunk);
|
|
|
|
RiderInfo = [];
|
|
for (local i = 0; i< Jso.outcome.len(); i++) {
|
|
RiderInfo.append(Jso.outcome[i]);
|
|
}
|
|
}
|
|
|
|
//获取过往战绩
|
|
function GetPastInfo() {
|
|
local T = {
|
|
op = 20055009,
|
|
}
|
|
SendPack(T);
|
|
}
|
|
|
|
//获取过往战绩回调包
|
|
function GetPastInfoCallBack(Chunk) {
|
|
// Sout("收到包内容: %L", Chunk);
|
|
|
|
local Jso = Json.Decode(Chunk);
|
|
|
|
InfoContestLog = [];
|
|
for (local i = 0; i< Jso.knights.len(); i++) {
|
|
local gPeriods = Jso.knights[i].Periods;
|
|
if (gPeriods == false) break;
|
|
local gWinner = Jso.knights[i].code;
|
|
local gRate = Jso.knights[i].SOdds;
|
|
local T = {
|
|
Periods = gPeriods,
|
|
Winner = gWinner,
|
|
Rate = gRate
|
|
}
|
|
InfoContestLog.append(T);
|
|
}
|
|
}
|
|
|
|
//战斗开始包
|
|
function FightStartCallBack(Chunk) {
|
|
local Jso = Json.Decode(Chunk);
|
|
CompetitionState = Jso.state;
|
|
}
|
|
|
|
|
|
//战斗状态包
|
|
function RefreshFightStateCallback(Chunk) {
|
|
|
|
local Jso = Json.Decode(Chunk);
|
|
if (!MainState) return;
|
|
|
|
CompetitionState = Jso.state;
|
|
|
|
if (Rider8T) {
|
|
//获取8位
|
|
for (local i = 0; i< Jso.Rank.Top8.len(); i++) {
|
|
//获取编号
|
|
local gHp = Jso.Rank.Top8[i].hp;
|
|
local T = Rider8T[i];
|
|
T.rawset("hp", gHp);
|
|
}
|
|
}
|
|
|
|
|
|
if (Rider4T) {
|
|
//获取4位
|
|
for (local i = 0; i< Jso.Rank.Top4.len(); i++) {
|
|
//获取编号
|
|
local gHp = Jso.Rank.Top4[i].hp;
|
|
local T = Rider4T[i];
|
|
T.rawset("hp", gHp);
|
|
}
|
|
}
|
|
|
|
|
|
if (Rider2T) {
|
|
//获取2位
|
|
for (local i = 0; i< Jso.Rank.Top2.len(); i++) {
|
|
//获取编号
|
|
local gHp = Jso.Rank.Top2[i].hp;
|
|
local T = Rider2T[i];
|
|
T.rawset("hp", gHp);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//玩家获取包刷新回调
|
|
function UserRefreshCallBack(Chunk) {
|
|
GetInfo();
|
|
}
|
|
|
|
//获胜者公告包
|
|
function WinnerRefreshCallBack(Chunk) {
|
|
local Jso = Json.Decode(Chunk);
|
|
|
|
NotiState = true; //公告状态
|
|
NotiStr = Jso.Str; //公告内容
|
|
NotiTime = Clock();
|
|
}
|
|
|
|
//排行榜信息包
|
|
function WinnerRankCallBack(Chunk) {
|
|
|
|
local Jso = Json.Decode(Chunk);
|
|
RankInfo = Jso.RankInfo;
|
|
}
|
|
|
|
HookInputState = false;
|
|
InputValue = null;
|
|
//Hook输入
|
|
function HookInput(Code) {
|
|
if (Code >= 96 && Code <= 105) {
|
|
Code -= 96;
|
|
} else if (Code >= 48 && Code <= 57) {
|
|
Code -= 48;
|
|
} else return;
|
|
|
|
if (InputValue == null) InputValue = Code.tostring();
|
|
else InputValue += Code.tostring();
|
|
if (InputValue.tointeger() > ResidueCoin) InputValue = ResidueCoin.tostring();
|
|
}
|
|
|
|
constructor() {
|
|
if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
|
|
|
|
//获取信息包回调
|
|
// Pack_Control.rawset(20055080, GetItemInfoCallBack.bindenv(this));
|
|
|
|
Pack_Control.rawset(20055002, GetInfoCallBack.bindenv(this));
|
|
|
|
Pack_Control.rawset(20055004, GetRiderInfoCallBack.bindenv(this));
|
|
|
|
Pack_Control.rawset(20055010, GetPastInfoCallBack.bindenv(this));
|
|
|
|
Pack_Control.rawset(20055012, RefreshFightStateCallback.bindenv(this));
|
|
|
|
Pack_Control.rawset(20055080, GetBaseInfoCallBack.bindenv(this));
|
|
|
|
Pack_Control.rawset(20055020, FightStartCallBack.bindenv(this));
|
|
|
|
Pack_Control.rawset(20055066, UserRefreshCallBack.bindenv(this));
|
|
|
|
Pack_Control.rawset(20055078, WinnerRefreshCallBack.bindenv(this));
|
|
|
|
Pack_Control.rawset(20055088, WinnerRankCallBack.bindenv(this));
|
|
}
|
|
|
|
|
|
function DrawInfo(obj) {
|
|
|
|
if (!InfoTabButton1) {
|
|
InfoTabButton1 = HorseGuessingTabTextButtonPro(obj, "骑士马战指引Tab", 5, 24, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 27, 63, 19, "", 8, 5);
|
|
InfoTabButton1.SwitchState = true;
|
|
InfoTabButton1.SetRectEnble(true, "a骑士马战指引Tab", 5, 24 + 1, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 30);
|
|
InfoTabButton1.SetCustomClickEnble(true, "a骑士马战指引Tab", 5, 24, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 30);
|
|
}
|
|
InfoTabButton1.ex = X;
|
|
InfoTabButton1.ey = Y;
|
|
InfoTabButton1.Show();
|
|
if (!InfoTabButton2) {
|
|
InfoTabButton2 = HorseGuessingTabTextButtonPro(obj, "骑士马战骑士资料Tab", 5 + 63, 24, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 28, 63, 19, "", 8, 5);
|
|
InfoTabButton2.SwitchState = false;
|
|
InfoTabButton2.SetRectEnble(true, "a骑士马战骑士资料Tab", 5 + 63, 24 + 1, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 31);
|
|
InfoTabButton2.SetCustomClickEnble(true, "a骑士马战骑士资料Tab", 5 + 63, 24, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 31);
|
|
}
|
|
InfoTabButton2.ex = X;
|
|
InfoTabButton2.ey = Y;
|
|
InfoTabButton2.Show();
|
|
if (!InfoTabButton3) {
|
|
InfoTabButton3 = HorseGuessingTabTextButtonPro(obj, "骑士马战过往战绩Tab", 5 + 63 + 63, 24, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 29, 63, 19, "", 8, 5);
|
|
InfoTabButton3.SwitchState = false;
|
|
InfoTabButton3.SetRectEnble(true, "a骑士马战过往战绩Tab", 5 + 63 + 63, 24 + 1, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 32);
|
|
InfoTabButton3.SetCustomClickEnble(true, "a骑士马战过往战绩Tab", 5 + 63 + 63, 24, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 32);
|
|
}
|
|
InfoTabButton3.ex = X;
|
|
InfoTabButton3.ey = Y;
|
|
InfoTabButton3.Show();
|
|
|
|
if (InfoTabButton1.isLBActive()) {
|
|
InfoTabButton1.SwitchState = true;
|
|
InfoTabButton2.SwitchState = false;
|
|
InfoTabButton3.SwitchState = false;
|
|
InfoType = 0;
|
|
}
|
|
if (InfoTabButton2.isLBActive()) {
|
|
InfoTabButton1.SwitchState = false;
|
|
InfoTabButton2.SwitchState = true;
|
|
InfoTabButton3.SwitchState = false;
|
|
InfoType = 1;
|
|
}
|
|
if (InfoTabButton3.isLBActive()) {
|
|
InfoTabButton1.SwitchState = false;
|
|
InfoTabButton2.SwitchState = false;
|
|
InfoTabButton3.SwitchState = true;
|
|
InfoType = 2;
|
|
}
|
|
|
|
|
|
//指引页
|
|
if (InfoType == 0) {
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 0, X + 10, Y + 36 + 18);
|
|
}
|
|
|
|
//骑士资料页
|
|
if (InfoType == 1) {
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 1, X + 10, Y + 36 + 18);
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 50, X + 17, Y + 48 + 18);
|
|
|
|
//DrawRiderInfo
|
|
T_DrawDynamicAni(obj, "common/horseguessing/knight" + NowSelectRider + ".ani", X + 12, Y + 166 + 18, "HorseGuessingRiderAnimotion" + NowSelectRider);
|
|
T_DrawDynamicAni(obj, "common/horseguessing/knightinfoeffect.ani", X + 9, Y + 45, "HorseGuessingRiderAnimotionEff");
|
|
|
|
L_sq_DrawCode(RiderName[NowSelectRider], X + 12 + 80 + 14, Y + 166 + 18 + 146 + 7, sq_RGBA(255, 255, 255, 250), 0, 1);
|
|
|
|
|
|
//DrawItem
|
|
if (ItemId && ItemInfo) {
|
|
L_Sq_DrawItem(X + 84, Y + 374, ItemId, 1, 0, 0, 0);
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X + 84, Y + 374, 24, 24)) {
|
|
ItemDrawState = true;
|
|
} else {
|
|
ItemDrawState = false;
|
|
}
|
|
}
|
|
// ItemId
|
|
|
|
|
|
|
|
|
|
|
|
//DrawInvestButton
|
|
local Button = HorseGuessingPro("骑士马战投出支援按钮", X + 54, Y + 477 + 18, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 129, 33, 22);
|
|
Button.SetRectEnble(true, "骑士马战投出支援按钮", X + 54, Y + 477 + 18, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 23);
|
|
Button.SetCustomClickEnble(true, "骑士马战投出支援按钮", X + 54, Y + 477 + 18, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 24);
|
|
Button.Show();
|
|
if (Button.isLBActive()) {
|
|
if (InputValue) {
|
|
local T = {
|
|
op = 20055005,
|
|
code = NowSelectRider,
|
|
num = InputValue.tointeger(),
|
|
}
|
|
SendPack(T);
|
|
}
|
|
|
|
ErasesInputHook("HorseGuessingInput");
|
|
HookInputState = false;
|
|
InputValue = null;
|
|
}
|
|
|
|
//骑手胜率信息
|
|
if (RiderInfo && RiderInfo.len() >= 5) {
|
|
|
|
L_sq_DrawCode("获胜 : " + RiderInfo[2] + "次", X + 25 + 5, Y + 56 + 17, sq_RGBA(255, 255, 255, 250), 0, 1);
|
|
L_sq_DrawCode(RiderInfo[0] + "胜" + RiderInfo[1] + "败", X + 25 + 5, Y + 56 + 17 + 19, sq_RGBA(255, 255, 255, 250), 0, 1);
|
|
local WinRate = 0;
|
|
if (RiderInfo[0] + RiderInfo[1] != 0)
|
|
WinRate = ((RiderInfo[0].tofloat() / (RiderInfo[0] + RiderInfo[1]).tofloat()) * 100.0).tointeger();
|
|
L_sq_DrawCode("胜率 : " + WinRate + "%", X + 25 + 5, Y + 56 + 17 + 19 + 15, sq_RGBA(255, 255, 255, 250), 0, 1);
|
|
|
|
if (RiderInfo[3] != 0 && RiderInfo[4] != 0) {
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", RiderInfo[3], X + 25 + 5 + 152, Y + 62);
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", RiderInfo[4], X + 25 + 5 + 152, Y + 62 + 36);
|
|
}
|
|
}
|
|
|
|
|
|
//DrawInput 95 421 158 434
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 5, 5, X + 84, Y + 412, 70, 14)) {
|
|
if (Mobj.Lb == 1) {
|
|
RegisterInputHook("HorseGuessingInput", HookInput.bindenv(this));
|
|
HookInputState = true;
|
|
}
|
|
} else {
|
|
if (Mobj.Lb == 1 && !Button.isInRect()) {
|
|
ErasesInputHook("HorseGuessingInput");
|
|
HookInputState = false;
|
|
InputValue = null;
|
|
}
|
|
}
|
|
if (HookInputState) {
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 34, X + 45, Y + 390 + 18);
|
|
}
|
|
if (InputValue) {
|
|
L_sq_DrawCode(InputValue, X + 45 + 42, Y + 390 + 18 + 3, sq_RGBA(255, 255, 255, 250), 0, 1);
|
|
}
|
|
if (ResidueCoin != null) {
|
|
L_sq_DrawCode(ResidueCoin.tostring(), X + 45 + 42 + 52, Y + 390 + 18 + 3 + 18 + 11, sq_RGBA(255, 255, 255, 250), 0, 1);
|
|
}
|
|
}
|
|
|
|
//往期战绩
|
|
if (InfoType == 2) {
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 26, X + 10, Y + 36 + 18);
|
|
if (InfoContestLog) {
|
|
foreach(Pos, Value in InfoContestLog) {
|
|
L_sq_DrawCode((format("%03d", Value.Periods)).tostring(), X + 10 + 6, Y + 36 + 18 + 26 + (Pos * 20), sq_RGBA(255, 255, 255, 250), 0, 1);
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 38 + Value.Winner, X + 10 + 32, Y + 36 + 18 + 24 + (Pos * 20));
|
|
L_sq_DrawCode(RiderName[Value.Winner], X + 10 + 32 + 28, Y + 36 + 18 + 26 + (Pos * 20), sq_RGBA(255, 255, 255, 250), 0, 1);
|
|
|
|
L_sq_DrawCode((format("%.2f", Value.Rate.tofloat())).tostring(), X + 10 + 32 + 28 + 100, Y + 36 + 18 + 26 + (Pos * 20), sq_RGBA(255, 255, 255, 250), 0, 1);
|
|
}
|
|
}
|
|
|
|
local Button = HorseGuessingPro("骑士马战买手战绩", X + 54 + 126 + 10, Y + 477 + 18 + 10, "interface/windowcommon.img", 23, 22, 268);
|
|
Button.SetRectEnble(true, "骑士马战买手战绩", X + 54 + 126 + 10, Y + 477 + 18 + 10, "interface/windowcommon.img", 269);
|
|
Button.SetCustomClickEnble(true, "骑士马战买手战绩", X + 54 + 126 + 10, Y + 477 + 18 + 10, "interface/windowcommon.img", 270);
|
|
Button.Show();
|
|
if (Button.isInRect()) {
|
|
PlayerRankButtonInfo = true;
|
|
} else {
|
|
PlayerRankButtonInfo = false;
|
|
}
|
|
if (Button.isLBActive()) {
|
|
PlayerRankMainState = !PlayerRankMainState;
|
|
local T = {
|
|
op = 20055087,
|
|
type = 0,
|
|
}
|
|
SendPack(T);
|
|
}
|
|
}
|
|
}
|
|
|
|
PlayerRankMainState = false;
|
|
PlayerRankButtonInfo = false;
|
|
|
|
function DrawRider(obj) {
|
|
//BackGround
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 0, X + 227, Y + 26);
|
|
|
|
//DrawRiderButton
|
|
for (local i = 0; i< 8; i++) {
|
|
local Button = HorseGuessingPro("HorseGuessingRider" + i, X + 269 + ((i / 2) * 121) + ((i % 2) * 59), Y + 398, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_cha_btn.img", 36, 42, 0 + (i * 4));
|
|
Button.SetRectEnble(true, "HorseGuessingRider" + i, X + 269 + ((i / 2) * 121) + ((i % 2) * 59), Y + 398, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_cha_btn.img", 1 + (i * 4));
|
|
Button.SetCustomClickEnble(true, "HorseGuessingRider" + i, X + 269 + ((i / 2) * 121) + ((i % 2) * 59), Y + 398, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_cha_btn.img", 2 + (i * 4));
|
|
if (i != 0 && (i == 1 || i % 2 != 0)) Button.Overturn = true;
|
|
Button.Show();
|
|
if (Button.isLBActive()) {
|
|
NowSelectRider = i;
|
|
InfoTabButton1.SwitchState = false;
|
|
InfoTabButton2.SwitchState = true;
|
|
InfoTabButton3.SwitchState = false;
|
|
InfoType = 1;
|
|
|
|
//获取选手具体信息
|
|
GetRiderInfo();
|
|
}
|
|
|
|
local PathBuf = "right";
|
|
local PathXbuf = -1;
|
|
if (i % 2 == 0) {
|
|
PathBuf = "left";
|
|
PathXbuf = 0;
|
|
}
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_horse_" + PathBuf + "_effect.img", i * 2, X + 258 + ((i / 2) * 121) + ((i % 2) * 59) + PathXbuf, Y + 337);
|
|
|
|
|
|
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 11 + i, X + 263 + ((i / 2) * 121) + ((i % 2) * 59), Y + 441);
|
|
|
|
//如果有赔率信息
|
|
if (Rider8T && Rider8T.len() > 0) {
|
|
local ValueBuf = Rider8T[i].Odds.tofloat();
|
|
if (ValueBuf > 10) {
|
|
L_sq_DrawCode((format("%.1f", ValueBuf)).tostring(), X + 278 + ((i / 2) * 121) + ((i % 2) * 59), Y + 441 + 8, sq_RGBA(255, 255, 255, 250), 0, 1);
|
|
} else {
|
|
L_sq_DrawCode((format("%.2f", ValueBuf)).tostring(), X + 278 + ((i / 2) * 121) + ((i % 2) * 59), Y + 441 + 8, sq_RGBA(255, 255, 255, 250), 0, 1);
|
|
}
|
|
|
|
local ValueBuf2 = Rider8T[i].CodeItem.tofloat();
|
|
L_sq_DrawCode(ValueBuf2.tostring(), X + 273 + ((i / 2) * 121) + ((i % 2) * 59), Y + 441 + 8 + 14, sq_RGBA(229, 192, 123, 250), 0, 1);
|
|
|
|
if (CompetitionState< 10) {
|
|
if (CompetitionState == 1) L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 2, X + 270 + ((i / 2) * 121) + ((i % 2) * 59), Y + 441 + 8 + 14 - 69);
|
|
//如果存在生命值绘制生命值
|
|
if ("hp" in Rider8T[i]) {
|
|
setClip(X + 270 + ((i / 2) * 121) + ((i % 2) * 59), Y + 441 + 8 + 14 - 69, X + 270 + ((i / 2) * 121) + ((i % 2) * 59) + (34.0 * (Rider8T[i].hp.tofloat() / 100.0)).tointeger(), 2); //开始裁切
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 2, X + 270 + ((i / 2) * 121) + ((i % 2) * 59), Y + 441 + 8 + 14 - 69);
|
|
releaseClip(); //裁切结束
|
|
}
|
|
} else {
|
|
local fr = 6;
|
|
if (Rider4T && Rider4T.len() > 0) {
|
|
foreach(Pos, Value in Rider4T) {
|
|
if (i == Value.Code) {
|
|
fr = 5;
|
|
}
|
|
}
|
|
}
|
|
//绘制胜负
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", fr, X + 269 + ((i / 2) * 121) + ((i % 2) * 59), Y + 398);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((CompetitionState != 8 && CompetitionState != 18 && CompetitionState != 28 && CompetitionState != 38) && CompetitionStartAnimotion)
|
|
sq_Rewind(CompetitionStartAnimotion);
|
|
//第一轮正在打
|
|
if (CompetitionState< 10 && CompetitionState > 0) {
|
|
if (CompetitionState != 8) {
|
|
for (local i = 0; i< 4; i++) {
|
|
T_DrawDynamicAni(obj, "common/horseguessing/battle.ani", X + 9 + 287 - 14 + (i * 122), Y + 45 + 237 + 64, "HorseGuessingCompetitionState10");
|
|
}
|
|
} else {
|
|
CompetitionStartAnimotion = T_DrawDynamicAni(obj, "common/horseguessing/countdown.ani", X + 9 + 287 - 14 + 202, Y + 45 + 237 + 64 - 144, "HorseGuessingCompetitionState8");
|
|
}
|
|
}
|
|
|
|
//第二轮后的情况
|
|
if (CompetitionState >= 10) {
|
|
//4强信息包
|
|
if (Rider4T && Rider4T.len() > 0) {
|
|
foreach(Pos, Value in Rider4T) {
|
|
local Xf = 1.0;
|
|
local Xoffset = 0;
|
|
if (Pos != 0 && (Pos == 1 || Pos % 2 != 0)) {
|
|
Xf = -1.0;
|
|
Xoffset = 36;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
if (Value.Code != 0 && (Value.Code == 1 || Value.Code % 2 != 0)) {
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 23, X + 28 + 296 - 9 + ((Pos / 2) * 242) + ((Pos % 2) * 122), Y + 238 - 12 + 107);
|
|
} else {
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 20, X + 297 - 9 + ((Pos / 2) * 242) + ((Pos % 2) * 122), Y + 238 - 12 + 107);
|
|
}
|
|
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_cha_btn.img", Value.Code * 4, X + 298 + ((Pos / 2) * 242) + ((Pos % 2) * 122) + Xoffset, Y + 287, 0, sq_RGBA(255, 255, 255, 250), Xf, 1.0);
|
|
|
|
|
|
|
|
|
|
|
|
local PathBuf = "right";
|
|
local PathXbuf = -1;
|
|
if (Pos % 2 == 0) {
|
|
PathBuf = "left";
|
|
PathXbuf = 0;
|
|
}
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_horse_" + PathBuf + "_effect.img", Value.Code * 2, X + 296 - 9 + ((Pos / 2) * 242) + ((Pos % 2) * 122) + PathXbuf, Y + 238 - 12);
|
|
|
|
if (CompetitionState< 20) {
|
|
if (CompetitionState == 11) L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 2, X + 308 - 9 + ((Pos / 2) * 242) + ((Pos % 2) * 122), Y + 238 - 12 + 57);
|
|
//如果存在生命值绘制生命值
|
|
if ("hp" in Rider4T[Pos]) {
|
|
setClip(X + 308 - 9 + ((Pos / 2) * 242) + ((Pos % 2) * 122), Y + 238 - 12 + 57, X + 308 - 9 + ((Pos / 2) * 242) + ((Pos % 2) * 122) + (34.0 * (Rider4T[Pos].hp.tofloat() / 100.0)).tointeger(), 2); //开始裁切
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 2, X + 308 - 9 + ((Pos / 2) * 242) + ((Pos % 2) * 122), Y + 238 - 12 + 57);
|
|
releaseClip(); //裁切结束
|
|
}
|
|
} else {
|
|
local fr = 6;
|
|
if (Rider2T && Rider2T.len() > 0) {
|
|
foreach(Pos, TValue in Rider2T) {
|
|
if (Value.Code == TValue.Code) {
|
|
fr = 5;
|
|
}
|
|
}
|
|
}
|
|
//绘制胜负
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", fr, X + 298 + ((Pos / 2) * 242) + ((Pos % 2) * 122), Y + 287);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//第二轮正在打
|
|
if (CompetitionState< 20 && CompetitionState > 10) {
|
|
if (CompetitionState != 18) {
|
|
for (local i = 0; i< 2; i++) {
|
|
T_DrawDynamicAni(obj, "common/horseguessing/semifinalbattle.ani", X + 9 + 349 - 14 + (i * 244), Y + 45 + 237 + 64 - 90, "HorseGuessingCompetitionState21");
|
|
}
|
|
} else {
|
|
CompetitionStartAnimotion = T_DrawDynamicAni(obj, "common/horseguessing/countdown.ani", X + 9 + 287 - 14 + 202, Y + 45 + 237 + 64 - 144, "HorseGuessingCompetitionState8");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//第三轮后的情况
|
|
if (CompetitionState >= 20) {
|
|
//4强信息包
|
|
if (Rider2T && Rider2T.len() > 0) {
|
|
foreach(Pos, Value in Rider2T) {
|
|
local Xf = 1.0;
|
|
local Xoffset = 0;
|
|
if (Pos != 0 && (Pos == 1 || Pos % 2 != 0)) {
|
|
Xf = -1.0;
|
|
Xoffset = 36;
|
|
}
|
|
|
|
|
|
if ((Value.Code / 2) != 0 && ((Value.Code / 2) == 1 || (Value.Code / 2) % 2 != 0)) {
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 24, X + 28 + 296 + 60 - 9 + ((Pos / 2) * 484) + ((Pos % 2) * 244), Y + 115 + 107);
|
|
} else {
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 21, X - 32 + 297 + 60 - 9 + ((Pos / 2) * 484) + ((Pos % 2) * 244), Y + 115 + 107);
|
|
}
|
|
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_cha_btn.img", Value.Code * 4, X + 358 + ((Pos / 2) * 484) + ((Pos % 2) * 244) + Xoffset, Y + 176, 0, sq_RGBA(255, 255, 255, 250), Xf, 1.0);
|
|
|
|
|
|
local PathBuf = "right";
|
|
local PathXbuf = -1;
|
|
if (Pos % 2 == 0) {
|
|
PathBuf = "left";
|
|
PathXbuf = 0;
|
|
}
|
|
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_horse_" + PathBuf + "_effect.img", Value.Code * 2, X + 296 + 60 - 9 + ((Pos / 2) * 484) + ((Pos % 2) * 244) + PathXbuf, Y + 115);
|
|
|
|
if (CompetitionState< 30) {
|
|
if (CompetitionState == 21) L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 2, X + 60 + 308 - 9 + ((Pos / 2) * 484) + ((Pos % 2) * 244), Y + 238 - 12 + 57 - 111);
|
|
//如果存在生命值绘制生命值
|
|
if ("hp" in Rider2T[Pos]) {
|
|
setClip(X + 60 + 308 - 9 + ((Pos / 2) * 484) + ((Pos % 2) * 244), Y + 238 - 12 + 57 - 111, X + 60 + 308 - 9 + ((Pos / 2) * 484) + ((Pos % 2) * 244) + (34.0 * (Rider2T[Pos].hp.tofloat() / 100.0)).tointeger(), 2); //开始裁切
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 2, X + 60 + 308 - 9 + ((Pos / 2) * 484) + ((Pos % 2) * 244), Y + 238 - 12 + 57 - 111);
|
|
releaseClip(); //裁切结束
|
|
}
|
|
} else {
|
|
local fr = 6;
|
|
if (Rider1T && Rider1T.len() > 0) {
|
|
foreach(Pos, TValue in Rider1T) {
|
|
if (Value.Code == TValue.Code) {
|
|
fr = 5;
|
|
}
|
|
}
|
|
}
|
|
//绘制胜负
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", fr, X + 358 + ((Pos / 2) * 484) + ((Pos % 2) * 244), Y + 176);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//第三轮正在打
|
|
if (CompetitionState< 30 && CompetitionState > 20) {
|
|
if (CompetitionState != 28) {
|
|
T_DrawDynamicAni(obj, "common/horseguessing/finalbattle.ani", X + 9 + 469 - 14, Y + 45 + 237 + 64 - 90 - 80, "HorseGuessingCompetitionState30");
|
|
} else {
|
|
CompetitionStartAnimotion = T_DrawDynamicAni(obj, "common/horseguessing/countdown.ani", X + 9 + 287 - 14 + 202, Y + 45 + 237 + 64 - 144, "HorseGuessingCompetitionState8");
|
|
}
|
|
}
|
|
|
|
// CompetitionState = 30;
|
|
//第四轮后的情况
|
|
if (CompetitionState >= 30) {
|
|
//4强信息包
|
|
if (Rider1T && Rider1T.len() > 0) {
|
|
foreach(Pos, Value in Rider1T) {
|
|
local Xf = 1.0;
|
|
local Xoffset = 0;
|
|
if (Pos != 0 && (Pos == 1 || Pos % 2 != 0)) {
|
|
Xf = -1.0;
|
|
Xoffset = 36;
|
|
}
|
|
|
|
if ((Value.Code / 4) != 0 && ((Value.Code / 4) == 1 || (Value.Code / 4) % 2 != 0)) {
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 25, X + 185 + 296 + 60 - 9 + ((Pos / 2) * 484) + ((Pos % 2) * 244), Y + 115 + 107 - 104);
|
|
} else {
|
|
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 22, X - 32 + 62 + 296 + 60 - 9 + ((Pos / 2) * 484) + ((Pos % 2) * 244), Y + 115 + 107 - 104);
|
|
}
|
|
|
|
T_DrawDynamicAni(obj, "common/horseguessing/winnereffect_back.ani", X + 481 + ((Pos / 2) * 968) + ((Pos % 2) * 488) + Xoffset, Y + 88, "HorseGuessingWinnerBack");
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_cha_btn.img", Value.Code * 4, X + 481 + ((Pos / 2) * 968) + ((Pos % 2) * 488) + Xoffset, Y + 88, 0, sq_RGBA(255, 255, 255, 250), Xf, 1.0);
|
|
T_DrawDynamicAni(obj, "common/horseguessing/winnereffect_front.ani", X + 481 + ((Pos / 2) * 968) + ((Pos % 2) * 488) + Xoffset, Y + 88, "HorseGuessingWinnerFront");
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//绘制悬浮窗图层
|
|
function DrawSuspendedLayer(obj) {
|
|
if (ItemDrawState) {
|
|
if (!ItemObject) {
|
|
ItemObject = ItemInfoClass(ItemInfo);
|
|
}
|
|
ItemObject.Show(X + 84 - (211 / 2), Y + 374 - ItemObject.PageLength);
|
|
}
|
|
|
|
if (PlayerRankButtonInfo) {
|
|
//Item信息框一般为211的宽度
|
|
L_sq_DrawWindow(X + 54 + 126 + 10 - 33, Y + 477 + 18 + 10 - 50 + 18, 110, 20, "interface2/popup/popup.img", 134, 6, 12, 6, 13);
|
|
L_sq_DrawCode("点击查看买手排行榜", X + 54 + 126 + 10 - 33 + 5, Y + 477 + 18 + 10 - 50 + 18 + 7, sq_RGBA(255, 255, 255, 250), 0, 1);
|
|
}
|
|
}
|
|
|
|
|
|
DRBTN = null;
|
|
SRBTN = null;
|
|
ABTN = null;
|
|
|
|
//绘制排行榜
|
|
function DrawRank(obj) {
|
|
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 0, X + 227, Y + 26);
|
|
|
|
L_sq_DrawWindow(X + 228, Y + 27, 530, 460, "interface2/popup/popup.img", 134, 6, 12, 6, 13);
|
|
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 35, X + 227, Y + 26);
|
|
|
|
L_sq_DrawCode("马战排行榜", X + 227 + 236, Y + 32, sq_RGBA(255, 198, 0, 250), 0, 1);
|
|
|
|
L_sq_DrawCode("排名", X + 227 + 23, Y + 35 + 288, sq_RGBA(255, 198, 0, 250), 0, 1);
|
|
|
|
L_sq_DrawCode("角色名", X + 227 + 23 + 106, Y + 35 + 288, sq_RGBA(255, 198, 0, 250), 0, 1);
|
|
|
|
L_sq_DrawCode("获胜货币", X + 227 + 23 + 106 + 146, Y + 35 + 288, sq_RGBA(255, 198, 0, 250), 0, 1);
|
|
|
|
L_sq_DrawCode("命中战绩", X + 227 + 23 + 106 + 146 + 158, Y + 35 + 288, sq_RGBA(255, 198, 0, 250), 0, 1);
|
|
|
|
|
|
if (!DRBTN) {
|
|
DRBTN = LenheartcommonSwitchButtonText(X + 227 + 23, Y + 35 + 288 + 192, "今日战况");
|
|
DRBTN.State = 1;
|
|
}
|
|
DRBTN.SyncPos(X + 227 + 23, Y + 35 + 288 + 192);
|
|
DRBTN.Show();
|
|
if (DRBTN.isLBActive()) {
|
|
SRBTN.State = 0;
|
|
ABTN.State = 0;
|
|
local T = {
|
|
op = 20055087,
|
|
type = 0,
|
|
}
|
|
SendPack(T);
|
|
}
|
|
|
|
if (!SRBTN) SRBTN = LenheartcommonSwitchButtonText(X + 227 + 23 + 216, Y + 35 + 288 + 192, "三日战况");
|
|
SRBTN.SyncPos(X + 227 + 23 + 216, Y + 35 + 288 + 192);
|
|
SRBTN.Show();
|
|
if (SRBTN.isLBActive()) {
|
|
DRBTN.State = 0;
|
|
ABTN.State = 0;
|
|
local T = {
|
|
op = 20055087,
|
|
type = 1,
|
|
}
|
|
SendPack(T);
|
|
}
|
|
|
|
|
|
if (!ABTN) ABTN = LenheartcommonSwitchButtonText(X + 227 + 23 + 216 + 216, Y + 35 + 288 + 192, "全部战况");
|
|
ABTN.SyncPos(X + 227 + 23 + 216 + 216, Y + 35 + 288 + 192);
|
|
ABTN.Show();
|
|
if (ABTN.isLBActive()) {
|
|
DRBTN.State = 0;
|
|
SRBTN.State = 0;
|
|
local T = {
|
|
op = 20055087,
|
|
type = 2,
|
|
}
|
|
SendPack(T);
|
|
}
|
|
|
|
//如果有排行榜信息
|
|
if (RankInfo) {
|
|
foreach(Pos, Value in RankInfo) {
|
|
L_sq_DrawCode((Pos + 1).tostring(), X + 227 + 23 + 15 - LenheartTextClass.GetStringLength((Pos + 1).tostring()) / 2, Y + 35 + 288 + 20 + (Pos * 16), sq_RGBA(255, 198, 0, 250), 0, 1);
|
|
L_sq_DrawCode(Value.name, X + 227 + 148 - LenheartTextClass.GetStringLength(Value.name) / 2, Y + 35 + 288 + 20 + (Pos * 16), sq_RGBA(104, 237, 161, 250), 0, 1);
|
|
L_sq_DrawCode(Value.win.tostring(), X + 227 + 172 + 128 - LenheartTextClass.GetStringLength(Value.win.tostring()) / 2, Y + 35 + 288 + 20 + (Pos * 16), sq_RGBA(217, 193, 144, 250), 0, 1);
|
|
foreach(_i, ok in Value.victoryFieldInt) {
|
|
L_sq_DrawImg("interface/lenheartwindowcommon.img", 50 + ok, X + 227 + 182 + 211 + (_i * 16), Y + 35 + 288 + 20 + (Pos * 16));
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
//绘制主界面
|
|
function DrawMain(obj) {
|
|
//绘制窗口
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 33, X, Y);
|
|
|
|
|
|
//绘制详情页
|
|
DrawInfo(obj);
|
|
|
|
//绘制骑手页
|
|
if (!PlayerRankMainState) DrawRider(obj);
|
|
else DrawRank(obj);
|
|
|
|
//绘制悬浮窗图层
|
|
DrawSuspendedLayer(obj);
|
|
}
|
|
|
|
//开启界面回调
|
|
function OpenClassCallBack() {
|
|
|
|
L_NewWindows("Lenheart", 170, 0x65535);
|
|
local W = sq_GetPopupWindowMainCotrol(170);
|
|
W.SetVisible(false);
|
|
W.SetEnable(false);
|
|
|
|
//获取基础信息
|
|
GetBaseInfo();
|
|
//获取信息
|
|
GetInfo();
|
|
//获取选手具体信息
|
|
GetRiderInfo();
|
|
//获取过往战绩
|
|
GetPastInfo();
|
|
}
|
|
|
|
//绘制公告
|
|
function DrawNoti(obj) {
|
|
//NotiStr
|
|
if (NotiState) {
|
|
// print(Clock() - NotiTime);
|
|
local A = 0;
|
|
if (Clock() - NotiTime< 2000) {
|
|
A = sq_GetUniformVelocity(0, 250, Clock() - NotiTime, 2000);
|
|
}
|
|
if (Clock() - NotiTime >= 2000 && Clock() - NotiTime< 3000) A = 250;
|
|
if (Clock() - NotiTime >= 3000) {
|
|
A = sq_GetUniformVelocity(250, 0, Clock() - NotiTime, 6000);
|
|
}
|
|
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 26, 74, 160, 0, sq_RGBA(255, 255, 255, A), 1.0, 1.0);
|
|
L_sq_DrawCode(NotiStr, 74 + 270, 160 + 44, sq_RGBA(255, 255, 255, A), 2, 1);
|
|
if (Clock() - NotiTime >= 6000) {
|
|
NotiState = false;
|
|
}
|
|
// NotiTime
|
|
}
|
|
}
|
|
|
|
|
|
//绘制入口
|
|
function Draw(obj) {
|
|
if (MainState) {
|
|
if (WindowObj) {
|
|
DrawMain(obj);
|
|
WindowObj.Show(obj);
|
|
X = WindowObj.X;
|
|
Y = WindowObj.Y;
|
|
} else {
|
|
WindowObj = HorseGuessingWindow(X, Y, 800, 600, 28); //坐标 大小 标题栏高度
|
|
//WindowObj.DeBugMode = true;
|
|
}
|
|
} else {
|
|
if (WindowObj && WindowObj.YMouseSw == false) {
|
|
IMouse.ReleaseMouseClick();
|
|
WindowObj.YMouseSw = true;
|
|
WindowObj = null;
|
|
}
|
|
}
|
|
|
|
DrawNoti(obj);
|
|
}
|
|
|
|
//逻辑入口
|
|
function Proc(obj) {
|
|
if (KeyPressNB.isKeyPress(48, "HorseGuessingCloseKey")) {
|
|
MainState = false;
|
|
|
|
ErasesInputHook("HorseGuessingInput");
|
|
HookInputState = false;
|
|
InputValue = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
function HorseGuessing(obj) {
|
|
local RootTab = getroottable();
|
|
if (!RootTab.rawin("HorseGuessingCObj")) {
|
|
local Cobj = HorseGuessingC();
|
|
RootTab.rawset("HorseGuessingCObj", Cobj);
|
|
EventIcon("骑士马战", 106, 106, Cobj);
|
|
} else {
|
|
RootTab["HorseGuessingCObj"].Proc(obj);
|
|
RootTab["HorseGuessingCObj"].Draw(obj);
|
|
}
|
|
}
|
|
|
|
if (getroottable().rawin("LenheartFuncTab")) {
|
|
getroottable()["LenheartFuncTab"].rawset("HorseGuessingFunc", HorseGuessing);
|
|
} else {
|
|
local T = {};
|
|
T.rawset("HorseGuessingFunc", HorseGuessing);
|
|
getroottable().rawset("LenheartFuncTab", T);
|
|
} |