798 lines
		
	
	
		
			27 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			798 lines
		
	
	
		
			27 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
|  | /* | ||
|  | 文件名:DamageFont.nut | ||
|  | 路径:Plugins/DamageFont/DamageFont.nut | ||
|  | 创建日期:2023-06-25	18:00 | ||
|  | 文件用途:伤害字体 | ||
|  | */ | ||
|  | 
 | ||
|  | //HudPro按钮类 | ||
|  | class DamageFontIMGPro extends BasicsDrawTool //  obj  --  按钮名称  --  X坐标  --  Y坐标  --  Ani调用路径  --  宽度  --  高度 | ||
|  | { | ||
|  |     obj = null; //Obj对象 | ||
|  |     State = 0; //按钮状态 | ||
|  |     ClickEnble = false; //点击效果 | ||
|  |     ButtonDynamic = false; //动态按钮效果 | ||
|  |     BaseFrame = null; | ||
|  | 
 | ||
|  |     CustomClickEnble = false; //自定义点击效果 | ||
|  |     CustomClickAnifile = null; //自定义点击效果Ani路径 | ||
|  |     CustomButtonName = null; //自定义点击效果名称 | ||
|  |     CustomClickFrame = null; //自定义点击效果Ani编号 | ||
|  |     CustomClickx = null; //自定义点击效果X坐标 | ||
|  |     CustomClicky = null; //自定义点击效果Y坐标 | ||
|  | 
 | ||
|  | 
 | ||
|  |     RectEnble = false; //悬停效果 | ||
|  |     RectButtonName = null; //悬停名称 | ||
|  |     RectBaseAnifile = null; //悬停Ani路径 | ||
|  |     RectFrame = null; //非动态按钮的悬停调用Ani编号 | ||
|  |     Rectx = null; //悬停X坐标 | ||
|  |     Recty = null; //悬停Y坐标 | ||
|  | 
 | ||
|  | 
 | ||
|  |     ButtonName = null; //按钮名称 | ||
|  |     x = null; //X坐标 | ||
|  |     y = null; //Y坐标 | ||
|  |     BaseAnifile = null; //调用Ani路径 | ||
|  |     width = null; //可点击宽度 | ||
|  |     length = null; //可点击高度 | ||
|  | 
 | ||
|  |     Mobj = null; //鼠标对象 | ||
|  |     //构造函数 | ||
|  |     constructor(gObj, gButtonName, gX, gY, gAnifile, gWidth, gLength, gBaseFrame) { | ||
|  |         obj = gObj; | ||
|  |         ButtonName = gButtonName; | ||
|  |         x = gX; | ||
|  |         y = gY; | ||
|  |         BaseAnifile = gAnifile; | ||
|  |         width = gWidth; | ||
|  |         length = gLength; | ||
|  |         BaseFrame = gBaseFrame; | ||
|  |         if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"]; | ||
|  |     } | ||
|  | 
 | ||
|  |     function T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName) { | ||
|  |         L_sq_DrawImg(CustomClickAnifile, CustomClickFrame, CustomClickx, CustomClicky); | ||
|  |     } | ||
|  | 
 | ||
