| 
									
										
										
										
											2024-09-27 14:04:23 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 文件名: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; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-29 16:52:10 +08:00
										 |  |  |     AniList = null; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-27 14:04:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { | 
					
						
							|  |  |  |         Childrens = []; | 
					
						
							| 
									
										
										
										
											2024-10-01 10:12:27 +08:00
										 |  |  |         // 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 | 
					
						
							|  |  |  |         //     }); | 
					
						
							|  |  |  |         // } | 
					
						
							| 
									
										
										
										
											2024-09-27 14:04:23 +08:00
										 |  |  |         //注册控件 | 
					
						
							|  |  |  |         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); | 
					
						
							| 
									
										
										
										
											2024-09-29 16:52:10 +08:00
										 |  |  |         BetButton.SetCallBackFunc(function(Button) { | 
					
						
							|  |  |  |             if (Parent.MyState != 0) Button.Visible = false; | 
					
						
							|  |  |  |             else Button.Visible = true; | 
					
						
							|  |  |  |         }.bindenv(this)); | 
					
						
							| 
									
										
										
										
											2024-09-27 14:04:23 +08:00
										 |  |  |         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); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //骑手胜率信息 | 
					
						
							| 
									
										
										
										
											2024-09-29 16:52:10 +08:00
										 |  |  |         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); | 
					
						
							| 
									
										
										
										
											2024-09-27 14:04:23 +08:00
										 |  |  |             local WinRate = 0; | 
					
						
							| 
									
										
										
										
											2024-09-29 16:52:10 +08:00
										 |  |  |             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 (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); | 
					
						
							| 
									
										
										
										
											2024-09-27 14:04:23 +08:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //绘制剩余道具数量 | 
					
						
							|  |  |  |         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()); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-09-29 16:52:10 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-01 10:12:27 +08:00
										 |  |  |         // //在城镇的时候才播放 | 
					
						
							|  |  |  |         // if (sq_GetCurrentModuleType() == 1) { | 
					
						
							|  |  |  |         //     foreach(value in AniList) { | 
					
						
							|  |  |  |         //         sq_AnimationProc(value.ani); | 
					
						
							|  |  |  |         //         sq_drawCurrentFrame(value.ani, -600, 0, true); | 
					
						
							|  |  |  |         //     } | 
					
						
							|  |  |  |         // } | 
					
						
							| 
									
										
										
										
											2024-09-27 14:04:23 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //因为要重载LenheartNewUI_Windows的构造函数 | 
					
						
							|  |  |  |     function ResetFocus() { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | getroottable().rawdelete("HorseGuessing_Obj"); |