111
This commit is contained in:
@@ -6,6 +6,74 @@
|
||||
*/
|
||||
dofile("sqr/Project/HorseGuessing/HorseGuessing_Guide.nut"); //骑士马战指引
|
||||
dofile("sqr/Project/HorseGuessing/HorseGuessing_KnightInfo.nut"); //骑士马战资料
|
||||
dofile("sqr/Project/HorseGuessing/HorseGuessing_PastRecord.nut"); //骑士马战过往战绩
|
||||
|
||||
class HorseGuessingBaseButton extends LenheartNewUI_BaseButton {
|
||||
//是否翻转
|
||||
IsFlip = false;
|
||||
|
||||
//ovverride
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(Flag, MousePos_X, MousePos_Y) {
|
||||
if (!IsFlip) {
|
||||
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) isInRect = true;
|
||||
else isInRect = false;
|
||||
} else {
|
||||
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X - Width, Y, Width, Height)) isInRect = true;
|
||||
else isInRect = false;
|
||||
}
|
||||
}
|
||||
//ovverride
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||
if (!IsFlip) {
|
||||
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) {
|
||||
isLBDown = true;
|
||||
if (!OnClickSound) {
|
||||
R_Utils.PlaySound("CLICK_BUTTON1");
|
||||
} else {
|
||||
R_Utils.PlaySound(OnClickSound);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X - Width, Y, Width, Height)) {
|
||||
isLBDown = true;
|
||||
if (!OnClickSound) {
|
||||
R_Utils.PlaySound("CLICK_BUTTON1");
|
||||
} else {
|
||||
R_Utils.PlaySound(OnClickSound);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//ovverride
|
||||
function Show(obj) {
|
||||
|
||||
local XRate = 1.0;
|
||||
if (IsFlip) XRate = -1.0;
|
||||
//不可用
|
||||
if (State == 8) {
|
||||
L_sq_DrawImg(Path, Idx + 3, X, Y + 1, 1, sq_RGBA(255, 255, 255, 250), XRate, 1.0);
|
||||
} else {
|
||||
//按下
|
||||
if (isLBDown) {
|
||||
L_sq_DrawImg(Path, Idx + 2, X, Y + 1, 1, sq_RGBA(255, 255, 255, 250), XRate, 1.0);
|
||||
}
|
||||
//悬停
|
||||
else if (isInRect) {
|
||||
L_sq_DrawImg(Path, Idx + 1, X, Y, 1, sq_RGBA(255, 255, 255, 250), XRate, 1.0);
|
||||
}
|
||||
//普通
|
||||
else {
|
||||
L_sq_DrawImg(Path, Idx, X, Y, 1, sq_RGBA(255, 255, 255, 250), XRate, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class HorseGuessingC extends LenheartNewUI_Windows {
|
||||
//调试模式
|
||||
//DeBugMode = true;
|
||||
@@ -14,7 +82,7 @@ class HorseGuessingC extends LenheartNewUI_Windows {
|
||||
// NoWindow = true;
|
||||
|
||||
//是否可见
|
||||
// Visible = false;
|
||||
Visible = false;
|
||||
|
||||
//标题栏
|
||||
Title = null;
|
||||
@@ -32,16 +100,7 @@ class HorseGuessingC extends LenheartNewUI_Windows {
|
||||
|
||||
|
||||
//骑手名称
|
||||
RiderName = [
|
||||
"伊撒尔",
|
||||
"理查德",
|
||||
"席恩",
|
||||
"吉尔特",
|
||||
"爱德华",
|
||||
"罗兰",
|
||||
"莱奥",
|
||||
"贝奥武夫",
|
||||
];
|
||||
RiderName = null;
|
||||
|
||||
//当前选择骑手
|
||||
NowSelectRider = 0;
|
||||
@@ -52,53 +111,185 @@ class HorseGuessingC extends LenheartNewUI_Windows {
|
||||
//剩余可下注数量
|
||||
ResidueCoin = 10000;
|
||||
|
||||
|
||||
//骑手信息
|
||||
RiderInfo = null;
|
||||
|
||||
//往期战绩
|
||||
InfoContestLog = null;
|
||||
|
||||
//状态
|
||||
MyState = 0;
|
||||
|
||||
//初始化名字包
|
||||
function InitRiderNameCallBack(Chunk) {
|
||||
local Jso = Json.Decode(Chunk);
|
||||
RiderName = Jso.name;
|
||||
ResidueCoin = Jso.Max;
|
||||
BetItem = Jso.itemId;
|
||||
}
|
||||
|
||||
//获取基础配置信息
|
||||
function GetBaseConfig() {
|
||||
local T = {
|
||||
op = 20055001,
|
||||
}
|
||||
SendPackEx(T);
|
||||
}
|
||||
//获取基础配置信息回调
|
||||
function GetBaseConfigCallBack(Chunk) {
|
||||
local Jso = Json.Decode(Chunk);
|
||||
if (!("Top8" in Jso.Rank)) return;
|
||||
|
||||
//同步状态
|
||||
MyState = Jso.state;
|
||||
|
||||
//初始化骑手信息
|
||||
RiderInfo = [];
|
||||
RiderInfo = Jso.Rank.Top8;
|
||||
|
||||
//写入骑手下注信息
|
||||
for (local i = 0; i< RiderInfo.len(); i++) {
|
||||
RiderInfo[i].codeItem <- Jso.codeItem[i];
|
||||
}
|
||||
|
||||
//重置骑手按钮
|
||||
|
||||
//构造骑手按钮
|
||||
InitKnightButton();
|
||||
|
||||
//刷新剩余可下注数量
|
||||
ResidueCoin = Jso.ResidueCoin;
|
||||
|
||||
|
||||
//请求骑士个人信息
|
||||
this.GetRiderInfo();
|
||||
}
|
||||
|
||||
//获取过往战绩
|
||||
function GetPastRecord() {
|
||||
local T = {
|
||||
op = 20055009,
|
||||
}
|
||||
SendPackEx(T);
|
||||
}
|
||||
//获取过往战绩回调
|
||||
function GetPastRecordCallBack(Chunk) {
|
||||
local Jso = Json.Decode(Chunk);
|
||||
InfoContestLog = Jso.knights;
|
||||
}
|
||||
|
||||
|
||||
//获取选手具体信息
|
||||
function GetRiderInfo() {
|
||||
local T = {
|
||||
op = 20055003,
|
||||
code = NowSelectRider,
|
||||
}
|
||||
SendPack(T);
|
||||
SendPackEx(T);
|
||||
}
|
||||
|
||||
//获取选手具体信息回调包
|
||||
function GetRiderInfoCallBack(Chunk) {
|
||||
local Jso = Json.Decode(Chunk);
|
||||
RiderInfo = [];
|
||||
for (local i = 0; i< Jso.outcome.len(); i++) {
|
||||
RiderInfo.append(Jso.outcome[i]);
|
||||
RiderInfo[NowSelectRider].outcome <- Jso.outcome;
|
||||
}
|
||||
|
||||
//通知刷新信息包
|
||||
function NotifyRefreshInfoCallBack(Chunk) {
|
||||
GetBaseConfig();
|
||||
}
|
||||
|
||||
//动画脚本状态
|
||||
AnimationAct = 0;
|
||||
//绘制动画包
|
||||
function DrawAniInfoCallBack(Chunk) {
|
||||
local Jso = Json.Decode(Chunk);
|
||||
AnimationAct = Jso.state;
|
||||
|
||||
if (AnimationAct == 2) {
|
||||
if (CompetitionStartAnimotion) sq_Rewind(CompetitionStartAnimotion);
|
||||
}
|
||||
}
|
||||
|
||||
//战斗信息
|
||||
FightInfo = null;
|
||||
WinnerEffectTimer = null;
|
||||
//战斗信息包
|
||||
function FightInfoCallBack(Chunk) {
|
||||
local Jso = Json.Decode(Chunk);
|
||||
MyState = Jso.state;
|
||||
|
||||
FightInfo = Jso;
|
||||
if (MyState >= 30) {
|
||||
WinnerEffectTimer = Clock();
|
||||
}
|
||||
}
|
||||
|
||||
//获胜者动画
|
||||
NotiState = false; //公告状态
|
||||
NotiStr = null; //公告内容
|
||||
NotiTime = null; //公告时间
|
||||
|
||||
function WinnerAniCallBack(Chunk) {
|
||||
local Jso = Json.Decode(Chunk);
|
||||
NotiState = true; //公告状态
|
||||
NotiStr = Jso.Str; //公告内容
|
||||
NotiTime = Clock();
|
||||
}
|
||||
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
Childrens = [];
|
||||
Title = [];
|
||||
RiderInfo = [];
|
||||
//读取配置文件
|
||||
local Config = R_Utils.ReadScriptConfig("etc/rindro/horseguessing/horseguessing.dat", 1024, "utf8");
|
||||
RiderName = [
|
||||
"伊撒尔",
|
||||
"理查德",
|
||||
"席恩",
|
||||
"吉尔特",
|
||||
"爱德华",
|
||||
"罗兰",
|
||||
"莱奥",
|
||||
"贝奥武夫",
|
||||
];
|
||||
|
||||
RiderName = Config.RiderInfo;
|
||||
BetItem = Config.ItemId;
|
||||
//把big的名字 转成 utf8
|
||||
for (local i = 0; i< RiderName.len(); i++) {
|
||||
RiderName[i] = Sq_ConvertWideChar(RiderName[i], "big5");
|
||||
}
|
||||
// //读取配置文件
|
||||
// local Config = R_Utils.ReadScriptConfig("etc/rindro/horseguessing/horseguessing.dat", 1024, "utf8");
|
||||
|
||||
// RiderName = Config.RiderInfo;
|
||||
// BetItem = Config.ItemId;
|
||||
// //把big的名字 转成 utf8
|
||||
// for (local i = 0; i< RiderName.len(); i++) {
|
||||
// RiderName[i] = Sq_ConvertWideChar(RiderName[i], "big5");
|
||||
// }
|
||||
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
|
||||
Pack_Control.rawset(20055058, InitRiderNameCallBack.bindenv(this));
|
||||
Pack_Control.rawset(20055002, GetBaseConfigCallBack.bindenv(this));
|
||||
Pack_Control.rawset(20055010, GetPastRecordCallBack.bindenv(this));
|
||||
Pack_Control.rawset(20055004, GetRiderInfoCallBack.bindenv(this));
|
||||
Pack_Control.rawset(20055018, NotifyRefreshInfoCallBack.bindenv(this));
|
||||
Pack_Control.rawset(20055020, DrawAniInfoCallBack.bindenv(this));
|
||||
Pack_Control.rawset(20055012, FightInfoCallBack.bindenv(this));
|
||||
Pack_Control.rawset(20055078, WinnerAniCallBack.bindenv(this));
|
||||
|
||||
//获取基础配置
|
||||
GetBaseConfig();
|
||||
//获取历史战绩
|
||||
GetPastRecord();
|
||||
|
||||
|
||||
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
|
||||
GuidePage = HorseGuessing_GuideC("骑士马战_指引窗口", X + 7, Y + 50, 214, 480, 0);
|
||||
KnightInfoPage = HorseGuessing_KnightInfoC("骑士马战_资料窗口", X + 7, Y + 50, 214, 480, 0);
|
||||
PastRecordPage = HorseGuessing_PastRecordC("骑士马战_战绩窗口", X + 7, Y + 50, 214, 480, 0);
|
||||
|
||||
//默认构造时切换到0页
|
||||
ChangePage(1);
|
||||
ChangePage(0);
|
||||
}
|
||||
|
||||
function ChangePage(ToPage) {
|
||||
@@ -129,6 +320,46 @@ class HorseGuessingC extends LenheartNewUI_Windows {
|
||||
}
|
||||
}
|
||||
|
||||
//初始化骑士按钮
|
||||
function InitKnightButton() {
|
||||
foreach(pos, v in RiderInfo) {
|
||||
local KnightButton = HorseGuessingBaseButton(269 + ((pos / 2) * 121) + ((pos % 2) * 59), 398, 36, 42, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_cha_btn.img", pos * 4);
|
||||
//如果是偶数需要翻转骑士
|
||||
if (pos % 2 == 1) {
|
||||
KnightButton.IsFlip = true;
|
||||
KnightButton.Localtion_X += 36;
|
||||
}
|
||||
KnightButton.Data = v;
|
||||
KnightButton.OnClickEx = function(Button) {
|
||||
this.NowSelectRider = Button.Data.code;
|
||||
ChangePage(1);
|
||||
//请求骑士个人信息
|
||||
this.GetRiderInfo();
|
||||
}.bindenv(this);
|
||||
|
||||
KnightButton.SetCallBackFunc(function(Button) {
|
||||
//是否翻转的偏移
|
||||
local FlipXOffset = ((Button.IsFlip == true) ? -35 : 0);
|
||||
local horseKey = ((Button.IsFlip == true) ? "right" : "left");
|
||||
//绘制旗帜
|
||||
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 11 + Button.Data.code, Button.X - 6 + FlipXOffset, Button.Y + 46);
|
||||
//绘制赔率信息
|
||||
local OddsStr = format("%.2f", Button.Data.Odds.tofloat());
|
||||
L_sq_DrawCode(OddsStr, Button.X + 18 + FlipXOffset - LenheartTextClass.GetStringLength(OddsStr) / 2, Button.Y + 53);
|
||||
//绘制已投币数量
|
||||
local codeItem = Button.Data.codeItem.tostring();
|
||||
L_sq_DrawCode(codeItem, Button.X + 18 + FlipXOffset - LenheartTextClass.GetStringLength(codeItem) / 2, Button.Y + 68);
|
||||
|
||||
//绘制框
|
||||
if (FlipXOffset == -35) FlipXOffset = -37; //傻逼国服美工这个偏移和那个翻转的偏移不一样
|
||||
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_horse_" + horseKey + "_effect.img", Button.Data.code * 2, Button.X + FlipXOffset - 11, Button.Y - 54);
|
||||
|
||||
|
||||
}.bindenv(this));
|
||||
Childrens.append(KnightButton);
|
||||
}
|
||||
}
|
||||
|
||||
function RegisterWidget() {
|
||||
//关闭按钮
|
||||
local CloseButton = LenheartNewUI_BaseButton(750, 0, 11, 12, "interface/lenheartwindowcommon.img", 276);
|
||||
@@ -161,6 +392,9 @@ class HorseGuessingC extends LenheartNewUI_Windows {
|
||||
Tabbars3.SetTextOffset(7, 3);
|
||||
Title.append(Tabbars3);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function DrawInfo(obj) {
|
||||
@@ -185,10 +419,167 @@ class HorseGuessingC extends LenheartNewUI_Windows {
|
||||
// L_sq_DrawCode(L_sq_StringBinById(271069), X + 400, Y + 386, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||
}
|
||||
|
||||
//开始动画
|
||||
CompetitionStartAnimotion = null;
|
||||
//绘制动画
|
||||
function DrawAnimation(obj) {
|
||||
//绘制321开始
|
||||
if (AnimationAct == 1) {
|
||||
CompetitionStartAnimotion = T_DrawDynamicAni(obj, "common/horseguessing/countdown.ani", X + 9 + 287 - 14 + 202, Y + 45 + 237 + 64 - 144, "HorseGuessingCompetitionState8");
|
||||
}
|
||||
//绘制战斗
|
||||
else if (AnimationAct == 2) {
|
||||
local T = {
|
||||
count = 4,
|
||||
x = 282,
|
||||
y = 346,
|
||||
x2 = 282,
|
||||
y2 = 346,
|
||||
x3 = 282,
|
||||
y3 = 346,
|
||||
offset = 122,
|
||||
}
|
||||
// if(MyState < 10)
|
||||
if (MyState >= 10 && MyState< 20) {
|
||||
T.count = 2;
|
||||
T.x = 344;
|
||||
T.y = 222;
|
||||
T.x2 = 310;
|
||||
T.y2 = 232;
|
||||
T.x3 = 380;
|
||||
T.y3 = 232;
|
||||
T.offset = 244;
|
||||
} else if (MyState >= 20) {
|
||||
T.count = 1;
|
||||
T.x = 465;
|
||||
T.y = 54;
|
||||
T.x2 = 370;
|
||||
T.y2 = 120;
|
||||
T.x3 = 560;
|
||||
T.y3 = 120;
|
||||
T.offset = 244;
|
||||
}
|
||||
|
||||
for (local i = 0; i< T.count; i++) {
|
||||
T_DrawDynamicAni(obj, "common/horseguessing/battle.ani", X + T.x + (i * T.offset), Y + T.y, "骑士马战战斗动画文字");
|
||||
|
||||
T_DrawDynamicAni(obj, "common/horseguessing/battleleffect.ani", X + T.x2 + (i * T.offset), Y + T.y2, "骑士马战战斗动画左");
|
||||
T_DrawDynamicAni(obj, "common/horseguessing/battlereffect.ani", X + T.x3 + (i * T.offset), Y + T.y3, "骑士马战战斗动画右");
|
||||
}
|
||||
}
|
||||
//结束绘制
|
||||
else if (AnimationAct == 3) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//绘制骑士和生命值
|
||||
function DrawKnightAndHpDrawFunction(T, Key) {
|
||||
foreach(i, value in FightInfo[Key]) {
|
||||
local DrawX = X + T.x + ((i / 2) * T.offset1) + ((i % 2) * T.offset2);
|
||||
local DrawY = Y + T.y;
|
||||
|
||||
local XRate = (i % 2 == 0 ? 1.0 : -1.0);
|
||||
local Xoffset = (i % 2 == 0 ? 0 : 36);
|
||||
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_cha_btn.img", value.code * 4, DrawX + Xoffset, DrawY, 1, sq_RGBA(255, 255, 255, 250), XRate, 1.0);
|
||||
|
||||
//绘制血条
|
||||
setClip(DrawX + 2, DrawY - 4, DrawX + 2 + (34.0 * (value.hp.tofloat() / 100.0)).tointeger(), DrawY - 4 + 2);
|
||||
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 2, DrawX + 2, DrawY - 4);
|
||||
releaseClip();
|
||||
|
||||
//绘制胜利线
|
||||
if (value.win > 0) {
|
||||
local XXoffset = (i % 2 == 0 ? 0 : -2);
|
||||
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 20 + T.imgoffset, DrawX + XXoffset + T.Xx, DrawY - 65 + T.Xy, 1, sq_RGBA(255, 255, 255, 250), XRate, 1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function DrawKnightAndHp(obj) {
|
||||
if (!FightInfo) return;
|
||||
|
||||
if (MyState > 0) {
|
||||
local T = {
|
||||
x = 268,
|
||||
y = 398,
|
||||
offset1 = 121,
|
||||
offset2 = 59,
|
||||
imgoffset = 0,
|
||||
Xx = 20,
|
||||
Xy = 0
|
||||
}
|
||||
DrawKnightAndHpDrawFunction(T, "top8");
|
||||
}
|
||||
if (MyState >= 10) {
|
||||
local T = {
|
||||
x = 298,
|
||||
y = 287,
|
||||
offset1 = 242,
|
||||
offset2 = 122,
|
||||
imgoffset = 1,
|
||||
Xx = 19,
|
||||
Xy = 0
|
||||
};
|
||||
DrawKnightAndHpDrawFunction(T, "top4");
|
||||
}
|
||||
if (MyState >= 20) {
|
||||
local T = {
|
||||
x = 358,
|
||||
y = 176,
|
||||
offset1 = 400,
|
||||
offset2 = 244,
|
||||
imgoffset = 2,
|
||||
Xx = 19,
|
||||
Xy = 7
|
||||
};
|
||||
DrawKnightAndHpDrawFunction(T, "top2");
|
||||
}
|
||||
if (MyState >= 30) {
|
||||
local T = {
|
||||
x = 482,
|
||||
y = 88,
|
||||
offset1 = 121,
|
||||
offset2 = 59,
|
||||
imgoffset = 1,
|
||||
Xx = 19,
|
||||
Xy = 0
|
||||
};
|
||||
T_DrawDynamicAni(obj, "common/horseguessing/winnereffect_back.ani", X + T.x, Y + T.y, "骑士马战冠军背景");
|
||||
DrawKnightAndHpDrawFunction(T, "top1");
|
||||
T_DrawDynamicAni(obj, "common/horseguessing/winnereffect_front.ani", X + T.x - 15, Y + T.y - 10, "骑士马战冠军特效" + WinnerEffectTimer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//绘制公告
|
||||
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);
|
||||
}
|
||||
local Xpos = ((getroottable().Rindro_Scr_Width - 647) / 2).tointeger();
|
||||
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_ui.img", 26, Xpos, 160, 0, sq_RGBA(255, 255, 255, A), 1.0, 1.0);
|
||||
L_sq_DrawCode(NotiStr, Xpos + 366 - LenheartTextClass.GetStringLength(NotiStr), 160 + 44, sq_RGBA(255, 255, 255, A), 2, 1);
|
||||
if (Clock() - NotiTime >= 6000) {
|
||||
NotiState = false;
|
||||
}
|
||||
// NotiTime
|
||||
}
|
||||
}
|
||||
|
||||
function Show(obj) {
|
||||
DrawMain(obj);
|
||||
LenheartNewUI_Windows.Show(obj);
|
||||
|
||||
DrawAnimation(obj);
|
||||
DrawKnightAndHp(obj);
|
||||
}
|
||||
|
||||
//逻辑入口
|
||||
@@ -202,10 +593,18 @@ class HorseGuessingC extends LenheartNewUI_Windows {
|
||||
}
|
||||
}
|
||||
|
||||
function TopShow(obj) {
|
||||
DrawNoti(obj);
|
||||
}
|
||||
|
||||
|
||||
function OpenCallBack() {
|
||||
this.Visible = true;
|
||||
ResetFocus();
|
||||
//获取基础配置
|
||||
GetBaseConfig();
|
||||
//获取历史战绩
|
||||
GetPastRecord();
|
||||
}
|
||||
}
|
||||
getroottable().rawdelete("HorseGuessing_Obj");
|
||||
|
||||
@@ -18,9 +18,20 @@ class HorseGuessing_KnightInfoC extends LenheartNewUI_Windows {
|
||||
//输入框
|
||||
InputObject = null;
|
||||
|
||||
AniList = null;
|
||||
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
Childrens = [];
|
||||
AniList = [];
|
||||
for (local i = 0; i< 13; i++) {
|
||||
local obj = sq_getMyCharacter();
|
||||
local ani = obj.getVar().GetAnimationMap("common/horseguessing/knight" + i + ".ani", "common/horseguessing/knight" + i + ".ani");
|
||||
AniList.append({
|
||||
ani = ani,
|
||||
flag = false
|
||||
});
|
||||
}
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
|
||||
@@ -39,6 +50,10 @@ class HorseGuessing_KnightInfoC extends LenheartNewUI_Windows {
|
||||
}
|
||||
SendPackEx(T);
|
||||
}.bindenv(this);
|
||||
BetButton.SetCallBackFunc(function(Button) {
|
||||
if (Parent.MyState != 0) Button.Visible = false;
|
||||
else Button.Visible = true;
|
||||
}.bindenv(this));
|
||||
Childrens.append(BetButton);
|
||||
|
||||
InputObject = LenheartNewUI_BaseInput(80, 564, 76, 20);
|
||||
@@ -64,17 +79,21 @@ class HorseGuessing_KnightInfoC extends LenheartNewUI_Windows {
|
||||
|
||||
|
||||
//骑手胜率信息
|
||||
if (Parent.RiderInfo && Parent.RiderInfo.len() >= 5) {
|
||||
L_sq_DrawCode("获胜 : " + Parent.RiderInfo[2] + "次", X + 25 + 5, Y + 56 + 17, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||
L_sq_DrawCode(Parent.RiderInfo[0] + "胜" + Parent.RiderInfo[1] + "败", X + 25 + 5, Y + 56 + 17 + 19, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||
if (Parent.RiderInfo && Parent.RiderInfo.len() > Parent.NowSelectRider && "outcome" in Parent.RiderInfo[Parent.NowSelectRider]) {
|
||||
local Info = Parent.RiderInfo[Parent.NowSelectRider].outcome;
|
||||
L_sq_DrawCode("获胜 : " + Info[2] + "次", X + 15 + 5, Y + 20, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||
//胜负情况字符串
|
||||
local outcomeStr = Info[0] + "胜" + Info[1] + "败";
|
||||
L_sq_DrawCode(outcomeStr, X + 50 - LenheartTextClass.GetStringLength(outcomeStr) / 2, Y + 38, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||
local WinRate = 0;
|
||||
if (Parent.RiderInfo[0] + Parent.RiderInfo[1] != 0)
|
||||
WinRate = ((Parent.RiderInfo[0].tofloat() / (Parent.RiderInfo[0] + Parent.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 (Info[0] + Info[1] != 0) //判断不要0 / 0
|
||||
WinRate = ((Info[0].tofloat() / (Info[0] + Info[1]).tofloat()) * 100.0).tointeger();
|
||||
WinRate = "胜率 : " + WinRate + "%";
|
||||
L_sq_DrawCode(WinRate, X + 55 - LenheartTextClass.GetStringLength(WinRate) / 2, Y + 54, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||
|
||||
if (Parent.RiderInfo[3] != 0 && Parent.RiderInfo[4] != 0) {
|
||||
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", Parent.RiderInfo[3], X + 25 + 5 + 152, Y + 62);
|
||||
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", Parent.RiderInfo[4], X + 25 + 5 + 152, Y + 62 + 36);
|
||||
if (Info[3] != 0 && Info[4] != 0) {
|
||||
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", Info[3], X + 25 + 5 + 152, Y + 10);
|
||||
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", Info[4], X + 25 + 5 + 152, Y + 46);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,6 +126,14 @@ class HorseGuessing_KnightInfoC extends LenheartNewUI_Windows {
|
||||
if (InputObject.str.len() > 0 && InputObject.str.tointeger() > Parent.ResidueCoin) {
|
||||
InputObject.SetStr(Parent.ResidueCoin.tostring());
|
||||
}
|
||||
|
||||
//在城镇的时候才播放
|
||||
if (sq_GetCurrentModuleType() == 1) {
|
||||
foreach(value in AniList) {
|
||||
sq_AnimationProc(value.ani);
|
||||
sq_drawCurrentFrame(value.ani, -600, 0, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
68
Project/HorseGuessing/HorseGuessing_PastRecord.nut
Normal file
68
Project/HorseGuessing/HorseGuessing_PastRecord.nut
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
文件名:HorseGuessing_PastRecord.nut
|
||||
路径:Project/HorseGuessing/HorseGuessing_PastRecord.nut
|
||||
创建日期:2024-09-27 19:10
|
||||
文件用途:马战过往战绩窗口
|
||||
*/
|
||||
class HorseGuessing_PastRecordC extends LenheartNewUI_Windows {
|
||||
//调试模式
|
||||
// DeBugMode = true;
|
||||
|
||||
//不是窗口
|
||||
// NoWindow = true;
|
||||
|
||||
//是否可见
|
||||
// Visible = false;
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
Childrens = [];
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
|
||||
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
}
|
||||
|
||||
function RegisterWidget() {}
|
||||
|
||||
//绘制主界面
|
||||
function DrawMain(obj) {
|
||||
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 26, X, Y);
|
||||
|
||||
|
||||
if (Parent.InfoContestLog) {
|
||||
foreach(Pos, Value in Parent.InfoContestLog) {
|
||||
L_sq_DrawCode((format("%03d", Value.Periods)).tostring(), X + 6, Y + 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.code, X + 32, Y + 24 + (Pos * 20));
|
||||
L_sq_DrawCode(Parent.RiderName[Value.code], X + 32 + 28, Y + 26 + (Pos * 20), sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||
L_sq_DrawCode((format("%.2f", Value.SOdds.tofloat())).tostring(), X + 32 + 28 + 100, Y + 26 + (Pos * 20), sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Show(obj) {
|
||||
DrawMain(obj);
|
||||
LenheartNewUI_Windows.Show(obj);
|
||||
|
||||
}
|
||||
|
||||
//逻辑入口
|
||||
function Proc(obj) {
|
||||
LenheartNewUI_Windows.SyncPos(X - 7, Y - 50);
|
||||
|
||||
if (Parent && Parent.Visible && Parent.PageSelectM == 2) {
|
||||
Visible = true;
|
||||
X = Parent.X + 7;
|
||||
Y = Parent.Y + 50;
|
||||
} else {
|
||||
Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//因为要重载LenheartNewUI_Windows的构造函数
|
||||
function ResetFocus() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getroottable().rawdelete("HorseGuessing_Obj");
|
||||
Reference in New Issue
Block a user