219 lines
		
	
	
		
			9.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			219 lines
		
	
	
		
			9.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| /*
 | |
| 文件名:Sq_SettingWindow.nut
 | |
| 路径:LenheartCallBack/Sq_SettingWindow.nut
 | |
| 创建日期:2022-10-21	08:29
 | |
| 文件用途:设置窗口回调函数
 | |
| */
 | |
| 
 | |
| //切换武器回调
 | |
| // function SelectWeapon(Type) {
 | |
| //     SetUpgradeRate();
 | |
| // }
 | |
| // if (getroottable().rawin("SendPackTypeTable")) getroottable()["SendPackTypeTable"].rawset(19, SelectWeapon);
 | |
| 
 | |
| //上传设置发包
 | |
| function ReqPlayerSettingSet(Type) {
 | |
|     local MonsterBloodSB = getroottable()["MonsterBloodSwitchButtonObj"];
 | |
|     local GameShakeSB = getroottable()["GameShakeSwitchButtonObj"];
 | |
|     local DamageNumSB = getroottable()["DamageNumSwitchButtonObj"];
 | |
|     local Tabbuffer = {
 | |
|         MonsterBloodSB = MonsterBloodSB.SwitchState,
 | |
|         GameShakeSB = GameShakeSB.SwitchState,
 | |
|         DamageNumSB = DamageNumSB.SwitchState,
 | |
|     }
 | |
|     local PlayerSettingSetPack = Json_STL("PlayerSettingSetPack");
 | |
|     PlayerSettingSetPack.Put("op", 20001001);
 | |
|     PlayerSettingSetPack.Put("Setting", Json_STL.Encode(Tabbuffer));
 | |
| 
 | |
| 
 | |
|     local str = PlayerSettingSetPack.GetString();
 | |
|     L_sq_SendPackType(130);
 | |
|     L_sq_SendPackWChar(str);
 | |
|     L_sq_SendPack();
 | |
|     PlayerSettingSetPack.Delete();
 | |
| }
 | |
| if (getroottable().rawin("SendPackTypeTable")) getroottable()["SendPackTypeTable"].rawset(200, ReqPlayerSettingSet);
 | |
| 
 | |
| //获取设置收包
 | |
| function RcvPlayerSettingSet(Chunk) {
 | |
|     local RootTab = getroottable();
 | |
|     local Buffer = Json_STL("RcvPlayerSettingSetBuffer");
 | |
|     Buffer.Parse(Chunk, 0, false);
 | |
|     local str = Buffer.Get("Setting");
 | |
|     Buffer.Delete();
 | |
|     if (str && str.len() > 0) {
 | |
|         local SettingBuffer = Json_STL("SettingBuffer");
 | |
|         SettingBuffer.Parse(str, 0, false);
 | |
|         RootTab.rawset("S_MonsterBloodSB", SettingBuffer.Get("MonsterBloodSB"));
 | |
|         RootTab.rawset("S_GameShakeSB", SettingBuffer.Get("GameShakeSB"));
 | |
|         RootTab.rawset("S_DamageNumSB", SettingBuffer.Get("DamageNumSB"));
 | |
|         SettingBuffer.Delete();
 | |
|     } else {
 | |
|         RootTab.rawset("S_MonsterBloodSB", false);
 | |
|         RootTab.rawset("S_GameShakeSB", false);
 | |
|         RootTab.rawset("S_DamageNumSB", false);
 | |
|     }
 | |
|     //设置一下伤害字体上限
 | |
|     if (RootTab["S_DamageNumSB"]) {
 | |
|         L_sq_WA(0x7EEA7A, 999999999);
 | |
|         L_sq_WA(0x7EEAA7, 999999999);
 | |
|     }
 | |
| }
 | |
| 
 | |
| if (getroottable().rawin("Pack_Control")) getroottable()["Pack_Control"].rawset(20001002, RcvPlayerSettingSet);
 | |
