更新装备融合使用新版slot槽 可预览融合后装备

This commit is contained in:
Lenheart 2025-12-17 19:08:18 +08:00
parent 66a3e9f49b
commit a11458d226
2 changed files with 59 additions and 48 deletions

View File

@ -1535,12 +1535,6 @@ class LenheartNewUI_ItemSlot extends LenheartNewUI_CommonUi {
}
}
}
//悬停光效
if (isInRect) {
L_sq_SetDrawImgModel(2, 0);
Rindro_Image_GlobalMap["lenheartui"].DrawPng(353, X - 2, Y - 2);
L_sq_ReleaseDrawImgModel();
}
}
function SetItem(item) {

View File

@ -5,11 +5,11 @@
文件用途:
*/
class ItemFusionC_ItemSlot extends LenheartNewUI_CommonUi {
class ItemFusionC_ItemSlot extends LenheartNewUI_ItemSlot {
WindowImg = Rindro_Image("interface2/itemtoolwindow/itemfusion/itemfusion.img");
Item = null;
ItemInfo = null;
//覆写悬停Flag
HoverFlag = false;
@ -18,20 +18,19 @@ class ItemFusionC_ItemSlot extends LenheartNewUI_CommonUi {
UseFlag = true;
constructor(X, Y) {
LenheartNewUI_CommonUi.constructor(X, Y, 46, 47);
LenheartNewUI_ItemSlot.constructor(X, Y);
}
function Show(obj) {
WindowImg.DrawPng(9, X, Y);
WindowImg.DrawPng(9, X - 9, Y - 10);
LenheartNewUI_ItemSlot.Show(obj);
//如果槽里面有道具 绘制道具
if (Item) {
if (Item.rawin("itemAddress")) Parent.TemporaryDrawItemAddress = Item.itemAddress;
Parent.DrawItemBase(X + 9, Y + 10, Item.itemId, 1);
if (Item.rawin("itemAddress")) Parent.TemporaryDrawItemAddress = null;
}
// //如果槽里面有道具 绘制道具
// if (Item) {
// if (Item.rawin("itemAddress")) Parent.TemporaryDrawItemAddress = Item.itemAddress;
// Parent.DrawItemBase(X + 9, Y + 10, Item.itemId, 1);
// if (Item.rawin("itemAddress")) Parent.TemporaryDrawItemAddress = null;
// }
CheckInRect();
@ -40,10 +39,10 @@ class ItemFusionC_ItemSlot extends LenheartNewUI_CommonUi {
function CheckInRect() {
local MousePos_X = IMouse.GetXPos();
local MousePos_Y = IMouse.GetYPos();
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + 9, Y + 10, 24, 24)) {
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, 30, 30)) {
//绘制悬停框
L_sq_SetDrawImgModel(2, 0);
Rindro_Image_GlobalMap["lenheartui"].DrawPng(353, X + 8, Y + 8);
Rindro_Image_GlobalMap["lenheartui"].DrawPng(353, X, Y);
L_sq_ReleaseDrawImgModel();
HoverFlag = true;
} else HoverFlag = false;
@ -59,30 +58,32 @@ class ItemFusionC_ItemSlot extends LenheartNewUI_CommonUi {
function DiscardItem(info) {
if (HoverFlag) {
if (info) {
Item = info;
local ItemObject = Rindro_Item();
ItemObject.LoadByAddress(info.itemAddress);
ItemInfo = info;
SetItem(ItemObject);
}
return true;
}
}
//鼠标右键按下回调
function OnMouseRbDown(MousePos_X, MousePos_Y) {
if (!UseFlag) return;
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + 9, Y + 10, 24, 24)) {
Item = null;
if (Parent.ItemInfoDrawS) {
L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0);
Parent.ItemInfoDrawS = null;
Parent.ResetFocus();
}
if (Parent.Slot[2].Item != null) {
Parent.Msg = 0;
Parent.Slot[2].Item = null;
}
}
}
// //鼠标右键按下回调
// function OnMouseRbDown(MousePos_X, MousePos_Y) {
// if (!UseFlag) return;
// if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + 9, Y + 10, 24, 24)) {
// Item = null;
// if (Parent.ItemInfoDrawS) {
// L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0);
// Parent.ItemInfoDrawS = null;
// Parent.ResetFocus();
// }
// if (Parent.Slot[2].Item != null) {
// Parent.Msg = 0;
// Parent.Slot[2].Item = null;
// }
// }
// }
}
class ItemFusionC extends LenheartNewUI_Windows {
@ -93,7 +94,7 @@ class ItemFusionC extends LenheartNewUI_Windows {
// NoWindow = true;
//是否可见
Visible = false;
// Visible = false;
Slot = null;
@ -125,10 +126,26 @@ class ItemFusionC extends LenheartNewUI_Windows {
local Jso = Json.Decode(Chunk);
Msg = Jso.msg;
if (Jso.rawin("value")) {
print(Jso.value[0]);
Slot[2].Item = {
itemId = Jso.value[0]
}
//构造一个新装备
local ItemObject = Rindro_Item();
ItemObject.LoadById(Jso.value[0]);
//读取
local MaterialItemObject = Slot[0].ItemObject;
local Upgrade = MaterialItemObject.GetUpgrade();
local Amplification = MaterialItemObject.GetAmplification();
local Forging = MaterialItemObject.GetForging();
local ForgingAttribute = MaterialItemObject.GetForgingAttribute();
local Enchanting = MaterialItemObject.GetEnchanting();
ItemObject.SetUpgrade(Upgrade);
ItemObject.SetAmplification(Amplification);
ItemObject.SetForging(Forging);
ItemObject.SetForgingAttribute(ForgingAttribute);
ItemObject.SetEnchanting(Enchanting);
// Item = ItemObject;
Slot[2].SetItem(ItemObject);
}
}.bindenv(this));
@ -191,7 +208,7 @@ class ItemFusionC extends LenheartNewUI_Windows {
AddChild(ConfirmButton);
//创建槽
Slot = [ItemFusionC_ItemSlot(49, 58), ItemFusionC_ItemSlot(150, 58), ItemFusionC_ItemSlot(99, 182)];
Slot = [ItemFusionC_ItemSlot(58, 68), ItemFusionC_ItemSlot(159, 68), ItemFusionC_ItemSlot(108, 192)];
foreach(value in Slot) {
AddChild(value);
}
@ -213,7 +230,7 @@ class ItemFusionC extends LenheartNewUI_Windows {
local SlotEnableCount = 0;
for (local i = 0; i< 2; i++) {
local value = Slot[i];
if (value.Item != null) SlotEnableCount++;
if (value.ItemInfo != null) SlotEnableCount++;
}
WindowImg.DrawPng(0 + SlotEnableCount, X + 8, Y + 30);
WindowImg.DrawPng(3, X + 8, Y + 32);
@ -280,11 +297,11 @@ class ItemFusionC extends LenheartNewUI_Windows {
local Ret = Value.DiscardItem(info);
if (Ret) {
R_Utils.PlaySound("CHANGE_ALERT");
if (Slot[0].Item && Slot[1].Item) {
if (Slot[0].ItemInfo && Slot[1].ItemInfo) {
local T = {
op = 21006001,
item1 = Slot[0].Item,
item2 = Slot[1].Item,
item1 = Slot[0].ItemInfo,
item2 = Slot[1].ItemInfo,
}
SendPackEx(T);
}