|  |     //绘制按钮 | ||
|  |     function Show() { | ||
|  |         if (ClickEnble) //是否开启点击效果 | ||
|  |         { | ||
|  |             if (isLBDown() && State == 0) //按下左键并且按钮处于弹起状态 | ||
|  |             { | ||
|  |                 State = 1; //按键进入按下状态 | ||
|  |                 ++y; | ||
|  |             } | ||
|  |             if (!isLBDown() && State == 1) //按下左键并且按钮处于弹起状态 | ||
|  |             { | ||
|  |                 State = 0; //按键进入弹起状态 | ||
|  |                 --y; | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  |         if (CustomClickEnble) //是否开启自定义点击效果 | ||
|  |         { | ||
|  |             if (isLBDown()) //按下左键并且按钮处于弹起状态 | ||
|  |             { | ||
|  |                 if (!ButtonDynamic) T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName); | ||
|  |                 else T_DrawDynamicAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomButtonName); | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  |         if (RectEnble) //开启悬停效果时 | ||
|  |         { | ||
|  |             if ((isInRect() && !isLBDown()) || (isInRect() && !CustomClickEnble)) //如果鼠标悬停的时候  并且没有点击的时候 | ||
|  |             { | ||
|  |                 //IMouse.SetMouseTask(44); | ||
|  |                 if (!ButtonDynamic) T_DrawStayAni(obj, RectBaseAnifile, Rectx, Recty, RectFrame, RectButtonName); | ||
|  |                 else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName); | ||
|  |             } | ||
|  |         } | ||
|  |         if (!isInRect()) //如果鼠标没有悬停的时候 | ||
|  |         { | ||
|  |             //IMouse.SetMouseTask(0); | ||
|  |             if (!ButtonDynamic) T_DrawStayAni(obj, BaseAnifile, x, y, BaseFrame, ButtonName); | ||
|  |             else T_DrawDynamicAni(obj, BaseAnifile, x, y, ButtonName); | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  |     //设置自定义点击效果 | ||
|  |     function SetCustomClickEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) { | ||
|  |         CustomClickEnble = bool; //自定义点击效果 | ||
|  |         CustomClickAnifile = gAnifile; //自定义点击效果Ani路径 | ||
|  |         CustomButtonName = gButtonName; //自定义点击效果名称 | ||
|  |         CustomClickFrame = gFrame; //自定义点击效果Ani编号 | ||
|  |         CustomClickx = gX; //自定义点击效果X坐标 | ||
|  |         CustomClicky = gY; //自定义点击效果Y坐标 | ||
|  |     } | ||
|  | 
 | ||
|  |     //设置悬停效果 | ||
|  |     function SetRectEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) { | ||
|  |         RectEnble = bool; //悬停效果 | ||
|  |         RectButtonName = gButtonName; //悬停名称 | ||
|  |         RectBaseAnifile = gAnifile; //悬停Ani路径 | ||
|  |         RectFrame = gFrame; //非动态按钮的悬停调用Ani编号 | ||
|  |         Rectx = gX; //悬停X坐标 | ||
|  |         Recty = gY; //悬停Y坐标 | ||
|  |     } | ||
|  | 
 | ||
|  |     //设置动态按钮 | ||
|  |     function SetClickEnble(bool) { | ||
|  |         ButtonDynamic = bool; | ||
|  |     } | ||
|  | 
 | ||
|  |     //设置点击效果 | ||
|  |     function SetClickEnble(bool) { | ||
|  |         ClickEnble = bool; | ||
|  |     } | ||
|  | 
 | ||
|  |     //悬停状态 | ||
|  |     function isInRect() { | ||
|  |         if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 5, 5, x, y, width, length)) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  |     //左键按下状态 | ||
|  |     function isLBDown() { | ||
|  |         if (isInRect() && Mobj.Lb == 1) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  |     //左键弹起状态 | ||
|  |     function isLBUp() { | ||
|  |         if (isInRect() && Mobj.Lb == 0) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  | 
 | ||
|  |     //左键单击状态 | ||
|  |     function isLBActive() { | ||
|  |         if (isInRect() && Mobj.LbEvent) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | class DamageFontWindow extends BasicsDrawTool { | ||
|  |     //宽度 | ||
|  |     Width = null; | ||
|  |     //高度 | ||
|  |     Height = null; | ||
|  |     //标题高度 | ||
|  |     TitleH = null; | ||
|  | 
 | ||
|  |     //X坐标 | ||
|  |     X = null; | ||
|  |     B_X = null; | ||
|  |     //Y坐标 | ||
|  |     Y = null; | ||
|  |     B_Y = null; | ||
|  | 
 | ||
|  |     YMouseSw = true; | ||
|  |     DeBugMode = false; | ||
|  | 
 | ||
|  |     Mobj = null; | ||
|  |     M_Xpos = null; | ||
|  |     M_Ypos = null; | ||
|  | 
 | ||
|  | 
 | ||
|  |     constructor(gX, gY, gWidth, gHeight, gTitleH) { | ||
|  |         //宽度 | ||
|  |         Width = gWidth; | ||
|  |         //高度 | ||
|  |         Height = gHeight; | ||
|  |         //标题高度 | ||
|  |         TitleH = gTitleH; | ||
|  | 
 | ||
|  |         //X坐标 | ||
|  |         X = gX; | ||
|  |         //Y坐标 | ||
|  |         Y = gY; | ||
|  | 
 | ||
|  |         if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"]; | ||
|  |     } | ||
|  | 
 | ||
|  |     //设定鼠标逻辑 | ||
|  |     function LockMouse() { | ||
|  |         if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, Width, Height)) { | ||
|  |             IMouse.LockMouseClick(); | ||
|  |             YMouseSw = false; | ||
|  |         } else { | ||
|  |             if (YMouseSw == false && sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 0, 0, 800, 600)) { | ||
|  |                 IMouse.ReleaseMouseClick(); | ||
|  |                 YMouseSw = true; | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  |     } | ||
|  | 
 | ||
|  |     //设定窗口拖动逻辑 | ||
|  |     function MoveWindow() { | ||
|  |         if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, Width, TitleH)) { | ||
|  | 
 | ||
|  |             if (Mobj.Lb == 1) { | ||
|  |                 if (!M_Xpos) M_Xpos = IMouse.GetXPos(); //原始鼠标位置数据 | ||
|  |                 if (!M_Ypos) M_Ypos = IMouse.GetYPos(); | ||
|  |                 if (!B_X) B_X = X; //原始窗口位置 | ||
|  |                 if (!B_Y) B_Y = Y; | ||
|  | 
 | ||
|  |                 X = B_X - (M_Xpos - IMouse.GetXPos()); | ||
|  |                 Y = B_Y - (M_Ypos - IMouse.GetYPos()); | ||
|  | 
 | ||
|  |             } else if (Mobj.Lb == 0) { | ||
|  |                 M_Xpos = null; | ||
|  |                 M_Ypos = null; | ||
|  |                 B_X = null; | ||
|  |                 B_Y = null; | ||
|  |             } | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  |     function Show(obj) { | ||
|  |         if (DeBugMode) sq_DrawBox(X, Y, Width, Height, 0xffffffff); | ||
|  | 
 | ||
|  |         //设定鼠标逻辑 | ||
|  |         LockMouse(); | ||
|  | 
 | ||
|  |         //设定窗口拖动逻辑 | ||
|  |         MoveWindow(); | ||
|  | 
 | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | class DamageFontObjectC extends BasicsDrawTool { | ||
|  |     X = 0; | ||
|  |     Y = 0; | ||
|  |     IDX = null; | ||
|  |     UIdx = null; | ||
|  |     Name = null; | ||
|  |     ImgPath = null; | ||
|  |     MaxNumArr = null; | ||
|  |     Mobj = null; //鼠标对象 | ||
|  |     ID = null; | ||
|  | 
 | ||
|  |     constructor(gIdx, gName, gImgPath, gMaxNumArr, gUIdx, gId) { | ||
|  |         this.IDX = gIdx; | ||
|  |         this.Name = gName; | ||
|  |         this.ImgPath = gImgPath; | ||
|  |         this.MaxNumArr = gMaxNumArr; | ||
|  |         this.UIdx = gUIdx; | ||
|  |         this.ID = gId; | ||
|  |         if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"]; | ||
|  |     } | ||
|  | 
 | ||
|  |     //绘制 | ||
|  |     function Show(obj, x, y) { | ||
|  |         X = x; | ||
|  |         Y = y; | ||
|  | 
 | ||
|  |         //绘制底 | ||
|  |         L_sq_DrawImg("interface2/skinstorage/slots.img", 0, x, y); | ||
|  |         //绘制伤害字体999 | ||
|  |         // local Idx = 70; | ||
|  |         // if (MaxNumArr.len() >= 3) Idx = 72; | ||
|  |         // L_sq_DrawImg(ImgPath, Idx, x + 3, y + 26); | ||
|  |         L_Sq_DrawItem(X + 22, Y + 23, ID, 1, 0, 0, 0); | ||
|  |         //绘制盖子 | ||
|  |         L_sq_DrawImg("interface2/skinstorage/slots.img", 2, x, y); | ||
|  |         // | ||
|  |         L_sq_DrawCode(Name, X + 84, Y + 23, sq_RGBA(178, 155, 113, 250), 0, 1); | ||
|  |         L_sq_DrawCode("Yosin皮肤字体", X + 84, Y + 40, sq_RGBA(255, 177, 0, 250), 0, 1); | ||
|  |         L_sq_DrawCode("无限制使用", X + 84, Y + 55, sq_RGBA(255, 85, 0, 250), 0, 1); | ||
|  | 
 | ||
|  | 
 | ||
|  |         //绘制选中效果 | ||
|  |         if (getroottable()["DamageFontCObj"].FocusPrintIdx == IDX) L_sq_DrawImg("interface2/skinstorage/slots.img", 4, x, y); | ||
|  |         //绘制应用中 | ||
|  |         if (getroottable()["DamageFontCObj"].NowDamageSkinIndex == IDX) L_sq_DrawImg("interface2/skinstorage/slots.img", 23, x + 290, y + 3); | ||
|  | 
 | ||
|  | 
 | ||
|  |         //绘制应用按钮 | ||
|  |         local Button = DamageFontIMGPro(obj, "应用", x + 284, y + 26, "interface2/yosin/windowscommon.img", 56, 24, 12); | ||
|  |         Button.SetRectEnble(true, "应用", x + 284, y + 26, "interface2/yosin/windowscommon.img", 13); | ||
|  |         Button.SetCustomClickEnble(true, "应用", x + 284, y + 26, "interface2/yosin/windowscommon.img", 14); | ||
|  |         Button.Show(); | ||
|  |         if (Button.isInRect()) L_sq_DrawCode("应用", Button.x + 16, Button.y + 5, sq_RGBA(231, 198, 132, 250), 0, 1); | ||
|  |         else L_sq_DrawCode("应用", Button.x + 16, Button.y + 5, sq_RGBA(189, 148, 99, 250), 0, 1); | ||
|  |         if (Button.isLBActive()) { | ||
|  |             local T = { | ||
|  |                 op = 20024003, | ||
|  |                 UseIdx = UIdx, | ||
|  |             } | ||
|  |             SendPack(T); | ||
|  |             getroottable()["DamageFontCObj"].NowDamageSkinIndex = IDX; | ||
|  |             getroottable()["DamageFontCObj"].InitDamageFont(IDX); | ||
|  |         } | ||
|  | 
 | ||
|  |         if (isLBActive()) { | ||
|  |             getroottable()["DamageFontCObj"].FocusPrintIdx = IDX; | ||
|  |             getroottable()["DamageFontCObj"].InitDamageFont(IDX); | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  | 
 | ||
|  |     //悬停状态 | ||
|  |     function isInRect() { | ||
|  |         if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 5, 5, X, Y, 354, 74)) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  |     //左键按下状态 | ||
|  |     function isLBDown() { | ||
|  |         if (isInRect() && Mobj.Lb == 1) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  |     //左键弹起状态 | ||
|  |     function isLBUp() { | ||
|  |         if (isInRect() && Mobj.Lb == 0) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  | 
 | ||
|  |     //左键单击状态 | ||
|  |     function isLBActive() { | ||
|  |         if (isInRect() && Mobj.LbEvent) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | class DamageFontC extends BasicsDrawTool { | ||
|  |     WindowObj = null; //窗口对象 | ||
|  |     MainState = false; //主状态 | ||
|  |     X = 6; | ||
|  |     Y = 6; | ||
|  | 
 | ||
|  |     //当前字体皮肤编号 | ||
|  |     NowDamageSkinIndex = null; | ||
|  |     //字体皮肤数据 | ||
|  |     DamageSkinList = null; | ||
|  |     //数字伤害类型 | ||
|  |     RealType = null; | ||
|  |     //滚动列表对象 | ||
|  |     Sobj = null; | ||
|  | 
 | ||
|  |     //最大伤害数字 | ||
|  |     MaxDamageNumber = 999999; | ||
|  | 
 | ||
|  |     //显示对象 | ||
|  |     FocusPrintIdx = 0; | ||
|  |     //Nut白字倍率 | ||
|  |     NutWRate = 0; | ||
|  | 
 | ||
|  |     //获取字体列表信息 | ||
|  |     function GetFontList() { | ||
|  |         local T = { | ||
|  |             op = 20024001, | ||
|  |         } | ||
|  |         SendPack(T); | ||
|  |     } | ||
|  | 
 | ||
|  |     //获取字体列表信息回调 | ||
|  |     function GetFontListCallBack(Chunk) { | ||
|  |         // Sout("收到包 %L", Chunk); | ||
|  |         local Buffer = Json_STL("CheckDamageFontCObjGetBaseInfoCallBackBuffer"); | ||
|  |         Buffer.Parse(Chunk, 0, false); | ||
|  |         local RootTab = getroottable(); | ||
|  |         if (RootTab.rawin("DamageFontCObj")) { | ||
|  |             local Tobj = RootTab["DamageFontCObj"]; | ||
|  |             Tobj.DamageSkinList = null; | ||
|  |             Tobj.DamageSkinList = []; | ||
|  | 
 | ||
|  |             Tobj.MaxDamageNumber = Buffer.Get("MaxDamageNumber"); | ||
|  |             // Tobj.MaxDamageNumber = 9999; | ||
|  |             Tobj.NowDamageSkinIndex = Buffer.Get("UseIdx"); | ||
|  |             Tobj.FocusPrintIdx = Buffer.Get("UseIdx"); | ||
|  | 
 | ||
|  |             for (local i = 0; i< 100; i++) { | ||
|  |                 local gIdx = Buffer.Get("FontArray->" + i + "->gIdx"); | ||
|  |                 if (gIdx == false) break; | ||
|  |                 local cIdx = Buffer.Get("FontArray->" + i + "->cIdx"); | ||
|  |                 local gName = Buffer.Get("FontArray->" + i + "->gName"); | ||
|  |                 local gItem = Buffer.Get("FontArray->" + i + "->itemId"); | ||
|  | 
 | ||
|  |                 local gImgPath = Buffer.Get("FontArray->" + i + "->gImgPath"); | ||
|  | 
 | ||
|  | 
 | ||
|  |                 local gMaxNumArr = []; | ||
|  |                 for (local z = 0; z< 100; z++) { | ||
|  |                     local buf = Buffer.Get("FontArray->" + i + "->gMaxNumArr->" + z); | ||
|  |                     if (!buf) break; | ||
|  |                     gMaxNumArr.append(buf); | ||
|  |                 } | ||
|  |                 local gKeyMaxNumArr = []; | ||
|  |                 for (local y = 0; y< 100; y++) { | ||
|  |                     local buf = Buffer.Get("FontArray->" + i + "->gKeyMaxNumArr->" + y); | ||
|  |                     if (!buf) break; | ||
|  |                     gKeyMaxNumArr.append(buf); | ||
|  |                 } | ||
|  |                 local T = { | ||
|  |                     Idx = cIdx, //伤害字体排列编号 | ||
|  |                     UIdx = gIdx, //伤害字体编号 | ||
|  |                     Name = gName, //伤害字体名称 | ||
|  |                     ImgPath = gImgPath, //Img路径 | ||
|  |                     MaxNumArr = gMaxNumArr, //普通999帧数数组 | ||
|  |                     KeyMaxNumArr = gKeyMaxNumArr, //暴击999帧数数组 | ||
|  |                     Item = gItem, //道具ID | ||
|  |                 } | ||
|  |                 Tobj.DamageSkinList.append(T); | ||
|  |             } | ||
|  |             Tobj.InitDamageFont(Tobj.NowDamageSkinIndex); | ||
|  |             Tobj.Sobj = ScrollControl(Tobj.DamageSkinList, 5, 1); | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  |     //初始化伤害字体 | ||
|  |     function InitDamageFont(Idx) { | ||
|  |         if (Idx == null) { | ||
|  |             for (local i = 0; i< 7; i++) { | ||
|  |                 L_sq_IntiNumberDraw("common/etc/damagefontskin/damagefont00.img", 0 + (i * 10), i); | ||
|  |             } | ||
|  |         } else { | ||
|  |             for (local i = 0; i< 7; i++) { | ||
|  |                 L_sq_IntiNumberDraw(DamageSkinList[Idx].ImgPath, 0 + (i * 10), i); | ||
|  |             } | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  |     //初始化数字伤害类型 | ||
|  |     function InitRealType() { | ||
|  |         RealType = [0, 5, 1, 5, 2, 5, 1, 2, 3, 5, 4, 5, 3, 5, 4, 5, 0, 5, 4, 5, 2, 5, 4]; | ||
|  |         // //白字 | ||
|  |         // RealType.rwaset(0, 0); | ||
|  |         // //橙字 | ||
|  |         // RealType.rwaset(1, 1); | ||
|  |         // //回血 绿字 | ||
|  |         // RealType.rwaset(7, 2); | ||
|  |         // //回蓝 蓝字 | ||
|  |         // RealType.rwaset(8, 3); | ||
|  |         // //流血 | ||
|  |         // RealType.rwaset(34, 4); | ||
|  | 
 | ||
|  |     } | ||
|  | 
 | ||
|  |     constructor() { | ||
|  |         Pack_Control.rawset(20024002, GetFontListCallBack); | ||
|  | 
 | ||
|  |         //初始化伤害类型 | ||
|  |         InitRealType(); | ||
|  | 
 | ||
|  |         DamageFontArray = {}; | ||
|  |         DamageSkinList = []; | ||
|  | 
 | ||
|  |         local T = { | ||
|  |             Idx = 0, //伤害字体排列编号 | ||
|  |             UIdx = 0, //伤害字体编号 | ||
|  |             Name = "默认伤害字体", //伤害字体名称 | ||
|  |             ImgPath = "common/etc/damagefontskin/damagefont00.img", //Img路径 | ||
|  |             MaxNumArr = [73, 72], //普通999帧数数组 | ||
|  |             KeyMaxNumArr = [71, 70], //暴击999帧数数组 | ||
|  |             Item = 19880400, //道具ID | ||
|  |         } | ||
|  |         DamageSkinList.append(T); | ||
|  | 
 | ||
|  |         //初始化伤害字体 | ||
|  |         InitDamageFont(NowDamageSkinIndex); | ||
|  | 
 | ||
|  |         //获取字体列表信息 | ||
|  |         GetFontList(); | ||
|  |     } | ||
|  | 
 | ||
|  |     //绘制主界面 | ||
|  |     function DrawMain(obj) { | ||
|  |         //绘制窗口 | ||
|  |         L_sq_DrawImg("interface2/skinstorage/skinstorage.img", 0, X, Y); | ||
|  |         //绘制字体排列窗口 | ||
|  |         L_sq_DrawImg("interface2/skinstorage/skinstorage.img", 5, X + 421 - 9, Y + 108 - 67); | ||
|  | 
 | ||
|  |         //总览 | ||
|  |         L_sq_DrawImg("interface2/skinstorage/tab/tab_summary.img", 3, X + 421 - 8, Y + 46 - 8); | ||
|  |         //边框 | ||
|  |         L_sq_DrawImg("interface2/skinstorage/tab/tab_partyframe.img", 3, X + 487 - 8, Y + 46 - 8); | ||
|  |         //伤害字体 | ||
|  |         L_sq_DrawImg("interface2/skinstorage/tab/tab_damagefonts.img", 2, X + 533 + 4, Y + 42 - 3); | ||
|  |         //觉醒插图 | ||
|  |         L_sq_DrawImg("interface2/skinstorage/tab/tab_cutscene.img", 3, X + 609 - 7, Y + 52 - 14); | ||
|  |         //表情 | ||
|  |         L_sq_DrawImg("interface2/skinstorage/tab/tab_instantemoticon.img", 3, X + 674 - 16, Y + 49 - 11); | ||
|  |         //表情 | ||
|  |         L_sq_DrawImg("interface2/skinstorage/tab/tab_weaponlook.img", 3, X + 722 - 7, Y + 55 - 17); | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  |         if (Sobj) { | ||
|  |             foreach(Pos, v in Sobj.FocusList[0]) { | ||
|  |                 local Dobj = DamageFontObjectC(v.Idx, v.Name, v.ImgPath, v.MaxNumArr, v.UIdx, v.Item); | ||
|  |                 Dobj.Show(obj, X + 425, Y + 114 + (Pos * 85)); | ||
|  |             } | ||
|  |             L_sq_DrawCode((Sobj.Controller.Value + 1).tostring(), X + 586, Y + 537, sq_RGBA(150, 255, 30, 250), 0, 1); | ||
|  |             L_sq_DrawCode("   /  " + (Sobj.Controller.MaxValue + 1).tostring(), X + 586, Y + 537, sq_RGBA(150, 255, 30, 250), 0, 1); | ||
|  |         } | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  |         local chr = sq_GetCNRDObjectToSQRCharacter(obj); | ||
|  |         local charAni = chr.sq_GetStayAni(); | ||
|  |         sq_AnimationProc(charAni); | ||
|  |         sq_drawCurrentFrame(charAni, X + 210, Y + 364, false); | ||
|  | 
 | ||
|  |         local MonsterAni = T_DrawDynamicAni_Fx(obj, "monster/goblin/animation_goblin2/down.ani", X + 360, Y + 364, "伤害字体哥布林倒地"); | ||
|  |         local NeArray = TryGetArry(1); | ||
|  |         if (sq_GetCurrentTime(MonsterAni) >= 1000 && NeArray.len() == 0) { | ||
|  |             local Timer = TimeSTL("演示字体" + FontIdx, 2000); | ||
|  |             Timer.Reset(); | ||
|  |             Timer.Start(); | ||
|  |             local T = { | ||
|  |                 Idx = "演示字体" + FontIdx, | ||
|  |                 XPos = X + 166, | ||
|  |                 YPos = Y + 230, | ||
|  |                 DamageNum = 999999999, | ||
|  |                 Type = 5, | ||
|  |                 TimeObj = Timer, | ||
|  |                 isKeyHit = false, | ||
|  |             } | ||
|  |             NeArray.append(T); | ||
|  |             DamageFontArray.rawset(1, NeArray); | ||
|  |             sq_Rewind(MonsterAni); | ||
|  |         } | ||
|  | 
 | ||
|  |     } | ||
|  | 
 | ||
|  |     //开启界面回调 | ||
|  |     function OpenClassCallBack() { | ||
|  | 
 | ||
|  |         L_NewWindows("Lenheart", 170, 0x65535); | ||
|  |         local W = sq_GetPopupWindowMainCotrol(170); | ||
|  |         W.SetVisible(false); | ||
|  |         W.SetEnable(false); | ||
|  |         if (sq_GetMapIndex(sq_GetGlobaludpModuleStage()) >= 0) MainState = false; | ||
|  |         //获取字体列表信息 | ||
|  |         GetFontList(); | ||
|  |         if (DamageSkinList.len() > 0) Sobj = ScrollControl(DamageSkinList, 5, 1); | ||
|  |     } | ||
|  | 
 | ||
|  |     //绘制入口 | ||
|  |     function Draw(obj) { | ||
|  | 
 | ||
|  |         if (MainState) { | ||
|  |             if (WindowObj) { | ||
|  |                 DrawMain(obj); | ||
|  |                 WindowObj.Show(obj); | ||
|  |                 X = WindowObj.X; | ||
|  |                 Y = WindowObj.Y; | ||
|  |             } else { | ||
|  |                 WindowObj = DamageFontWindow(X, Y, 788, 576, 28); //坐标 大小 标题栏高度 | ||
|  |                 //WindowObj.DeBugMode = true; | ||
|  |             } | ||
|  |         } else { | ||
|  |             if (WindowObj && WindowObj.YMouseSw == false) { | ||
|  |                 IMouse.ReleaseMouseClick(); | ||
|  |                 WindowObj.YMouseSw = true; | ||
|  |                 WindowObj = null; | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  | 
 | ||
|  |         //绘制字体 | ||
|  |         if (sq_GetCurrentModuleType() == 3 || MainState) DrawFont(obj); | ||
|  |         //回到城镇清空字体数组 | ||
|  |         else { | ||
|  |             DamageFontArray = null; | ||
|  |             DamageFontArray = {}; | ||
|  |             MapBaseXPos = 0; | ||
|  |             MapBaseYPos = 0; | ||
|  |         } | ||
|  | 
 | ||
|  |     } | ||
|  | 
 | ||
|  |     //设置NUT白字 | ||
|  |     function SetNutRate() { | ||
|  |         // local allRate = 1.0; | ||
|  |         // for (local i = 1; i < 41; i++) { | ||
|  |         //     allRate = allRate * (sq_GetIntData(obj, 169, i) / 100).tofloat(); | ||
|  |         // } | ||
|  |         // for (local w = 1; w < 21; w++) { | ||
|  |         //     allRate = allRate * (sq_GetIntData(obj, 174, w) / 100).tofloat(); | ||
|  |         // } | ||
|  |         NutWRate = 1.0; | ||
|  |     } | ||
|  | 
 | ||
|  |     //逻辑入口 | ||
|  |     function Proc(obj) { | ||
|  |         if (KeyPressNB.isKeyPress(48, "DamageFontCloseKey")) { | ||
|  |             MainState = false; | ||
|  |         } | ||
|  |         if (MainState) { | ||
|  |             if (IMouse.IsWheelUp()) { | ||
|  |                 Sobj.M(); | ||
|  |             } | ||
|  |             if (IMouse.IsWheelDown()) { | ||
|  |                 Sobj.A(); | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  |         //设置地图原点 | ||
|  |         SetMapBasePos(obj); | ||
|  |         //设置NUT白字 | ||
|  |         SetNutRate(); | ||
|  |     } | ||
|  | 
 | ||
|  |     FontIdx = 0; | ||
|  |     MapBaseXPos = 0; | ||
|  |     MapBaseYPos = 0; | ||
|  |     DamageFontArray = null; | ||
|  | 
 | ||
|  |     //设置地图原点 | ||
|  |     function SetMapBasePos(obj) { | ||
|  |         local objectManager = obj.getObjectManager(); | ||
|  |         if (!objectManager) return; | ||
|  |         MapBaseXPos = objectManager.getFieldXPos(0, ENUM_DRAWLAYER_NORMAL); | ||
|  |         MapBaseYPos = objectManager.getFieldYPos(0, 0, ENUM_DRAWLAYER_NORMAL); | ||
|  |     } | ||
|  | 
 | ||
|  |     function TryGetArry(Type) { | ||
|  |         if (DamageFontArray.rawin(Type)) return DamageFontArray[Type]; | ||
|  |         else return []; | ||
|  |     } | ||
|  | 
 | ||
|  | 
 | ||
|  |     //将伤害字体数据Push进数组 | ||
|  |     function PushDamageFontArray(ObjAddress, X, Y, Z, Value, Type) { | ||
|  |         local Timer = TimeSTL("DamageFontTimer" + ObjAddress + FontIdx, 2000); | ||
|  |         Timer.Reset(); | ||
|  |         Timer.Start(); | ||
|  |         local gRealType; | ||
|  |         if (Type <= 7) gRealType = RealType[Type]; | ||
|  |         else gRealType = RealType[((Type - 7) % 16) + 7]; | ||
|  |         //暴击 | ||
|  |         local KeyHit = false; | ||
|  |         if (Type == 17) KeyHit = true; | ||
|  |         //是扣血还是回血 | ||
|  |         if (Type == 7) { | ||
|  |             if (Value< 0) gRealType = 4; | ||
|  |         } | ||
|  |         if (Type == 4) { | ||
|  |             if (Value< 0) gRealType = 0; | ||
|  |         } | ||
|  |         if (Type == 1 || Type == 17) { | ||
|  |             local oldDamageNum = Value; | ||
|  |             Value = (Value / NutWRate).tointeger(); | ||
|  |             local newDamageNum = oldDamageNum - Value; | ||
|  |             local NeArray = TryGetArry(Type); | ||
|  |             local Timer = TimeSTL("WDamageFontTimer" + ObjAddress + FontIdx, 2000); | ||
|  |             Timer.Reset(); | ||
|  |             Timer.Start(); | ||
|  |             local T = { | ||
|  |                 Idx = ObjAddress + FontIdx, | ||
|  |                 XPos = X, | ||
|  |                 YPos = Y - Z - (NeArray.len() * 6), | ||
|  |                 DamageNum = Value, | ||
|  |                 Type = 0, | ||
|  |                 TimeObj = Timer, | ||
|  |                 isKeyHit = KeyHit, | ||
|  |             } | ||
|  |             NeArray.append(T); | ||
|  |             DamageFontArray.rawset(Type, NeArray); | ||
|  |             ++FontIdx; | ||
|  |         } | ||
|  |         local NeArray = TryGetArry(Type); | ||
|  |         local T = { | ||
|  |             Idx = ObjAddress + FontIdx, | ||
|  |             XPos = X, | ||
|  |             YPos = Y - Z - (NeArray.len() * 6), | ||
|  |             DamageNum = Value, | ||
|  |             Type = gRealType, | ||
|  |             TimeObj = Timer, | ||
|  |             isKeyHit = KeyHit, | ||
|  |         } | ||
|  |         NeArray.append(T); | ||
|  |         DamageFontArray.rawset(Type, NeArray); | ||
|  |         ++FontIdx; | ||
|  |     } | ||
|  | 
 | ||
|  |     function DrawFontImg(X, Y, Type, DamageNum, Time, isKeyHit) { | ||
|  |         local rate = sq_GetUniformVelocity(60, 100, Time, 100); | ||
|  |         rate = rate.tofloat() / 100.0; | ||
|  |         //如果暴击 | ||
|  |         if (isKeyHit) { | ||
|  |             rate *= 1.3; | ||
|  |             Type = 4; | ||
|  |         } | ||
|  |         //白字 | ||
|  |         if (Type == 0) { | ||
|  |             rate *= 0.7; | ||
|  |             Y += 60; | ||
|  |         } | ||
|  |         local UpOffset = 0; | ||
|  |         //超过0.3秒开始飘 | ||
|  |         if (Time >= 600) { | ||
|  |             UpOffset = sq_GetUniformVelocity(0, 30, Time - 600, 500); | ||
|  |         } | ||
|  |         if (DamageNum > MaxDamageNumber) { | ||
|  |             if (isKeyHit) { | ||
|  |                 foreach(imgpos in DamageSkinList[FocusPrintIdx].KeyMaxNumArr) { | ||
|  |                     L_sq_DrawImg(DamageSkinList[FocusPrintIdx].ImgPath, imgpos, X + ((30 * (MaxDamageNumber.tostring().len())) - ((20 * (MaxDamageNumber.tostring().len())) * rate)), Y + (20 - (20 * rate)) - UpOffset, 0, sq_RGBA(255, 255, 255, 255 - (UpOffset * 8)), rate, rate); | ||
|  |                 } | ||
|  |             } else { | ||
|  |                 foreach(imgpos in DamageSkinList[FocusPrintIdx].MaxNumArr) { | ||
|  |                     L_sq_DrawImg(DamageSkinList[FocusPrintIdx].ImgPath, imgpos, X + ((30 * (MaxDamageNumber.tostring().len())) - ((20 * (MaxDamageNumber.tostring().len())) * rate)), Y + (20 - (20 * rate)) - UpOffset, 0, sq_RGBA(255, 255, 255, 255 - (UpOffset * 8)), rate, rate); | ||
|  |                 } | ||
|  |             } | ||
|  |         } else { | ||
|  |             L_sq_DrawNumber(X + ((30 * (DamageNum.tostring().len())) - ((20 * (DamageNum.tostring().len())) * rate)), Y + (20 - (20 * rate)) - UpOffset, sq_RGBA(255, 255, 255, 255 - (UpOffset * 8)), rate, rate, Type, 18 * rate, 6, sq_Abs(DamageNum)); | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  |     //伤害字体绘制 | ||
|  |     function DrawFont(obj) { | ||
|  |         foreach(Type, FontArrayObject in DamageFontArray) { | ||
|  |             if (Type == 0) continue; | ||
|  |             for (local i = 0; i< FontArrayObject.len(); i++) { | ||
|  |                 local FontObject = FontArrayObject[i]; | ||
|  |                 if (FontObject) { | ||
|  |                     local Timer = FontObject.TimeObj; | ||
|  |                     if (Timer) { | ||
|  |                         local Time = Timer.Get(); | ||
|  |                         if (Time >= 1100) { | ||
|  |                             FontObject.TimeObj.Delete(); | ||
|  |                             FontObject.TimeObj = null; | ||
|  |                             FontArrayObject.remove(i); | ||
|  |                             continue; | ||
|  |                         } else { | ||
|  |                             DrawFontImg(FontObject.XPos - MapBaseXPos, FontObject.YPos - MapBaseYPos, FontObject.Type, FontObject.DamageNum, Time, FontObject.isKeyHit); | ||
|  |                             //L_sq_DrawCode(FontObject.DamageNum.tostring(), FontObject.XPos - MapBaseXPos, FontObject.YPos - (Time / 100) - MapBaseYPos, sq_RGBA(255, 255, 184, 250), 0, 1); | ||
|  |                         } | ||
|  |                     } | ||
|  |                 } | ||
|  |             } | ||
|  |         } | ||
|  |         //白字 | ||
|  |         foreach(Type, FontArrayObject in DamageFontArray) { | ||
|  |             if (Type != 0) break; | ||
|  |             for (local i = 0; i< FontArrayObject.len(); i++) { | ||
|  |                 local FontObject = FontArrayObject[i]; | ||
|  |                 if (FontObject) { | ||
|  |                     local Timer = FontObject.TimeObj; | ||
|  |                     if (Timer) { | ||
|  |                         local Time = Timer.Get(); | ||
|  |                         if (Time >= 1100) { | ||
|  |                             FontObject.TimeObj.Delete(); | ||
|  |                             FontObject.TimeObj = null; | ||
|  |                             FontArrayObject.remove(i); | ||
|  |                             continue; | ||
|  |                         } else { | ||
|  |                             DrawFontImg(FontObject.XPos - MapBaseXPos, FontObject.YPos - MapBaseYPos, FontObject.Type, FontObject.DamageNum, Time, FontObject.isKeyHit); | ||
|  |                             //L_sq_DrawCode(FontObject.DamageNum.tostring(), FontObject.XPos - MapBaseXPos, FontObject.YPos - (Time / 100) - MapBaseYPos, sq_RGBA(255, 255, 184, 250), 0, 1); | ||
|  |                         } | ||
|  |                     } | ||
|  |                 } | ||
|  |             } | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  |     function T_DrawDynamicAni_Fx(obj, aniFileName, x, y, aniname) { | ||
|  |         local ani = obj.getVar().GetAnimationMap(aniname, aniFileName); | ||
|  |         ani.setImageRateFromOriginal(-1.0, 1.0); | ||
|  |         sq_AnimationProc(ani); | ||
|  |         sq_drawCurrentFrame(ani, x, y, true); | ||
|  |         return ani; | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | function DamageFont(obj) { | ||
|  |     local RootTab = getroottable(); | ||
|  |     if (!RootTab.rawin("DamageFontCObj")) { | ||
|  |         local Cobj = DamageFontC(); | ||
|  |         RootTab.rawset("DamageFontCObj", Cobj); | ||
|  |         EventIcon("皮肤仓库", 70, 70, Cobj); | ||
|  |     } else { | ||
|  |         RootTab["DamageFontCObj"].Proc(obj); | ||
|  |         RootTab["DamageFontCObj"].Draw(obj); | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | function Sq_PushDamageFontData(ObjAddress, X, Y, Z, Value, Type) { | ||
|  |     // Sout("对象地址: %L", ObjAddress); | ||
|  |     // Sout("X坐标: %L", X); | ||
|  |     // Sout("Y坐标: %L", Y); | ||
|  |     // Sout("Z坐标: %L", Z); | ||
|  |     // Sout("伤害数值: %L", Value); | ||
|  |     // Sout("伤害类型: %L", Type); | ||
|  | 
 | ||
|  |     getroottable()["DamageFontCObj"].PushDamageFontArray(ObjAddress, X - 100, Y, Z, Value, Type); | ||
|  | } |