装备详细信息绘制 tag 改为PVF文件读取
This commit is contained in:
parent
72d2e37fb0
commit
f4bd95e9d1
BIN
Yosin_Engine.exe
BIN
Yosin_Engine.exe
Binary file not shown.
|
|
@ -155,6 +155,57 @@ class _AssetManager_ {
|
|||
if (Ret == "[/elemental property tag]") break;
|
||||
DataTable.elemental_property_tag.rawset(Ret, Data.Get());
|
||||
}
|
||||
} else if (Pack == "[rarity frame color idx]") {
|
||||
DataTable.rarityframe_color_idx <- [];
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/rarity frame color idx]") break;
|
||||
DataTable.rarityframe_color_idx.push(Ret);
|
||||
}
|
||||
} else if (Pack == "[rarity name tag]") {
|
||||
DataTable.rarity_name_tag <- [];
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/rarity name tag]") break;
|
||||
DataTable.rarity_name_tag.push(Ret);
|
||||
}
|
||||
} else if (Pack == "[rarity color]") {
|
||||
DataTable.rarity_color <- [];
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/rarity color]") break;
|
||||
local color = HexStringToInt(Ret);
|
||||
DataTable.rarity_color.push(color);
|
||||
}
|
||||
} else if (Pack == "[percentage text]") {
|
||||
DataTable.percentage_text <- [];
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/percentage text]") break;
|
||||
DataTable.percentage_text.push(Ret);
|
||||
}
|
||||
} else if (Pack == "[percentage range boundaries]") {
|
||||
DataTable.percentage_range_boundaries <- [];
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/percentage range boundaries]") break;
|
||||
DataTable.percentage_range_boundaries.push(Ret);
|
||||
}
|
||||
} else if (Pack == "[trade type text]") {
|
||||
DataTable.trade_type_text <- [];
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/trade type text]") break;
|
||||
DataTable.trade_type_text.push(Ret);
|
||||
}
|
||||
} else if (Pack == "[trade type color]") {
|
||||
DataTable.trade_type_color <- [];
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/trade type color]") break;
|
||||
local color = HexStringToInt(Ret);
|
||||
DataTable.trade_type_color.push(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,44 +6,53 @@
|
|||
*/
|
||||
//装备信息标签类(信息类)
|
||||
if (!GameItem.rawin("EquipmentInfoTag")) GameItem.EquipmentInfoTag <- null;
|
||||
//装备图标窗口
|
||||
class GameItem.EquipmentIcon extends CL_CanvasObject {
|
||||
|
||||
constructor(Equipment) {
|
||||
base.constructor();
|
||||
ResizeAndClear(32, 32);
|
||||
BeginDraw();
|
||||
//构造图标 及图标边框
|
||||
if (Equipment.Icon) {
|
||||
//图标
|
||||
local Icon = CL_SpriteFrameObject(Equipment.Icon.path, Equipment.Icon.index);
|
||||
DrawSpriteFrame(Icon, 0, 0);
|
||||
|
||||
//是否封装
|
||||
local IsPackage = Equipment.Property ? Equipment.Property.IsPackage : 1;
|
||||
if (IsPackage && (Equipment.Rarity == 2 || Equipment.Rarity == 3)) {
|
||||
local IconFrame = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 634);
|
||||
IconFrame.SetMode(0);
|
||||
DrawSprite(IconFrame);
|
||||
}
|
||||
|
||||
//边框
|
||||
local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + GameItem.EquipmentInfoTag.rarityframe_color_idx[Equipment.Rarity]);
|
||||
DrawSpriteFrame(IconFrame, 0, 0);
|
||||
}
|
||||
EndDraw();
|
||||
}
|
||||
}
|
||||
|
||||
//装备信息窗口
|
||||
class GameItem.EquipmentInfo extends Yosin_Window {
|
||||
|
||||
//装备
|
||||
Equipment = null;
|
||||
//画布
|
||||
Canvas = null;
|
||||
//画布实际高度
|
||||
RealCanvasHeight = 0;
|
||||
//稀有度边框颜色对应Idx表
|
||||
//白装 蓝装 紫装 粉装 金装 红装 橙装
|
||||
RarityFrameColorIdx = [0, 1, 2, 4, 6, 3, 5];
|
||||
//稀有度对应名称
|
||||
RarityNameTag = ["普通", "高级", "稀有", "神器", "史诗", "勇者", "传说"];
|
||||
//稀有度对应颜色
|
||||
RarityColor = [0xffffffff, 0xff68d5ed, 0xffb36bff, 0xffff00f0, 0xffffb100, 0xffff6666, 0xffff5500];
|
||||
//品级对应的文字显示
|
||||
PercentageText = ["最下级", "下级", "中级", "上级", "最上级"];
|
||||
// 定义每个品级对应的数值范围边界
|
||||
PercentageRangeBoundaries = [20, 40, 60, 80];
|
||||
//交易类型对应的文字显示
|
||||
TradeTypeText = ["自由交易", "不可交易", "封装", "账号绑定"];
|
||||
//交易类型对应的文字颜色
|
||||
TradeTypeColor = [0xffffffff, 0xffbb3332, 0xff4ba157, 0xffff5500];
|
||||
//装备类型描述
|
||||
GroupNameTag = ["武器", "防具", "饰品", "光环"];
|
||||
|
||||
|
||||
constructor(Equipment) {
|
||||
this.Equipment = Equipment.weakref();
|
||||
base.constructor(clock() + "EquipmentInfo" + Equipment.Idx, 0, 0, 0, 0, 0);
|
||||
|
||||
//210
|
||||
Init();
|
||||
|
||||
local background = Yosin_NineBoxStretch(0, 0, 208, RealCanvasHeight + 10, "sprite/interface/lenheartwindowcommon.img", 213);
|
||||
background.SetZOrder(-1);
|
||||
AddUIChild(background);
|
||||
Addchild(background);
|
||||
}
|
||||
|
||||
function Init() {
|
||||
|
|
@ -55,26 +64,14 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
|
||||
//构造图标 及图标边框
|
||||
if (Equipment.Icon) {
|
||||
local Icon = CL_SpriteFrameObject(Equipment.Icon.path, Equipment.Icon.index);
|
||||
Canvas.DrawSpriteFrame(Icon, 7, 7);
|
||||
|
||||
local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + RarityFrameColorIdx[Equipment.Rarity]);
|
||||
Canvas.DrawSpriteFrame(IconFrame, 7, 7);
|
||||
|
||||
//是否封装
|
||||
local IsPackage = Equipment.Property ? Equipment.Property.IsPackage : 1;
|
||||
if (IsPackage && (Equipment.Rarity == 2 || Equipment.Rarity == 3)) {
|
||||
local IconFrame = CL_SpriteObject("sprite/item/iconmark.img", 46);
|
||||
IconFrame.SetMode(0);
|
||||
IconFrame.SetPosition(8, 6);
|
||||
Canvas.DrawSprite(IconFrame);
|
||||
}
|
||||
local Icon = GameItem.EquipmentIcon(Equipment);
|
||||
Canvas.DrawActor(Icon, 7, 7);
|
||||
}
|
||||
|
||||
//绘制装备名称
|
||||
if (Equipment.Name.len() > 0) {
|
||||
local EquName = FontAssetManager.GenerateNormal(Equipment.Name, false, {
|
||||
color = RarityColor[Equipment.Rarity]
|
||||
color = GameItem.EquipmentInfoTag.rarity_color[Equipment.Rarity]
|
||||
});
|
||||
Canvas.DrawActor(EquName, 41, 7);
|
||||
}
|
||||
|
|
@ -100,8 +97,8 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
Canvas.DrawActor(PercentageGradeText, 6, 41);
|
||||
Canvas.DrawActor(PercentageText, 130, 41);
|
||||
//绘制稀有度名称
|
||||
local RarityTagName = FontAssetManager.GenerateNormal(RarityNameTag[Equipment.Rarity], false, {
|
||||
color = RarityColor[Equipment.Rarity]
|
||||
local RarityTagName = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.rarity_name_tag[Equipment.Rarity], false, {
|
||||
color = GameItem.EquipmentInfoTag.rarity_color[Equipment.Rarity]
|
||||
});
|
||||
Canvas.DrawActor(RarityTagName, 210 - RarityTagName.GetSize().w - 6, 41);
|
||||
|
||||
|
|
@ -119,8 +116,8 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
|
||||
//绘制交易类型 如果有主体属性读取 否则一律为封装
|
||||
local TradeType = Equipment.Property ? Equipment.Property.TradeType : 0;
|
||||
local TradeTypeText = FontAssetManager.GenerateNormal(TradeTypeText[TradeType], false, {
|
||||
color = TradeTypeColor[TradeType]
|
||||
local TradeTypeText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.trade_type_text[TradeType], false, {
|
||||
color = GameItem.EquipmentInfoTag.trade_type_color[TradeType]
|
||||
});
|
||||
Canvas.DrawActor(TradeTypeText, 210 - TradeTypeText.GetSize().w - 6, 73);
|
||||
|
||||
|
|
@ -321,30 +318,31 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
|
||||
// 根据数值获取对应的品级文字
|
||||
function GetPercentageText(num) {
|
||||
if (num< PercentageRangeBoundaries[0]) {
|
||||
return PercentageText[0];
|
||||
if (num< GameItem.EquipmentInfoTag.percentage_range_boundaries[0]) {
|
||||
return GameItem.EquipmentInfoTag.percentage_text[0];
|
||||
}
|
||||
for (local i = 0; i< PercentageRangeBoundaries.len(); i++) {
|
||||
if (num <= PercentageRangeBoundaries[i]) {
|
||||
return PercentageText[i + 1];
|
||||
for (local i = 0; i< GameItem.EquipmentInfoTag.percentage_range_boundaries.len(); i++) {
|
||||
if (num <= GameItem.EquipmentInfoTag.percentage_range_boundaries[i]) {
|
||||
return GameItem.EquipmentInfoTag.percentage_text[i + 1];
|
||||
}
|
||||
}
|
||||
return PercentageText.top();
|
||||
return GameItem.EquipmentInfoTag.percentage_text.top();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!getroottable().rawin("chongzaiflag")) {
|
||||
getroottable()["chongzaiflag"] <- true;
|
||||
} else {
|
||||
//遍历窗口队列 如果可见则调用Show
|
||||
for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
||||
local Window = _SYS_WINDOW_LIST_[i];
|
||||
Window.Visible = false;
|
||||
Window.RemoveSelf();
|
||||
}
|
||||
TestStage();
|
||||
}
|
||||
|
||||
// if (!getroottable().rawin("chongzaiflag")) {
|
||||
// getroottable()["chongzaiflag"] <- true;
|
||||
// } else {
|
||||
// //遍历窗口队列 如果可见则调用Show
|
||||
// for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
||||
// local Window = _SYS_WINDOW_LIST_[i];
|
||||
// Window.Visible = false;
|
||||
// Window.RemoveSelf();
|
||||
// }
|
||||
// TestStage();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
|
@ -552,11 +550,12 @@ class GameItem.Equipment extends GameItem.Item {
|
|||
|
||||
//获取装备信息窗口
|
||||
function GetEquipmentInfoWindow() {
|
||||
if (Property) {
|
||||
return GameItem.EquipmentInfo(this);
|
||||
}
|
||||
|
||||
} else {
|
||||
return GameItem.EquipmentInfo(this);
|
||||
}
|
||||
//获取装备图标精灵
|
||||
function GetEquipmentIconSprite() {
|
||||
return GameItem.EquipmentIcon(this);
|
||||
}
|
||||
|
||||
//穿戴装备回调
|
||||
|
|
|
|||
|
|
@ -14,22 +14,30 @@ function TestStage() {
|
|||
|
||||
|
||||
|
||||
local Equ = GameItem.Equipment(27675);
|
||||
local Window = Equ.GetEquipmentInfoWindow();
|
||||
Window.SetPosition(100, 80);
|
||||
Window.ResetFocus();
|
||||
// local Equ = GameItem.Equipment(27675);
|
||||
// local Window = Equ.GetEquipmentInfoWindow();
|
||||
// Window.SetPosition(100, 80);
|
||||
// Window.ResetFocus();
|
||||
|
||||
local Equ = GameItem.Equipment(101020048);
|
||||
local Window = Equ.GetEquipmentInfoWindow();
|
||||
Window.SetPosition(350, 80);
|
||||
Window.ResetFocus();
|
||||
// local Equ = GameItem.Equipment(101020048);
|
||||
// local Window = Equ.GetEquipmentInfoWindow();
|
||||
// Window.SetPosition(350, 80);
|
||||
// Window.ResetFocus();
|
||||
|
||||
local Equ = GameItem.Equipment(24144);
|
||||
local Window = Equ.GetEquipmentInfoWindow();
|
||||
Window.SetPosition(580, 80);
|
||||
Window.ResetFocus();
|
||||
// local Equ = GameItem.Equipment(24144);
|
||||
// local Window = Equ.GetEquipmentInfoWindow();
|
||||
// Window.SetPosition(580, 80);
|
||||
// Window.ResetFocus();
|
||||
|
||||
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20);
|
||||
local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20);
|
||||
|
||||
Window.equipmentPage.Item.ItemCollection.SetItemList([{
|
||||
ItemId = 27675
|
||||
}, {
|
||||
ItemId = 101020048
|
||||
}, {
|
||||
ItemId = 24144
|
||||
}]);
|
||||
|
||||
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20);
|
||||
// //大背景
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
//local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 555, 20);
|
||||
class _Inventory extends Yosin_Window {
|
||||
|
||||
equipmentPage = null;
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
|
|
@ -29,7 +31,7 @@ class _Inventory extends Yosin_Window {
|
|||
};
|
||||
|
||||
//物品栏 装备页
|
||||
local equipmentPage = Inventory_EquipmentPage( 2, titlesBtn.bottom() + 4, 300, Height - titlesBtn.bottom() - 4);
|
||||
equipmentPage = Inventory_EquipmentPage(2, titlesBtn.bottom() + 4, 300, Height - titlesBtn.bottom() - 4);
|
||||
AddUIChild(equipmentPage);
|
||||
|
||||
|
||||
|
|
@ -41,5 +43,4 @@ class _Inventory extends Yosin_Window {
|
|||
base.Proc(Dt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -8,6 +8,8 @@
|
|||
// 背包装备页面
|
||||
class Inventory_EquipmentPage extends Yosin_CommonUi {
|
||||
|
||||
Item = null;
|
||||
|
||||
constructor(x, y, w, h) {
|
||||
base.constructor(x, y, w, h);
|
||||
|
||||
|
|
@ -17,8 +19,8 @@ class Inventory_EquipmentPage extends Yosin_CommonUi {
|
|||
AddUIChild(charactersEquipment);
|
||||
|
||||
// 物品栏
|
||||
local item = InventoryItem(0, charactersEquipment.bottom(), Width, Height - charactersEquipment.bottom());
|
||||
AddUIChild(item);
|
||||
Item = InventoryItem(0, charactersEquipment.bottom(), Width, Height - charactersEquipment.bottom());
|
||||
AddUIChild(Item);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -77,7 +79,7 @@ class Inventory_CharactersEquipment extends Yosin_CommonUi {
|
|||
AddUIChild(designation);
|
||||
|
||||
// 增益强化
|
||||
local intensify = Yosin_BaseButton(designation.right() +2, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 128);
|
||||
local intensify = Yosin_BaseButton(designation.right() + 2, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 128);
|
||||
AddUIChild(intensify);
|
||||
// 皮肤仓库
|
||||
local skin = Yosin_BaseButton(intensify.right() + 2, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 134);
|
||||
|
|
@ -148,6 +150,7 @@ class Inventory_CharactersEquipment extends Yosin_CommonUi {
|
|||
|
||||
// 物品栏
|
||||
class InventoryItem extends Yosin_CommonUi {
|
||||
ItemCollection = null;
|
||||
|
||||
constructor(gX, gY, gWidth, gHeight) {
|
||||
base.constructor(gX, gY, gWidth, gHeight);
|
||||
|
|
@ -165,8 +168,8 @@ class InventoryItem extends Yosin_CommonUi {
|
|||
Addchild(itemBg);
|
||||
|
||||
// 物品栏
|
||||
local itemCollection = itemCollection(itemBg.X + 7, itemBg.Y + 7, 239, 209, 7, 8);
|
||||
AddUIChild(itemCollection);
|
||||
ItemCollection = _ItemCollection(itemBg.X + 7, itemBg.Y + 7, 7);
|
||||
AddUIChild(ItemCollection);
|
||||
|
||||
|
||||
local itemBgBottom = itemBg.bottom();
|
||||
|
|
@ -174,7 +177,7 @@ class InventoryItem extends Yosin_CommonUi {
|
|||
local weight = FontAssetManager.GenerateNormal("重量", true, {
|
||||
color = sq_RGBA(160, 132, 75, 255)
|
||||
});
|
||||
weight.SetPosition(itemCollection.X + 5, itemBgBottom - weight.GetSize().h - 5);
|
||||
weight.SetPosition(ItemCollection.X + 5, itemBgBottom - weight.GetSize().h - 5);
|
||||
Addchild(weight);
|
||||
|
||||
// 重量进度条
|
||||
|
|
@ -203,7 +206,10 @@ class InventoryItem extends Yosin_CommonUi {
|
|||
local moneyItem = MoneyItem(5, itemBgBottom + 3, 3);
|
||||
AddUIChild(moneyItem);
|
||||
|
||||
}
|
||||
|
||||
function SetItemList(gItemList) {
|
||||
ItemCollection.SetItemList(gItemList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -233,7 +239,7 @@ class MoneyItem extends Yosin_CommonUi {
|
|||
local winNum = FontAssetManager.GenerateNormal("23434个", true, {
|
||||
color = txtColor
|
||||
});
|
||||
winNum.SetPosition( 245 - winNum.GetSize().w, 2);
|
||||
winNum.SetPosition(245 - winNum.GetSize().w, 2);
|
||||
Addchild(winNum);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,62 +4,151 @@
|
|||
创建日期:2025-01-06 13:50
|
||||
文件用途: 物品栏
|
||||
*/
|
||||
//物品槽
|
||||
class ItemSlot {
|
||||
X = null;
|
||||
Y = null;
|
||||
|
||||
//物品对象
|
||||
Item = null;
|
||||
//物品对象的图标
|
||||
ItemIcon = null;
|
||||
//物品对象的详细信息窗口
|
||||
ItemInfo = null;
|
||||
//详细信息窗口显示Flag
|
||||
ItemInfoShowFlag = false;
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
function SyncPos(x, y) {
|
||||
this.X = x;
|
||||
this.Y = y;
|
||||
}
|
||||
|
||||
function SetItem(Item) {
|
||||
this.Item = Item;
|
||||
this.ItemIcon = this.Item.GetEquipmentIconSprite();
|
||||
}
|
||||
|
||||
//生成详细信息
|
||||
function GenerateInfo() {
|
||||
this.ItemInfo = this.Item.GetEquipmentInfoWindow();
|
||||
}
|
||||
|
||||
//显示详细信息
|
||||
function ShowInfo(x, y) {
|
||||
if (!this.ItemInfo) GenerateInfo();
|
||||
this.ItemInfoShowFlag = true;
|
||||
//设置位置
|
||||
this.ItemInfo.SetPosition(x, y);
|
||||
this.ItemInfo.ResetFocus();
|
||||
}
|
||||
|
||||
//关闭显示详细信息
|
||||
function CloseInfo() {
|
||||
if (this.ItemInfo) {
|
||||
this.ItemInfoShowFlag = false;
|
||||
this.ItemInfo.CloseWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 物品栏
|
||||
class itemCollection extends Yosin_CommonUi {
|
||||
|
||||
// 行
|
||||
column = null;
|
||||
// 列
|
||||
row = null;
|
||||
class _ItemCollection extends Yosin_CommonUi {
|
||||
|
||||
// 悬浮时显示的框
|
||||
rect = null;
|
||||
HoverEffect = null;
|
||||
//行数
|
||||
RowNum = null;
|
||||
//底层画布对象
|
||||
BottomCanvas = null;
|
||||
//顶层画布对象
|
||||
TopCanvas = null;
|
||||
//物品对象List
|
||||
ItemList = null;
|
||||
//当前显示详细信息的物品对象
|
||||
CurrentShowItem = null;
|
||||
//当前鼠标指向的位置
|
||||
ItemPos = null;
|
||||
|
||||
columnNum = null;
|
||||
rowNum = null;
|
||||
|
||||
Canvas = null;
|
||||
constructor(x, y, rowNum) {
|
||||
this.RowNum = rowNum;
|
||||
//计算实际需要的高度
|
||||
local RealH = 30 * rowNum;
|
||||
base.constructor(x, y, 239, RealH);
|
||||
|
||||
constructor(x, y, w, h, columnNum, rowNum) {
|
||||
base.constructor(x, y, w, h);
|
||||
this.columnNum = columnNum;
|
||||
this.rowNum = rowNum;
|
||||
//构造相应数量的槽
|
||||
ItemList = array(8 * rowNum, null);
|
||||
|
||||
//整体底板
|
||||
InitOverallBasePlate();
|
||||
|
||||
|
||||
HoverEffect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 131);
|
||||
HoverEffect.SetZOrder(1);
|
||||
HoverEffect.SetVisible(false);
|
||||
Addchild(HoverEffect);
|
||||
|
||||
}
|
||||
|
||||
//根据高度绘制整体底板
|
||||
function InitOverallBasePlate() {
|
||||
// 创建画布
|
||||
Canvas = CL_CanvasObject();
|
||||
BottomCanvas = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
Canvas.ResizeAndClear(w, h);
|
||||
BottomCanvas.ResizeAndClear(239, this.RowNum * 30);
|
||||
// 开始绘制
|
||||
Canvas.BeginDraw();
|
||||
BottomCanvas.BeginDraw();
|
||||
foreach(pos, ItemObj in ItemList) {
|
||||
local XPos = (pos % 8) * 30;
|
||||
local YPos = (pos / 8) * 30;
|
||||
local bg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 49);
|
||||
BottomCanvas.DrawSpriteFrame(bg, XPos, YPos);
|
||||
}
|
||||
// 结束绘制
|
||||
BottomCanvas.EndDraw();
|
||||
// 添加画布
|
||||
Addchild(BottomCanvas);
|
||||
}
|
||||
|
||||
local itemX = 0;
|
||||
local itemY = 0;
|
||||
for (local i = 0; i< columnNum; i++) {
|
||||
local cells = [];
|
||||
for (local i = 0; i< rowNum; i++) {
|
||||
local bg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 49);
|
||||
Canvas.DrawSpriteFrame(bg, itemX, itemY);
|
||||
//设置道具列表
|
||||
function SetItemList(gItemList) {
|
||||
//如果不存在则构造画布
|
||||
if (!TopCanvas) {
|
||||
// 创建画布
|
||||
TopCanvas = CL_CanvasObject();
|
||||
// 添加画布
|
||||
Addchild(TopCanvas);
|
||||
}
|
||||
|
||||
itemX += 30;
|
||||
// 重设大小并清空
|
||||
TopCanvas.ResizeAndClear(239, this.RowNum * 30);
|
||||
// 开始绘制
|
||||
TopCanvas.BeginDraw();
|
||||
//创建道具
|
||||
foreach(Index, ItemObject in gItemList) {
|
||||
local ItemId = ItemObject.ItemId;
|
||||
//TODO
|
||||
local Item = GameItem.Equipment(ItemId);
|
||||
ItemList[Index] = ItemSlot();
|
||||
ItemList[Index].SetItem(Item);
|
||||
}
|
||||
|
||||
foreach(pos, ItemObj in ItemList) {
|
||||
if (ItemObj) {
|
||||
local XPos = (pos % 8) * 30;
|
||||
local YPos = (pos / 8) * 30;
|
||||
ItemObj.ItemIcon.SetPosition(XPos, YPos);
|
||||
TopCanvas.DrawSprite(ItemObj.ItemIcon, XPos, YPos);
|
||||
}
|
||||
itemX = 0;
|
||||
itemY += 30;
|
||||
}
|
||||
|
||||
// 结束绘制
|
||||
Canvas.EndDraw();
|
||||
// 添加画布
|
||||
Addchild(Canvas);
|
||||
|
||||
|
||||
rect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 131);
|
||||
rect.SetVisible(false);
|
||||
Addchild(rect);
|
||||
|
||||
TopCanvas.EndDraw();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -70,30 +159,80 @@ class itemCollection extends Yosin_CommonUi {
|
|||
|
||||
if (isInRect) {
|
||||
local WorldPosition = this.GetWorldPosition();
|
||||
local xx = MousePos_X - WorldPosition.x -5;
|
||||
local yy = MousePos_Y - WorldPosition.y -5;
|
||||
local xx = MousePos_X - WorldPosition.x;
|
||||
local yy = MousePos_Y - WorldPosition.y;
|
||||
local column = (yy / 30).tointeger();
|
||||
local row = (xx / 30).tointeger();
|
||||
|
||||
|
||||
local inRadius = column< columnNum && row< rowNum;
|
||||
local change = column != this.column || row != this.row;
|
||||
// 移动到另一个槽
|
||||
if (change && inRadius) {
|
||||
|
||||
this.column = column;
|
||||
this.row = row;
|
||||
|
||||
rect.SetVisible(true);
|
||||
rect.SetPosition(row * 30, column * 30);
|
||||
|
||||
//指向的项目位置
|
||||
local Idx = column * 8 + row;
|
||||
ItemPos = Idx;
|
||||
//如果有道具
|
||||
if (ItemList[Idx]) {
|
||||
//设置透明度
|
||||
HoverEffect.SetOpacity(0.4);
|
||||
//如果没有物品信息窗口
|
||||
if (!ItemList[Idx].ItemInfo) {
|
||||
ItemList[Idx].GenerateInfo();
|
||||
}
|
||||
if (!ItemList[Idx].ItemInfoShowFlag) {
|
||||
//关闭上一个显示的对象
|
||||
if (CurrentShowItem) {
|
||||
CurrentShowItem.CloseInfo();
|
||||
}
|
||||
//显示详细信息
|
||||
ItemList[Idx].ShowInfo(MousePos_X - 50, MousePos_Y - 150);
|
||||
//记录当前显示的对象
|
||||
CurrentShowItem = ItemList[Idx];
|
||||
}
|
||||
} else {
|
||||
//关闭上一个显示的对象
|
||||
if (CurrentShowItem) {
|
||||
CurrentShowItem.CloseInfo();
|
||||
}
|
||||
HoverEffect.SetOpacity(1);
|
||||
}
|
||||
|
||||
//设置悬停槽
|
||||
HoverEffect.SetVisible(true);
|
||||
HoverEffect.SetPosition(row * 30, column * 30);
|
||||
} else {
|
||||
this.column = null;
|
||||
this.row = null;
|
||||
rect.SetVisible(false);
|
||||
HoverEffect.SetVisible(false);
|
||||
//关闭所有详细信息显示
|
||||
foreach(ItemObj in ItemList) {
|
||||
if (ItemObj && ItemObj.ItemInfoShowFlag) {
|
||||
ItemObj.CloseInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||
//关闭显示的对象
|
||||
if (CurrentShowItem) {
|
||||
CurrentShowItem.CloseInfo();
|
||||
}
|
||||
|
||||
if (ItemPos) {
|
||||
local Item = ItemList[ItemPos];
|
||||
ItemList[ItemPos] = null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!getroottable().rawin("chongzaiflag")) {
|
||||
getroottable()["chongzaiflag"] <- true;
|
||||
} else {
|
||||
//遍历窗口队列 如果可见则调用Show
|
||||
for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
||||
local Window = _SYS_WINDOW_LIST_[i];
|
||||
Window.Visible = false;
|
||||
Window.RemoveSelf();
|
||||
}
|
||||
TestStage();
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
equipment/equipmentinfo.etc 装备信息界面的配置
|
||||
|
||||
角色chr文件新增了[default avatar] 的标签用于设置 角色默认装备
|
||||
Loading…
Reference in New Issue