| 
									
										
										
										
											2024-09-16 17:09:36 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 文件名:RepairWorldMap.nut | 
					
						
							|  |  |  | 路径:Project/RepairWorldMap/RepairWorldMap.nut | 
					
						
							|  |  |  | 创建日期:2024-08-10	08:04 | 
					
						
							|  |  |  | 文件用途:修补世界地图 | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | class RepairWorldMapC extends LenheartNewUI_Windows { | 
					
						
							|  |  |  |     //调试模式 | 
					
						
							|  |  |  |     // DeBugMode = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //开启状态 | 
					
						
							|  |  |  |     OpenState = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //不是窗口 | 
					
						
							|  |  |  |     NoWindow = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //是否可见 | 
					
						
							|  |  |  |     Visible = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //世界地图信息 | 
					
						
							|  |  |  |     Info = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //当前城镇编号 | 
					
						
							|  |  |  |     AreaId = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //下拉框打开Flag | 
					
						
							|  |  |  |     TabbarFlag = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //选中Flag | 
					
						
							|  |  |  |     MarkFlag = -1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function GetWorldMap_CallBack(Chunk) { | 
					
						
							|  |  |  |         local Jso = Json.Decode(Chunk); | 
					
						
							|  |  |  |         Info = Jso; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { | 
					
						
							|  |  |  |         Childrens = []; | 
					
						
							|  |  |  |         //注册控件 | 
					
						
							|  |  |  |         RegisterWidget(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         Pack_Control.rawset(20240802, GetWorldMap_CallBack.bindenv(this)); | 
					
						
							|  |  |  |         L_sq_WAB(0x1031B33, 0x90); | 
					
						
							|  |  |  |         L_sq_WAB(0x1031B34, 0x90); | 
					
						
							|  |  |  |         L_sq_WAB(0x1031B35, 0x90); | 
					
						
							|  |  |  |         L_sq_WAB(0x1031B36, 0x90); | 
					
						
							|  |  |  |         L_sq_WAB(0x1031B37, 0x90); | 
					
						
							|  |  |  |         L_sq_WAB(0x1031B38, 0x90); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function RegisterWidget() { | 
					
						
							|  |  |  |         //三角按钮 | 
					
						
							|  |  |  |         local Button = LenheartNewUI_BaseButton(7, 8, 21, 21, "interface/windowcommon.img", 59); | 
					
						
							|  |  |  |         Button.OnClick = function() { | 
					
						
							|  |  |  |             TabbarFlag = !TabbarFlag; | 
					
						
							|  |  |  |         }.bindenv(this); | 
					
						
							|  |  |  |         Childrens.append(Button); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //绘制主界面 | 
					
						
							|  |  |  |     function DrawMain(obj) { | 
					
						
							|  |  |  |         if (!getroottable().rawin("RINDRO_CONFIG")) { | 
					
						
							|  |  |  |             return; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         //黑框 | 
					
						
							|  |  |  |         L_sq_DrawImg("interface/minimap_minimap_town.img", 8, 131, 7); | 
					
						
							|  |  |  |         //绘制区域名称 | 
					
						
							|  |  |  |         L_sq_DrawCode(getroottable().RINDRO_CONFIG.region[AreaId].Name, 135, 10, 0xFFFFFFFF, 1, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (TabbarFlag) { | 
					
						
							|  |  |  |             foreach(Pos, Value in getroottable().RINDRO_CONFIG.region) { | 
					
						
							|  |  |  |                 L_sq_DrawImg("interface/minimap_minimap_town.img", 9, 131, 25 + (Pos * 18)); | 
					
						
							|  |  |  |                 // L_sq_DrawWindow(128, 24 + (Pos * 18), 108, 10, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); | 
					
						
							|  |  |  |                 L_sq_DrawCode(Value.Name, 135, 28 + (Pos * 18), 0xFFFFFFFF, 1, 1); | 
					
						
							|  |  |  |                 if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 131, 25 + (Pos * 18), 108, 18)) { | 
					
						
							|  |  |  |                     MarkFlag = Pos; | 
					
						
							|  |  |  |                     L_sq_SetDrawImgModel(2, 0); | 
					
						
							|  |  |  |                     L_sq_DrawImg("interface/minimap_minimap_town.img", 16, 131, 25 + (Pos * 18)); | 
					
						
							|  |  |  |                     L_sq_ReleaseDrawImgModel(); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //鼠标左键弹起回调 overr | 
					
						
							|  |  |  |     function OnMouseLbUp(MousePos_X, MousePos_Y) { | 
					
						
							|  |  |  |         //还原编队的鼠标指针 | 
					
						
							|  |  |  |         if (this.MarkFlag != -1) { | 
					
						
							|  |  |  |             AreaId = MarkFlag; | 
					
						
							|  |  |  |             L_sq_Select_MiniMap_Index(AreaId + 1); | 
					
						
							|  |  |  |             this.MarkFlag = -1; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (TabbarFlag) TabbarFlag = false; | 
					
						
							|  |  |  |         LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function Show(obj) { | 
					
						
							|  |  |  |         DrawMain(obj); | 
					
						
							|  |  |  |         LenheartNewUI_Windows.Show(obj); | 
					
						
							|  |  |  |         if (!OpenState) { | 
					
						
							|  |  |  |             CloseWindow(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         OpenState = false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //逻辑入口 | 
					
						
							|  |  |  |     function Proc(obj) { | 
					
						
							|  |  |  |         LenheartNewUI_Windows.SyncPos(X, Y); | 
					
						
							|  |  |  |         if (OpenState) { | 
					
						
							|  |  |  |             Visible = true; | 
					
						
							|  |  |  |             ResetFocus(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | //回调函数 | 
					
						
							|  |  |  | function Sq_DrawMiniMapUI(obj) { | 
					
						
							|  |  |  |     if ("RepairWorldMap_Obj" in getroottable()) { | 
					
						
							|  |  |  |         RepairWorldMap_Obj.OpenState = true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | getroottable().rawdelete("RepairWorldMap_Obj"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function Lenheart_RepairWorldMap_Fun(obj) { | 
					
						
							| 
									
										
										
										
											2024-09-27 14:04:23 +08:00
										 |  |  |     return; | 
					
						
							| 
									
										
										
										
											2024-09-16 17:09:36 +08:00
										 |  |  |     local RootTab = getroottable(); | 
					
						
							|  |  |  |     if (!RootTab.rawin("RepairWorldMap_Obj")) { | 
					
						
							|  |  |  |         RootTab.rawset("RepairWorldMap_Obj", LenheartNewUI_CreateWindow(RepairWorldMapC, "世界地图修补", 230, 0, 30, 30, 0)); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | getroottable()["LenheartFuncTab"].rawset("RepairWorldMapFuncN", Lenheart_RepairWorldMap_Fun); |