| 
 | |
| 
 | |
| function InitGameSetting(obj) {
 | |
|     local PlayerSettingGetPack = Json_STL("PlayerSettingGetPack");
 | |
|     PlayerSettingGetPack.Put("op", 20001003);
 | |
|     local str = PlayerSettingGetPack.GetString();
 | |
|     L_sq_SendPackType(130);
 | |
|     L_sq_SendPackWChar(str);
 | |
|     L_sq_SendPack();
 | |
|     PlayerSettingGetPack.Delete();
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
| function Sq_SettingWindowCallBack(Xpos, Ypos) {
 | |
|     local obj = sq_GetMyMasterCharacter();
 | |
| 
 | |
|     L_sq_DrawCode(":: 开启新版怪物血条", Xpos + 228, Ypos + 32, 0xFF93C5DD, 0, 1);
 | |
|     L_sq_DrawCode(" ┄┄┄┄┄", Xpos + 338, Ypos + 32, 0x9693C5DD, 0, 1);
 | |
|     L_sq_DrawCode(":: 关闭震动屏幕效果", Xpos + 228, Ypos + 32 + 19, 0xFF93C5DD, 0, 1);
 | |
|     L_sq_DrawCode(" ┄┄┄┄┄", Xpos + 338, Ypos + 32 + 19, 0x9693C5DD, 0, 1);
 | |
|     L_sq_DrawCode(":: 新版伤害字体上限", Xpos + 228, Ypos + 32 + 19 + 19, 0xFF93C5DD, 0, 1);
 | |
|     L_sq_DrawCode(" ┄┄┄┄┄", Xpos + 338, Ypos + 32 + 19 + 19, 0x9693C5DD, 0, 1);
 | |
| 
 | |
| 
 | |
|     //怪物血条
 | |
|     //if (!getroottable().rawin("MonsterBloodSwitchButtonObj")) {
 | |
|     local MonsterBloodSB = SettingWindowSwitchButtonPro(obj, "MonsterBloodSwitchButton", Xpos + 410, Ypos + 32, "ui/optionwindow/custombutton/switchbutton.ani", 0, 16, 15);
 | |
|     MonsterBloodSB.SetRectEnble(true, "MonsterBloodSwitchButtonR", Xpos + 410, Ypos + 32, "ui/optionwindow/custombutton/switchbutton.ani", 1);
 | |
|     MonsterBloodSB.SetCustomClickEnble(true, "MonsterBloodSwitchButtonC", Xpos + 410, Ypos + 32, "ui/optionwindow/custombutton/switchbutton.ani", 1);
 | |
|     MonsterBloodSB.SetSwitchStateAni("MonsterBloodSwitchButtonS", "ui/optionwindow/custombutton/switchbutton.ani", 2);
 | |
|     if (getroottable().rawin("S_MonsterBloodSB")) MonsterBloodSB.SwitchState = getroottable()["S_MonsterBloodSB"];
 | |
|     else MonsterBloodSB.SwitchState = false;
 | |
|     getroottable().rawset("MonsterBloodSwitchButtonObj", MonsterBloodSB);
 | |
|     //}
 | |
|     if (getroottable().rawin("MonsterBloodSwitchButtonObj")) {
 | |
|         local MonsterBloodSB = getroottable()["MonsterBloodSwitchButtonObj"];
 | |
|         MonsterBloodSB.Show();
 | |
|         if (MonsterBloodSB.isLBActive()) {
 | |
|             MonsterBloodSB.SwitchState = !MonsterBloodSB.SwitchState;
 | |
|             getroottable().rawset("S_MonsterBloodSB", MonsterBloodSB.SwitchState);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     //游戏震动
 | |
|     //if (!getroottable().rawin("GameShakeSwitchButtonObj")) {
 | |
|     local GameShakeSB = SettingWindowSwitchButtonPro(obj, "GameShakeSwitchButton", Xpos + 410, Ypos + 32 + 19, "ui/optionwindow/custombutton/switchbutton.ani", 0, 16, 15);
 | |
|     GameShakeSB.SetRectEnble(true, "GameShakeSwitchButtonR", Xpos + 410, Ypos + 32 + 19, "ui/optionwindow/custombutton/switchbutton.ani", 1);
 | |
|     GameShakeSB.SetCustomClickEnble(true, "GameShakeSwitchButtonC", Xpos + 410, Ypos + 32 + 19, "ui/optionwindow/custombutton/switchbutton.ani", 1);
 | |
|     GameShakeSB.SetSwitchStateAni("GameShakeSwitchButtonS", "ui/optionwindow/custombutton/switchbutton.ani", 2);
 | |
|     if (getroottable().rawin("S_GameShakeSB")) GameShakeSB.SwitchState = getroottable()["S_GameShakeSB"];
 | |
|     else GameShakeSB.SwitchState = false;
 | |
|     getroottable().rawset("GameShakeSwitchButtonObj", GameShakeSB);
 | |
|     //}
 | |
|     if (getroottable().rawin("GameShakeSwitchButtonObj")) {
 | |
|         local GameShakeSB = getroottable()["GameShakeSwitchButtonObj"];
 | |
|         GameShakeSB.Show();
 | |
|         if (GameShakeSB.isLBActive()) {
 | |
|             GameShakeSB.SwitchState = !GameShakeSB.SwitchState;
 | |
|             getroottable().rawset("S_GameShakeSB", GameShakeSB.SwitchState);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     //伤害字体上限
 | |
|     //if (!getroottable().rawin("DamageNumSwitchButtonObj")) {
 | |
|     local DamageNumSB = SettingWindowSwitchButtonPro(obj, "DamageNumSwitchButton", Xpos + 410, Ypos + 32 + 19 + 19, "ui/optionwindow/custombutton/switchbutton.ani", 0, 16, 15);
 | |
|     DamageNumSB.SetRectEnble(true, "DamageNumSwitchButtonR", Xpos + 410, Ypos + 32 + 19 + 19, "ui/optionwindow/custombutton/switchbutton.ani", 1);
 | |
|     DamageNumSB.SetCustomClickEnble(true, "DamageNumSwitchButtonC", Xpos + 410, Ypos + 32 + 19 + 19, "ui/optionwindow/custombutton/switchbutton.ani", 1);
 | |
|     DamageNumSB.SetSwitchStateAni("DamageNumSwitchButtonS", "ui/optionwindow/custombutton/switchbutton.ani", 2);
 | |
|     if (getroottable().rawin("S_DamageNumSB")) DamageNumSB.SwitchState = getroottable()["S_DamageNumSB"];
 | |
|     else DamageNumSB.SwitchState = false;
 | |
|     getroottable().rawset("DamageNumSwitchButtonObj", DamageNumSB);
 | |
|     //}
 | |
|     if (getroottable().rawin("DamageNumSwitchButtonObj")) {
 | |
|         local DamageNumSB = getroottable()["DamageNumSwitchButtonObj"];
 | |
|         DamageNumSB.Show();
 | |
|         if (DamageNumSB.isLBActive()) {
 | |
|             DamageNumSB.SwitchState = !DamageNumSB.SwitchState;
 | |
|             getroottable().rawset("S_DamageNumSB", DamageNumSB.SwitchState);
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
| //踢自己
 | |
| function KickMySelf(chunk) {
 | |
|     local KickMySelf = Json_STL("KickMySelf");
 | |
|     KickMySelf.Put("op", 77777);
 | |
|     local str = KickMySelf.GetString();
 | |
|     L_sq_SendPackType(130);
 | |
|     L_sq_SendPackWChar(str);
 | |
|     L_sq_SendPack();
 | |
|     KickMySelf.Delete();
 | |
|     L_sq_SendPack();
 | |
| }
 | |
| if (getroottable().rawin("Pack_Control")) getroottable()["Pack_Control"].rawset(77778, KickMySelf);
 | |
| 
 | |
| //全屏拾物
 | |
| function MoveItems(chunk) {
 | |
|     local obj = sq_GetMyMasterCharacter();
 | |
|     local objectManager = obj.getObjectManager();
 | |
|     if (!objectManager) return;
 | |
|     local CollisionObjectNumber = objectManager.getCollisionObjectNumber();
 | |
|     for (local i = 0; i < CollisionObjectNumber; i += 1) {
 | |
|         local object = objectManager.getCollisionObject(i);
 | |
|         if (object.isObjectType(OBJECTTYPE_ITEM)) {
 | |
|             sq_SetCurrentPos(object, obj.getXPos(), obj.getYPos(), 0);
 | |
|         }
 | |
|     }
 | |
| }
 | |
| if (getroottable().rawin("Pack_Control")) getroottable()["Pack_Control"].rawset(900, MoveItems);
 | |
| 
 | |
| 
 | |
| //充值全服公告动画
 | |
| function ChargeNotiFunc(obj) {
 | |
|     if (getroottable().rawin("ChargeNotiTab") && getroottable()["ChargeNotiTab"].len() > 0) {
 | |
|         local BaseAni = BasicsDrawTool.T_DrawDynamicAni(obj, "common/addpoint/dh.ani", 0, -180, "ChargeNotiAni");
 | |
|         if (sq_GetAnimationFrameIndex(BaseAni) >= 80) {
 | |
|             //L_sq_DrawCode("      [" + getroottable()["ChargeNotiTab"][0].name + "]", 170, 286 - 173, sq_RGBA(255, 177, 0, 250), 1, 0);
 | |
|             local NotiObj = getroottable()["ChargeNotiTab"][0];
 | |
|             local StrArr = NotiObj.Noti;
 | |
| 
 | |
|             L_sq_DrawCode(StrArr[0] + NotiObj.name + StrArr[1] + StrArr[2] + NotiObj.point + StrArr[3], NotiObj.nameposx,NotiObj.nameposy, NotiObj.color, 1, 0);
 | |
|         }
 | |
|         if (sq_GetCurrentTime(BaseAni) >= 6000) {
 | |
|             sq_Rewind(BaseAni);
 | |
|             getroottable()["ChargeNotiTab"].remove(0);
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| //大佬充值全服公告
 | |
| function ChargeNoti(Chunk) {
 | |
|     local Buffer = Json_STL("ChargeNotiBuffer");
 | |
|     Buffer.Parse(Chunk, 0, false);
 | |
|     local Tab = {
 | |
|         name = Buffer.Get("name"),
 | |
|         point = Buffer.Get("Point"),
 | |
|         nameposx = Buffer.Get("NameXpos"),
 | |
|         nameposy = Buffer.Get("NameYpos"),
 | |
|         Noti = [Buffer.Get("ExNot0"), Buffer.Get("ExNot1"), Buffer.Get("ExNot2"), Buffer.Get("ExNot3")],
 | |
|         color = sq_RGBA(Buffer.Get("R"),Buffer.Get("G"),Buffer.Get("B"),Buffer.Get("A")),
 | |
|     }
 | |
|     local arr;
 | |
|     if (!getroottable().rawin("ChargeNotiTab")) {
 | |
|         arr = [];
 | |
|     } else {
 | |
|         arr = getroottable()["ChargeNotiTab"];
 | |
|     }
 | |
|     arr.append(Tab);
 | |
|     getroottable().rawset("ChargeNotiTab", arr);
 | |
| 
 | |
|     Buffer.Delete();
 | |
| }
 | |
| if (getroottable().rawin("Pack_Control")) getroottable()["Pack_Control"].rawset(20005002, ChargeNoti); |