11
This commit is contained in:
52
Base/UI/Lenheart_Cursor_Class.nut
Normal file
52
Base/UI/Lenheart_Cursor_Class.nut
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
文件名:Lenheart_Cursor_Class.nut
|
||||
路径:Base/UI/Lenheart_Cursor_Class.nut
|
||||
创建日期:2024-09-25 19:23
|
||||
文件用途:鼠标绘制逻辑
|
||||
*/
|
||||
class Rindro_Cursor {
|
||||
|
||||
UseState = 0;
|
||||
|
||||
TypeState = 0;
|
||||
SubState = 0;
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
function Proc(Xpos, Ypos) {
|
||||
|
||||
//使用自建的鼠标绘制函数
|
||||
if (UseState) {
|
||||
//工作类型为0
|
||||
if (TypeState == 0) {
|
||||
//常规状态
|
||||
if (SubState == 0) {
|
||||
L_sq_DrawImg("interface/newstyle/windows/cursor.img", 0, Xpos, Ypos);
|
||||
}
|
||||
//按下状态
|
||||
else if (SubState == 1) {
|
||||
L_sq_DrawImg("interface/newstyle/windows/cursor.img", 1, Xpos, Ypos);
|
||||
}
|
||||
} else {
|
||||
L_sq_DrawImg("interface/newstyle/windows/cursor.img", TypeState, Xpos, Ypos);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function Sync(Xpos, Ypos) {
|
||||
Proc(Xpos, Ypos);
|
||||
return UseState;
|
||||
}
|
||||
}
|
||||
_Rindro_Cusor_ <- Rindro_Cursor();
|
||||
|
||||
function SyncRindro_Cursor(Xpos, Ypos) {
|
||||
if (getroottable().rawin("_Rindro_Cusor_")) {
|
||||
local Ret = _Rindro_Cusor_.Sync(Xpos, Ypos);
|
||||
return Ret;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -168,6 +168,8 @@ class Rindro_EventList {
|
||||
x = X - 456,
|
||||
y = Y
|
||||
};
|
||||
|
||||
L_sq_RefreshEventIcon();
|
||||
}
|
||||
|
||||
constructor() {
|
||||
|
||||
@@ -21,26 +21,32 @@ class R_Mouse {
|
||||
}
|
||||
//锁定鼠标
|
||||
function Lock() {
|
||||
_Rindro_Cusor_.UseState = 1;
|
||||
L_sq_WAB(0x1B46886, 1);
|
||||
}
|
||||
//解锁鼠标
|
||||
function UnLock() {
|
||||
_Rindro_Cusor_.UseState = 0;
|
||||
L_sq_WAB(0x1B46886, 0);
|
||||
}
|
||||
//获取鼠标工作类型
|
||||
function GetType() {
|
||||
return _Rindro_Cusor_.TypeState;
|
||||
// return L_sq_RAB(0x1b46898);
|
||||
}
|
||||
//设置鼠标工作类型
|
||||
function SetType(Type) {
|
||||
_Rindro_Cusor_.TypeState = Type;
|
||||
// L_sq_WAB(0x1b46898, Type);
|
||||
}
|
||||
//鼠标0状态下是否按下
|
||||
function GetBaseState() {
|
||||
return _Rindro_Cusor_.SubState;
|
||||
// return L_sq_RAB(0x1B46874);
|
||||
}
|
||||
//鼠标0状态设置是否按下
|
||||
function SetBaseState(Flag) {
|
||||
_Rindro_Cusor_.SubState = Flag;
|
||||
// return L_sq_WAB(0x1B46874, Flag);
|
||||
}
|
||||
|
||||
@@ -51,7 +57,7 @@ class R_Mouse {
|
||||
//如果鼠标工作类型不是0则设置为0
|
||||
if (R_Mouse.GetType() != 0) R_Mouse.SetType(0);
|
||||
//如果鼠标是按下状态则设置为未按下
|
||||
// if (R_Mouse.GetBaseState() != 0) R_Mouse.SetBaseState(0);
|
||||
if (R_Mouse.GetBaseState() != 0) R_Mouse.SetBaseState(0);
|
||||
}
|
||||
}
|
||||
//基础窗口类 所有UI类继承与本类
|
||||
@@ -254,54 +260,46 @@ class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow {
|
||||
// L_sq_MouseClick();
|
||||
}
|
||||
|
||||
//道具信息窗口地址
|
||||
ItemInfoDrawS = null;
|
||||
//绘制道具相信信息
|
||||
ItemObject = null;
|
||||
|
||||
//获取道具信息并生成缓存
|
||||
function GetItemInfo(Id) {
|
||||
if (!Rindro_ItemInfoObject.rawin(Id)) {
|
||||
local ItemObject = L_sq_GetItem(Id);
|
||||
if (!ItemObject) ItemObject = L_sq_GetItem(3037);
|
||||
Rindro_ItemInfoObject.rawset(Id, ItemObject);
|
||||
}
|
||||
}
|
||||
//绘制道具带道具信息 带道具边框
|
||||
function DrawItemEx(X, Y, Id, Count) {
|
||||
if (!Rindro_ItemInfoObject.rawin(Id)) Id = 3037;
|
||||
if (Id != -1) {
|
||||
local Rarity = Rindro_ItemInfoObject[Id].Rarity ? Rindro_ItemInfoObject[Id].Rarity : 0;
|
||||
L_sq_DrawImg("interface2/rindro_reward.img", Rarity, X - 3, Y - 3);
|
||||
L_Sq_DrawItem(X, Y, Id, Count, 0, 0, 0);
|
||||
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 24, 24)) {
|
||||
ItemInfoDrawS = {};
|
||||
ItemInfoDrawS.X <- X;
|
||||
ItemInfoDrawS.Y <- Y;
|
||||
ItemInfoDrawS.ItemId <- Id;
|
||||
}
|
||||
}
|
||||
GetItemInfo(Id);
|
||||
local Rarity = L_sq_RA(Rindro_ItemInfoObject[Id] + 0xF4);
|
||||
L_sq_DrawImg("interface2/rindro_reward.img", Rarity, X - 3, Y - 3);
|
||||
DrawItemBase(X, Y, Id, Count);
|
||||
}
|
||||
//绘制道具带道具信息
|
||||
function DrawItemBase(X, Y, Id, Count) {
|
||||
if (!Rindro_ItemInfoObject.rawin(Id)) Id = 3037;
|
||||
if (Id != -1) {
|
||||
local Rarity = Rindro_ItemInfoObject[Id].Rarity ? Rindro_ItemInfoObject[Id].Rarity : 0;
|
||||
L_Sq_DrawItem(X, Y, Id, Count, 0, 0, 0);
|
||||
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 24, 24)) {
|
||||
ItemInfoDrawS = {};
|
||||
ItemInfoDrawS.X <- X;
|
||||
ItemInfoDrawS.Y <- Y;
|
||||
ItemInfoDrawS.ItemId <- Id;
|
||||
GetItemInfo(Id);
|
||||
L_Sq_DrawItem(X, Y, Id, Count, 0, 0, 0);
|
||||
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, 24, 24)) {
|
||||
//打开道具信息窗口
|
||||
if (!ItemInfoDrawS) {
|
||||
ItemInfoDrawS = L_Sq_CallFunc(0xE6E070, "int", FFI_THISCALL, ["int", "int", "int", "int"], L_sq_RA(0x1A5FB20), 275, Rindro_ItemInfoObject[Id], 41);
|
||||
//校准道具信息窗口位置
|
||||
L_Sq_CallFunc(0xF3B3B0, "int", FFI_THISCALL, ["int", "int", "int", "int", "int"], ItemInfoDrawS, IMouse.GetXPos(), IMouse.GetYPos(), 28, 28);
|
||||
}
|
||||
}
|
||||
}
|
||||
//绘制悬停
|
||||
function DrawItemInfo() {
|
||||
if (ItemInfoDrawS) {
|
||||
if (!ItemObject) {
|
||||
local ItemId = ItemInfoDrawS.ItemId;
|
||||
if (Rindro_ItemInfoObject.rawin(ItemId)) {
|
||||
ItemObject = ItemInfoClass(Rindro_ItemInfoObject[ItemId]);
|
||||
}
|
||||
}
|
||||
ItemObject.Show(ItemInfoDrawS.X, ItemInfoDrawS.Y - ItemObject.PageLength);
|
||||
} else {
|
||||
ItemObject = null;
|
||||
if (ItemInfoDrawS) {
|
||||
L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0);
|
||||
ItemInfoDrawS = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//生成DT
|
||||
function GenerateDt() {
|
||||
try {
|
||||
@@ -321,10 +319,8 @@ class LenheartNewUI_Windows extends LenheartNewUI_BaseWindow {
|
||||
LenheartNewUI_BaseWindow.Show(obj);
|
||||
if (DeBugMode) DeBug(obj);
|
||||
|
||||
|
||||
DrawItemInfo();
|
||||
//初始化绘制道具
|
||||
ItemInfoDrawS = null;
|
||||
// ItemInfoDrawS = null;
|
||||
}
|
||||
|
||||
function TopShow(obj) {
|
||||
@@ -686,6 +682,7 @@ class LenheartNewUI_CommonUi extends LenheartNewUI_BaseWindow {
|
||||
isInRect = false;
|
||||
|
||||
OnClick = null;
|
||||
OnClickSound = null;
|
||||
ObjectId = null;
|
||||
|
||||
Visible = true;
|
||||
@@ -714,13 +711,18 @@ class LenheartNewUI_CommonUi extends LenheartNewUI_BaseWindow {
|
||||
}
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) isLBDown = true;
|
||||
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) {
|
||||
isLBDown = true;
|
||||
if (!OnClickSound) {
|
||||
R_Utils.PlaySound("CLICK_BUTTON1");
|
||||
} else {
|
||||
R_Utils.PlaySound(OnClickSound);
|
||||
}
|
||||
}
|
||||
}
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||
if (isLBDown && OnClick) {
|
||||
local obj = sq_getMyCharacter();
|
||||
obj.sq_PlaySound("CLICK_BUTTON1");
|
||||
OnClick();
|
||||
}
|
||||
isLBDown = false;
|
||||
@@ -922,6 +924,10 @@ class LenheartNewUI_BaseInput extends LenheartNewUI_CommonUi {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function SetStr(Value) {
|
||||
L_sq_SetInputBoxStr(InputController, Value);
|
||||
}
|
||||
}
|
||||
|
||||
//复选框
|
||||
|
||||
Reference in New Issue
Block a user