1074 lines
		
	
	
		
			31 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			1074 lines
		
	
	
		
			31 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| function LenheartAdditionalAttributes(obj) {
 | |
|     //在副本中
 | |
|     if (sq_GetCurrentModuleType() == 3) {
 | |
|         if (!CNSquirrelAppendage.sq_IsAppendAppendage(obj, "appendage/lenheartap.nut")) {
 | |
|             if ("LenheartAttributesTable" in getroottable()) {
 | |
|                 local Abarr = array(32, 0);
 | |
|                 foreach(AtObj in getroottable()["LenheartAttributesTable"]) {
 | |
|                     foreach(Apos, At in AtObj) {
 | |
|                         Abarr[Apos] += At;
 | |
|                     }
 | |
|                 }
 | |
| 
 | |
|                 local appendage = CNSquirrelAppendage.sq_AppendAppendage(obj, obj, -1, false, "appendage/lenheartap.nut", true);
 | |
|                 CNSquirrelAppendage.sq_Append(appendage, obj, obj);
 | |
|                 local change_appendage = appendage.sq_getChangeStatus("Yosin_LenheartDgnBuff");
 | |
|                 if (!change_appendage) {
 | |
|                     change_appendage = appendage.sq_AddChangeStatusAppendageID(obj, obj, 0,
 | |
|                         CHANGE_STATUS_TYPE_COOLTIME_DECLINE,
 | |
|                         false, 0, 115514);
 | |
|                 }
 | |
|                 if (change_appendage) {
 | |
|                     change_appendage.clearParameter();
 | |
| 
 | |
|                     foreach(Key, Value in Abarr) {
 | |
|                         if (Key == 0) change_appendage.addParameter(13, false, Value.tofloat()); //HP
 | |
|                         else if (Key == 1) change_appendage.addParameter(48, false, Value.tofloat()); //MP
 | |
|                         else if (Key == 2) change_appendage.addParameter(0, false, Value.tofloat()); //力量
 | |
|                         else if (Key == 3) change_appendage.addParameter(1, false, Value.tofloat()); //智力
 | |
|                         else if (Key == 4) change_appendage.addParameter(2, false, Value.tofloat()); //体力
 | |
|                         else if (Key == 5) change_appendage.addParameter(3, false, Value.tofloat()); //精神
 | |
|                         else if (Key == 6) change_appendage.addParameter(4, false, Value.tofloat()); //物攻
 | |
|                         else if (Key == 7) change_appendage.addParameter(31, false, Value.tofloat()); //魔攻
 | |
|                         else if (Key == 8) {
 | |
|                             change_appendage.addParameter(53, false, Value.tofloat()); //独立
 | |
|                             change_appendage.addParameter(54, false, Value.tofloat()); //独立
 | |
|                         } else if (Key == 10) change_appendage.addParameter(5, false, Value.tofloat()); //物理防御
 | |
|                         else if (Key == 11) change_appendage.addParameter(32, false, Value.tofloat()); //魔法防御
 | |
|                         else if (Key == 12) change_appendage.addParameter(15, false, Value.tofloat() / 10.0); //物理暴击
 | |
|                         else if (Key == 13) change_appendage.addParameter(16, false, Value.tofloat() / 10.0); //魔法暴击
 | |
|                         else if (Key == 14) change_appendage.addParameter(10, false, Value.tofloat()); //攻速
 | |
|                         else if (Key == 15) change_appendage.addParameter(12, false, Value.tofloat()); //释放
 | |
|                         else if (Key == 16) change_appendage.addParameter(11, false, Value.tofloat()); //移速
 | |
|                         else if (Key == 17) change_appendage.addParameter(39, false, Value.tofloat()); //抗磨
 | |
|                         else if (Key == 18) change_appendage.addParameter(33, false, Value.tofloat()); //命中
 | |
|                         else if (Key == 19) change_appendage.addParameter(27, false, Value.tofloat()); //闪避
 | |
|                         else if (Key == 20) change_appendage.addParameter(14, false, Value.tofloat()); //HP恢复
 | |
|                         else if (Key == 21) change_appendage.addParameter(29, false, Value.tofloat()); //MP恢复
 | |
|                         else if (Key == 22) change_appendage.addParameter(41, false, Value.tofloat()); //僵直
 | |
|                         else if (Key == 23) change_appendage.addParameter(34, false, Value.tofloat()); //硬直
 | |
|                         else if (Key == 24) change_appendage.addParameter(42, false, Value.tofloat()); //火强
 | |
|                         else if (Key == 25) change_appendage.addParameter(20, false, Value.tofloat()); //火抗
 | |
|                         else if (Key == 26) change_appendage.addParameter(43, false, Value.tofloat()); //冰强
 | |
|                         else if (Key == 27) change_appendage.addParameter(21, false, Value.tofloat()); //冰抗
 | |
|                         else if (Key == 28) change_appendage.addParameter(45, false, Value.tofloat()); //光强
 | |
|                         else if (Key == 29) change_appendage.addParameter(23, false, Value.tofloat()); //光抗
 | |
|                         else if (Key == 30) change_appendage.addParameter(44, false, Value.tofloat()); //暗强
 | |
|                         else if (Key == 31) change_appendage.addParameter(22, false, Value.tofloat()); //暗抗
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| if (getroottable().rawin("LenheartFuncTab")) {
 | |
|     getroottable()["LenheartFuncTab"].rawset("LenheartAdditionalAttributesFunc", LenheartAdditionalAttributes);
 | |
| } else {
 | |
|     local T = {};
 | |
|     T.rawset("LenheartAdditionalAttributesFunc", LenheartAdditionalAttributes);
 | |
|     getroottable().rawset("LenheartFuncTab", T);
 | |
| }
 | |
| 
 | |
| class LenheartTextClass {
 | |
| 
 | |
|     function GetStringLength(str) {
 | |
|         return L_sq_GetStringDrawLength(str);
 | |
|     }
 | |
| 
 | |
| }
 | |
| 
 | |
| 
 | |
| class ItemInfoClass {
 | |
| 
 | |
|     //Gm模式
 | |
|     GmModel = true;
 | |
| 
 | |
|     Info = null;
 | |
|     PageLength = 0;
 | |
| 
 | |
|     //静态品级颜色
 | |
|     static RarityColor = [
 | |
|         0xFFFFFFFF, //白
 | |
|         0xFFEDD568, //蓝
 | |
|         0xFFFF6BB3, //紫
 | |
|         0xFFF000FF, //粉
 | |
|         0xFF00B1FF, //黄
 | |
|         0xFF6666FF, //红
 | |
|         0xFF0055FF, //橙
 | |
|     ];
 | |
|     // print(format("0x%02X as ",sq_RGBA(255, 85, 0, 255)));
 | |
| 
 | |
|     //我的品级颜色
 | |
|     MyRarityColor = null;
 | |
|     //我的售价长度
 | |
|     MyPriceLength = null;
 | |
|     //我的冷却时间长度
 | |
|     MyCoolTimeLength = null;
 | |
| 
 | |
|     //获取真实类型
 | |
|     function GetRealType(Type) {
 | |
|         switch (Type) {
 | |
|             case "[material]\r":
 | |
|                 return "材料";
 | |
|                 break;
 | |
|             default:
 | |
|                 return "道具";
 | |
|                 break;
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     constructor(gInfo) {
 | |
|         Info = clone(gInfo);
 | |
| 
 | |
| 
 | |
|         //Gm模式显示编号
 | |
|         if (GmModel) Info.Name += "[" + Info.Id + "]";
 | |
| 
 | |
|         //配置品级颜色
 | |
|         if (Info.Rarity< 0 || Info.Rarity > 6) {
 | |
|             MyRarityColor = Info.Rarity;
 | |
|         } else {
 | |
|             MyRarityColor = RarityColor[Info.Rarity];
 | |
|         }
 | |
| 
 | |
|         //配置售价长度
 | |
|         if ("Price" in Info) {
 | |
|             MyPriceLength = LenheartTextClass.GetStringLength(Info.Price.tostring());
 | |
|         }
 | |
| 
 | |
|         //配置冷却时间长度
 | |
|         if ("CoolTime" in Info) {
 | |
|             MyCoolTimeLength = LenheartTextClass.GetStringLength((Info.CoolTime / 1000.0).tostring());
 | |
|         }
 | |
| 
 | |
|         //配置类型
 | |
|         if ("Type" in Info) {
 | |
|             Info.Type = GetRealType(Info.Type);
 | |
|         }
 | |
| 
 | |
|         // CheckInfoLength("Name", 40);
 | |
|         // CheckInfoLength("Price", 16);
 | |
|         // CheckInfoLength("Type", 16);
 | |
| 
 | |
|         PageLength += 72;
 | |
|         CheckStrLength();
 | |
|     }
 | |
| 
 | |
|     function CheckInfoLength(TableKey, AddLength) {
 | |
|         if (TableKey in Info) {
 | |
|             PageLength += AddLength;
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     function CheckStrLength() {
 | |
|         if ("Explain" in Info) {
 | |
|             local Buf = LenheartTextClass.GetStringLength(Info.Explain.tostring());
 | |
|             local Pn = (Buf / 211.0);
 | |
|             if (Pn< 1) PageLength += 12;
 | |
|             if (Pn > 1) Pn = Pn.tointeger() + 1;
 | |
|             PageLength += (16 * Pn);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     //高级绘制文字(带换行)
 | |
|     function L_sq_DrawCode_Ex(str, x, y, rgba, mb, jc, hl) {
 | |
|         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 + 1;
 | |
|             }
 | |
|             for (local z = 0; z< strarr.len(); z++) {
 | |
|                 L_sq_DrawCode(strarr[z], x, y + (z * 14), rgba, mb, jc);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     function Show(X, Y) {
 | |
|         if (X< 0) X = 0;
 | |
|         if ((X + 211) > 800) X = (800 - 211);
 | |
|         if (Y< 0) Y = 0;
 | |
|         if (Y + PageLength > 600) Y = 600 - PageLength;
 | |
| 
 | |
|         //Item信息框一般为211的宽度
 | |
|         L_sq_DrawWindow(X, Y, 211, PageLength, "interface2/popup/popup.img", 134, 6, 12, 6, 13);
 | |
| 
 | |
|         //绘制名字 和 图标
 | |
|         if ("Id" in Info) L_Sq_DrawItem(X + 8 + 174, Y + 8, Info.Id, 1, 0, 0, 0);
 | |
|         if ("Name2" in Info) L_sq_DrawCode(Info.Name2, X + 8, Y + 9, MyRarityColor, 1, 1);
 | |
|         if ("Name" in Info) L_sq_DrawCode(Info.Name, X + 8, Y + 23, MyRarityColor, 1, 1);
 | |
| 
 | |
| 
 | |
|         //绘制线
 | |
|         L_sq_DrawImg("interface2/popup/popup.img", 270, X + 7, Y + 26 + 16);
 | |
| 
 | |
|         //绘制重量
 | |
|         if ("Weight" in Info) {
 | |
|             L_sq_DrawCode((Info.Weight).tostring() + "kg", X + 7, Y + 24 + 24, 0xFFFFFFFF, 1, 1);
 | |
|         }
 | |
| 
 | |
|         //绘制售价
 | |
|         if ("Price" in Info) {
 | |
|             L_sq_DrawCode("金币", X + 186, Y + 24 + 24, 0xFFFFFFFF, 1, 1);
 | |
|             L_sq_DrawCode(Info.Price.tostring(), X - MyPriceLength + 186, Y + 24 + 24, 0xFFFFFFFF, 1, 1);
 | |
|         }
 | |
| 
 | |
| 
 | |
|         //绘制类型
 | |
|         if ("Type" in Info) {
 | |
|             L_sq_DrawCode(Info.Type.tostring(), X + 7, Y + 48 + 16, 0xFFFFFFFF, 1, 1);
 | |
|         }
 | |
| 
 | |
| 
 | |
| 
 | |
|         //绘制冷却时间
 | |
|         if ("CoolTime" in Info) {
 | |
|             L_sq_DrawCode("秒", X + 186 + 12, Y + 48 + 16, 0xFFFFFFFF, 1, 1);
 | |
|             L_sq_DrawCode((Info.CoolTime / 1000.0).tostring(), X - MyCoolTimeLength + 214 - 18, Y + 48 + 16, 0xFFFFFFFF, 1, 1);
 | |
|         }
 | |
| 
 | |
|         //绘制普通描述
 | |
|         if ("Explain" in Info) {
 | |
|             local a = L_sq_GetStringDrawArray(Info.Explain, 251);
 | |
|             foreach(Pos, va in a) {
 | |
|                 // Sout("文本内容嗯: %L", va);
 | |
|                 L_sq_DrawCode(va, X + 7, Y + 48 + 16 + 24 + (Pos * 16), 0xFFEDD568, 1, 1);
 | |
|             }
 | |
| 
 | |
|             // Sout("A%L", a[0]);
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| function GetOtherPlayerAttributeLMain(Chunk) {
 | |
|     if (L_sq_RA(0x1A5FB4C, "0x14+0x28+") == 0) return;
 | |
|     local PlayerName = L_Sq_GetPlayerEachName();
 | |
|     if (PlayerName) {
 | |
|         local T = {
 | |
|             op = 20231017,
 | |
|             realop = 2023102002,
 | |
|             name = PlayerName,
 | |
|         }
 | |
|         BasicsDrawTool.SendPack(T);
 | |
|     }
 | |
| 
 | |
| }
 | |
| if (!(getroottable().rawin("GetOtherPlayerAttributeLMainCCC"))) {
 | |
|     SendPackTypeTable.rawset(8, GetOtherPlayerAttributeLMain);
 | |
|     getroottable().rawset("GetOtherPlayerAttributeLMainCCC", 1);
 | |
| }
 | |
| 
 | |
| function GetOtherPlayerAttributeLMainCallBack(Chunk) {
 | |
|     // Sout("收到包内容: %L", Chunk);
 | |
|     local Jso = Json.Decode(Chunk);
 | |
|     getroottable().LenheartOtherPlayerAb <- Jso.attribute;
 | |
| }
 | |
| Pack_Control.rawset(2023102002, GetOtherPlayerAttributeLMainCallBack);
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| function Sq_L_OtherPlayerInfo(x, y, Type, Value, ImgBuf) {
 | |
|     if ("LenheartOtherPlayerAb" in getroottable()) {
 | |
|         if (sq_GetCurrentModuleType() == 1)
 | |
|             Value = Value + (getroottable().LenheartOtherPlayerAb[Type].tofloat() / 100.0).tointeger();
 | |
|     }
 | |
|     local str = Value.tostring();
 | |
|     if ((Type >= 12 && Type <= 16) || Type == 18 || Type == 19) {
 | |
|         str = format("+%d.0/", Value);
 | |
|     }
 | |
| 
 | |
| 
 | |
|     local lenght = LenheartTextClass.GetStringLength(str);
 | |
| 
 | |
|     L_sq_DrawImg(ImgBuf, x + 70 - lenght, y + 5);
 | |
|     return Value;
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| class LenheartWindow 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;
 | |
|             L_sq_WA(0x1b46898, 1);
 | |
|         } else {
 | |
|             if (YMouseSw == false && sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, 0, 0, 800, 600)) {
 | |
|                 IMouse.ReleaseMouseClick();
 | |
|                 YMouseSw = true;
 | |
|                 L_sq_WA(0x1b46898, 0);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     //设定窗口拖动逻辑
 | |
|     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 LenheartcommonUiC {
 | |
|     X = null;
 | |
|     Y = null;
 | |
|     Width = null;
 | |
|     Height = null;
 | |
| 
 | |
|     Mobj = null; //鼠标对象
 | |
| 
 | |
|     constructor(x, y, width, height) {
 | |
|         this.X = x;
 | |
|         this.Y = y;
 | |
|         this.Width = width;
 | |
|         this.Height = height;
 | |
|         if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
 | |
|     }
 | |
| 
 | |
|     //同步坐标
 | |
|     function SyncPos(x, y) {
 | |
|         this.X = x;
 | |
|         this.Y = y;
 | |
|     }
 | |
| 
 | |
|     //悬停状态
 | |
|     function isInRect() {
 | |
|         if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, Width, Height)) 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) {
 | |
|             State = 1;
 | |
|             return true;
 | |
|         } else return false;
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| //复选框
 | |
| class LenheartcommonSwitchButton extends LenheartcommonUiC {
 | |
|     State = 0;
 | |
|     ImgIndex = null;
 | |
| 
 | |
|     constructor(X, Y) {
 | |
|         LenheartcommonUiC.constructor(X, Y, 14, 15);
 | |
|     }
 | |
| 
 | |
|     function Show() {
 | |
|         //不可用
 | |
|         if (State == 8) {
 | |
|             L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 3 : 141, X, Y + 1);
 | |
|         } else {
 | |
|             //悬停
 | |
|             if (isLBDown()) {
 | |
|                 L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 2 : 140, X, Y + 1);
 | |
|             }
 | |
|             //按下
 | |
|             else if (isInRect()) {
 | |
|                 if (State == 0)
 | |
|                     L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 1 : 139, X, Y);
 | |
|                 if (State == 1)
 | |
|                     L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 2 : 140, X, Y);
 | |
|             }
 | |
|             //普通
 | |
|             else {
 | |
|                 if (State == 0)
 | |
|                     L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex : 138, X, Y);
 | |
|                 if (State == 1)
 | |
|                     L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 2 : 140, X, Y);
 | |
| 
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| class LenheartcommonSwitchButtonText extends LenheartcommonSwitchButton {
 | |
| 
 | |
|     TextStr = null;
 | |
|     TextX = 0;
 | |
|     TextY = 0;
 | |
|     TextColor = null;
 | |
|     TextRColor = null;
 | |
| 
 | |
| 
 | |
|     constructor(X, Y, Str) {
 | |
|         LenheartcommonSwitchButton.constructor(X, Y);
 | |
|         this.TextStr = Str;
 | |
|         TextColor = sq_RGBA(221, 197, 147, 250);
 | |
|         TextRColor = sq_RGBA(255, 255, 184, 250);
 | |
|     }
 | |
| 
 | |
|     function SetTextColor(RGBA) {
 | |
|         TextColor = RGBA;
 | |
|     }
 | |
| 
 | |
|     function SetTextPos(gX, gY) {
 | |
|         TextX = gX;
 | |
|         TextY = gY;
 | |
|     }
 | |
| 
 | |
|     function Show() {
 | |
|         LenheartcommonSwitchButton.Show();
 | |
|         local Color = TextColor;
 | |
|         local SY = Y;
 | |
|         if (State != 8) {
 | |
|             if (isLBDown()) {
 | |
|                 SY = Y + 1;
 | |
|             }
 | |
|             if (isInRect() || State == 1) {
 | |
|                 Color = TextRColor;
 | |
|             }
 | |
|         }
 | |
|         L_sq_DrawCode(TextStr, X + 16 + TextX, SY + 1 + TextY, Color, 0, 1);
 | |
|     }
 | |
| }
 | |
| 
 | |
| class LenheartTabbars extends LenheartcommonUiC {
 | |
|     State = 0;
 | |
|     Path = "interface/lenheartwindowcommon.img";
 | |
|     Idx = 29;
 | |
| 
 | |
|     constructor(X, Y, ...) {
 | |
|         if (vargc == 2) {
 | |
|             LenheartcommonUiC.constructor(X, Y, vargv[0], vargv[1]);
 | |
|         } else {
 | |
|             LenheartcommonUiC.constructor(X, Y, 61, 19);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     function SetFrame(gPath, gIdx) {
 | |
|         if (gPath) Path = gPath;
 | |
|         Idx = gIdx;
 | |
|     }
 | |
| 
 | |
|     function Show() {
 | |
|         //不可用
 | |
|         if (State == 8) {
 | |
|             L_sq_DrawImg(Path, Idx + 3, X, Y);
 | |
|         } else {
 | |
|             //按下
 | |
|             if (isLBDown()) {
 | |
|                 L_sq_DrawImg(Path, Idx + 1, X, Y + 1);
 | |
|             }
 | |
|             //悬停
 | |
|             else if (isInRect()) {
 | |
|                 if (State == 0)
 | |
|                     L_sq_DrawImg(Path, Idx + 1, X, Y);
 | |
|                 if (State == 1)
 | |
|                     L_sq_DrawImg(Path, Idx + 2, X, Y);
 | |
|             }
 | |
|             //普通
 | |
|             else {
 | |
|                 if (State == 0)
 | |
|                     L_sq_DrawImg(Path, Idx, X, Y);
 | |
|                 if (State == 1)
 | |
|                     L_sq_DrawImg(Path, Idx + 2, X, Y);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| class LenheartTabbarsText extends LenheartTabbars {
 | |
|     TextStr = null;
 | |
|     TextX = null;
 | |
|     TextY = null;
 | |
|     TextColor = null;
 | |
|     TextRColor = null;
 | |
| 
 | |
|     TextXoffset = null;
 | |
|     TextYoffset = null;
 | |
| 
 | |
|     constructor(X, Y, Str, ...) {
 | |
|         if (vargc == 2) {
 | |
|             LenheartTabbars.constructor(X, Y, vargv[0], vargv[1]);
 | |
|         } else {
 | |
|             LenheartTabbars.constructor(X, Y);
 | |
|         }
 | |
|         this.TextStr = Str;
 | |
|         TextColor = sq_RGBA(124, 110, 82, 255);
 | |
|         TextRColor = sq_RGBA(185, 172, 145, 255);
 | |
| 
 | |
|         TextXoffset = 19;
 | |
|         TextYoffset = 3;
 | |
|     }
 | |
| 
 | |
|     function SetTextColor(RGBA) {
 | |
|         TextColor = RGBA;
 | |
|     }
 | |
| 
 | |
|     function SetTextOffset(gX, gY) {
 | |
|         TextXoffset = gX;
 | |
|         TextYoffset = gY;
 | |
|     }
 | |
| 
 | |
|     function Show() {
 | |
|         LenheartTabbars.Show();
 | |
|         local Color = TextColor;
 | |
|         local SY = Y + TextYoffset;
 | |
|         if (State != 8) {
 | |
|             if (isLBDown()) {
 | |
|                 SY = Y + TextYoffset + 1;
 | |
|             }
 | |
|             if (isInRect() || State == 1) {
 | |
|                 Color = TextRColor;
 | |
|             }
 | |
|         }
 | |
|         if (State == 1)
 | |
|             L_sq_DrawCode(TextStr, X + TextXoffset, SY, Color, 0, 1);
 | |
|         if (State == 0 || State == 8)
 | |
|             L_sq_DrawCode(TextStr, X + TextXoffset, SY + 2, Color, 0, 1);
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| class LenheartButton extends LenheartcommonUiC {
 | |
|     State = 0;
 | |
|     BaseIdx = 29;
 | |
|     DWidth = null;
 | |
|     Path = "interface/lenheartwindowcommon.img";
 | |
|     Idx = 172;
 | |
|     FillWidth = 2;
 | |
|     FirstWidth = 28;
 | |
| 
 | |
| 
 | |
|     constructor(X, Y, W) {
 | |
|         this.DWidth = W;
 | |
|         LenheartcommonUiC.constructor(X, Y, W + 28 * 2, 24);
 | |
|     }
 | |
| 
 | |
|     function SetFrame(gPath, gIdx) {
 | |
|         if (gPath) Path = gPath;
 | |
|         Idx = gIdx;
 | |
|     }
 | |
| 
 | |
|     function Show() {
 | |
|         //不可用
 | |
|         if (State == 8) {
 | |
|             L_sq_DrawButton(X, Y + 1, this.DWidth, Path, Idx + 9,FillWidth,FirstWidth);
 | |
|         } else {
 | |
|             //按下
 | |
|             if (isLBDown()) {
 | |
|                 L_sq_DrawButton(X, Y + 1, this.DWidth, Path, Idx + 3,FillWidth,FirstWidth);
 | |
|             }
 | |
|             //悬停
 | |
|             else if (isInRect()) {
 | |
|                 L_sq_DrawButton(X, Y, this.DWidth, Path, Idx + 3,FillWidth,FirstWidth);
 | |
|             }
 | |
|             //普通
 | |
|             else {
 | |
|                 L_sq_DrawButton(X, Y, this.DWidth, Path, Idx,FillWidth,FirstWidth);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| class LenheartButtonText extends LenheartButton {
 | |
|     TextStr = null;
 | |
|     TextX = null;
 | |
|     TextY = null;
 | |
|     TextColor = null;
 | |
|     TextRColor = null;
 | |
| 
 | |
|     TextXoffset = null;
 | |
|     TextYoffset = null;
 | |
| 
 | |
|     constructor(X, Y, W, Str) {
 | |
|         LenheartButton.constructor(X, Y, W);
 | |
|         this.TextStr = Str;
 | |
|         TextColor = sq_RGBA(185, 148, 96, 255);
 | |
|         TextRColor = sq_RGBA(227, 212, 154, 255);
 | |
| 
 | |
|         TextXoffset = 19;
 | |
|         TextYoffset = 3;
 | |
|     }
 | |
| 
 | |
|     function SetTextColor(RGBA) {
 | |
|         TextColor = RGBA;
 | |
|     }
 | |
| 
 | |
|     function SetTextOffset(gX, gY) {
 | |
|         TextXoffset = gX;
 | |
|         TextYoffset = gY;
 | |
|     }
 | |
| 
 | |
|     function Show() {
 | |
|         LenheartButton.Show();
 | |
|         local Color = TextColor;
 | |
|         local SY = Y + TextYoffset;
 | |
|         if (State != 8) {
 | |
|             if (isLBDown()) {
 | |
|                 SY = Y + TextYoffset + 1;
 | |
|             }
 | |
|             if (isInRect() || State == 1) {
 | |
|                 Color = TextRColor;
 | |
|             }
 | |
|         }
 | |
|         L_sq_DrawCode(TextStr, X + TextXoffset + 19, SY + 5, Color, 0, 1);
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
| class LenheartBaseButton extends LenheartcommonUiC {
 | |
|     State = 0;
 | |
|     BaseIdx = 29;
 | |
|     DWidth = null;
 | |
|     Path = null;
 | |
|     Idx = null;
 | |
| 
 | |
| 
 | |
|     constructor(X, Y, W, H, Path, Idx) {
 | |
|         this.DWidth = W;
 | |
|         this.Path = Path;
 | |
|         this.Idx = Idx;
 | |
|         LenheartcommonUiC.constructor(X, Y, W, H);
 | |
|     }
 | |
| 
 | |
|     function SetFrame(gPath, gIdx) {
 | |
|         if (gPath) Path = gPath;
 | |
|         Idx = gIdx;
 | |
|     }
 | |
| 
 | |
|     function Show() {
 | |
|         //不可用
 | |
|         if (State == 8) {
 | |
|             L_sq_DrawImg(Path, Idx + 3, X, Y + 1);
 | |
|         } else {
 | |
|             //按下
 | |
|             if (isLBDown()) {
 | |
|                 L_sq_DrawImg(Path, Idx + 2, X, Y + 1);
 | |
|             }
 | |
|             //悬停
 | |
|             else if (isInRect()) {
 | |
|                 L_sq_DrawImg(Path, Idx + 1, X, Y);
 | |
|             }
 | |
|             //普通
 | |
|             else {
 | |
|                 L_sq_DrawImg(Path, Idx, X, Y);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 | |
| class LenheartBaseButtonText extends LenheartBaseButton {
 | |
|     TextStr = null;
 | |
|     TextX = null;
 | |
|     TextY = null;
 | |
|     TextColor = null;
 | |
|     TextRColor = null;
 | |
| 
 | |
|     TextXoffset = null;
 | |
|     TextYoffset = null;
 | |
| 
 | |
|     constructor(X, Y, W, H, Path, Idx, Str) {
 | |
|         LenheartBaseButton.constructor(X, Y, W, H, Path, Idx);
 | |
|         this.TextStr = Str;
 | |
|         TextColor = sq_RGBA(185, 148, 96, 255);
 | |
|         TextRColor = sq_RGBA(227, 212, 154, 255);
 | |
| 
 | |
|         TextXoffset = 19;
 | |
|         TextYoffset = 3;
 | |
|     }
 | |
| 
 | |
|     function SetTextColor(RGBA) {
 | |
|         TextColor = RGBA;
 | |
|     }
 | |
| 
 | |
|     function SetTextOffset(gX, gY) {
 | |
|         TextXoffset = gX;
 | |
|         TextYoffset = gY;
 | |
|     }
 | |
| 
 | |
|     function Show() {
 | |
|         LenheartBaseButton.Show();
 | |
|         local Color = TextColor;
 | |
|         local SY = Y + TextYoffset;
 | |
|         if (State != 8) {
 | |
|             if (isLBDown()) {
 | |
|                 SY = Y + TextYoffset + 1;
 | |
|             }
 | |
|             if (isInRect() || State == 1) {
 | |
|                 Color = TextRColor;
 | |
|             }
 | |
|         }
 | |
|         L_sq_DrawCode(TextStr, X + TextXoffset + 19, SY + 5, Color, 0, 1);
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| class LenheartBaseInput extends LenheartcommonUiC {
 | |
|     State = 0;
 | |
|     InputState = 0;
 | |
|     DWidth = null;
 | |
|     str = "";
 | |
|     sliceCode = "|";
 | |
|     BaseTime = 0;
 | |
|     InputController = null;
 | |
| 
 | |
|     constructor(X, Y, W, H) {
 | |
|         this.DWidth = W;
 | |
|         LenheartcommonUiC.constructor(X, Y, W, H);
 | |
|     }
 | |
| 
 | |
|     function sliceCodeFlicker() {
 | |
|         local T = Clock();
 | |
|         if ((T - 500) >= BaseTime) {
 | |
|             BaseTime = T;
 | |
|             if (sliceCode.len() > 0) sliceCode = "";
 | |
|             else if (sliceCode.len() == 0) sliceCode = "|";
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     //同步坐标
 | |
|     function SyncPos(x, y) {
 | |
|         this.X = x;
 | |
|         this.Y = y;
 | |
|     }
 | |
| 
 | |
|     function Show() {
 | |
|         //光标闪烁
 | |
|         if (InputState == 1) sliceCodeFlicker();
 | |
|         else sliceCode = "";
 | |
| 
 | |
|         L_sq_DrawImg("interface/lenheartwindowcommon.img", 63, this.X, this.Y);
 | |
|         for (local i = 0; i< this.Width; i++) {
 | |
|             L_sq_DrawImg("interface/lenheartwindowcommon.img", 64, this.X + 3 + i, this.Y);
 | |
|         }
 | |
|         L_sq_DrawImg("interface/lenheartwindowcommon.img", 65, this.X + 3 + this.Width, this.Y);
 | |
|         L_sq_DrawCode(str + sliceCode, this.X + 4, this.Y + 3, sq_RGBA(179, 169, 135, 255), 0, 1);
 | |
|         if (this.isLBActive()) {
 | |
|             InputController = L_sq_NewInputBox(this.X, this.Y, this.Width, this.Height, str);
 | |
|             InputState = 1;
 | |
|         }
 | |
| 
 | |
| 
 | |
|         if (InputController) {
 | |
|             local StrBuf = L_sq_GetInputBoxStr(InputController);
 | |
|             if (StrBuf != "LenheartNULL") str = StrBuf;
 | |
|             else {
 | |
|                 InputController = null;
 | |
|                 InputState = 0;
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
| 
 | |
| }
 | |
| 
 | |
| //在DrawMain后面调用
 | |
| function L_drawMainCustomUI_All() {
 | |
|     local obj = sq_GetMyMasterCharacter();
 | |
|     //尝试调用百级UI
 | |
|     if (getroottable().rawin("Lenheart_100UI_Event_BackGround")) Lenheart_100UI_Event_BackGround();
 | |
|     if (getroottable().rawin("Lenheart_100UI")) Lenheart_100UI(obj);
 | |
| }
 | |
| 
 | |
| 
 | |
| if (!getroottable().rawin("L_CompleteTaskTable")) L_CompleteTaskTable <- {}
 | |
| //完成任务回调
 | |
| function Sq_CompleteTask(a2, a3, a4) {
 | |
|     foreach(Func in L_CompleteTaskTable) {
 | |
|         Func(a2, a3, a4);
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| DIK_ESCAPE <- 0x01
 | |
| DIK_1 <- 0x02
 | |
| DIK_2 <- 0x03
 | |
| DIK_3 <- 0x04
 | |
| DIK_4 <- 0x05
 | |
| DIK_5 <- 0x06
 | |
| DIK_6 <- 0x07
 | |
| DIK_7 <- 0x08
 | |
| DIK_8 <- 0x09
 | |
| DIK_9 <- 0x0A
 | |
| DIK_0 <- 0x0B
 | |
| DIK_MINUS <- 0x0C /* - on main keyboard */
 | |
| DIK_EQUALS <- 0x0D
 | |
| DIK_BACK <- 0x0E /* backspace */
 | |
| DIK_TAB <- 0x0F
 | |
| DIK_Q <- 0x10
 | |
| DIK_W <- 0x11
 | |
| DIK_E <- 0x12
 | |
| DIK_R <- 0x13
 | |
| DIK_T <- 0x14
 | |
| DIK_Y <- 0x15
 | |
| DIK_U <- 0x16
 | |
| DIK_I <- 0x17
 | |
| DIK_O <- 0x18
 | |
| DIK_P <- 0x19
 | |
| DIK_LBRACKET <- 0x1A
 | |
| DIK_RBRACKET <- 0x1B
 | |
| DIK_RETURN <- 0x1C /* Enter on main keyboard */
 | |
| DIK_LCONTROL <- 0x1D
 | |
| DIK_A <- 0x1E
 | |
| DIK_S <- 0x1F
 | |
| DIK_D <- 0x20
 | |
| DIK_F <- 0x21
 | |
| DIK_G <- 0x22
 | |
| DIK_H <- 0x23
 | |
| DIK_J <- 0x24
 | |
| DIK_K <- 0x25
 | |
| DIK_L <- 0x26
 | |
| DIK_SEMICOLON <- 0x27
 | |
| DIK_APOSTROPHE <- 0x28
 | |
| DIK_GRAVE <- 0x29 /* accent grave */
 | |
| DIK_LSHIFT <- 0x2A
 | |
| DIK_BACKSLASH <- 0x2B
 | |
| DIK_Z <- 0x2C
 | |
| DIK_X <- 0x2D
 | |
| DIK_C <- 0x2E
 | |
| DIK_V <- 0x2F
 | |
| DIK_B <- 0x30
 | |
| DIK_N <- 0x31
 | |
| DIK_M <- 0x32
 | |
| DIK_COMMA <- 0x33
 | |
| DIK_PERIOD <- 0x34 /* . on main keyboard */
 | |
| DIK_SLASH <- 0x35 /* / on main keyboard */
 | |
| DIK_RSHIFT <- 0x36
 | |
| DIK_MULTIPLY <- 0x37 /* * on numeric keypad */
 | |
| DIK_LMENU <- 0x38 /* left Alt */
 | |
| DIK_SPACE <- 0x39
 | |
| DIK_CAPITAL <- 0x3A
 | |
| DIK_F1 <- 0x3B
 | |
| DIK_F2 <- 0x3C
 | |
| DIK_F3 <- 0x3D
 | |
| DIK_F4 <- 0x3E
 | |
| DIK_F5 <- 0x3F
 | |
| DIK_F6 <- 0x40
 | |
| DIK_F7 <- 0x41
 | |
| DIK_F8 <- 0x42
 | |
| DIK_F9 <- 0x43
 | |
| DIK_F10 <- 0x44
 | |
| DIK_NUMLOCK <- 0x45
 | |
| DIK_SCROLL <- 0x46 /* Scroll Lock */
 | |
| DIK_NUMPAD7 <- 0x47
 | |
| DIK_NUMPAD8 <- 0x48
 | |
| DIK_NUMPAD9 <- 0x49
 | |
| DIK_SUBTRACT <- 0x4A /* - on numeric keypad */
 | |
| DIK_NUMPAD4 <- 0x4B
 | |
| DIK_NUMPAD5 <- 0x4C
 | |
| DIK_NUMPAD6 <- 0x4D
 | |
| DIK_ADD <- 0x4E /* + on numeric keypad */
 | |
| DIK_NUMPAD1 <- 0x4F
 | |
| DIK_NUMPAD2 <- 0x50
 | |
| DIK_NUMPAD3 <- 0x51
 | |
| DIK_NUMPAD0 <- 0x52
 | |
| DIK_DECIMAL <- 0x53 /* . on numeric keypad */
 | |
| DIK_OEM_102 <- 0x56 /* <> or \| on RT 102-key keyboard (Non-U.S.) */
 | |
| DIK_F11 <- 0x57
 | |
| DIK_F12 <- 0x58
 | |
| DIK_F13 <- 0x64 /*                     (NEC PC98) */
 | |
| DIK_F14 <- 0x65 /*                     (NEC PC98) */
 | |
| DIK_F15 <- 0x66 /*                     (NEC PC98) */
 | |
| DIK_KANA <- 0x70 /* (Japanese keyboard)            */
 | |
| DIK_ABNT_C1 <- 0x73 /* /? on Brazilian keyboard */
 | |
| DIK_CONVERT <- 0x79 /* (Japanese keyboard)            */
 | |
| DIK_NOCONVERT <- 0x7B /* (Japanese keyboard)            */
 | |
| DIK_YEN <- 0x7D /* (Japanese keyboard)            */
 | |
| DIK_ABNT_C2 <- 0x7E /* Numpad . on Brazilian keyboard */
 | |
| DIK_NUMPADEQUALS <- 0x8D /* = on numeric keypad (NEC PC98) */
 | |
| DIK_PREVTRACK <- 0x90 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */
 | |
| DIK_AT <- 0x91 /*                     (NEC PC98) */
 | |
| DIK_COLON <- 0x92 /*                     (NEC PC98) */
 | |
| DIK_UNDERLINE <- 0x93 /*                     (NEC PC98) */
 | |
| DIK_KANJI <- 0x94 /* (Japanese keyboard)            */
 | |
| DIK_STOP <- 0x95 /*                     (NEC PC98) */
 | |
| DIK_AX <- 0x96 /*                     (Japan AX) */
 | |
| DIK_UNLABELED <- 0x97 /*                        (J3100) */
 | |
| DIK_NEXTTRACK <- 0x99 /* Next Track */
 | |
| DIK_NUMPADENTER <- 0x9C /* Enter on numeric keypad */
 | |
| DIK_RCONTROL <- 0x9D
 | |
| DIK_MUTE <- 0xA0 /* Mute */
 | |
| DIK_CALCULATOR <- 0xA1 /* Calculator */
 | |
| DIK_PLAYPAUSE <- 0xA2 /* Play / Pause */
 | |
| DIK_MEDIASTOP <- 0xA4 /* Media Stop */
 | |
| DIK_VOLUMEDOWN <- 0xAE /* Volume - */
 | |
| DIK_VOLUMEUP <- 0xB0 /* Volume + */
 | |
| DIK_WEBHOME <- 0xB2 /* Web home */
 | |
| DIK_NUMPADCOMMA <- 0xB3 /* , on numeric keypad (NEC PC98) */
 | |
| DIK_DIVIDE <- 0xB5 /* / on numeric keypad */
 | |
| DIK_SYSRQ <- 0xB7
 | |
| DIK_RMENU <- 0xB8 /* right Alt */
 | |
| DIK_PAUSE <- 0xC5 /* Pause */
 | |
| DIK_HOME <- 0xC7 /* Home on arrow keypad */
 | |
| DIK_UP <- 0xC8 /* UpArrow on arrow keypad */
 | |
| DIK_PRIOR <- 0xC9 /* PgUp on arrow keypad */
 | |
| DIK_LEFT <- 0xCB /* LeftArrow on arrow keypad */
 | |
| DIK_RIGHT <- 0xCD /* RightArrow on arrow keypad */
 | |
| DIK_END <- 0xCF /* End on arrow keypad */
 | |
| DIK_DOWN <- 0xD0 /* DownArrow on arrow keypad */
 | |
| DIK_NEXT <- 0xD1 /* PgDn on arrow keypad */
 | |
| DIK_INSERT <- 0xD2 /* Insert on arrow keypad */
 | |
| DIK_DELETE <- 0xD3 /* Delete on arrow keypad */
 | |
| DIK_LWIN <- 0xDB /* Left Windows key */
 | |
| DIK_RWIN <- 0xDC /* Right Windows key */
 | |
| DIK_APPS <- 0xDD /* AppMenu key */
 | |
| DIK_POWER <- 0xDE /* System Power */
 | |
| DIK_SLEEP <- 0xDF /* System Sleep */
 | |
| DIK_WAKE <- 0xE3 /* System Wake */
 | |
| DIK_WEBSEARCH <- 0xE5 /* Web Search */
 | |
| DIK_WEBFAVORITES <- 0xE6 /* Web Favorites */
 | |
| DIK_WEBREFRESH <- 0xE7 /* Web Refresh */
 | |
| DIK_WEBSTOP <- 0xE8 /* Web Stop */
 | |
| DIK_WEBFORWARD <- 0xE9 /* Web Forward */
 | |
| DIK_WEBBACK <- 0xEA /* Web Back */
 | |
| DIK_MYCOMPUTER <- 0xEB /* My Computer */
 | |
| DIK_MAIL <- 0xEC /* Mail */
 | |
| DIK_MEDIASELECT <- 0xED /* Media Select */
 | |
| 
 | |
| 
 | |
| 
 | |
| //Json类
 | |
| class Json {
 | |
|     constructor() {
 | |
| 
 | |
|     }
 | |
| 
 | |
| 
 | |
| 
 | |
|     function Encode(Table) {
 | |
|         local Size = Table.len();
 | |
|         local Pos = 0;
 | |
|         local Str = "{";
 | |
|         foreach(Key, Value in Table) {
 | |
| 
 | |
|             ++Pos;
 | |
|             Str += "\"";
 | |
|             Str += Key.tostring();
 | |
|             Str += "\"";
 | |
|             Str += ":";
 | |
|             
 | |
|             if (typeof(Value) == "string") {
 | |
|                 print(Value.len());
 | |
|                 Sout("中文字符串為: %L",Value); 
 | |
|                 Str += "\"";
 | |
|                 Str += Value;
 | |
|                 Str += "\"";
 | |
|             } else if (typeof(Value) == "table") {
 | |
|                 Str += Json.Encode(Value);
 | |
|             }  else if (typeof(Value) == "array") {
 | |
|                 Str += "[";
 | |
|                 foreach(ArrObj in Value) {
 | |
|                     if(typeof(ArrObj) == "table")Str += Json.Encode(Value);
 | |
|                     else{
 | |
|                         Str += ArrObj;
 | |
|                         Str += ",";
 | |
|                     }
 | |
|                 }
 | |
|                 Str = Str.slice(0,Str.len() - 1);
 | |
|                 Str += "]";
 | |
|             }else Str += Value;
 | |
|             if (Pos != Size) Str += ",";
 | |
|         }
 | |
|         Str += "}";
 | |
|         return Str;
 | |
|     }
 | |
| 
 | |
|     function Decode(Str) 
 | |
|     {
 | |
|         Str = L_sq_DecondeJson(Str);
 | |
|         local Str = "local _M = " + Str + ";\n return _M;\n";
 | |
|         local Func = compilestring(Str);
 | |
|         return Func();
 | |
|     }
 | |
| } |