This commit is contained in:
2024-10-01 10:12:27 +08:00
parent 16be225768
commit 8c2522f366
11 changed files with 520 additions and 37 deletions

View File

@@ -359,9 +359,8 @@ class Lenheart_Character_Info_ClassC extends LenheartNewUI_Windows {
local WindowX = sq_GetPopupWindowMainCotrol(74);
local WindowAddress = L_sq_GetWindowById(74);
if (!WindowX || !WindowAddress) return false;
//确定是个人信息窗口才执行逻辑 并且返回true 不执行原逻辑
if (Address - WindowAddress <= 0x20000) {
if (Address - WindowAddress <= 0x50000 && L_sq_RA(Address + 0x34) == 4089) {
OldWindowAddress = Address;
local obj = sq_getMyCharacter();
RealShow(obj);

View File

@@ -0,0 +1,244 @@
/*
文件名:Lenheart_Each_Class.nut
路径:Base/UI/Lenheart_Each_Class.nut
创建日期:2024-09-30 14:46
文件用途:交互界面类
*/
class LenheartNewUI_Each_BaseButton extends LenheartNewUI_CommonUi {
State = 0;
BaseIdx = 29;
DWidth = null;
Path = null;
Idx = null;
SetFlag = null;
SetIndex = null;
Icon = null;
IconIdx = null;
Str = null;
StrColor = sq_RGBA(189, 159, 126, 250);
constructor(X, Y, W, H, Path, Idx) {
this.DWidth = W;
this.Path = Path;
this.Idx = Idx;
LenheartNewUI_CommonUi.constructor(X, Y, W, H);
}
function SetFrame(gPath, gIdx) {
if (gPath) Path = gPath;
Idx = gIdx;
}
function Show(obj) {
//不可用
if (State == 8) {
// L_sq_DrawImg(Path, Idx + 3, X, Y);
} else {
//按下
if (isLBDown) {
L_sq_DrawImg(Path, Idx + 1, X, Y);
if (Icon) L_sq_DrawImg(Icon, IconIdx, X + 3, Y + 2);
if (Str) L_sq_DrawCode(Str, X + 60 - LenheartTextClass.GetStringLength(Str) / 2, Y + 5, StrColor, 0, 1);
}
//悬停
else if (isInRect) {
L_sq_DrawImg(Path, Idx, X, Y);
if (Icon) L_sq_DrawImg(Icon, IconIdx, X + 3, Y + 1);
if (Str) L_sq_DrawCode(Str, X + 60 - LenheartTextClass.GetStringLength(Str) / 2, Y + 4, StrColor, 0, 1);
}
//普通
else {
L_sq_DrawImg(Path, 0, X, Y);
if (Icon) L_sq_DrawImg(Icon, IconIdx, X + 3, Y + 1);
if (Str) L_sq_DrawCode(Str, X + 60 - LenheartTextClass.GetStringLength(Str) / 2, Y + 4, StrColor, 0, 1);
}
}
}
//鼠标左键弹起回调
function OnMouseLbUp(MousePos_X, MousePos_Y) {
if (isLBDown && OnClick) {
OnClick(this);
}
isLBDown = false;
}
}
class Lenheart_EachC extends LenheartNewUI_Windows {
//调试模式
// DeBugMode = true;
//不是窗口
NoWindow = true;
//是否可见
// Visible = false;
Info = null;
NPC_Index = null;
NPC_Flag = false;
NPC_ButtonMap = null;
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
Childrens = [];
NPC_ButtonMap = {};
//注册控件
RegisterWidget();
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
}
function RegisterWidget() {
}
function Show(obj) {
}
function TopShow(obj) {
if (NPC_Index) {
SyncPos();
LenheartNewUI_Windows.Show(obj);
}
}
function DrawMain(obj) {
// if (Info) {
// local NPC_Index = Rindro_BaseToolClass.GetEachNpcId();
// }
}
// function BottomShow() {}
//初始化NPC按钮
function InitNpcButton() {
Childrens = [];
if (NPC_ButtonMap.rawin(NPC_Index)) {
NPC_ButtonMap[NPC_Index](this);
}
this.Visible = true;
}
function AddEachForNpc(Index, Func) {
NPC_ButtonMap.rawset(Index, Func);
}
function RemoveEachForNpc(Index) {
NPC_ButtonMap.rawdelete(Index);
}
//逻辑入口
function Proc(obj) {
LenheartNewUI_Windows.SyncPos(X, Y);
NPC_Index = Rindro_BaseToolClass.GetEachNpcId();
if (NPC_Index) {
if (!NPC_Flag) {
NPC_Flag = true;
InitNpcButton();
}
} else {
NPC_Flag = false;
}
}
function CloseAllEach() {
local EachClassObject = L_sq_RA(0x1ADE0E0);
if (EachClassObject) {
local FristChildOffset = (EachClassObject + 0x68);
for (local i = 0; i< 74; i++) {
local AddressBuf = FristChildOffset + (4 * i);
local ChildAddress = L_sq_RA(AddressBuf);
if (ChildAddress) {
local OpenFlag = L_sq_RA(ChildAddress + 0xC);
if (OpenFlag = 257) L_sq_WA(ChildAddress + 0xC, 256);
}
}
}
}
function Lenheart_Get_Each_Info() {
local EachCount = 0;
local Xpos = 0;
local Ypos = 0;
local EachClassObject = L_sq_RA(0x1ADE0E0);
if (EachClassObject) {
local FristChildOffset = (EachClassObject + 0x68);
for (local i = 0; i< 74; i++) {
local AddressBuf = FristChildOffset + (4 * i);
local ChildAddress = L_sq_RA(AddressBuf);
if (ChildAddress) {
local OpenFlag = L_sq_RA(ChildAddress + 0xC);
if (OpenFlag == 257) EachCount++;
}
//第0个的时候记录一下坐标
if (i == 0) {
Xpos = L_sq_RA(ChildAddress + 0x14);
Ypos = L_sq_RA(ChildAddress + 0x18);
}
}
}
return {
Count = EachCount,
X = Xpos,
Y = Ypos
};
}
//override
//鼠标左键弹起回调
function OnMouseLbUp(MousePos_X, MousePos_Y) {
//调用原生方法
LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y);
}
function SyncPos() {
//读取交互坐标数据
Info = Lenheart_Get_Each_Info();
X = Info.X;
Y = Info.Y + (21 * Info.Count);
//宽度
Width = 100;
//高度
Height = (21 * Childrens.len());
// //同步子对象坐标
// foreach(winobj in Childrens) {
// winobj.X = Info.X;
// winobj.Y = Info.Y + (21 * Info.Count);
// }
}
}
function Lenheart_Each_Fun(obj) {
local RootTab = getroottable();
if (!RootTab.rawin("L_Each_Obj")) {
RootTab.rawset("L_Each_Obj", LenheartNewUI_CreateWindow(Lenheart_EachC, "玩家与NPC交互界面窗口", 0, 0, 0, 0, 0));
}
}
getroottable()["LenheartFuncTab"].rawset("Lenheart_EachN", Lenheart_Each_Fun);
// Rindro_Haker.LoadHook(0x10041D0, ["int", "int", "int"],
// function(args) {
// if (getroottable().rawin("L_Each_Obj")) {
// getroottable()["L_Each_Obj"].BottomShow();
// }
// return null;
// },
// function(args) {
// return null;
// });

View File

@@ -465,7 +465,8 @@ function CheackMouseInOldWindows() {
//空地
if (Flag == 0x184D0C4 || Flag == 0x0184CF6C) {
if ((L_sq_RA(WindowAddress + 0x14) == 0 && L_sq_RA(WindowAddress + 0x18) == 0)) {
//都为0的时候城镇背景 508是血槽那一块的逻辑 坐标Y是508
if ((L_sq_RA(WindowAddress + 0x14) == 0 && (L_sq_RA(WindowAddress + 0x18) == 0 || L_sq_RA(WindowAddress + 0x18) == 508))) {
return false;
}
} else return false;
@@ -599,7 +600,7 @@ function L_MouseCallBack(MouseState, MouseFlag, MousePos_X, MousePos_Y) {
//打开原生窗口回调
function L_OpenOldWindowCallBack(WindowIndex) {
//将新窗口渲染队列改为下层 抵消窗口 Esc窗口 登录可能显示的任务窗口
if (WindowIndex != 170 && WindowIndex != 176 && WindowIndex != 276 && WindowIndex != 275 && WindowIndex != 278 && WindowIndex != 283) {
if (WindowIndex != 170 && WindowIndex != 176 && WindowIndex != 276 && WindowIndex != 275 && WindowIndex != 278 && WindowIndex != 283 && WindowIndex != 36) {
getroottable().WindowsShowABFlag <- false;
}
}