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

This commit is contained in:
Lenheart 2025-12-17 19:08:18 +08:00
parent 66a3e9f49b
commit d9aad4d06a
2 changed files with 57 additions and 58 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) { function SetItem(item) {
@ -1565,9 +1559,7 @@ class LenheartNewUI_ItemSlot extends LenheartNewUI_CommonUi {
if(NoClick)return; if(NoClick)return;
if (isInRect) { if (isInRect) {
if(ItemObject){ if(ItemObject){
ItemObject = null; RemoveItem();
ItemId = null;
ItemCount = null;
} }
if (ItemInfoWindow) { if (ItemInfoWindow) {
L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0); L_Sq_CallFunc(0xE6B2B0, "int", FFI_THISCALL, ["int", "int", "int", "char"], 0x1ADE090, 0x113, 0xFFFFFFFF, 0x0);

View File

@ -5,33 +5,32 @@
文件用途: 文件用途:
*/ */
class ItemFusionC_ItemSlot extends LenheartNewUI_CommonUi { class ItemFusionC_ItemSlot extends LenheartNewUI_ItemSlot {
MyIndex = null;
WindowImg = Rindro_Image("interface2/itemtoolwindow/itemfusion/itemfusion.img"); WindowImg = Rindro_Image("interface2/itemtoolwindow/itemfusion/itemfusion.img");
Item = null; ItemInfo = null;
//覆写悬停Flag //覆写悬停Flag
HoverFlag = false; HoverFlag = false;
//UseFlag
UseFlag = true;
constructor(X, Y) { constructor(X, Y, Index) {
LenheartNewUI_CommonUi.constructor(X, Y, 46, 47); MyIndex = Index;
LenheartNewUI_ItemSlot.constructor(X, Y);
} }
function Show(obj) { function Show(obj) {
WindowImg.DrawPng(9, X, Y); WindowImg.DrawPng(9, X - 9, Y - 10);
LenheartNewUI_ItemSlot.Show(obj);
// //如果槽里面有道具 绘制道具
//如果槽里面有道具 绘制道具 // if (Item) {
if (Item) { // if (Item.rawin("itemAddress")) Parent.TemporaryDrawItemAddress = Item.itemAddress;
if (Item.rawin("itemAddress")) Parent.TemporaryDrawItemAddress = Item.itemAddress; // Parent.DrawItemBase(X + 9, Y + 10, Item.itemId, 1);
Parent.DrawItemBase(X + 9, Y + 10, Item.itemId, 1); // if (Item.rawin("itemAddress")) Parent.TemporaryDrawItemAddress = null;
if (Item.rawin("itemAddress")) Parent.TemporaryDrawItemAddress = null; // }
}
CheckInRect(); CheckInRect();
@ -40,49 +39,38 @@ class ItemFusionC_ItemSlot extends LenheartNewUI_CommonUi {
function CheckInRect() { function CheckInRect() {
local MousePos_X = IMouse.GetXPos(); local MousePos_X = IMouse.GetXPos();
local MousePos_Y = IMouse.GetYPos(); 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); 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(); L_sq_ReleaseDrawImgModel();
HoverFlag = true; HoverFlag = true;
} else HoverFlag = false; } else HoverFlag = false;
} }
//override
function OnMouseProc(Flag, MousePos_X, MousePos_Y) {
if (!Visible) return;
//调用原生方法
LenheartNewUI_CommonUi.OnMouseProc(Flag, MousePos_X, MousePos_Y);
}
function DiscardItem(info) { function DiscardItem(info) {
if (HoverFlag) { if (HoverFlag) {
if (info) { if (info) {
Item = info; local ItemObject = Rindro_Item();
ItemObject.LoadByAddress(info.itemAddress);
ItemInfo = info;
SetItem(ItemObject);
} }
return true; return true;
} }
} }
function RemoveItem() {
LenheartNewUI_ItemSlot.RemoveItem();
ItemInfo = null;
//鼠标右键按下回调 if (MyIndex != 2) {
function OnMouseRbDown(MousePos_X, MousePos_Y) { Parent.Slot[2].ItemInfo = null;
if (!UseFlag) return; Parent.Slot[2].RemoveItem();
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 { class ItemFusionC extends LenheartNewUI_Windows {
@ -125,10 +113,26 @@ class ItemFusionC extends LenheartNewUI_Windows {
local Jso = Json.Decode(Chunk); local Jso = Json.Decode(Chunk);
Msg = Jso.msg; Msg = Jso.msg;
if (Jso.rawin("value")) { if (Jso.rawin("value")) {
print(Jso.value[0]); //构造一个新装备
Slot[2].Item = { local ItemObject = Rindro_Item();
itemId = Jso.value[0] 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)); }.bindenv(this));
@ -191,11 +195,11 @@ class ItemFusionC extends LenheartNewUI_Windows {
AddChild(ConfirmButton); AddChild(ConfirmButton);
//创建槽 //创建槽
Slot = [ItemFusionC_ItemSlot(49, 58), ItemFusionC_ItemSlot(150, 58), ItemFusionC_ItemSlot(99, 182)]; Slot = [ItemFusionC_ItemSlot(58, 68, 0), ItemFusionC_ItemSlot(159, 68, 1), ItemFusionC_ItemSlot(108, 192, 2)];
foreach(value in Slot) { foreach(value in Slot) {
AddChild(value); AddChild(value);
} }
Slot[2].UseFlag = false; Slot[2].NoClick = true;
} }
//绘制主界面 //绘制主界面
@ -213,7 +217,7 @@ class ItemFusionC extends LenheartNewUI_Windows {
local SlotEnableCount = 0; local SlotEnableCount = 0;
for (local i = 0; i< 2; i++) { for (local i = 0; i< 2; i++) {
local value = Slot[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(0 + SlotEnableCount, X + 8, Y + 30);
WindowImg.DrawPng(3, X + 8, Y + 32); WindowImg.DrawPng(3, X + 8, Y + 32);
@ -280,11 +284,11 @@ class ItemFusionC extends LenheartNewUI_Windows {
local Ret = Value.DiscardItem(info); local Ret = Value.DiscardItem(info);
if (Ret) { if (Ret) {
R_Utils.PlaySound("CHANGE_ALERT"); R_Utils.PlaySound("CHANGE_ALERT");
if (Slot[0].Item && Slot[1].Item) { if (Slot[0].ItemInfo && Slot[1].ItemInfo) {
local T = { local T = {
op = 21006001, op = 21006001,
item1 = Slot[0].Item, item1 = Slot[0].ItemInfo,
item2 = Slot[1].Item, item2 = Slot[1].ItemInfo,
} }
SendPackEx(T); SendPackEx(T);
} }
@ -361,6 +365,9 @@ class ItemFusionC extends LenheartNewUI_Windows {
} }
function InitWindow() { function InitWindow() {
foreach (obj in Slot) {
obj.RemoveItem();
}
Visible = true; Visible = true;
} }
} }