为消耗品图标增加显示数量
This commit is contained in:
parent
da0e76a02c
commit
dc1214f83c
|
|
@ -7,7 +7,7 @@
|
||||||
//消耗品图标窗口
|
//消耗品图标窗口
|
||||||
class GameItem.StackableIcon extends CL_CanvasObject {
|
class GameItem.StackableIcon extends CL_CanvasObject {
|
||||||
|
|
||||||
constructor(Stackable) {
|
constructor(Stackable, RenderCount = true) {
|
||||||
base.constructor();
|
base.constructor();
|
||||||
ResizeAndClear(32, 32);
|
ResizeAndClear(32, 32);
|
||||||
BeginDraw();
|
BeginDraw();
|
||||||
|
|
@ -20,6 +20,12 @@ class GameItem.StackableIcon extends CL_CanvasObject {
|
||||||
//边框
|
//边框
|
||||||
local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + GameItem.EquipmentInfoTag.rarityframe_color_idx[Stackable.Rarity]);
|
local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + GameItem.EquipmentInfoTag.rarityframe_color_idx[Stackable.Rarity]);
|
||||||
DrawSpriteFrame(IconFrame, 0, 0);
|
DrawSpriteFrame(IconFrame, 0, 0);
|
||||||
|
|
||||||
|
//数量
|
||||||
|
if (RenderCount && Stackable.Count > 0) {
|
||||||
|
local CountText = Yosin_Mininumber(Stackable.Count);
|
||||||
|
DrawActor(CountText, 28 - CountText.GetSize().w, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EndDraw();
|
EndDraw();
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +60,7 @@ class GameItem.StackableInfo extends Yosin_Window {
|
||||||
|
|
||||||
//构造图标 及图标边框
|
//构造图标 及图标边框
|
||||||
if (Stackable.Icon) {
|
if (Stackable.Icon) {
|
||||||
local Icon = GameItem.StackableIcon(Stackable);
|
local Icon = GameItem.StackableIcon(Stackable, false);
|
||||||
Canvas.DrawActor(Icon, 7, 7);
|
Canvas.DrawActor(Icon, 7, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,6 +150,8 @@ class GameItem.Stackable extends GameItem.Item {
|
||||||
Idx = -1;
|
Idx = -1;
|
||||||
//物品名称
|
//物品名称
|
||||||
Name = "";
|
Name = "";
|
||||||
|
//数量
|
||||||
|
Count = 0;
|
||||||
|
|
||||||
//物品类型
|
//物品类型
|
||||||
Type = null;
|
Type = null;
|
||||||
|
|
@ -187,10 +195,16 @@ class GameItem.Stackable extends GameItem.Item {
|
||||||
local StkInfo;
|
local StkInfo;
|
||||||
//通过ID构造
|
//通过ID构造
|
||||||
if (typeof vargv[0] == "integer") {
|
if (typeof vargv[0] == "integer") {
|
||||||
StkInfo = AssetManager.GetStackable(vargv[0]);
|
|
||||||
Idx = vargv[0];
|
Idx = vargv[0];
|
||||||
ConstructStackableFromScript(StkInfo);
|
ConstructStackableFromScript(AssetManager.GetStackable(Idx));
|
||||||
}
|
}
|
||||||
|
//通过脚本信息构造
|
||||||
|
else if (typeof vargv[0] == "table") {
|
||||||
|
Idx = vargv[0].ItemId;
|
||||||
|
ConstructStackableFromScript(AssetManager.GetStackable(Idx));
|
||||||
|
IterateStackableBasedOnActualStackableInformation(vargv[0]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -228,6 +242,12 @@ class GameItem.Stackable extends GameItem.Item {
|
||||||
if (StkInfo.rawin("trade_type")) TradeType = StkInfo["trade_type"];
|
if (StkInfo.rawin("trade_type")) TradeType = StkInfo["trade_type"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//根据实际的消耗品信息迭代消耗品
|
||||||
|
function IterateStackableBasedOnActualStackableInformation(Info) {
|
||||||
|
Count = Info.ItemCount;
|
||||||
|
TradeType = Info.ItemTradeType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ function RegisterFunctionalPack() {
|
||||||
//道具数量
|
//道具数量
|
||||||
ItemCount = Pack.Get_Int(),
|
ItemCount = Pack.Get_Int(),
|
||||||
}
|
}
|
||||||
ItemList[ItemInfo.Pos] <- GameItem.Stackable(ItemInfo.ItemId);
|
ItemList[ItemInfo.Pos] <- GameItem.Stackable(ItemInfo);
|
||||||
|
|
||||||
|
|
||||||
ClientCharacterInventory.PageList[0].SetItemCollectionList(InventoryType - 2, ItemList);
|
ClientCharacterInventory.PageList[0].SetItemCollectionList(InventoryType - 2, ItemList);
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,13 @@ function TestStage() {
|
||||||
|
|
||||||
local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
|
local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
|
||||||
|
|
||||||
|
|
||||||
// local BackGround = CL_SpriteObject("sprite/loding.img", 0);
|
// local BackGround = CL_SpriteObject("sprite/loding.img", 0);
|
||||||
// T.Addchild(BackGround);
|
// T.Addchild(BackGround);
|
||||||
|
|
||||||
|
|
||||||
// local Stk = GameItem.Stackable(3037);
|
// local Stk = GameItem.Stackable(3037);
|
||||||
|
// Stk.Count = 10;
|
||||||
// local Window = Stk.GetInfoWindow();
|
// local Window = Stk.GetInfoWindow();
|
||||||
// Window.SetPosition(300, 80);
|
// Window.SetPosition(300, 80);
|
||||||
// Window.ResetFocus();
|
// Window.ResetFocus();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue