11111
This commit is contained in:
@@ -238,13 +238,181 @@ function Lenheart_Each_Fun(obj) {
|
||||
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;
|
||||
// });
|
||||
|
||||
|
||||
|
||||
class Lenheart_PlayerEachC extends LenheartNewUI_Windows {
|
||||
//调试模式
|
||||
// DeBugMode = true;
|
||||
|
||||
//不是窗口
|
||||
NoWindow = true;
|
||||
|
||||
//是否可见
|
||||
// Visible = false;
|
||||
|
||||
Info = null;
|
||||
Basic = null;
|
||||
|
||||
//当前交互角色姓名
|
||||
PlayerEach_Name = null;
|
||||
PlayerEach_Flag = false;
|
||||
PlayerEach_ButtonMap = null;
|
||||
|
||||
//通用按钮
|
||||
PlayerEach_CommonButtonMap = null;
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
Childrens = [];
|
||||
PlayerEach_ButtonMap = {};
|
||||
PlayerEach_CommonButtonMap = {};
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
|
||||
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
}
|
||||
|
||||
function RegisterWidget() {}
|
||||
|
||||
function Show(obj) {}
|
||||
|
||||
function TopShow(obj) {}
|
||||
|
||||
function DrawMain(obj) {}
|
||||
|
||||
function MySelfShow() {
|
||||
if (PlayerEach_Name) {
|
||||
local obj = sq_getMyCharacter();
|
||||
LenheartNewUI_Windows.Show(obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//初始化NPC按钮
|
||||
function InitNpcButton() {
|
||||
Childrens = [];
|
||||
if (PlayerEach_ButtonMap.rawin(PlayerEach_Name)) {
|
||||
foreach(Func in PlayerEach_ButtonMap[PlayerEach_Name]) {
|
||||
Func(this);
|
||||
}
|
||||
}
|
||||
foreach(Func in PlayerEach_CommonButtonMap) {
|
||||
Func(this);
|
||||
}
|
||||
this.Visible = true;
|
||||
}
|
||||
|
||||
function AddEachForCommon(Index, Func) {
|
||||
PlayerEach_CommonButtonMap.rawset(Index, Func);
|
||||
}
|
||||
|
||||
function RemoveEachForCommon(Index) {
|
||||
PlayerEach_CommonButtonMap.rawdelete(Index);
|
||||
}
|
||||
|
||||
function AddEachForPlayerName(Index, Func) {
|
||||
if (PlayerEach_ButtonMap.rawin(Index)) {
|
||||
PlayerEach_ButtonMap[Index].append(Func);
|
||||
return;
|
||||
}
|
||||
PlayerEach_ButtonMap.rawset(Index, [Func]);
|
||||
}
|
||||
|
||||
function RemoveEachForPlayerName(Index) {
|
||||
PlayerEach_ButtonMap.rawdelete(Index);
|
||||
}
|
||||
|
||||
function CloseAllEach() {
|
||||
if (Basic) {
|
||||
L_sq_WA(L_sq_P2I(Basic) + 0xC, 256);
|
||||
}
|
||||
}
|
||||
|
||||
//逻辑入口
|
||||
function Proc(obj) {
|
||||
LenheartNewUI_Windows.SyncPos(X, Y);
|
||||
|
||||
local Str = L_Sq_GetPlayerEachName();
|
||||
if (Str.len() > 0) {
|
||||
PlayerEach_Name = Str;
|
||||
}
|
||||
if (PlayerEach_Name) {
|
||||
if (!PlayerEach_Flag) {
|
||||
PlayerEach_Flag = true;
|
||||
InitNpcButton();
|
||||
}
|
||||
} else {
|
||||
PlayerEach_Flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||
LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||
}
|
||||
|
||||
function SelfSyncPos(gInfo) {
|
||||
//读取交互坐标数据
|
||||
Info = gInfo;
|
||||
Basic = gInfo.BasicAdd;
|
||||
|
||||
X = Info.X;
|
||||
Y = Info.Y + (21 * Info.Count);
|
||||
//宽度
|
||||
Width = 100;
|
||||
//高度
|
||||
Height = (21 * Childrens.len());
|
||||
//同步子对象坐标
|
||||
foreach(pos, winobj in Childrens) {
|
||||
winobj.X = Info.X;
|
||||
winobj.Y = Info.Y + (21 * (Info.Count + pos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RindroPlayerEachDrawFlag <- false;
|
||||
RindroPlayerEachDrawCountBuffer <- 0;
|
||||
RindroPlayerEachDrawCount <- 0;
|
||||
Rindro_Haker.LoadHook(0x10002A0, ["pointer", "int", "int"],
|
||||
function(args) {
|
||||
if (L_Sq_GetPlayerEachName().len() <= 0) return;
|
||||
local Xpos = L_sq_RA(L_sq_P2I(args[0]) + 0x14);
|
||||
local Ypos = L_sq_RA(L_sq_P2I(args[0]) + 0x18);
|
||||
|
||||
if (!RindroPlayerEachDrawFlag) {
|
||||
local RootTab = getroottable();
|
||||
RindroPlayerEachDrawFlag = true;
|
||||
if (RootTab.rawin("L_PlayerEach_Obj")) {
|
||||
RootTab["L_PlayerEach_Obj"].SelfSyncPos({
|
||||
X = Xpos,
|
||||
Y = Ypos,
|
||||
Count = RindroPlayerEachDrawCount,
|
||||
BasicAdd = args[0]
|
||||
});
|
||||
RootTab["L_PlayerEach_Obj"].MySelfShow();
|
||||
}
|
||||
}
|
||||
RindroPlayerEachDrawCountBuffer++;
|
||||
// print(args[0]);
|
||||
return null;
|
||||
|
||||
},
|
||||
function(args) {
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
function Lenheart_PlayerEach_Fun(obj) {
|
||||
local RootTab = getroottable();
|
||||
RindroPlayerEachDrawFlag = false;
|
||||
RindroPlayerEachDrawCount = RindroPlayerEachDrawCountBuffer;
|
||||
RindroPlayerEachDrawCountBuffer = 0;
|
||||
if (!RootTab.rawin("L_PlayerEach_Obj")) {
|
||||
RootTab.rawset("L_PlayerEach_Obj", LenheartNewUI_CreateWindow(Lenheart_PlayerEachC, "玩家与玩家交互界面窗口", 0, 0, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
getroottable()["LenheartFuncTab"].rawset("Lenheart_PlayerEachN", Lenheart_PlayerEach_Fun);
|
||||
Reference in New Issue
Block a user