11
This commit is contained in:
120
Project/HorseGuessing/HorseGuessing_KnightInfo.nut
Normal file
120
Project/HorseGuessing/HorseGuessing_KnightInfo.nut
Normal file
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
文件名:HorseGuessing_KnightInfo.nut
|
||||
路径:Project/HorseGuessing/HorseGuessing_KnightInfo.nut
|
||||
创建日期:2024-09-25 21:11
|
||||
文件用途:骑士信息
|
||||
*/
|
||||
class HorseGuessing_KnightInfoC extends LenheartNewUI_Windows {
|
||||
//调试模式
|
||||
// DeBugMode = true;
|
||||
|
||||
//不是窗口
|
||||
// NoWindow = true;
|
||||
|
||||
//是否可见
|
||||
// Visible = false;
|
||||
|
||||
|
||||
//输入框
|
||||
InputObject = null;
|
||||
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
Childrens = [];
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
|
||||
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
}
|
||||
|
||||
function RegisterWidget() {
|
||||
//下注按钮
|
||||
local BetButton = LenheartNewUI_BaseButton(54, 654, 129, 33, "interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 22);
|
||||
BetButton.OnClickSound = "BUTTON_01";
|
||||
BetButton.OnClick = function() {
|
||||
local T = {
|
||||
op = 20055005,
|
||||
code = Parent.NowSelectRider,
|
||||
num = InputObject.str,
|
||||
}
|
||||
SendPackEx(T);
|
||||
}.bindenv(this);
|
||||
Childrens.append(BetButton);
|
||||
|
||||
InputObject = LenheartNewUI_BaseInput(80, 564, 76, 20);
|
||||
AddChild(InputObject);
|
||||
}
|
||||
|
||||
//绘制主界面
|
||||
function DrawMain(obj) {
|
||||
|
||||
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 1, X, Y);
|
||||
L_sq_DrawImg("interface2/event/chn_event_2016/160927_joustmatches/joustmatches_info_window.img", 50, X + 7, Y + 12);
|
||||
|
||||
//DrawParent.RiderInfo
|
||||
T_DrawDynamicAni(obj, "common/horseguessing/knight" + Parent.NowSelectRider + ".ani", X + 2, Y + 130, "HorseGuessingRiderAnimotion" + Parent.NowSelectRider);
|
||||
T_DrawDynamicAni(obj, "common/horseguessing/knightinfoeffect.ani", X - 1, Y - 9, "HorseGuessingRiderAnimotionEff");
|
||||
|
||||
//绘制名字
|
||||
local RiderNameStr = Parent.RiderName[Parent.NowSelectRider];
|
||||
L_sq_DrawCode(RiderNameStr, X + 111 - (LenheartTextClass.GetStringLength(RiderNameStr) / 2), Y + 116 + 18 + 146 + 3, sq_RGBA(255, 255, 255, 250), 0, 1);
|
||||
|
||||
//绘制下注道具
|
||||
DrawItemBase(X + 74, Y + 320, Parent.BetItem, 1);
|
||||
|
||||
|
||||
//骑手胜率信息
|
||||
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);
|
||||
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 (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 (Parent.ResidueCoin != null) {
|
||||
L_sq_DrawCode(Parent.ResidueCoin.tostring(), X + 128, Y + 386, 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 - 210);
|
||||
|
||||
if (Parent && Parent.Visible && Parent.PageSelectM == 1) {
|
||||
Visible = true;
|
||||
X = Parent.X + 7;
|
||||
Y = Parent.Y + 50;
|
||||
} else {
|
||||
Visible = false;
|
||||
}
|
||||
|
||||
//判断如果输入的金额大于自身有的金额
|
||||
if (InputObject.str.len() > 0 && InputObject.str.tointeger() > Parent.ResidueCoin) {
|
||||
InputObject.SetStr(Parent.ResidueCoin.tostring());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//因为要重载LenheartNewUI_Windows的构造函数
|
||||
function ResetFocus() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getroottable().rawdelete("HorseGuessing_Obj");
|
||||
Reference in New Issue
Block a user