1253 lines
		
	
	
		
			45 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			1253 lines
		
	
	
		
			45 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
|  | /* | ||
|  | 文件名:Medal.nut | ||
|  | 路径:Plugins/Medal/Medal.nut | ||
|  | 创建日期:2022-12-18	05:53 | ||
|  | 文件用途:勋章系统文件 | ||
|  | */ | ||
|  | 
 | ||
|  | //TabTextButtonPro按钮类 | ||
|  | class TabTextButtonPro extends BasicsDrawTool //  obj  --  按钮名称  --  X坐标  --  Y坐标  --  Ani调用路径  --  宽度  --  高度 | ||
|  | { | ||
|  |     obj = null; //Obj对象 | ||
|  |     State = 0; //按钮状态 | ||
|  |     ClickEnble = false; //点击效果 | ||
|  |     ButtonDynamic = false; //动态按钮效果 | ||
|  |     SwitchState = false; //复选框是否选中 | ||
|  |     str = null; | ||
|  |     strx = null; | ||
|  |     stry = 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路径 | ||
|  |     BaseAnifileFrame = null; //调用的Ani帧数 | ||
|  |     width = null; //可点击宽度 | ||
|  |     length = null; //可点击高度 | ||
|  |     //构造函数 | ||
|  |     constructor(gObj, gButtonName, gX, gY, gAnifile, gBaseAnifileFrame, gWidth, gLength, gstr, gstrx, gstry) { | ||
|  |         obj = gObj; | ||
|  |         ButtonName = gButtonName; | ||
|  |         x = gX; | ||
|  |         y = gY; | ||
|  |         BaseAnifile = gAnifile; | ||
|  |         BaseAnifileFrame = gBaseAnifileFrame; | ||
|  |         width = gWidth; | ||
|  |         length = gLength; | ||
|  |         str = gstr; | ||
|  |         strx = gstrx; | ||
|  |         stry = gstry; | ||
|  |     } | ||
|  |     //绘制按钮 | ||
|  |     function Show() { | ||
|  |         if (ClickEnble) //是否开启点击效果 | ||
|  |         { | ||
|  |             if (isLBDown() && State == 0) //按下左键并且按钮处于弹起状态 | ||
|  |             { | ||
|  |                 State = 1; //按键进入按下状态 | ||
|  |                 //++y; | ||
|  |             } | ||
|  |             if (!isLBDown() && State == 1) //按下左键并且按钮处于弹起状态 | ||
|  |             { | ||
|  |                 State = 0; //按键进入弹起状态 | ||
|  |                 //--y; | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  |         if (CustomClickEnble) //是否开启自定义点击效果 | ||
|  |         { | ||
|  |             if (isLBDown() && SwitchState == false) //按下左键并且按钮处于弹起状态 | ||
|  |             { | ||
|  |                 if (!ButtonDynamic) T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName); | ||
|  |                 else T_DrawDynamicAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomButtonName); | ||
|  |                 L_sq_DrawCode(str, CustomClickx + strx, CustomClicky + stry, sq_RGBA(255, 255, 184, 250), 1, 1); | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  |         if (RectEnble && SwitchState == false) //开启悬停效果时 | ||
|  |         { | ||
|  |             if ((isInRect()) || (isInRect() && !CustomClickEnble)) //如果鼠标悬停的时候  并且没有点击的时候 | ||
|  |             { | ||
|  |                 //IMouse.SetMouseTask(44); | ||
|  |                 if (!ButtonDynamic) T_DrawStayAni(obj, RectBaseAnifile, Rectx, Recty, RectFrame, RectButtonName); | ||
|  |                 else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName); | ||
|  |                 L_sq_DrawCode(str, CustomClickx + strx, CustomClicky + stry, sq_RGBA(255, 255, 184, 250), 1, 1); | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  |         if (!isInRect() && !SwitchState) //如果鼠标没有悬停的时候 | ||
|  |         { | ||
|  |             //IMouse.SetMouseTask(0); | ||
|  |             if (!ButtonDynamic) T_DrawStayAni(obj, BaseAnifile, x, y, BaseAnifileFrame, ButtonName); | ||
|  |             else T_DrawDynamicAni(obj, BaseAnifile, x, y, ButtonName); | ||
|  |             L_sq_DrawCode(str, CustomClickx + strx, CustomClicky + stry, sq_RGBA(221, 197, 147, 250), 1, 1); | ||
|  |         } | ||
|  | 
 | ||
|  |         if (SwitchState) { | ||
|  |             if (!ButtonDynamic) T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName); | ||
|  |             else T_DrawDynamicAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomButtonName); | ||
|  |             L_sq_DrawCode(str, CustomClickx + strx, CustomClicky + stry, sq_RGBA(255, 255, 184, 250), 1, 1); | ||
|  |         } | ||
|  | 
 | ||
|  | 
 | ||
|  |     } | ||
|  | 
 | ||
|  |     //设置自定义点击效果 | ||
|  |     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() && IMouse.GetLButton() == 1) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  |     //左键弹起状态 | ||
|  |     function isLBUp() { | ||
|  |         if (isInRect() && IMouse.GetLButton() == 0) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  |     //左键双击状态 | ||
|  |     function IsLBDoubleClick() { | ||
|  |         if (isInRect() && IMouse.GetLButton() == 64) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  |     //左键单击状态 | ||
|  |     function isLBActive() { | ||
|  |         if (isInRect() && IMouse.isButtonUpEvent()) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | //HudPro按钮类 | ||
|  | class MedalButtonPro 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; //可点击高度 | ||
|  |     //构造函数 | ||
|  |     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; | ||
|  |     } | ||
|  |     //绘制按钮 | ||
|  |     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() && IMouse.GetLButton() == 1) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  |     //左键弹起状态 | ||
|  |     function isLBUp() { | ||
|  |         if (isInRect() && IMouse.GetLButton() == 0) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  |     //左键双击状态 | ||
|  |     function IsLBDoubleClick() { | ||
|  |         if (isInRect() && IMouse.GetLButton() == 64) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  |     //左键单击状态 | ||
|  |     function isLBActive() { | ||
|  |         if (isInRect() && IMouse.isButtonUpEvent()) return true; | ||
|  |         else return false; | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | 
 | ||
|  | class MedalItem extends BasicsDrawTool { | ||
|  |     X = null; | ||
|  |     Y = null; | ||
|  |     ItemId = null; | ||
|  |     Attribute = null; | ||
|  |     MCount = 0; | ||
|  |     Rarity = null; | ||
|  |     TabName = ["名称: ", | ||
|  |         "强化等级: ", | ||
|  |         "力量 +", | ||
|  |         "体力 +", | ||
|  |         "智力 +", | ||
|  |         "精神 +", | ||
|  |         "独立攻击力 +", | ||
|  |         "物理攻击力 +", | ||
|  |         "魔法攻击力 +", | ||
|  |         "物理防御 +", | ||
|  |         "魔法防御 +", | ||
|  |         "移动速度 +", | ||
|  |         "攻击速度 +", | ||
|  |         "释放速度 +", | ||
|  |         "物理暴击 +", | ||
|  |         "魔法暴击 +", | ||
|  |         "命中率 +", | ||
|  |         "光属性强化 +", | ||
|  |         "暗属性强化 +", | ||
|  |         "水属性强化 +", | ||
|  |         "火属性强化 +", | ||
|  |         "全属性强化 +" | ||
|  |     ] | ||
|  | 
 | ||
|  |     constructor(Id, attribute, rarity) { | ||
|  |         ItemId = Id; | ||
|  |         Attribute = attribute; | ||
|  |         Rarity = rarity; | ||
|  |     } | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  |     //绘制悬停 | ||
|  |     function DrawHover(obj) { | ||
|  |         local dx; | ||
|  |         local dy; | ||
|  |         local line = Attribute.len() - 3; //减去名字 强化之类的偏移 | ||
|  | 
 | ||
|  |         //悬停界面总高度计算 | ||
|  |         { | ||
|  |             local X1 = 0; //防御力线偏移 | ||
|  |             local X2 = 0; //四维和三攻线偏移 | ||
|  |             local X3 = 0; //三速线偏移 | ||
|  |             local X4 = 0; //属强线偏移 | ||
|  |             local X5 = 0; //全属强线偏移 | ||
|  |             MCount = 0; | ||
|  |             for (local y = 0; y < Attribute.len(); y++) { | ||
|  |                 local gType = Attribute[y][0]; | ||
|  |                 //防御力 | ||
|  |                 if (gType == 9 || gType == 10) X1 = 1; | ||
|  |                 //四维和三攻 | ||
|  |                 if (gType >= 2 && gType <= 8) X2 = 1; | ||
|  |                 //三速 | ||
|  |                 if (gType >= 11 && gType <= 16) X3 = 1; | ||
|  |                 //属强 | ||
|  |                 if (gType >= 17 && gType <= 20) X4 = 1; | ||
|  |                 //全属强 | ||
|  |                 if (gType == 21) X5 = 1; | ||
|  |                 //守护珠数量 | ||
|  |                 if (gType >= 22 && gType <= 25) MCount++; | ||
|  |             } | ||
|  |             line = line + X1 + X2 + X3 + X4 + X5 + 1 - MCount; //总共需要的长度 | ||
|  |         } | ||
|  | 
 | ||
|  |         //界面是否靠近边界偏移计算 | ||
|  |         { | ||
|  |             if ((800 - X) >= 216) dx = X; | ||
|  |             else dx = X - (216 - (800 - X)); | ||
|  |             local needY = 19 + (line * 14) + 19; | ||
|  |             if ((600 - Y) >= needY) dy = Y; | ||
|  |             else dy = Y - (needY - (600 - Y)); | ||
|  |             dx -= 25; | ||
|  |             dy -= 25; | ||
|  |         } | ||
|  | 
 | ||
|  |         //主界面绘制 | ||
|  |         { | ||
|  |             //绘制顶 | ||
|  |             T_DrawStayAni(obj, "common/medal/main.ani", dx, dy, 25, "MedalItemInfoMainTop"); | ||
|  | 
 | ||
|  |             //绘制线 | ||
|  |             T_DrawStayAni(obj, "common/medal/main.ani", dx, dy + 19, 26, "MedalItemInfoMainXian"); | ||
|  | 
 | ||
|  |             //绘制中 | ||
|  |             for (local i = 0; i < line; i++) { | ||
|  |                 T_DrawStayAni(obj, "common/medal/main.ani", dx, dy + 19 + 14 + (i * 14), 27, "MedalItemInfoMainZhong"); | ||
|  |             } | ||
|  |             //绘制底 | ||
|  |             T_DrawStayAni(obj, "common/medal/main.ani", dx, dy + 19 + 14 + (line * 14), 28, "MedalItemInfoMainDi"); | ||
|  | 
 | ||
|  |             if (MCount > 0) L_sq_DrawCode("[ 已镶嵌守护珠: " + MCount + " ]", dx + 6, dy + 19 + 16 + (line * 14), sq_RGBA(255, 177, 0, 250), 1, 1); | ||
|  |         } | ||
|  | 
 | ||
|  |         //获取颜色 | ||
|  |         local Colorobj = getroottable()["MedalObj"].ColorArr[Rarity]; | ||
|  |         local RGBADATA = sq_RGBA(Colorobj[0], Colorobj[1], Colorobj[2], Colorobj[3]); | ||
|  | 
 | ||
|  |         //绘制名字 | ||
|  |         L_sq_DrawCode(Attribute[0][1], dx + 6, dy + 6, RGBADATA, 1, 1); | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  |         //绘制强化等级 | ||
|  |         if (Attribute[1][1] != 0) L_sq_DrawCode("强化等级: " + Attribute[1][1], dx + 140, dy + 6, sq_RGBA(255, 177, 0, 250), 1, 1); | ||
|  | 
 | ||
|  |         //线的数量 | ||
|  |         local XianCount = 0; | ||
|  | 
 | ||
|  |         local FYS = false; //防御属性是否绘制判断 | ||
|  |         local SWS = false; //四维属性是否绘制判断 | ||
|  |         local SGS = false; //三攻属性是否绘制判断 | ||
|  |         local SSS = false; //三速属性是否绘制判断 | ||
|  |         local SQS = false; //属强属性是否绘制判断 | ||
|  | 
 | ||
|  |         local cx = dx + 6; //起始点偏移(要从名字下面的线开始绘制) | ||
|  |         local cy = dy + 20; //起始点偏移(要从名字下面的线开始绘制) | ||
|  | 
 | ||
|  |         local o = 2; //属性剔除前2无用属性 | ||
|  |         local RGBA; //根据不同的属性绘制不同颜色字体 | ||
|  | 
 | ||
|  |         //防御属性 | ||
|  |         for (; o < Attribute.len(); o++) { | ||
|  |             local gType = Attribute[o][0]; | ||
|  |             //如果不属于防御属性就终止 | ||
|  |             if (gType != 9 && gType != 10) break; | ||
|  | 
 | ||
|  |             RGBA = sq_RGBA(119, 110, 95, 250); | ||
|  |             local gTabName = TabName[gType]; | ||
|  |             local gValue = Attribute[o][1]; | ||
|  |             L_sq_DrawCode(gTabName + gValue.tostring(), cx, cy + ((o - 1) * 15), RGBA, 1, 1); | ||
|  |             FYS = true; | ||
|  |             if (o == (Attribute.len() - 1 - MCount)) return; | ||
|  |         } | ||
|  | 
 | ||
|  |         //绘制线 | ||
|  |         if (FYS) { | ||
|  |             T_DrawStayAni(obj, "common/medal/main.ani", dx, cy + ((o - 1) * 15) + (XianCount * 14), 29, "MedalItemInfoMainXianT"); | ||
|  |             XianCount++; | ||
|  |         } | ||
|  | 
 | ||
|  |         //四维属性 | ||
|  |         for (; o < Attribute.len(); o++) { | ||
|  |             local gType = Attribute[o][0]; | ||
|  |             //如果不属于四维属性就终止 | ||
|  |             if (gType < 2 || gType > 5) break; | ||
|  | 
 | ||
|  |             RGBA = sq_RGBA(141, 140, 109, 250); | ||
|  |             local gTabName = TabName[gType]; | ||
|  |             local gValue = Attribute[o][1]; | ||
|  |             L_sq_DrawCode(gTabName + gValue.tostring(), cx, cy + (XianCount * 14) + ((o - 1) * 15), RGBA, 1, 1); | ||
|  |             SWS = true; | ||
|  |             if (o == (Attribute.len() - 1 - MCount)) return; | ||
|  |         } | ||
|  | 
 | ||
|  |         //三攻属性 | ||
|  |         for (; o < Attribute.len(); o++) { | ||
|  |             local gType = Attribute[o][0]; | ||
|  |             //如果不属于三攻属性就终止 | ||
|  |             if (gType < 6 || gType > 8) break; | ||
|  | 
 | ||
|  |             RGBA = sq_RGBA(255, 255, 216, 200); | ||
|  |             local gTabName = TabName[gType]; | ||
|  |             local gValue = Attribute[o][1]; | ||
|  |             L_sq_DrawCode(gTabName + gValue.tostring(), cx, cy + (XianCount * 14) + ((o - 1) * 15), RGBA, 1, 1); | ||
|  |             SGS = true; | ||
|  |             if (o == (Attribute.len() - 1 - MCount)) return; | ||
|  |         } | ||
|  | 
 | ||
|  |         if ((SGS || SWS) && (o < Attribute.len())) { | ||
|  |             //绘制线 | ||
|  |             T_DrawStayAni(obj, "common/medal/main.ani", dx, cy + (XianCount * 14) + ((o - 1) * 15), 29, "MedalItemInfoMainXianT"); | ||
|  |             XianCount++; | ||
|  |         } | ||
|  | 
 | ||
|  |         //三速属性 | ||
|  |         for (; o < Attribute.len(); o++) { | ||
|  |             local gType = Attribute[o][0]; | ||
|  |             //如果不属于三速属性就终止 | ||
|  |             if (gType < 11 || gType > 16) break; | ||
|  | 
 | ||
|  |             RGBA = sq_RGBA(166, 215, 136, 250); | ||
|  |             local gTabName = TabName[gType]; | ||
|  |             local gValue = Attribute[o][1].tofloat() / 10.0; | ||
|  |             L_sq_DrawCode(gTabName + gValue.tostring() + "%", cx, cy + (XianCount * 14) + ((o - 1) * 15), RGBA, 1, 1); | ||
|  |             SSS = true; | ||
|  |             if (o == (Attribute.len() - 1 - MCount)) return; | ||
|  |         } | ||
|  | 
 | ||
|  |         if (SSS) { | ||
|  |             //绘制线 | ||
|  |             T_DrawStayAni(obj, "common/medal/main.ani", dx, cy + (XianCount * 14) + ((o - 1) * 15), 29, "MedalItemInfoMainXianT"); | ||
|  |             XianCount++; | ||
|  |         } | ||
|  | 
 | ||
|  |         //属强属性 | ||
|  |         for (; o < Attribute.len(); o++) { | ||
|  |             local gType = Attribute[o][0]; | ||
|  |             //如果不属于属强属性就终止 | ||
|  |             if (gType < 17 || gType > 20) break; | ||
|  | 
 | ||
|  |             RGBA = sq_RGBA(240, 230, 135, 250); | ||
|  |             local gTabName = TabName[gType]; | ||
|  |             local gValue = Attribute[o][1]; | ||
|  |             L_sq_DrawCode(gTabName + gValue.tostring(), cx, cy + (XianCount * 14) + ((o - 1) * 15), RGBA, 1, 1); | ||
|  |             SQS = true; | ||
|  |             if (o == (Attribute.len() - 1 - MCount)) return; | ||
|  |         } | ||
|  | 
 | ||
|  |         if (SQS) XianCount++; | ||
|  | 
 | ||
|  |         //全属强属性 | ||
|  |         for (; o < Attribute.len(); o++) { | ||
|  |             local gType = Attribute[o][0]; | ||
|  |             //如果不属于全属强属性就终止 | ||
|  |             if (gType != 21) break; | ||
|  | 
 | ||
|  |             RGBA = sq_RGBA(255, 177, 0, 250); | ||
|  |             local gTabName = TabName[gType]; | ||
|  |             local gValue = Attribute[o][1]; | ||
|  |             L_sq_DrawCode(gTabName + gValue.tostring(), cx, cy + (XianCount * 14) + ((o - 1) * 15), RGBA, 1, 1); | ||
|  |             if (o == (Attribute.len() - 1 - MCount)) return; | ||
|  |         } | ||
|  | 
 | ||
|  | 
 | ||
|  |     } | ||
|  | 
 | ||
|  |     function Run(x, y) { | ||
|  |         X = x; | ||
|  |         Y = y; | ||
|  |         L_Sq_DrawItem(x, y, ItemId, 1, 0, 0, 0); | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | class MedalSlot extends BasicsDrawTool { | ||
|  | 
 | ||
|  |     Type = null; | ||
|  |     X = null; | ||
|  |     Y = null; | ||
|  |     Item = null; | ||
|  |     ItemM = null; | ||
|  |     Select = false; | ||
|  |     SlotName = null; | ||
|  | 
 | ||
|  |     Tobj = null; | ||
|  | 
 | ||
|  |     constructor(type) { | ||
|  |         Type = type; | ||
|  |         local RootTab = getroottable(); | ||
|  |         Tobj = RootTab["MedalObj"]; | ||
|  |     } | ||
|  | 
 | ||
|  |     function IsHover() { | ||
|  |         if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 28, 28)) { | ||
|  |             //因为拖拽的时候会有两个重叠 所以要判断不是当前拿着的物品 | ||
|  |             if (Tobj.MoveModel != SlotName) Tobj.HoverModel = SlotName; | ||
|  |             return true; | ||
|  |         } else return false; | ||
|  |     } | ||
|  | 
 | ||
|  | 
 | ||
|  |     //左键按下状态 | ||
|  |     function isLBDown(obj) { | ||
|  |         if (IsHover() && IMouse.GetLButton() == 1) { | ||
|  |             obj.getVar(SlotName + "L").setBool(1, true); | ||
|  |             return true; | ||
|  |         } else return false; | ||
|  |     } | ||
|  | 
 | ||
|  |     //左键弹起状态 | ||
|  |     function isLBUp(obj) { | ||
|  |         if (IMouse.GetLButton() == 0) { | ||
|  |             obj.getVar(SlotName + "L").setBool(1, false); | ||
|  |             return true; | ||
|  |         } else return false; | ||
|  |     } | ||
|  | 
 | ||
|  |     //右键按下状态 | ||
|  |     function isRBDown(obj) { | ||
|  |         if (IsHover() && IMouse.GetRButton() == 2) { | ||
|  |             obj.getVar(SlotName + "R").setBool(1, true); | ||
|  |             return true; | ||
|  |         } else return false; | ||
|  |     } | ||
|  | 
 | ||
|  |     //右键单击状态 | ||
|  |     function isRBActive(obj) { | ||
|  |         if (IsHover() && IMouse.isButtonUpEvent() && obj.getVar(SlotName + "R").getBool(1) == true) { | ||
|  |             obj.getVar(SlotName + "R").setBool(1, false); | ||
|  |             return true; | ||
|  |         } else return false; | ||
|  |     } | ||
|  | 
 | ||
|  |     function DrawHover(obj) { | ||
|  | 
 | ||
|  |         //绘制悬停槽蓝光 | ||
|  |         T_DrawStayAni(obj, "common/medal/main.ani", X, Y, Type, "MedalSlotHover" + Type); | ||
|  |     } | ||
|  | 
 | ||
|  |     //第一图层 | ||
|  |     function Show(obj, x, y, slot) { | ||
|  | 
 | ||
|  |         SlotName = slot; | ||
|  | 
 | ||
|  |         if (Tobj.MoveModel != SlotName) { | ||
|  |             X = x; | ||
|  |             Y = y; | ||
|  |         } else { | ||
|  |             X = IMouse.GetXPos() - 14; | ||
|  |             Y = IMouse.GetYPos() - 14; | ||
|  |         } | ||
|  | 
 | ||
|  | 
 | ||
|  |         //如果有勋章对象则执行 | ||
|  |         if (Item && Tobj.MoveModel != SlotName) Item.Run(X, Y); | ||
|  |         //如果有守护珠对象则执行 | ||
|  |         if (ItemM && Tobj.MoveModel != SlotName) ItemM.Run(X, Y); | ||
|  | 
 | ||
|  | 
 | ||
|  |         if (Type == 23) { | ||
|  | 
 | ||
|  |             if (Item) { | ||
|  |                 T_DrawStayAni(obj, "common/medal/main.ani", Tobj.X + 69 + (((slot - 88) % 2) * 78), Tobj.Y + 96 + (((slot - 88) / 2) * 90), 21, "MedalSystemMainSlot3"); | ||
|  |             } else { | ||
|  | 
 | ||
|  |                 T_DrawStayAni(obj, "common/medal/main.ani", Tobj.X + 69 + (((slot - 88) % 2) * 78), Tobj.Y + 96 + (((slot - 88) / 2) * 90), 20, "MedalSystemMainSlot2"); | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  |         //如果悬停 | ||
|  |         if (IsHover()) { | ||
|  |             //绘制背景蓝光   移动时绘制蓝光要在图标底下 | ||
|  |             if (Tobj.MoveModel != SlotName) DrawHover(obj); | ||
|  | 
 | ||
|  | 
 | ||
|  |             isRBDown(obj); | ||
|  |             //如果右键穿戴 | ||
|  |             if (Item && isRBActive(obj)) { | ||
|  |                 local UseMedalPack = Json_STL("UseMedalPack"); | ||
|  |                 UseMedalPack.Put("op", 20009003); | ||
|  |                 UseMedalPack.Put("sel_type", Tobj.State); | ||
|  | 
 | ||
|  |                 UseMedalPack.Put("old_slot", slot); | ||
|  | 
 | ||
|  |                 if (Tobj.State == 24) { | ||
|  |                     if (slot != 88) UseMedalPack.Put("new_slot", 88); | ||
|  |                     if (slot == 88) UseMedalPack.Put("new_slot", 999999); | ||
|  |                 } else UseMedalPack.Put("new_slot", 888888); | ||
|  | 
 | ||
|  |                 UseMedalPack.Put("page", Tobj.NowPage); | ||
|  |                 UseMedalPack.Put("type", Tobj.State); | ||
|  |                 local str = UseMedalPack.GetString(); | ||
|  | 
 | ||
|  |                 L_sq_SendPackType(130); | ||
|  |                 L_sq_SendPackWChar(str); | ||
|  |                 L_sq_SendPack(); | ||
|  |                 UseMedalPack.Delete(); | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  |         //如果左键按下 写入可移动状态 | ||
|  |         if (Item && isLBDown(obj) && Tobj.MoveModel == null && slot < 88) { | ||
|  |             Tobj.MoveModel = SlotName; | ||
|  |         } | ||
|  | 
 | ||
|  |         //如果左键弹起 写入静止状态 | ||
|  |         if (isLBUp(obj) && Tobj.MoveModel != null) { | ||
|  |             local MoveMedalPack = Json_STL("MoveMedalPack"); | ||
|  |             MoveMedalPack.Put("op", 20009003); | ||
|  |             MoveMedalPack.Put("sel_type", Tobj.State); | ||
|  | 
 | ||
|  |             MoveMedalPack.Put("old_slot", Tobj.MoveModel.tointeger()); | ||
|  |             MoveMedalPack.Put("new_slot", Tobj.HoverModel.tointeger()); | ||
|  |             MoveMedalPack.Put("page", Tobj.NowPage); | ||
|  |             local str = MoveMedalPack.GetString(); | ||
|  |             L_sq_SendPackType(130); | ||
|  |             L_sq_SendPackWChar(str); | ||
|  |             L_sq_SendPack(); | ||
|  |             MoveMedalPack.Delete(); | ||
|  | 
 | ||
|  |             Tobj.MoveModel = null; | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  |     //第二图层 | ||
|  |     function ItemShow(obj) { | ||
|  |         if (IsHover() && Tobj.MoveModel == null) { | ||
|  |             if (Item) Item.DrawHover(obj); | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  |     //第三图层 拖动物品时的最高图层绘制 | ||
|  |     function ItemMoveShow(obj) { | ||
|  |         if (Item && Tobj.MoveModel == SlotName) Item.Run(X, Y); | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | class MedalSystem extends BasicsDrawTool { | ||
|  |     //界面坐标 | ||
|  |     X = null; | ||
|  |     Y = null; | ||
|  | 
 | ||
|  | 
 | ||
|  |     State = 24; | ||
|  |     CheckGetMyMedalInfo = false; | ||
|  |     MedalButton = null; | ||
|  |     MedalButtonSwitch = true; | ||
|  |     BeadButton = null; | ||
|  |     BeadButtonSwitch = false; | ||
|  | 
 | ||
|  |     //最大页数  Json获取 | ||
|  |     MaxPage = 5; | ||
|  |     //当前页数  Json获取 | ||
|  |     NowPage = 1; | ||
|  |     //颜色 | ||
|  |     ColorArr = null; | ||
|  | 
 | ||
|  |     WearSlotM = null; | ||
|  |     WearSlotB = null; | ||
|  |     SlotArr = null; | ||
|  | 
 | ||
|  |     MoveModel = null; | ||
|  |     HoverModel = null; | ||
|  | 
 | ||
|  |     //副本附加状态 | ||
|  |     DgnAddBuff = false; | ||
|  | 
 | ||
|  |     constructor(obj) { | ||
|  | 
 | ||
|  |         //注册配置类信息回调 | ||
|  |         Pack_Control.rawset(20009998, SetBaseInfoCallBack); | ||
|  |         //请求配置信息 | ||
|  |         GetBaseInfo(); | ||
|  |         //注册获取背包信息回调 | ||
|  |         Pack_Control.rawset(20009002, GetMyMedalInfoCallBack); | ||
|  | 
 | ||
|  |         //注册穿戴勋章回调 | ||
|  |         Pack_Control.rawset(20009012, GetMyWearMedalCallBack); | ||
|  |         //初始请求背包信息 | ||
|  |         F_GetMyMedalInfo(24, 1); | ||
|  |     } | ||
|  | 
 | ||
|  |     //请求配置信息 | ||
|  |     function GetBaseInfo() { | ||
|  |         local GetBaseInfoPack = Json_STL("GetBaseInfoPack"); | ||
|  |         GetBaseInfoPack.Put("op", 20009997); | ||
|  |         local str = GetBaseInfoPack.GetString(); | ||
|  |         L_sq_SendPackType(130); | ||
|  |         L_sq_SendPackWChar(str); | ||
|  |         L_sq_SendPack(); | ||
|  |         GetBaseInfoPack.Delete(); | ||
|  |     } | ||
|  | 
 | ||
|  |     //配置类信息回调 | ||
|  |     function SetBaseInfoCallBack(Chunk) { | ||
|  |         print(Chunk); | ||
|  | 
 | ||
|  |         local Buffer = Json_STL("GetMyMedalInfoBuffer"); | ||
|  |         Buffer.Parse(Chunk, 0, false); | ||
|  |         local RootTab = getroottable(); | ||
|  |         if (RootTab.rawin("MedalObj")) { | ||
|  |             local Tobj = RootTab["MedalObj"]; | ||
|  |             Tobj.MaxPage = Buffer.Get("slotpage"); | ||
|  |             Tobj.ColorArr = []; | ||
|  |             for (local i = 0; i < 8; i++) { | ||
|  |                 local arrbuffer = [] | ||
|  |                 arrbuffer.append(Buffer.Get("color" + i + "->0")); | ||
|  |                 arrbuffer.append(Buffer.Get("color" + i + "->1")); | ||
|  |                 arrbuffer.append(Buffer.Get("color" + i + "->2")); | ||
|  |                 arrbuffer.append(250); | ||
|  |                 Tobj.ColorArr.append(arrbuffer); | ||
|  |             } | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  |     //穿戴信息回调 | ||
|  |     function GetMyWearMedalCallBack(Chunk) { | ||
|  |         //收到打开包 | ||
|  | 
 | ||
|  |         local Buffer = Json_STL("GetMyMedalInfoBuffer"); | ||
|  |         Buffer.Parse(Chunk, 0, false); | ||
|  |         local RootTab = getroottable(); | ||
|  | 
 | ||
|  |         if (RootTab.rawin("MedalObj")) { | ||
|  |             local Tobj = RootTab["MedalObj"]; | ||
|  | 
 | ||
|  |             //清空勋章对象 | ||
|  |             Tobj.WearSlotM.Item = null; | ||
|  |             //清空守护珠对象组 | ||
|  |             for (local w = 0; w < 4; w++) { | ||
|  |                 Tobj.WearSlotB[w].Item = null; | ||
|  |             } | ||
|  | 
 | ||
|  |             local dataarr = []; | ||
|  |             local dataarrsize = Buffer.Get("data->" + 0 + "->dataarrsize"); | ||
|  |             if (dataarrsize) { | ||
|  |                 for (local z = 0; z < dataarrsize; z++) { | ||
|  |                     local arrbuufer = []; | ||
|  |                     local a = Buffer.Get("data->" + 0 + "->stk_ab->" + z + "->0"); | ||
|  |                     local b = Buffer.Get("data->" + 0 + "->stk_ab->" + z + "->1"); | ||
|  | 
 | ||
|  |                     //这里是守护珠 | ||
|  |                     if (a >= 22 && a <= 25) { | ||
|  |                         //如果有守护珠 实例化守护珠对象组 | ||
|  |                         //if(Tobj.WearSlotB.Item == null)Tobj.WearSlotB.Item = []; | ||
|  |                         local str = b; | ||
|  |                         b = Json_STL("GetMyMedalInfoBufferB"); | ||
|  |                         b.Parse(str, 0, false); | ||
|  |                         local bSlotPos = b.Get("slot"); | ||
|  |                         local bdataarrsize = b.Get("dataarrsize"); | ||
|  |                         local bdataarr = []; | ||
|  |                         for (local j = 0; j < bdataarrsize; j++) { | ||
|  |                             local barrbuufer = []; | ||
|  |                             local c = b.Get("stk_ab->" + j + "->0"); | ||
|  |                             local d = b.Get("stk_ab->" + j + "->1"); | ||
|  |                             barrbuufer.append(c); | ||
|  |                             barrbuufer.append(d); | ||
|  |                             bdataarr.append(barrbuufer); | ||
|  |                         } | ||
|  |                         local brarity = b.Get("rarity"); | ||
|  |                         Tobj.WearSlotB[bSlotPos].Item = MedalItem(b.Get("stk_id"), bdataarr, brarity); | ||
|  | 
 | ||
|  |                     } | ||
|  | 
 | ||
|  |                     arrbuufer.append(a); | ||
|  |                     arrbuufer.append(b); | ||
|  |                     dataarr.append(arrbuufer); | ||
|  |                 } | ||
|  |                 local rarity = Buffer.Get("data->" + 0 + "->rarity"); | ||
|  |                 Tobj.WearSlotM.Item = MedalItem(Buffer.Get("data->" + 0 + "->stk_id"), dataarr, rarity); | ||
|  |             } | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  |     //获取背包信息回调 | ||
|  |     function GetMyMedalInfoCallBack(Chunk) { | ||
|  |         //收到打开包 | ||
|  | 
 | ||
|  |         local Buffer = Json_STL("GetMyMedalInfoBuffer"); | ||
|  |         Buffer.Parse(Chunk, 0, false); | ||
|  |         local RootTab = getroottable(); | ||
|  | 
 | ||
|  |         if (RootTab.rawin("MedalObj")) { | ||
|  |             local Tobj = RootTab["MedalObj"]; | ||
|  | 
 | ||
|  |             { //同步页面(勋章或守护珠) | ||
|  |                 local SelType = Buffer.Get("sel_type"); | ||
|  |                 Tobj.State = SelType; | ||
|  |                 if (SelType == 24) { | ||
|  |                     Tobj.MedalButtonSwitch = true; | ||
|  |                     Tobj.BeadButtonSwitch = false; | ||
|  |                 } else if (SelType == 23) { | ||
|  |                     Tobj.MedalButtonSwitch = false; | ||
|  |                     Tobj.BeadButtonSwitch = true; | ||
|  |                 } | ||
|  |             } | ||
|  | 
 | ||
|  |             //Tobj.SlotArr = []; | ||
|  |             local Count = Buffer.Get("count"); | ||
|  | 
 | ||
|  |             for (local z = 0; z < 24; z++) { | ||
|  |                 Tobj.SlotArr[z].Item = null; | ||
|  |             } | ||
|  |             for (local i = 0; i < Count; i++) { | ||
|  |                 local SlotPos = Buffer.Get("data->" + i + "->slot"); | ||
|  |                 local dataarrsize = Buffer.Get("data->" + i + "->dataarrsize"); | ||
|  |                 local dataarr = []; | ||
|  |                 for (local z = 0; z < dataarrsize; z++) { | ||
|  |                     local arrbuufer = []; | ||
|  |                     local a = Buffer.Get("data->" + i + "->stk_ab->" + z + "->0"); | ||
|  |                     local b = Buffer.Get("data->" + i + "->stk_ab->" + z + "->1"); | ||
|  | 
 | ||
|  | 
 | ||
|  |                     arrbuufer.append(a); | ||
|  |                     arrbuufer.append(b); | ||
|  |                     dataarr.append(arrbuufer); | ||
|  |                 } | ||
|  |                 local rarity = Buffer.Get("data->" + i + "->rarity"); | ||
|  |                 Tobj.SlotArr[SlotPos].Item = MedalItem(Buffer.Get("data->" + i + "->stk_id"), dataarr, rarity); | ||
|  |             } | ||
|  | 
 | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  |     //判断打开背包 | ||
|  |     function CheckOpenInv() { | ||
|  |         if (sq_GetPopupWindowMainCotrol(74) && CheckGetMyMedalInfo == false) { | ||
|  |             GetMyMedalInfo(State, NowPage); | ||
|  |             CheckGetMyMedalInfo = true; | ||
|  |         } else if (!sq_GetPopupWindowMainCotrol(74)) { | ||
|  |             CheckGetMyMedalInfo = false; | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  |     //获取背包信息 | ||
|  |     function GetMyMedalInfo(Type, Page) { | ||
|  |         local GetMyMedalInfoPack = Json_STL("GetMyMedalInfoPack"); | ||
|  |         GetMyMedalInfoPack.Put("op", 20009001); | ||
|  |         GetMyMedalInfoPack.Put("sel_type", Type); | ||
|  |         GetMyMedalInfoPack.Put("page", Page); | ||
|  |         GetMyMedalInfoPack.Put("wear", false); | ||
|  |         local str = GetMyMedalInfoPack.GetString(); | ||
|  |         L_sq_SendPackType(130); | ||
|  |         L_sq_SendPackWChar(str); | ||
|  |         L_sq_SendPack(); | ||
|  |         GetMyMedalInfoPack.Delete(); | ||
|  |     } | ||
|  | 
 | ||
|  |     //首次获取背包信息 | ||
|  |     function F_GetMyMedalInfo(Type, Page) { | ||
|  |         local GetMyMedalInfoPack = Json_STL("GetMyMedalInfoPack"); | ||
|  |         GetMyMedalInfoPack.Put("op", 20009001); | ||
|  |         GetMyMedalInfoPack.Put("sel_type", Type); | ||
|  |         GetMyMedalInfoPack.Put("page", Page); | ||
|  |         GetMyMedalInfoPack.Put("wear", true); | ||
|  |         local str = GetMyMedalInfoPack.GetString(); | ||
|  |         L_sq_SendPackType(130); | ||
|  |         L_sq_SendPackWChar(str); | ||
|  |         L_sq_SendPack(); | ||
|  |         GetMyMedalInfoPack.Delete(); | ||
|  |     } | ||
|  | 
 | ||
|  |     //绘制主界面 | ||
|  |     function DrawMain(obj) { | ||
|  | 
 | ||
|  |         { //底图层绘制 | ||
|  |             //窗口 | ||
|  |             T_DrawStayAni(obj, "common/medal/main.ani", X + 2, Y + 18, 0, "MedalSystemMain"); | ||
|  |             //勋章槽贴图 | ||
|  |             T_DrawStayAni(obj, "common/medal/main.ani", X + 105, Y + 138, 18, "MedalSystemMainSlot1"); | ||
|  |             //守护珠槽贴图 TODO 安装守护珠以后槽会缩小  贴图21 | ||
|  | 
 | ||
|  |             for (local u = 0; u < 4; u++) { | ||
|  |                 T_DrawStayAni(obj, "common/medal/main.ani", X + 68 + 7 + ((u % 2) * 78), Y + 95 + 7 + ((u / 2) * 90), 22, "MedalSystemMainSlot21"); | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  | 
 | ||
|  |         { //勋章和守护珠切换按钮 | ||
|  |             MedalButton = TabTextButtonPro(obj, "小勋章Tab", X + 5, Y + 253, "common/medal/main.ani", 4, 38, 21, "勋章", 8, 5); | ||
|  |             MedalButton.SwitchState = MedalButtonSwitch; | ||
|  |             MedalButton.SetRectEnble(true, "a勋章Tab", X + 5, Y + 253, "common/medal/main.ani", 5); | ||
|  |             MedalButton.SetCustomClickEnble(true, "a勋章Tab", X + 5, Y + 253, "common/medal/main.ani", 6); | ||
|  | 
 | ||
|  |             //勋章 | ||
|  |             MedalButton.Show(); | ||
|  |             if (MedalButton.isLBActive()) { | ||
|  |                 //MedalButton.SwitchState = true; | ||
|  |                 MedalButtonSwitch = true; | ||
|  |                 //BeadButton.SwitchState = false; | ||
|  |                 BeadButtonSwitch = false; | ||
|  |                 State = 24; | ||
|  |                 //清空槽对象 | ||
|  |                 SlotArr = []; | ||
|  |                 SlotArr = null; | ||
|  |                 //还原页码 | ||
|  |                 NowPage = 1; | ||
|  |                 GetMyMedalInfo(State, NowPage); | ||
|  |             } | ||
|  | 
 | ||
|  |             BeadButton = TabTextButtonPro(obj, "小珠子Tab", X + 5 + 39, Y + 253, "common/medal/main.ani", 7, 38, 21, "守护珠", 8, 5); | ||
|  |             BeadButton.SwitchState = BeadButtonSwitch; | ||
|  |             BeadButton.SetRectEnble(true, "a勋章Tab", X + 5 + 39, Y + 253, "common/medal/main.ani", 8); | ||
|  |             BeadButton.SetCustomClickEnble(true, "a勋章Tab", X + 5 + 39, Y + 253, "common/medal/main.ani", 9); | ||
|  |             //守护珠 | ||
|  |             BeadButton.Show(); | ||
|  |             if (BeadButton.isLBActive()) { | ||
|  |                 MedalButton.SwitchState = false; | ||
|  |                 MedalButtonSwitch = false; | ||
|  |                 BeadButton.SwitchState = true; | ||
|  |                 BeadButtonSwitch = true; | ||
|  |                 State = 23; | ||
|  |                 //清空槽对象 | ||
|  |                 SlotArr = []; | ||
|  |                 SlotArr = null; | ||
|  |                 //还原页码 | ||
|  |                 NowPage = 1; | ||
|  |                 GetMyMedalInfo(State, NowPage); | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  | 
 | ||
|  |         { //翻页 | ||
|  |             local LeftButton = MedalButtonPro(obj, "MedalLeftButton", X + 150 + 39, Y + 260, "common/medal/main.ani", 13, 9, 14); | ||
|  |             LeftButton.SetRectEnble(true, "MedalLeftButtonr", X + 150 + 39, Y + 260, "common/medal/main.ani", 16); | ||
|  |             LeftButton.SetCustomClickEnble(true, "MedalLeftButtonc", X + 150 + 39, Y + 260, "common/medal/main.ani", 15); | ||
|  |             LeftButton.Show(); | ||
|  | 
 | ||
|  |             if (LeftButton.isLBActive()) { | ||
|  |                 //页码减少 | ||
|  |                 if (NowPage > 1) NowPage--; | ||
|  |                 //清空槽对象 | ||
|  |                 SlotArr = []; | ||
|  |                 SlotArr = null; | ||
|  |                 GetMyMedalInfo(State, NowPage); | ||
|  |             } | ||
|  | 
 | ||
|  |             local RightButton = MedalButtonPro(obj, "MedalRightButton", X + 200 + 39, Y + 260, "common/medal/main.ani", 13, 9, 10); | ||
|  |             RightButton.SetRectEnble(true, "MedalRightButtonr", X + 200 + 39, Y + 260, "common/medal/main.ani", 11); | ||
|  |             RightButton.SetCustomClickEnble(true, "MedalRightButtonc", X + 200 + 39, Y + 260, "common/medal/main.ani", 12); | ||
|  |             RightButton.Show(); | ||
|  | 
 | ||
|  |             if (RightButton.isLBActive()) { | ||
|  |                 //页码增加 | ||
|  |                 if (NowPage < MaxPage) NowPage++; | ||
|  |                 //清空槽对象 | ||
|  |                 SlotArr = []; | ||
|  |                 SlotArr = null; | ||
|  |                 GetMyMedalInfo(State, NowPage); | ||
|  |             } | ||
|  | 
 | ||
|  |             L_sq_DrawCode(NowPage + "/" + MaxPage, X + 175 + 39, Y + 258, sq_RGBA(230, 200, 155, 250), 1, 1); | ||
|  |         } | ||
|  | 
 | ||
|  |         { //佩戴槽 | ||
|  |             { //勋章 | ||
|  |                 if (WearSlotM == null) WearSlotM = MedalSlot(24); | ||
|  |             } | ||
|  | 
 | ||
|  |             { //守护珠 | ||
|  |                 if (WearSlotB == null) { | ||
|  |                     WearSlotB = []; | ||
|  |                     WearSlotB.resize(4); | ||
|  |                     for (local i = 0; i < 4; i++) { | ||
|  |                         WearSlotB[i] = MedalSlot(23); | ||
|  |                     } | ||
|  |                 } | ||
|  |             } | ||
|  | 
 | ||
|  |         } | ||
|  | 
 | ||
|  |         { //背包槽 | ||
|  |             if (SlotArr == null) { | ||
|  |                 SlotArr = []; | ||
|  |                 SlotArr.resize(24); | ||
|  |                 for (local i = 0; i < 24; i++) { | ||
|  |                     SlotArr[i] = MedalSlot(24); | ||
|  |                 } | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  |         //绘制 | ||
|  |         { | ||
|  |             //第一图层 | ||
|  |             WearSlotM.Show(obj, X + 114, Y + 147, 88); | ||
|  |             for (local i = 0; i < 4; i++) { | ||
|  |                 WearSlotB[i].Show(obj, X + 76 + ((i % 2) * 78), Y + 103 + ((i / 2) * 90), i + 88); | ||
|  |             } | ||
|  |             for (local k = 0; k < 24; k++) { | ||
|  |                 SlotArr[k].Show(obj, X + 9 + ((k % 8) * 30), Y + 275 + ((k / 8) * 30), k); | ||
|  |             } | ||
|  |             for (local p = 0; p < 24; p++) { | ||
|  |                 SlotArr[p].Show(obj, X + 9 + ((p % 8) * 30), Y + 275 + ((p / 8) * 30), p); | ||
|  |             } | ||
|  | 
 | ||
|  |             //第二图层 | ||
|  |             WearSlotM.ItemShow(obj); | ||
|  |             for (local u = 0; u < 4; u++) { | ||
|  |                 WearSlotB[u].ItemShow(obj); | ||
|  |             } | ||
|  |             for (local z = 0; z < 24; z++) { | ||
|  |                 SlotArr[z].ItemShow(obj); | ||
|  |             } | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  |             WearSlotM.ItemMoveShow(obj); | ||
|  |             for (local g = 0; g < 4; g++) { | ||
|  |                 WearSlotB[g].ItemMoveShow(obj); | ||
|  |             } | ||
|  |             for (local z = 0; z < 24; z++) { | ||
|  |                 SlotArr[z].ItemMoveShow(obj); | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  |         // print("Fist: " + MoveModel); | ||
|  |         // print("Next: " + HoverModel); | ||
|  |     } | ||
|  | 
 | ||
|  |     //实例化槽对象 | ||
|  |     function NewSlotObject() { | ||
|  |         //勋章佩戴槽 | ||
|  |         if (WearSlotM == null) WearSlotM = MedalSlot(24); | ||
|  |         //守护珠佩戴槽 | ||
|  |         if (WearSlotB == null) { | ||
|  |             WearSlotB = []; | ||
|  |             WearSlotB.resize(4); | ||
|  |             for (local i = 0; i < 4; i++) { | ||
|  |                 WearSlotB[i] = MedalSlot(23); | ||
|  |             } | ||
|  |         } | ||
|  |         //背包槽 | ||
|  |         if (SlotArr == null) { | ||
|  |             SlotArr = []; | ||
|  |             SlotArr.resize(24); | ||
|  |             for (local i = 0; i < 24; i++) { | ||
|  |                 SlotArr[i] = MedalSlot(24); | ||
|  |             } | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  | 
 | ||
|  |     //界面开启后的回调 | ||
|  |     function Run(obj, x, y) { | ||
|  |         X = x; | ||
|  |         Y = y; | ||
|  | 
 | ||
|  |         //绘制界面 | ||
|  |         DrawMain(obj); | ||
|  |     } | ||
|  | 
 | ||
|  |     //常驻回调 | ||
|  |     function Proc() { | ||
|  |         //检测打开背包 | ||
|  |         CheckOpenInv(); | ||
|  |         //实例化槽对象 | ||
|  |         NewSlotObject(); | ||
|  |     } | ||
|  | 
 | ||
|  |     //设置表 | ||
|  |     function CalculationAttribute(TabBuffer, Str, Rate) { | ||
|  |         if (TabBuffer.rawin(Str)) TabBuffer.rawset(Str, TabBuffer[Str] + Rate); | ||
|  |         else TabBuffer.rawset(Str, Rate) | ||
|  |     } | ||
|  | 
 | ||
|  |     //读取属性 | ||
|  |     function ReadCalAttribute(M_Tab, S_Tab) { | ||
|  |         for (local i = 0; i < S_Tab.Item.Attribute.len(); i++) { | ||
|  |             local Type = S_Tab.Item.Attribute[i][0]; | ||
|  |             if (Type == 2) CalculationAttribute(M_Tab, "力量", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 3) CalculationAttribute(M_Tab, "体力", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 4) CalculationAttribute(M_Tab, "智力", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 5) CalculationAttribute(M_Tab, "精神", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 6) CalculationAttribute(M_Tab, "独立攻击力", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 7) CalculationAttribute(M_Tab, "物理攻击力", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 8) CalculationAttribute(M_Tab, "魔法攻击力", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 9) CalculationAttribute(M_Tab, "物理防御", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 10) CalculationAttribute(M_Tab, "魔法防御", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 11) CalculationAttribute(M_Tab, "移动速度", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 12) CalculationAttribute(M_Tab, "攻击速度", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 13) CalculationAttribute(M_Tab, "释放速度", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 14) CalculationAttribute(M_Tab, "物理暴击", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 15) CalculationAttribute(M_Tab, "魔法暴击", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 16) CalculationAttribute(M_Tab, "命中率", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 17) CalculationAttribute(M_Tab, "光属性强化", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 18) CalculationAttribute(M_Tab, "暗属性强化", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 19) CalculationAttribute(M_Tab, "冰属性强化", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 20) CalculationAttribute(M_Tab, "火属性强化", S_Tab.Item.Attribute[i][1]); | ||
|  |             else if (Type == 21) CalculationAttribute(M_Tab, "全属性强化", S_Tab.Item.Attribute[i][1]); | ||
|  |         } | ||
|  |     } | ||
|  | 
 | ||
|  |     //副本系统 | ||
|  |     function DgnSystem(obj) { | ||
|  | 
 | ||
|  | 
 | ||
|  |         // local str = Json_STL.Encode(AddAttributeArr); | ||
|  |         // Sout("查询当前身穿的属性:\n %L", str); | ||
|  | 
 | ||
|  |         if (sq_GetCurrentModuleType() == 3) { | ||
|  | 
 | ||
|  |             //如果没带勋章就直接走 | ||
|  |             if (WearSlotM.Item == null) return; | ||
|  | 
 | ||
|  |             local AddAttributeArr = {}; | ||
|  |             ReadCalAttribute(AddAttributeArr, WearSlotM); | ||
|  |             for (local i = 0; i < 4; i++) { | ||
|  |                 if (WearSlotB[i].Item != null) ReadCalAttribute(AddAttributeArr, WearSlotB[i]); | ||
|  |             } | ||
|  | 
 | ||
|  |             if (!CNSquirrelAppendage.sq_IsAppendAppendage(obj, "appendage/m/m.nut")) { | ||
|  |                 DgnAddBuff = true; | ||
|  | 
 | ||
|  |                 local appendage = CNSquirrelAppendage.sq_AppendAppendage(obj, obj, -1, false, "appendage/m/m.nut", true); | ||
|  |                 CNSquirrelAppendage.sq_Append(appendage, obj, obj); | ||
|  | 
 | ||
|  |                 local change_appendage = appendage.sq_getChangeStatus("Yosin_MedalDgnBuff"); | ||
|  |                 if (!change_appendage) { | ||
|  |                     change_appendage = appendage.sq_AddChangeStatusAppendageID(obj, obj, 0, | ||
|  |                         CHANGE_STATUS_TYPE_COOLTIME_DECLINE, | ||
|  |                         false, 0, 114514); | ||
|  |                 } | ||
|  |                 if (change_appendage) { | ||
|  |                     change_appendage.clearParameter(); | ||
|  |                     //print(WearSlotM.Item.TabName[0]); | ||
|  | 
 | ||
|  |                     foreach(Key, Value in AddAttributeArr) { | ||
|  |                         if (Key == "力量") change_appendage.addParameter(0, false, Value.tofloat()); | ||
|  |                         else if (Key == "体力") change_appendage.addParameter(3, false, Value.tofloat()); | ||
|  |                         else if (Key == "精神") change_appendage.addParameter(2, false, Value.tofloat()); | ||
|  |                         else if (Key == "智力") change_appendage.addParameter(1, false, Value.tofloat()); | ||
|  |                         else if (Key == "独立攻击力") change_appendage.addParameter(53, false, Value.tofloat()); | ||
|  |                         else if (Key == "物理攻击力") change_appendage.addParameter(4, false, Value.tofloat()); | ||
|  |                         else if (Key == "魔法攻击力") change_appendage.addParameter(31, false, Value.tofloat()); | ||
|  |                         else if (Key == "物理防御") change_appendage.addParameter(5, false, Value.tofloat()); | ||
|  |                         else if (Key == "魔法防御") change_appendage.addParameter(32, false, Value.tofloat()); | ||
|  |                         else if (Key == "移动速度") change_appendage.addParameter(11, false, Value.tofloat()); | ||
|  |                         else if (Key == "攻击速度") change_appendage.addParameter(10, false, Value.tofloat()); | ||
|  |                         else if (Key == "释放速度") change_appendage.addParameter(12, false, Value.tofloat()); | ||
|  |                         else if (Key == "物理暴击") change_appendage.addParameter(15, false, Value.tofloat() / 10.0); | ||
|  |                         else if (Key == "魔法暴击") change_appendage.addParameter(16, false, Value.tofloat() / 10.0); | ||
|  |                         else if (Key == "命中率") change_appendage.addParameter(33, false, 0 - (Value.tofloat() / 10.0)); | ||
|  | 
 | ||
|  |                         else if (Key == "光属性强化") change_appendage.addParameter(45, false, Value.tofloat()); | ||
|  |                         else if (Key == "暗属性强化") change_appendage.addParameter(44, false, Value.tofloat()); | ||
|  |                         else if (Key == "冰属性强化") change_appendage.addParameter(43, false, Value.tofloat()); | ||
|  |                         else if (Key == "火属性强化") change_appendage.addParameter(42, false, Value.tofloat()); | ||
|  |                         else if (Key == "全属性强化") change_appendage.addParameter(46, false, Value.tofloat()); | ||
|  |                     } | ||
|  |                 } | ||
|  | 
 | ||
|  |                 //Sout("已附加属性"); | ||
|  |             } | ||
|  |         } else { | ||
|  |             DgnAddBuff = false; | ||
|  |         } | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | function Medal(obj) { | ||
|  |     local RootTab = getroottable(); | ||
|  |     if (!RootTab.rawin("MedalObj")) { | ||
|  |         local Cobj = MedalSystem(obj); | ||
|  |         RootTab.rawset("MedalObj", Cobj); | ||
|  |     } else { | ||
|  |         RootTab["MedalObj"].Proc(); | ||
|  |         RootTab["MedalObj"].DgnSystem(obj); | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | function Sq_L_Medal(x, y) { | ||
|  |     local RootTab = getroottable(); | ||
|  |     if (RootTab.rawin("MedalObj")) { | ||
|  |         local obj = sq_GetMyMasterCharacter(); | ||
|  |         RootTab["MedalObj"].Run(obj, x - 900, y); | ||
|  |     } | ||
|  | } |