| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 文件名:Achievement.nut | 
					
						
							|  |  |  | 路径:Project/Achievement/Achievement.nut | 
					
						
							|  |  |  | 创建日期:2025-02-23	08:37 | 
					
						
							|  |  |  | 文件用途:成就系统 | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //类型按钮 | 
					
						
							|  |  |  | class Achievement_New_TypeButton extends LenheartNewUI_BaseButton { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function _typeof() { | 
					
						
							|  |  |  |         return "Achievement_TypeButton"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     State = 0; | 
					
						
							|  |  |  |     BaseIdx = 29; | 
					
						
							|  |  |  |     DWidth = null; | 
					
						
							|  |  |  |     Path = null; | 
					
						
							|  |  |  |     Idx = null; | 
					
						
							|  |  |  |     Pos = 0; | 
					
						
							|  |  |  |     isSelect = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //裁切位置 | 
					
						
							|  |  |  |     CutPosY_Start = null; | 
					
						
							|  |  |  |     CutPosY_End = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     constructor(W, H, Path, Idx, Pos, CYS, CYE) { | 
					
						
							|  |  |  |         this.DWidth = W; | 
					
						
							|  |  |  |         this.Path = Path; | 
					
						
							|  |  |  |         this.Idx = Idx; | 
					
						
							|  |  |  |         this.Pos = Pos; | 
					
						
							|  |  |  |         this.CutPosY_Start = CYS; | 
					
						
							|  |  |  |         this.CutPosY_End = CYE; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         LenheartNewUI_CommonUi.constructor(0, 0, W, H); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function Show(obj) { | 
					
						
							|  |  |  |         local MouseY = IMouse.GetYPos(); | 
					
						
							|  |  |  |         //按下 | 
					
						
							|  |  |  |         if (isLBDown) { | 
					
						
							|  |  |  |             L_sq_DrawImg(Path, Idx, X, Y); | 
					
						
							|  |  |  |             L_sq_DrawImg("achievement/buttoneffect.img", 0, X - 4, Y - 3); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         //悬停 | 
					
						
							|  |  |  |         else if (isInRect && !isSelect) { | 
					
						
							|  |  |  |             L_sq_DrawImg(Path, Idx, X, Y); | 
					
						
							|  |  |  |             L_sq_DrawImg("achievement/buttoneffect.img", 1, X + 2, Y + 2); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         //普通 | 
					
						
							|  |  |  |         else { | 
					
						
							|  |  |  |             L_sq_DrawImg(Path, Idx, X, Y); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (isSelect) { | 
					
						
							|  |  |  |             L_sq_DrawImg("achievement/buttoneffect.img", 0, X - 4, Y - 3); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //鼠标事件回调 | 
					
						
							|  |  |  |     function OnMouseProc(Flag, MousePos_X, MousePos_Y) { | 
					
						
							|  |  |  |         if (MousePos_Y< CutPosY_Start || MousePos_Y > (CutPosY_End)) { | 
					
						
							|  |  |  |             isInRect = false; | 
					
						
							|  |  |  |             return; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) isInRect = true; | 
					
						
							|  |  |  |         else isInRect = false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //鼠标左键按下回调 | 
					
						
							|  |  |  |     function OnMouseLbDown(MousePos_X, MousePos_Y) { | 
					
						
							|  |  |  |         if (MousePos_Y< CutPosY_Start || MousePos_Y > (CutPosY_End)) return; | 
					
						
							|  |  |  |         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); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //项目类完成按钮 | 
					
						
							|  |  |  | class Achievement_New_ItemButton extends LenheartNewUI_ButtonText { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //裁切位置 | 
					
						
							|  |  |  |     CutPosY_Start = null; | 
					
						
							|  |  |  |     CutPosY_End = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //鼠标事件回调 | 
					
						
							|  |  |  |     function OnMouseProc(Flag, MousePos_X, MousePos_Y) { | 
					
						
							|  |  |  |         if (MousePos_Y< CutPosY_Start || MousePos_Y > (CutPosY_End)) { | 
					
						
							|  |  |  |             isInRect = false; | 
					
						
							|  |  |  |             return; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) isInRect = true; | 
					
						
							|  |  |  |         else isInRect = false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //鼠标左键按下回调 | 
					
						
							|  |  |  |     function OnMouseLbDown(MousePos_X, MousePos_Y) { | 
					
						
							|  |  |  |         if (MousePos_Y< CutPosY_Start || MousePos_Y > (CutPosY_End)) return; | 
					
						
							|  |  |  |         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); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //项目类 | 
					
						
							|  |  |  | class AchievementNC_Item { | 
					
						
							|  |  |  |     //Img | 
					
						
							|  |  |  |     Img = null; | 
					
						
							|  |  |  |     //编号 | 
					
						
							|  |  |  |     Idx = null; | 
					
						
							|  |  |  |     //父对象 | 
					
						
							|  |  |  |     Parent = null; | 
					
						
							|  |  |  |     //坐标 | 
					
						
							|  |  |  |     X = 0; | 
					
						
							|  |  |  |     Y = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Info = null; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |     SuccessButton = null; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |     constructor(Window, Idx, Info) { | 
					
						
							|  |  |  |         Parent = Window; | 
					
						
							|  |  |  |         Img = Window.Img["widget"]; | 
					
						
							|  |  |  |         this.Idx = Idx; | 
					
						
							|  |  |  |         this.Info = Info; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //完成按钮 | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |         SuccessButton = Achievement_New_ItemButton(42 + 85 + 85, 420, 15, "完成"); | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |         SuccessButton.DWidth = -5; | 
					
						
							|  |  |  |         SuccessButton.Width = 50; | 
					
						
							| 
									
										
										
										
											2025-06-13 21:47:54 +08:00
										 |  |  |         SuccessButton.OnClickEx = function(Button) { | 
					
						
							|  |  |  |             if (Button.State == 8) return; | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |             Parent.SendPackEx({ | 
					
						
							|  |  |  |                 op = 20093005, | 
					
						
							|  |  |  |                 cjid = Parent.CurrentTypePage, | 
					
						
							|  |  |  |                 id = this.Info.Id | 
					
						
							|  |  |  |             }); | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |         }.bindenv(this); | 
					
						
							|  |  |  |         SuccessButton.SetCallBackFunc(function(Button) { | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |             Button.X = (X + 174).tointeger(); | 
					
						
							|  |  |  |             Button.Y = (Y + 30).tointeger(); | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |             Button.CutPosY_Start = Parent.Y + 110; | 
					
						
							|  |  |  |             Button.CutPosY_End = Parent.Y + 496; | 
					
						
							|  |  |  |         }.bindenv(this)); | 
					
						
							|  |  |  |         Parent.ItemButtonList.append(SuccessButton); | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         SetInfo(Info ? Info : { | 
					
						
							|  |  |  |             Name = "测试的成就名称", | 
					
						
							|  |  |  |             Desc = "0/100", | 
					
						
							|  |  |  |             Explain = "默认描述", | 
					
						
							|  |  |  |             Exp = sq_getRandom(1, 99).tostring(), | 
					
						
							|  |  |  |             IsSuccess = 0 | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function SetInfo(Info) { | 
					
						
							|  |  |  |         this.Info = Info; | 
					
						
							| 
									
										
										
										
											2025-06-11 09:51:28 +08:00
										 |  |  |         if (this.Info.IsSuccess == 0) { | 
					
						
							|  |  |  |             SuccessButton.State = 8; | 
					
						
							|  |  |  |             SuccessButton.TextStr = "未达成" | 
					
						
							|  |  |  |             SuccessButton.SetTextOffset(-11, 2); | 
					
						
							|  |  |  |         } else if (this.Info.IsSuccess == 1) { | 
					
						
							|  |  |  |             SuccessButton.State = 8; | 
					
						
							|  |  |  |             SuccessButton.TextStr = "已完成" | 
					
						
							|  |  |  |             SuccessButton.SetTextOffset(-11, 2); | 
					
						
							|  |  |  |             SuccessButton.Visible = false; | 
					
						
							|  |  |  |         } else if (this.Info.IsSuccess == 2) { | 
					
						
							|  |  |  |             SuccessButton.TextStr = "完成" | 
					
						
							|  |  |  |             SuccessButton.SetTextOffset(-4, 1); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function Show() { | 
					
						
							|  |  |  |         //绘制底槽 | 
					
						
							|  |  |  |         Img.DrawPng(6, X, Y); | 
					
						
							|  |  |  |         Img.DrawPng(6, X, Y); | 
					
						
							|  |  |  |         //绘制旗帜 | 
					
						
							|  |  |  |         Img.DrawPng(7, X + 9, Y + 9); | 
					
						
							|  |  |  |         //绘制经验值 | 
					
						
							|  |  |  |         L_sq_DrawCode(Info.Exp, X - LenheartTextClass.GetStringLength(Info.Exp) / 2 + 30, Y + 39, sq_RGBA(230, 200, 155, 255), 0, 1); | 
					
						
							|  |  |  |         //绘制成就名称 | 
					
						
							|  |  |  |         L_sq_DrawCode(Info.Name, X + 60, Y + 12, sq_RGBA(230, 200, 155, 255), 0, 1); | 
					
						
							|  |  |  |         //绘制成就描述 | 
					
						
							|  |  |  |         L_sq_DrawCode(Info.Desc, X + 60, Y + 30, sq_RGBA(174, 174, 174, 255), 0, 1); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |     function TopShow() { | 
					
						
							|  |  |  |         if (IMouse.GetXPos() > X && IMouse.GetXPos()< X + 236 && IMouse.GetYPos() > Y && IMouse.GetYPos()< Y + 66) { | 
					
						
							| 
									
										
										
										
											2025-06-10 09:17:53 +08:00
										 |  |  |             if (IMouse.GetYPos() >= Parent.Y + 110 && IMouse.GetYPos() <= Parent.Y + 496) { | 
					
						
							|  |  |  |                 L_sq_DrawWindow(X - 8, Y - 4 - 66, 236, 50, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13); | 
					
						
							|  |  |  |                 //绘制成就描述 | 
					
						
							|  |  |  |                 L_sq_DrawCode_Ex(Info.Explain, X, Y - 4 - 66 + 8, sq_RGBA(174, 174, 174, 255), 0, 1); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //高级绘制文字(带换行) | 
					
						
							|  |  |  |     function L_sq_DrawCode_Ex(str, x, y, rgba, mb, jc) { | 
					
						
							|  |  |  |         local strarr = []; | 
					
						
							|  |  |  |         if (str.find("\\n") == null) L_sq_DrawCode(str, x, y, rgba, mb, jc); | 
					
						
							|  |  |  |         else { | 
					
						
							|  |  |  |             local Bpos = 0; | 
					
						
							|  |  |  |             while (true) { | 
					
						
							|  |  |  |                 local Npos = str.find("\\n", Bpos); | 
					
						
							|  |  |  |                 if (!Npos) { | 
					
						
							|  |  |  |                     local strbuff = str.slice(Bpos, str.len()); | 
					
						
							|  |  |  |                     strarr.append(strbuff); | 
					
						
							|  |  |  |                     break; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 local strbuff = str.slice(Bpos, Npos); | 
					
						
							|  |  |  |                 strarr.append(strbuff); | 
					
						
							|  |  |  |                 Bpos = Npos + 2; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             for (local z = 0; z< strarr.len(); z++) { | 
					
						
							|  |  |  |                 L_sq_DrawCode(strarr[z], x, y + (z * 14), rgba, mb, jc); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |     function Proc() { | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |         X = (Parent.X + 235 + (Idx % 2 * 248)).tointeger(); | 
					
						
							|  |  |  |         Y = (Parent.Y - Parent.ItemScrollRate * Parent.ItemScrollValue + 121 + (Idx / 2 * 72)).tointeger(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //商品类 | 
					
						
							|  |  |  | class AchievementNC_MerchandiseItem { | 
					
						
							|  |  |  |     //Img | 
					
						
							|  |  |  |     Img = null; | 
					
						
							|  |  |  |     //UI | 
					
						
							| 
									
										
										
										
											2025-07-05 22:29:26 +08:00
										 |  |  |     // UI = Rindro_Image("interface/lenheartwindowcommon.img"); | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |     //编号 | 
					
						
							|  |  |  |     Idx = null; | 
					
						
							|  |  |  |     //父对象 | 
					
						
							|  |  |  |     Parent = null; | 
					
						
							|  |  |  |     //坐标 | 
					
						
							|  |  |  |     X = 0; | 
					
						
							|  |  |  |     Y = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Info = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     BuyButton = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     constructor(Window, Idx, Info) { | 
					
						
							|  |  |  |         Parent = Window; | 
					
						
							|  |  |  |         Img = Window.Img["widget"]; | 
					
						
							|  |  |  |         this.Idx = Idx; | 
					
						
							|  |  |  |         this.Info = Info; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //购买按钮 | 
					
						
							|  |  |  |         BuyButton = Achievement_New_ItemButton(42 + 85 + 85, 420, 15, "购买"); | 
					
						
							|  |  |  |         BuyButton.DWidth = -5; | 
					
						
							|  |  |  |         BuyButton.Width = 50; | 
					
						
							|  |  |  |         BuyButton.SetTextOffset(-4, 1); | 
					
						
							|  |  |  |         BuyButton.OnClick = function() { | 
					
						
							| 
									
										
										
										
											2025-06-10 09:17:53 +08:00
										 |  |  |             Parent.SendPackEx({ | 
					
						
							|  |  |  |                 op = 20093025, | 
					
						
							|  |  |  |                 itemPos = Idx | 
					
						
							|  |  |  |             }); | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |         }.bindenv(this); | 
					
						
							|  |  |  |         BuyButton.SetCallBackFunc(function(Button) { | 
					
						
							|  |  |  |             Button.X = (X + 174).tointeger(); | 
					
						
							|  |  |  |             Button.Y = (Y + 30).tointeger(); | 
					
						
							|  |  |  |             Button.CutPosY_Start = Parent.Y + 110; | 
					
						
							|  |  |  |             Button.CutPosY_End = Parent.Y + 496; | 
					
						
							|  |  |  |         }.bindenv(this)); | 
					
						
							|  |  |  |         Parent.ItemButtonList.append(BuyButton); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         SetInfo(Info ? Info : { | 
					
						
							|  |  |  |             Id = 3037, | 
					
						
							|  |  |  |             Name = "测试物品", | 
					
						
							|  |  |  |             CurrentLimit = 0, | 
					
						
							|  |  |  |             Limit = 0, | 
					
						
							|  |  |  |             NeedItemId = 3037, | 
					
						
							|  |  |  |             NeedItemCount = 1, | 
					
						
							|  |  |  |             NeedItemId2 = 3038, | 
					
						
							|  |  |  |             NeedItemCount2 = 1, | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function SetInfo(Info) { | 
					
						
							|  |  |  |         this.Info = Info; | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |     function GetItemNeedStr(ItemId, ItemCount) { | 
					
						
							|  |  |  |         if (ItemId == 0) return "金币 x" + ItemCount; | 
					
						
							|  |  |  |         else if (ItemId != -1) { | 
					
						
							|  |  |  |             local Name = Parent.GetItemNameById(ItemId); | 
					
						
							|  |  |  |             return Name + " x" + ItemCount; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             return ""; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function Show() { | 
					
						
							|  |  |  |         //绘制底槽 | 
					
						
							|  |  |  |         Img.DrawPng(6, X, Y); | 
					
						
							|  |  |  |         Img.DrawPng(6, X, Y); | 
					
						
							|  |  |  |         //绘制物品槽 | 
					
						
							|  |  |  |         Img.DrawPng(5, X + 12, Y + 18); | 
					
						
							|  |  |  |         Parent.DrawItemBase(X + 12 + 3, Y + 18 + 3, Info.Id, 1); | 
					
						
							|  |  |  |         //绘制物品名称 | 
					
						
							|  |  |  |         L_sq_DrawCode(format("%s (%d/%d)", Info.Name, Info.CurrentLimit, Info.Limit), X + 60, Y + 12, sq_RGBA(230, 200, 155, 255), 0, 1); | 
					
						
							|  |  |  |         //绘制所需物品名称 | 
					
						
							|  |  |  |         local Str1 = GetItemNeedStr(Info.NeedItemId, Info.NeedItemCount); | 
					
						
							|  |  |  |         if (Str1.len() > 0) L_sq_DrawCode("-> " + Str1, X + 60, Y + 30, sq_RGBA(174, 174, 174, 255), 0, 1); | 
					
						
							|  |  |  |         local Str2 = GetItemNeedStr(Info.NeedItemId2, Info.NeedItemCount2); | 
					
						
							|  |  |  |         if (Str2.len() > 0) L_sq_DrawCode("-> " + Str2, X + 60, Y + 46, sq_RGBA(174, 174, 174, 255), 0, 1); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function TopShow() {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //高级绘制文字(带换行) | 
					
						
							|  |  |  |     function L_sq_DrawCode_Ex(str, x, y, rgba, mb, jc) { | 
					
						
							|  |  |  |         local strarr = []; | 
					
						
							|  |  |  |         if (str.find("\\n") == null) L_sq_DrawCode(str, x, y, rgba, mb, jc); | 
					
						
							|  |  |  |         else { | 
					
						
							|  |  |  |             local Bpos = 0; | 
					
						
							|  |  |  |             while (true) { | 
					
						
							|  |  |  |                 local Npos = str.find("\\n", Bpos); | 
					
						
							|  |  |  |                 if (!Npos) { | 
					
						
							|  |  |  |                     local strbuff = str.slice(Bpos, str.len()); | 
					
						
							|  |  |  |                     strarr.append(strbuff); | 
					
						
							|  |  |  |                     break; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 local strbuff = str.slice(Bpos, Npos); | 
					
						
							|  |  |  |                 strarr.append(strbuff); | 
					
						
							|  |  |  |                 Bpos = Npos + 2; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             for (local z = 0; z< strarr.len(); z++) { | 
					
						
							|  |  |  |                 L_sq_DrawCode(strarr[z], x, y + (z * 14), rgba, mb, jc); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function Proc() { | 
					
						
							|  |  |  |         X = (Parent.X + 235 + (Idx % 2 * 248)).tointeger(); | 
					
						
							|  |  |  |         Y = (Parent.Y - Parent.ItemScrollRate * Parent.ItemScrollValue + 121 + (Idx / 2 * 72)).tointeger(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class AchievementNC extends LenheartNewUI_Windows { | 
					
						
							|  |  |  |     //调试模式 | 
					
						
							|  |  |  |     // DeBugMode = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //不是窗口 | 
					
						
							|  |  |  |     // NoWindow = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //是否可见 | 
					
						
							| 
									
										
										
										
											2025-06-12 23:48:23 +08:00
										 |  |  |     Visible = false; | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |     //脚本数据 | 
					
						
							|  |  |  |     ScriptInfo = null; | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     //图像对象 | 
					
						
							|  |  |  |     Img = null; | 
					
						
							|  |  |  |     //当前页面类型 | 
					
						
							|  |  |  |     CurrentTypePage = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //等级对象 | 
					
						
							|  |  |  |     Level = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //项目集合 | 
					
						
							|  |  |  |     ItemList = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //类型按钮集合 | 
					
						
							|  |  |  |     TypeButton = null; | 
					
						
							|  |  |  |     //类型按钮滚动条对象 | 
					
						
							|  |  |  |     TypeButtonScrollBar = null; | 
					
						
							|  |  |  |     //类型按钮滚轮值 | 
					
						
							|  |  |  |     TypeButtonScrollRate = 0; | 
					
						
							| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  |     TypeButtonScrollValue = 160; | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     //项目按钮集合 | 
					
						
							|  |  |  |     ItemButtonList = null; | 
					
						
							|  |  |  |     //项目滚动条对象 | 
					
						
							|  |  |  |     ItemScrollBar = null; | 
					
						
							|  |  |  |     //项目滚轮值 | 
					
						
							|  |  |  |     ItemScrollRate = 0; | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |     ItemScrollValue = 400; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //查询成就状态 | 
					
						
							|  |  |  |     function QueryTheAchievementStatus() { | 
					
						
							|  |  |  |         SendPackEx({ | 
					
						
							|  |  |  |             op = 20093001, | 
					
						
							|  |  |  |             cjid = CurrentTypePage | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     //查询商店信息 | 
					
						
							|  |  |  |     function QueryShopInfo() { | 
					
						
							|  |  |  |         SendPackEx({ | 
					
						
							|  |  |  |             op = 20093021 | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { | 
					
						
							|  |  |  |         Childrens = []; | 
					
						
							|  |  |  |         TypeButton = []; | 
					
						
							|  |  |  |         ItemButtonList = []; | 
					
						
							|  |  |  |         LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |         //给一个等级的默认值 | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |         Level = { | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |             lv = 1, | 
					
						
							|  |  |  |             exp = 0, | 
					
						
							| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  |             maxexp = 100, | 
					
						
							|  |  |  |             itemId = 3037 | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |         //读取pvf数据 | 
					
						
							|  |  |  |         InitScriptData(); | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |         //构造Img | 
					
						
							|  |  |  |         InitImg(); | 
					
						
							|  |  |  |         //构造类型按钮 | 
					
						
							|  |  |  |         InitTypeButton(); | 
					
						
							|  |  |  |         //构造商店按钮 | 
					
						
							|  |  |  |         InitShopButton(); | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |         //构造组件按钮 | 
					
						
							|  |  |  |         InitWidgetButton(); | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |         //构造项目 | 
					
						
							|  |  |  |         InitItem(); | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         //查询成就回包 | 
					
						
							|  |  |  |         RegisterPack(20093002, function(Chunk) { | 
					
						
							|  |  |  |             //清空右侧项目集合 | 
					
						
							|  |  |  |             ItemList = []; | 
					
						
							|  |  |  |             ItemButtonList = []; | 
					
						
							|  |  |  |             local Jso = Json.Decode(Chunk); | 
					
						
							|  |  |  |             Level.lv = Jso.lv.lv + 1; | 
					
						
							|  |  |  |             Level.exp = Jso.lv.exp; | 
					
						
							|  |  |  |             Level.maxexp = Jso.lv.maxexp; | 
					
						
							| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  |             Level.itemId = Jso.lv.itemId; | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |             foreach(Pos, obj in Jso.achievement) { | 
					
						
							|  |  |  |                 local PvfData = ScriptInfo[CurrentTypePage][obj.id]; | 
					
						
							|  |  |  |                 local Item = AchievementNC_Item(this, Pos, { | 
					
						
							|  |  |  |                     Id = obj.id, | 
					
						
							|  |  |  |                     Name = PvfData.name, | 
					
						
							|  |  |  |                     Explain = PvfData.explain, | 
					
						
							|  |  |  |                     Desc = obj.currentNum + "/" + obj.maxNum, | 
					
						
							|  |  |  |                     Exp = obj.exp.tostring(), | 
					
						
							|  |  |  |                     IsSuccess = obj.achievement | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |                 ItemList.append(Item); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2025-06-11 09:51:28 +08:00
										 |  |  |             if (Jso.rawin("scroll_value")) ItemScrollValue = Jso.scroll_value; | 
					
						
							| 
									
										
										
										
											2025-06-13 21:47:54 +08:00
										 |  |  |             if (Jso.rawin("scrollbj_value")) ItemScrollBar.SetStep(Jso.scrollbj_value / 100.0); | 
					
						
							| 
									
										
										
										
											2025-06-11 09:51:28 +08:00
										 |  |  |             // ItemScrollValue = ((ItemList.len() - 10) / 2 * 71).tointeger(); | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |         }.bindenv(this)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //查询商店回包 | 
					
						
							|  |  |  |         RegisterPack(20093022, function(Chunk) { | 
					
						
							|  |  |  |             //清空右侧项目集合 | 
					
						
							|  |  |  |             ItemList = []; | 
					
						
							|  |  |  |             ItemButtonList = []; | 
					
						
							|  |  |  |             local Jso = Json.Decode(Chunk); | 
					
						
							|  |  |  |             foreach(Pos, obj in Jso.info) { | 
					
						
							|  |  |  |                 local ItemName = GetItemNameById(obj.itemId); | 
					
						
							|  |  |  |                 local Item = AchievementNC_MerchandiseItem(this, Pos, { | 
					
						
							|  |  |  |                     Id = obj.itemId, | 
					
						
							|  |  |  |                     Name = ItemName, | 
					
						
							|  |  |  |                     Limit = obj.limit, | 
					
						
							|  |  |  |                     CurrentLimit = obj.currentNum, | 
					
						
							|  |  |  |                     NeedItemId = obj.reItemId, | 
					
						
							|  |  |  |                     NeedItemCount = obj.reItemNum, | 
					
						
							|  |  |  |                     NeedItemId2 = obj.reItemId2, | 
					
						
							|  |  |  |                     NeedItemCount2 = obj.reItemNum2, | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |                 ItemList.append(Item); | 
					
						
							| 
									
										
										
										
											2025-06-11 09:51:28 +08:00
										 |  |  |                 if (Jso.rawin("scroll_value")) ItemScrollValue = Jso.scroll_value; | 
					
						
							| 
									
										
										
										
											2025-06-13 21:47:54 +08:00
										 |  |  |                 if (Jso.rawin("scrollbj_value")) ItemScrollBar.SetStep(Jso.scrollbj_value / 100.0); | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |             } | 
					
						
							|  |  |  |         }.bindenv(this)); | 
					
						
							| 
									
										
										
										
											2025-06-12 23:48:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //播放动画回包 | 
					
						
							|  |  |  |         RegisterPack(20093014, function(Chunk) { | 
					
						
							|  |  |  |             local Jso = Json.Decode(Chunk); | 
					
						
							|  |  |  |             DrawAniMark = Jso.ani; | 
					
						
							|  |  |  |             DrawAniT = Clock(); | 
					
						
							|  |  |  |         }.bindenv(this)); | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function InitScriptData() { | 
					
						
							|  |  |  |         ScriptInfo = {}; | 
					
						
							|  |  |  |         Rindro_Script.GetFileData("etc/rindro/achievement/achievement.etc", function(DataTable, Data) { | 
					
						
							|  |  |  |             while (!Data.Eof()) { | 
					
						
							|  |  |  |                 local Buffer = Data.Get(); | 
					
						
							|  |  |  |                 if (Buffer == "[item]") { | 
					
						
							|  |  |  |                     Data.Get(); | 
					
						
							|  |  |  |                     local Type = Data.Get(); | 
					
						
							|  |  |  |                     Data.Get(); | 
					
						
							|  |  |  |                     local Id = Data.Get(); | 
					
						
							|  |  |  |                     Data.Get(); | 
					
						
							|  |  |  |                     local namebuf = Data.Get(); | 
					
						
							|  |  |  |                     namebuf = Sq_ConvertWideChar(namebuf, "big5") | 
					
						
							|  |  |  |                     Data.Get(); | 
					
						
							|  |  |  |                     local explainbuf = Data.Get(); | 
					
						
							|  |  |  |                     explainbuf = Sq_ConvertWideChar(explainbuf, "big5") | 
					
						
							|  |  |  |                     Data.Get(); | 
					
						
							|  |  |  |                     if (!ScriptInfo.rawin(Type)) ScriptInfo[Type] <- {}; | 
					
						
							|  |  |  |                     ScriptInfo[Type][Id] <- { | 
					
						
							|  |  |  |                         name = namebuf, | 
					
						
							|  |  |  |                         explain = explainbuf | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }.bindenv(this)); | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function InitTypeButton() { | 
					
						
							| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  |         for (local i = 0; i< 8; i++) { | 
					
						
							| 
									
										
										
										
											2025-06-10 09:17:53 +08:00
										 |  |  |             local Button = Achievement_New_TypeButton(171, 50, "achievement/typebutton.img", i, i, Y + 108, Y + 424) | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |             Button.SetCallBackFunc(function(Button) { | 
					
						
							|  |  |  |                 Button.X = X + 28; | 
					
						
							|  |  |  |                 Button.Y = Y + 110 + 60 * Button.Pos - (TypeButtonScrollRate * TypeButtonScrollValue).tointeger(); | 
					
						
							|  |  |  |             }.bindenv(this)); | 
					
						
							|  |  |  |             Button.OnClickEx = function(Button) { | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |                 //将其他的选中状态取消选中自己 | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |                 foreach(Btn in TypeButton) { | 
					
						
							|  |  |  |                     Btn.isSelect = false; | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |                 Button.isSelect = true; | 
					
						
							|  |  |  |                 //设定当前页面类型 | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |                 CurrentTypePage = Button.Pos; | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |                 //还原右侧滚动条 | 
					
						
							|  |  |  |                 ItemScrollBar.Reset(); | 
					
						
							|  |  |  |                 //查询 | 
					
						
							|  |  |  |                 QueryTheAchievementStatus(); | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |             }.bindenv(this); | 
					
						
							|  |  |  |             TypeButton.append(Button); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         TypeButtonScrollBar = Yosin_ScrollBar(204, 109, 317, 180); | 
					
						
							|  |  |  |         TypeButtonScrollBar.SetParent(this); | 
					
						
							|  |  |  |         TypeButtonScrollBar.SetStep(20 / 100.0); | 
					
						
							|  |  |  |         TypeButtonScrollBar.SetOnChange(function(Rate) { | 
					
						
							|  |  |  |             TypeButtonScrollRate = Rate; | 
					
						
							|  |  |  |         }.bindenv(this)); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |     function InitShopButton() { | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |         //商店按钮 | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |         local ShopButton = LenheartNewUI_BaseButton(34, 435, 160, 61, "achievement/shopbutton.img", 0); | 
					
						
							|  |  |  |         ShopButton.OnClick = function() { | 
					
						
							|  |  |  |             CurrentTypePage = -99; | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |             foreach(Btn in TypeButton) { | 
					
						
							|  |  |  |                 Btn.isSelect = false; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             QueryShopInfo(); | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |         }.bindenv(this); | 
					
						
							|  |  |  |         Childrens.append(ShopButton); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         ItemScrollBar = Yosin_ScrollBar(723, 114, 382, 180); | 
					
						
							|  |  |  |         ItemScrollBar.SetParent(this); | 
					
						
							|  |  |  |         ItemScrollBar.SetStep(20 / 100.0); | 
					
						
							|  |  |  |         ItemScrollBar.SetOnChange(function(Rate) { | 
					
						
							|  |  |  |             ItemScrollRate = Rate; | 
					
						
							|  |  |  |         }.bindenv(this)); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |     function InitWidgetButton() { | 
					
						
							|  |  |  |         //关闭按钮 | 
					
						
							|  |  |  |         local CloseButton = LenheartNewUI_BaseButton(734, 0, 11, 12, "interface/lenheartwindowcommon.img", 276); | 
					
						
							|  |  |  |         CloseButton.OnClick = function() { | 
					
						
							|  |  |  |             this.Visible = false; | 
					
						
							|  |  |  |         }.bindenv(this); | 
					
						
							|  |  |  |         Childrens.append(CloseButton); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |     function InitImg() { | 
					
						
							|  |  |  |         Img = {}; | 
					
						
							|  |  |  |         Img["background"] <- Rindro_Image("achievement/background.img"); | 
					
						
							|  |  |  |         Img["logo"] <- Rindro_Image("achievement/logo.img"); | 
					
						
							|  |  |  |         Img["buttoneffect"] <- Rindro_Image("achievement/buttoneffect.img"); | 
					
						
							|  |  |  |         Img["typebutton"] <- Rindro_Image("achievement/typebutton.img"); | 
					
						
							|  |  |  |         Img["widget"] <- Rindro_Image("achievement/widget.img"); | 
					
						
							|  |  |  |         Img["lv"] <- Rindro_Image("achievement/lv.img"); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function InitItem() { | 
					
						
							|  |  |  |         ItemList = []; | 
					
						
							|  |  |  |         for (local i = 0; i< 15; i++) { | 
					
						
							|  |  |  |             local Item = AchievementNC_Item(this, i, null); | 
					
						
							|  |  |  |             ItemList.append(Item); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //绘制主界面 | 
					
						
							|  |  |  |     function DrawMain(obj) { | 
					
						
							|  |  |  |         //绘制底层窗口 | 
					
						
							|  |  |  |         Img["background"].DrawPng(CurrentTypePage > 0 ? CurrentTypePage : 0, X, Y); | 
					
						
							|  |  |  |         //绘制logo | 
					
						
							|  |  |  |         Img["logo"].DrawPng(0, X + 25, Y + 40); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //绘制常规页面 | 
					
						
							|  |  |  |         if (CurrentTypePage != -99) { | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |             //上背景框 | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |             Img["widget"].DrawPng(0, X + 220, Y + 45); | 
					
						
							|  |  |  |             //经验 | 
					
						
							|  |  |  |             Img["widget"].DrawPng(2, X + 223, Y + 86); | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |             setClip(X + 223, Y + 86, X + 229 + (Level.exp.tofloat() / Level.maxexp.tofloat() * 463).tointeger(), Y + 90 + 6); | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |             Img["widget"].DrawPng(3, X + 229, Y + 90); | 
					
						
							|  |  |  |             releaseClip(); //裁切结束 | 
					
						
							| 
									
										
										
										
											2025-06-11 09:51:28 +08:00
										 |  |  |             //绘制经验值 | 
					
						
							|  |  |  |             local ExpStr = Level.exp + "/" + Level.maxexp; | 
					
						
							|  |  |  |             L_sq_DrawCode(ExpStr, X - LenheartTextClass.GetStringLength(ExpStr) / 2 + 678, Y + 74, sq_RGBA(230, 200, 155, 255), 0, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |             //旗帜 | 
					
						
							|  |  |  |             Img["widget"].DrawPng(4, X + 226, Y + 55); | 
					
						
							|  |  |  |             //奖励底槽 | 
					
						
							|  |  |  |             Img["widget"].DrawPng(5, X + 697, Y + 65); | 
					
						
							| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  |             DrawItemBase(X + 697 + 3, Y + 65 + 3, Level.itemId, 1); | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |             //绘制等级 | 
					
						
							|  |  |  |             Img["lv"].DrawPng(10, X + 252, Y + 63); | 
					
						
							|  |  |  |             DrawNum(format("%02d", Level.lv), X + 274, Y + 63); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |         //下背景框 | 
					
						
							|  |  |  |         Img["widget"].DrawPng(1, X + 220, Y + 109); | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-12 23:48:23 +08:00
										 |  |  |     function TopShow(obj) { | 
					
						
							|  |  |  |         DrawAni(obj); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-12 23:48:23 +08:00
										 |  |  |     DrawAniMark = null; | 
					
						
							|  |  |  |     DrawAniT = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function DrawAni(obj) { | 
					
						
							| 
									
										
										
										
											2025-06-13 21:47:54 +08:00
										 |  |  |         if (DrawAniMark == null || DrawAniT == null) return; | 
					
						
							| 
									
										
										
										
											2025-06-12 23:48:23 +08:00
										 |  |  |         local Ani = T_DrawDynamicAni(obj, "etc/rindro/achievement/" + DrawAniMark + ".ani", 0, 0, "新成就系统动画" + DrawAniMark); | 
					
						
							|  |  |  |         if (sq_IsEnd(Ani)) { | 
					
						
							|  |  |  |             DrawAniMark = null; | 
					
						
							|  |  |  |             DrawAniT = null; | 
					
						
							| 
									
										
										
										
											2025-06-30 00:25:43 +08:00
										 |  |  |             sq_Rewind(Ani); | 
					
						
							| 
									
										
										
										
											2025-06-12 23:48:23 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |     function Show(obj) { | 
					
						
							|  |  |  |         DrawMain(obj); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         LenheartNewUI_BaseWindow.Show(obj); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //左侧裁切 | 
					
						
							|  |  |  |         setClip(X + 15, Y + 108, X + 214, Y + 424); | 
					
						
							|  |  |  |         foreach(Window in TypeButton) { | 
					
						
							|  |  |  |             if (Window.CallBackFunc) Window.CallBackFunc(Window); | 
					
						
							|  |  |  |             if (Window.Visible) { | 
					
						
							|  |  |  |                 Window.Show(obj); | 
					
						
							|  |  |  |                 Window.TopShow(obj); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         releaseClip(); //裁切结束 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //右侧裁切 | 
					
						
							|  |  |  |         setClip(X + 221, Y + 110, X + 733, Y + 496); | 
					
						
							|  |  |  |         //绘制项目 | 
					
						
							|  |  |  |         foreach(Item in ItemList) { | 
					
						
							|  |  |  |             Item.Show(); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |         //项目的按钮层 | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |         foreach(Window in ItemButtonList) { | 
					
						
							|  |  |  |             if (Window.CallBackFunc) Window.CallBackFunc(Window); | 
					
						
							|  |  |  |             if (Window.Visible) { | 
					
						
							|  |  |  |                 Window.Show(obj); | 
					
						
							|  |  |  |                 Window.TopShow(obj); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         releaseClip(); //裁切结束 | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |         //用来显示悬停之类的顶层信息 | 
					
						
							|  |  |  |         foreach(Item in ItemList) { | 
					
						
							|  |  |  |             Item.TopShow(); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     RegisFlag = false; | 
					
						
							|  |  |  |     //逻辑入口 | 
					
						
							|  |  |  |     function Proc(obj) { | 
					
						
							|  |  |  |         LenheartNewUI_Windows.SyncPos(X, Y); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //项目Proc | 
					
						
							|  |  |  |         foreach(Item in ItemList) { | 
					
						
							|  |  |  |             Item.Proc(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         local RootTab = getroottable(); | 
					
						
							|  |  |  |         if (RootTab.rawin("L_PlayerEach_Obj") && RegisFlag == false) { | 
					
						
							|  |  |  |             RegisFlag = true; | 
					
						
							|  |  |  |             RootTab["L_PlayerEach_Obj"].AddEachForCommon("查看收集信息", function(SThis) { | 
					
						
							|  |  |  |                 //关闭按钮 | 
					
						
							|  |  |  |                 local ApplyEngagementButton = LenheartNewUI_Each_BaseButton(0, 0, 100, 21, "interface2/popup_menu/popup_back.img", 3); | 
					
						
							|  |  |  |                 ApplyEngagementButton.Icon = "interface2/popup_menu/popup_icon_cn.img"; | 
					
						
							|  |  |  |                 ApplyEngagementButton.IconIdx = 58; | 
					
						
							|  |  |  |                 ApplyEngagementButton.Str = "查看收集信息"; | 
					
						
							|  |  |  |                 ApplyEngagementButton.OnClick = function(Button) { | 
					
						
							|  |  |  |                     if (L_Sq_GetPlayerEachName().len() <= 0 || L_Sq_GetPlayerEachName() == L_Sq_GetObjectName(sq_GetMyMasterCharacter())) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     } else { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                     Button.Parent.CloseAllEach(); | 
					
						
							|  |  |  |                 }.bindenv(this); | 
					
						
							|  |  |  |                 ApplyEngagementButton.SetCallBackFunc(function(Button) {}) | 
					
						
							|  |  |  |                 SThis.AddChild(ApplyEngagementButton); | 
					
						
							|  |  |  |             }.bindenv(this)); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //鼠标事件回调 | 
					
						
							|  |  |  |     function OnMouseProc(Flag, MousePos_X, MousePos_Y) { | 
					
						
							|  |  |  |         LenheartNewUI_BaseWindow.OnMouseProc(Flag, MousePos_X, MousePos_Y); | 
					
						
							|  |  |  |         foreach(Window in TypeButton) { | 
					
						
							|  |  |  |             Window.OnMouseProc(Flag, MousePos_X, MousePos_Y); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         foreach(Window in ItemButtonList) { | 
					
						
							|  |  |  |             Window.OnMouseProc(Flag, MousePos_X, MousePos_Y); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     //鼠标左键按下回调 | 
					
						
							|  |  |  |     function OnMouseLbDown(MousePos_X, MousePos_Y) { | 
					
						
							|  |  |  |         LenheartNewUI_BaseWindow.OnMouseLbDown(MousePos_X, MousePos_Y); | 
					
						
							|  |  |  |         foreach(Window in TypeButton) { | 
					
						
							|  |  |  |             Window.OnMouseLbDown(MousePos_X, MousePos_Y); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         foreach(Window in ItemButtonList) { | 
					
						
							|  |  |  |             Window.OnMouseLbDown(MousePos_X, MousePos_Y); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     //鼠标左键弹起回调 | 
					
						
							|  |  |  |     function OnMouseLbUp(MousePos_X, MousePos_Y) { | 
					
						
							|  |  |  |         LenheartNewUI_BaseWindow.OnMouseLbUp(MousePos_X, MousePos_Y); | 
					
						
							|  |  |  |         foreach(Window in TypeButton) { | 
					
						
							|  |  |  |             Window.OnMouseLbUp(MousePos_X, MousePos_Y); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         foreach(Window in ItemButtonList) { | 
					
						
							|  |  |  |             Window.OnMouseLbUp(MousePos_X, MousePos_Y); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     //鼠标滚轮时间回调 | 
					
						
							|  |  |  |     function OnMouseWheel(Flag, MousePos_X, MousePos_Y) { | 
					
						
							|  |  |  |         LenheartNewUI_BaseWindow.OnMouseWheel(Flag, MousePos_X, MousePos_Y); | 
					
						
							|  |  |  |         //左侧的滚动条判定 | 
					
						
							|  |  |  |         if (MousePos_X > (X + 15) && MousePos_X<(X + 214) && MousePos_Y > (Y + 108) && MousePos_Y<(Y + 424)) { | 
					
						
							|  |  |  |             if (Flag) TypeButtonScrollBar.DoStep(-1); | 
					
						
							|  |  |  |             if (!Flag) TypeButtonScrollBar.DoStep(1); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         //右侧的滚动条判定 | 
					
						
							|  |  |  |         if (MousePos_X > (X + 221) && MousePos_X<(X + 733) && MousePos_Y > (Y + 110) && MousePos_Y<(Y + 496)) { | 
					
						
							|  |  |  |             if (Flag) ItemScrollBar.DoStep(-1); | 
					
						
							|  |  |  |             if (!Flag) ItemScrollBar.DoStep(1); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function DrawNum(Str, dx, dy) { | 
					
						
							|  |  |  |         for (local i = 0; i< Str.len(); i++) { | 
					
						
							|  |  |  |             local DrawNum = Str.slice(i, i + 1); | 
					
						
							|  |  |  |             Img["lv"].DrawPng(DrawNum.tointeger(), dx + (i * 8), dy); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function OpenCallBack() { | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  |         Visible = true; | 
					
						
							|  |  |  |         //查询 | 
					
						
							|  |  |  |         QueryTheAchievementStatus(); | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-06-09 00:36:27 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-06 21:58:18 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function Lenheart_Achievement_Fun(obj) { | 
					
						
							|  |  |  |     local RootTab = getroottable(); | 
					
						
							|  |  |  |     if (!RootTab.rawin("AchievementN_Obj")) { | 
					
						
							|  |  |  |         RootTab.rawset("AchievementN_Obj", true); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         local Win = LenheartNewUI_CreateWindow(AchievementNC, "成就系统窗口", ((getroottable().Rindro_Scr_Width - 753) / 2).tointeger(), 35, 753, 518, 20); | 
					
						
							|  |  |  |         EventList_Obj.AddEvent("成就系统", 118, Win); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | getroottable()["LenheartFuncTab"].rawset("AchievementFuncN", Lenheart_Achievement_Fun); |