diff --git a/Yosin_Engine.exe b/Yosin_Engine.exe index f5038e7..f89ff1f 100644 Binary files a/Yosin_Engine.exe and b/Yosin_Engine.exe differ diff --git a/sqr/Core/BaseClass/CanvasObject.nut b/sqr/Core/BaseClass/CanvasObject.nut index 15b2639..5340ebf 100644 --- a/sqr/Core/BaseClass/CanvasObject.nut +++ b/sqr/Core/BaseClass/CanvasObject.nut @@ -69,9 +69,12 @@ class CL_CanvasObject extends CL_BaseObject { } //绘制精灵帧 - function DrawSpriteFrame(SpriteFrame, XPos, YPos) { + function DrawSpriteFrame(SpriteFrame, XPos, YPos, Width = null, Height = null) { if (!Context) error("请先刷新上下文"); - Canvas_DrawSpriteFrame(Context, SpriteFrame.C_Object, XPos, YPos); + local Size = SpriteFrame.GetSize(); + if (Width == null) Width = Size.w; + if (Height == null) Height = Size.h; + Canvas_DrawSpriteFrame(Context, SpriteFrame.C_Object, XPos, YPos, Width, Height); } //设置填充画刷 diff --git a/sqr/User/Asset/AssetManager.nut b/sqr/User/Asset/AssetManager.nut index ebfa4f9..0fa51ae 100644 --- a/sqr/User/Asset/AssetManager.nut +++ b/sqr/User/Asset/AssetManager.nut @@ -136,6 +136,21 @@ class _AssetManager_ { } if (_DEBUG_) print("加载装备List完成, 共" + DataTable.len() + "个"); }); + //顺带初始化装备信息标签tag配置 + GameItem.EquipmentInfoTag = ScriptData.GetFileData("equipment/equipmentinfo.etc", function(DataTable, Data) { + while (!Data.Eof()) { + local Pack = Data.Get(); + //名称 grade 套装Id 稀有度 最低穿戴登记 重量 + if (Pack == "[item group name table]") { + DataTable.item_group_name_table <- {}; + while (true) { + local Ret = Data.Get(); + if (Ret == "[/item group name table]") break; + DataTable.item_group_name_table.rawset(Ret, Data.Get()); + } + } + } + }); } function InitNpcList() { @@ -196,8 +211,8 @@ class _AssetManager_ { DataTable.DirPath <- DataTable.filepath.slice(0, DataTable.filepath.lastfind("/") + 1); while (!Data.Eof()) { local Pack = Data.Get(); - //名称 grade 套装Id - if (Pack == "[name]" || Pack == "[part set index]" || Pack == "[grade]" || Pack == "[rarity]" || Pack == "[minimum level]") { + //名称 grade 套装Id 稀有度 最低穿戴登记 重量 组名 购买价格 出售价格 + if (Pack == "[name]" || Pack == "[part set index]" || Pack == "[grade]" || Pack == "[rarity]" || Pack == "[minimum level]" || Pack == "[weight]" || Pack == "[item group name]" || Pack == "[price]" || Pack == "[repair price]" || Pack == "[value]" || Pack == "[durability]") { local RealKey = Pack.slice(1, -1); DataTable[RealKey] <- Data.Get(); } diff --git a/sqr/User/Asset/Item/Equipment.nut b/sqr/User/Asset/Item/Equipment.nut index fce93c7..5ac0254 100644 --- a/sqr/User/Asset/Item/Equipment.nut +++ b/sqr/User/Asset/Item/Equipment.nut @@ -4,6 +4,8 @@ 创建日期:2024-12-12 19:03 文件用途: */ +//装备信息标签类(信息类) +if (!GameItem.rawin("EquipmentInfoTag")) GameItem.EquipmentInfoTag <- null; //装备信息窗口 class GameItem.EquipmentInfo extends Yosin_Window { @@ -12,25 +14,29 @@ class GameItem.EquipmentInfo extends Yosin_Window { //画布 Canvas = null; //稀有度边框颜色对应Idx表 - RarityColorIdx = [ - 0, //白装 普通 - 1, //蓝装 高级 - 2, //紫装 稀有 - 4, //粉装 神器 - 6, //金装 史诗 - 3, //红装 勇者 - 5, //橙装 传说 - ]; - //品级对应的文件显示 + //白装 蓝装 紫装 粉装 金装 红装 橙装 + 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); - local background = Yosin_NineBoxStretch(0, 0, 210, 600, "sprite/interface/lenheartwindowcommon.img", 213); + local background = Yosin_NineBoxStretch(0, 0, 208, 600, "sprite/interface/lenheartwindowcommon.img", 213); AddUIChild(background); //210 Init(); @@ -39,8 +45,8 @@ class GameItem.EquipmentInfo extends Yosin_Window { function Init() { Canvas = CL_CanvasObject(); Canvas.ResizeAndClear(210, 600); - Canvas.SetFillBrush(sq_RGBA(38, 38, 38, 250)); - Canvas.SetStrokeBrush(sq_RGBA(38, 38, 38, 250)); + Canvas.SetFillBrush(sq_RGBA(59, 56, 57, 250)); + Canvas.SetStrokeBrush(sq_RGBA(59, 56, 57, 250)); Canvas.BeginDraw(); //构造图标 及图标边框 @@ -48,14 +54,14 @@ class GameItem.EquipmentInfo extends Yosin_Window { local Icon = CL_SpriteFrameObject(Equipment.Icon.path, Equipment.Icon.index); Canvas.DrawSpriteFrame(Icon, 7, 7); - local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + RarityColorIdx[Equipment.Rarity]); + local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + RarityFrameColorIdx[Equipment.Rarity]); Canvas.DrawSpriteFrame(IconFrame, 7, 7); } //绘制装备名称 if (Equipment.Name.len() > 0) { local EquName = FontAssetManager.GenerateNormal(Equipment.Name, true, { - color = sq_RGBA(255, 0, 255, 255) + color = RarityColor[Equipment.Rarity] }); Canvas.DrawActor(EquName, 41, 7); } @@ -64,16 +70,68 @@ class GameItem.EquipmentInfo extends Yosin_Window { Canvas.DrawLine(3, 37, 207, 38); //绘制品级 //TODO 现在默认100 - local Percentage = 100; + local Percentage = 94; + //品级文字 local PercentageGradeText = FontAssetManager.GenerateNormal(GetPercentageText(Percentage), true, { color = sq_RGBA(255, 240, 0, 255) }); + //百分比UI + local PercentageUI = CL_SpriteFrameObject("sprite/interface/lenheartwindowcommon.img", 633); + Canvas.DrawSpriteFrame(PercentageUI, 48, 49, PercentageUI.GetSize().w * (Percentage.tofloat() / 100.0)); + local PercentageUIBG = CL_SpriteFrameObject("sprite/interface/lenheartwindowcommon.img", 632); + Canvas.DrawSpriteFrame(PercentageUIBG, 47, 48); + //百分比文字 local PercentageText = FontAssetManager.GenerateNormal(format("(%d%%)", Percentage), true, { color = sq_RGBA(161, 131, 74, 255) }); Canvas.DrawActor(PercentageGradeText, 6, 41); - Canvas.DrawActor(PercentageText, 52, 41); + Canvas.DrawActor(PercentageText, 130, 41); + //绘制稀有度名称 + local RarityTagName = FontAssetManager.GenerateNormal(RarityNameTag[Equipment.Rarity], true, { + color = RarityColor[Equipment.Rarity] + }); + Canvas.DrawActor(RarityTagName, 210 - RarityTagName.GetSize().w - 6, 41); + //绘制重量 + local WeightText = FontAssetManager.GenerateNormal((Equipment.Weight.tofloat() / 1000.0) + "kg", true, { + color = sq_RGBA(161, 131, 74, 255) + }); + Canvas.DrawActor(WeightText, 6, 57); + + //绘制最低多少级可以使用 + local MinUseLevelText = FontAssetManager.GenerateNormal(Equipment.Minimum_level + "级以上可以使用", true, { + color = sq_RGBA(161, 131, 74, 255) + }); + Canvas.DrawActor(MinUseLevelText, 210 - MinUseLevelText.GetSize().w - 6, 57); + + //绘制是否封装 如果有主体属性读取 否则一律为封装 + local IsPackage = Equipment.Property ? Equipment.Property.IsPackage : 0; + local IsPackageText = FontAssetManager.GenerateNormal(TradeTypeText[IsPackage], true, { + color = TradeTypeColor[IsPackage] + }); + Canvas.DrawActor(IsPackageText, 210 - IsPackageText.GetSize().w - 6, 73); + + //绘制装备类型 + local GroupNameText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.item_group_name_table[Equipment.GroupName], true, { + color = sq_RGBA(194, 161, 56, 255) + }); + Canvas.DrawActor(GroupNameText, 210 - GroupNameText.GetSize().w - 6, 89); + + //绘制售价 + local RealSellPrice = (Equipment.SellPrice == -1 ? (Equipment.Price == -1 ? 0 : Equipment.Price) : Equipment.SellPrice) / 5; + local SellPriceText = FontAssetManager.GenerateNormal(RealSellPrice + "金币", true, { + color = sq_RGBA(133, 121, 78, 255) + }); + Canvas.DrawActor(SellPriceText, 210 - SellPriceText.GetSize().w - 6, 105); + + //绘制耐久度 + local DurabilityText = FontAssetManager.GenerateNormal("耐久度 " + (Equipment.Property ? Equipment.Property.Durability : Equipment.Durability) + "/" + Equipment.Durability, true, { + color = sq_RGBA(133, 121, 80, 255) + }); + Canvas.DrawActor(DurabilityText, 6, 121); + + //绘制分割线 + Canvas.DrawLine(3, 139, 207, 139); Canvas.EndDraw(); Addchild(Canvas); @@ -126,6 +184,18 @@ class GameItem.Equipment extends GameItem.Item { Grade = null; //装备稀有度 Rarity = 0; + //重量 + Weight = 0; + //装备组名 + GroupName = "null"; + //购买价格 + Price = -1; + //维修价格 + RepairPrice = -1; + //出售价格 + SellPrice = -1; + //耐久度 + Durability = -1; //装备可穿戴职业 Job = 0; //装备图标 @@ -164,6 +234,18 @@ class GameItem.Equipment extends GameItem.Item { if (EquInfo.rawin("grade")) Grade = EquInfo["grade"]; //稀有度 if (EquInfo.rawin("rarity")) Rarity = EquInfo["rarity"]; + //重量 + if (EquInfo.rawin("weight")) Weight = EquInfo["weight"]; + //组名 + if (EquInfo.rawin("item group name")) GroupName = EquInfo["item group name"]; + //购买价格 + if (EquInfo.rawin("price")) Price = EquInfo["price"]; + //维修价格 + if (EquInfo.rawin("repair price")) RepairPrice = EquInfo["repair price"]; + //出售价格 + if (EquInfo.rawin("value")) SellPrice = EquInfo["value"]; + //耐久度 + if (EquInfo.rawin("durability")) Durability = EquInfo["durability"]; //职业 if (EquInfo.rawin("usable_job")) Job = EquInfo["usable_job"]; //图标