156 lines
		
	
	
		
			4.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			156 lines
		
	
	
		
			4.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| /*
 | |
| 文件名:RepairWorldMap.nut
 | |
| 路径:Project/RepairWorldMap/RepairWorldMap.nut
 | |
| 创建日期:2024-08-10	08:04
 | |
| 文件用途:修补世界地图
 | |
| */
 | |
| YosinWorldMapX <- 0;
 | |
| YosinWorldMapY <- 0;
 | |
| 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 = [];
 | |
|         Info = {};
 | |
|         //注册控件
 | |
|         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);
 | |
| 
 | |
|         Info = Rindro_Script.GetFileData("region/region.lst", function(DataTable, Data) {
 | |
|             while (!Data.Eof()) {
 | |
|                 local Key = Data.Get();
 | |
|                 local Path = "region/" + Data.Get();
 | |
|                 local RgnInfo = Rindro_Script.GetFileData(Path, function(DataTableA, Data) {
 | |
|                     while (!Data.Eof()) {
 | |
|                         local Str = Data.Get();
 | |
|                         if (Str == "[name]") {
 | |
|                             DataTableA.Name <- Sq_ConvertWideChar(Data.Get(), "big5");
 | |
|                         }
 | |
|                     }
 | |
|                 });
 | |
|                 DataTable.rawset(Key.tointeger() - 1, {
 | |
|                     Name = RgnInfo.Name
 | |
|                 });
 | |
|             }
 | |
|         }.bindenv(this));
 | |
|         Info.rawdelete("filepath");
 | |
|     }
 | |
| 
 | |
|     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 + YosinWorldMapX, 7 + YosinWorldMapY);
 | |
|         //绘制区域名称
 | |
|         L_sq_DrawCode(Info[AreaId].Name, 135 + YosinWorldMapX, 10 + YosinWorldMapY, 0xFFFFFFFF, 1, 1);
 | |
| 
 | |
|         if (TabbarFlag) {
 | |
|             foreach(Pos, Value in Info) {
 | |
|                 L_sq_DrawImg("interface/minimap_minimap_town.img", 9, 131 + YosinWorldMapX, 25 + (Pos * 18) + YosinWorldMapY);
 | |
|                 // L_sq_DrawWindow(128, 24 + (Pos * 18), 108, 10, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
 | |
|                 L_sq_DrawCode(Value.Name, 135 + YosinWorldMapX, 28 + (Pos * 18) + YosinWorldMapY, 0xFFFFFFFF, 1, 1);
 | |
|                 if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 131 + YosinWorldMapX, 25 + (Pos * 18) + YosinWorldMapY, 108, 18)) {
 | |
|                     MarkFlag = Pos;
 | |
|                     L_sq_SetDrawImgModel(2, 0);
 | |
|                     L_sq_DrawImg("interface/minimap_minimap_town.img", 16, 131 + YosinWorldMapX, 25 + (Pos * 18) + YosinWorldMapY);
 | |
|                     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) {
 | |
|     local RootTab = getroottable();
 | |
|     if (!RootTab.rawin("RepairWorldMap_Obj")) {
 | |
|         RootTab.rawset("RepairWorldMap_Obj", LenheartNewUI_CreateWindow(RepairWorldMapC, "世界地图修补", 230 + YosinWorldMapX, 0 + YosinWorldMapY, 30, 30, 0));
 | |
|     }
 | |
| }
 | |
| 
 | |
| getroottable()["LenheartFuncTab"].rawset("RepairWorldMapFuncN", Lenheart_RepairWorldMap_Fun); |