Compare commits
No commits in common. "75ffaba040f4fb0ce36225b975200201eab52171" and "383c07e61b42a2482e83e0ebd1e68a1e740c4fd4" have entirely different histories.
75ffaba040
...
383c07e61b
BIN
Yosin_Engine.exe
BIN
Yosin_Engine.exe
Binary file not shown.
|
|
@ -692,7 +692,7 @@ class Yosin_RowMoreTitleBtn extends Yosin_CommonUi {
|
|||
titleBtn.index = i;
|
||||
|
||||
titleBtn.LBDownOnClick = function(btn) {
|
||||
btn.Parent.LBDownOnClick(btn.Parent, btn.index);
|
||||
btn.Parent.LBDownOnClick(this, btn.index);
|
||||
|
||||
for (local i = 0; i< btn.Parent.btns.len(); i++) {
|
||||
btn.Parent.btns[i].SetSelect(false);
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ class _AssetManager_ {
|
|||
TownList = null;
|
||||
//装备列表
|
||||
EquipmentList = null;
|
||||
//消耗品列表
|
||||
StackableList = null;
|
||||
//NPC列表
|
||||
NpcList = null;
|
||||
|
||||
|
|
@ -213,20 +211,6 @@ class _AssetManager_ {
|
|||
});
|
||||
}
|
||||
|
||||
function InitStackableList() {
|
||||
StackableList = ScriptData.GetFileData("stackable/stackable.lst", function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
local Key = Data.Get();
|
||||
//注册装备列表 路径写入 数据未读取
|
||||
DataTable.rawset(Key, {
|
||||
Path = Data.Get(),
|
||||
Data = null
|
||||
});
|
||||
}
|
||||
if (_DEBUG_) print("加载消耗品List完成, 共" + DataTable.len() + "个");
|
||||
});
|
||||
}
|
||||
|
||||
function InitNpcList() {
|
||||
NpcList = ScriptData.GetFileData("npc/npc.lst", function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
|
|
@ -264,8 +248,6 @@ class _AssetManager_ {
|
|||
InitCharacter();
|
||||
//初始化装备列表
|
||||
InitEquipmentList();
|
||||
//初始化消耗品列表
|
||||
InitStackableList();
|
||||
//初始化NPC列表
|
||||
InitNpcList();
|
||||
|
||||
|
|
@ -301,8 +283,8 @@ class _AssetManager_ {
|
|||
DataTable.usable_job.append(Ret.slice(1, -1).tolower());
|
||||
}
|
||||
}
|
||||
//读取三攻 和 双防
|
||||
else if (Pack == "[equipment physical attack]" || Pack == "[equipment magical attack]" || Pack == "[separate attack]" || Pack == "[equipment physical defense]" || Pack == "[equipment magical defense]") {
|
||||
//读取三攻
|
||||
else if (Pack == "[equipment physical attack]" || Pack == "[equipment magical attack]" || Pack == "[separate attack]") {
|
||||
local RealKey = Pack.slice(1, -1);
|
||||
DataTable[RealKey] <- [Data.Get(), Data.Get()];
|
||||
}
|
||||
|
|
@ -365,60 +347,6 @@ class _AssetManager_ {
|
|||
return m_data;
|
||||
}
|
||||
|
||||
//获取消耗品信息
|
||||
function GetStackable(Idx) {
|
||||
//如果没有这件消耗品则返回
|
||||
if (!(StackableList.rawin(Idx))) return;
|
||||
//如果装备数据已经读取过存在了则直接返回
|
||||
if (StackableList[Idx].Data) return StackableList[Idx].Data;
|
||||
local Path = StackableList[Idx].Path;
|
||||
local m_data = ScriptData.GetFileData("stackable/" + Path, function(DataTable, Data) {
|
||||
DataTable.DirPath <- DataTable.filepath.slice(0, DataTable.filepath.lastfind("/") + 1);
|
||||
while (!Data.Eof()) {
|
||||
local Pack = Data.Get();
|
||||
//名称
|
||||
if (Pack == "[name]" || Pack == "[item group name]" || Pack == "[explain]") {
|
||||
local RealKey = Pack.slice(1, -1);
|
||||
DataTable[RealKey] <- Data.Get();
|
||||
}
|
||||
//适用角色
|
||||
else if (Pack == "[usable job]") {
|
||||
DataTable.usable_job <- [];
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/usable job]") break;
|
||||
DataTable.usable_job.append(Ret.slice(1, -1).tolower());
|
||||
}
|
||||
}
|
||||
//图标
|
||||
else if (Pack == "[icon]") {
|
||||
DataTable.icon <- {};
|
||||
local Ret = Data.Get();
|
||||
DataTable.icon.path <- "sprite/" + Ret.tolower();
|
||||
Ret = Data.Get();
|
||||
DataTable.icon.index <- Ret.tointeger();
|
||||
}
|
||||
//消耗品类型
|
||||
else if (Pack == "[stackable type]") {
|
||||
DataTable.type <- {};
|
||||
local Ret = Data.Get();
|
||||
DataTable.type.path <- Ret.tolower().slice(1, -1);
|
||||
Ret = Data.Get();
|
||||
DataTable.type.index <- Ret.tointeger();
|
||||
}
|
||||
//交易类型
|
||||
else if (Pack == "[attach type]") {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[free]") DataTable.trade_type <- 0;
|
||||
else if (Ret == "[trade]") DataTable.trade_type <- 1;
|
||||
else if (Ret == "[sealing]") DataTable.trade_type <- 2;
|
||||
else if (Ret == "[account]") DataTable.trade_type <- 3;
|
||||
}
|
||||
}
|
||||
});
|
||||
StackableList[Idx].Data = m_data;
|
||||
return m_data;
|
||||
}
|
||||
|
||||
//Public::
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class GameItem.EquipmentIcon extends CL_CanvasObject {
|
|||
DrawSpriteFrame(Icon, 0, 0);
|
||||
|
||||
//是否封装
|
||||
local IsPackage = Equipment.IsWrap;
|
||||
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);
|
||||
|
|
@ -70,13 +70,7 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
|
||||
//绘制装备名称
|
||||
if (Equipment.Name.len() > 0) {
|
||||
local UpgradeName = "";
|
||||
local SeparateLevelName = "";
|
||||
local DrawName = Equipment.Name;
|
||||
if (Equipment.Upgrade > 0) UpgradeName = "+" + Equipment.Upgrade;
|
||||
if (Equipment.SeparateLevel > 0) SeparateLevelName = "(" + Equipment.SeparateLevel + ")";
|
||||
if ((Equipment.Upgrade + Equipment.SeparateLevel) > 0) DrawName = UpgradeName + SeparateLevelName + " " + DrawName;
|
||||
local EquName = FontAssetManager.GenerateNormal(DrawName, false, {
|
||||
local EquName = FontAssetManager.GenerateNormal(Equipment.Name, false, {
|
||||
color = GameItem.EquipmentInfoTag.rarity_color[Equipment.Rarity]
|
||||
});
|
||||
Canvas.DrawActor(EquName, 41, 7);
|
||||
|
|
@ -86,7 +80,7 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
Canvas.DrawLine(3, 37, 207, 38);
|
||||
|
||||
//绘制品级
|
||||
local Percentage = Equipment.Percentage;
|
||||
local Percentage = Equipment.Property ? Equipment.Property.Percentage : 100;
|
||||
//品级文字
|
||||
local PercentageGradeText = FontAssetManager.GenerateNormal(GetPercentageText(Percentage), false, {
|
||||
color = sq_RGBA(255, 240, 0, 255)
|
||||
|
|
@ -121,7 +115,7 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
Canvas.DrawActor(MinUseLevelText, 210 - MinUseLevelText.GetSize().w - 6, 57);
|
||||
|
||||
//绘制交易类型 如果有主体属性读取 否则一律为封装
|
||||
local TradeType = Equipment.TradeType;
|
||||
local TradeType = Equipment.Property ? Equipment.Property.TradeType : 0;
|
||||
local TradeTypeText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.trade_type_text[TradeType], false, {
|
||||
color = GameItem.EquipmentInfoTag.trade_type_color[TradeType]
|
||||
});
|
||||
|
|
@ -141,7 +135,7 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
Canvas.DrawActor(SellPriceText, 210 - SellPriceText.GetSize().w - 6, 105);
|
||||
|
||||
//绘制耐久度
|
||||
local DurabilityText = FontAssetManager.GenerateNormal("耐久度 " + (Equipment.CurrentDurability == -1 ? Equipment.Durability : Equipment.CurrentDurability) + "/" + Equipment.Durability, false, {
|
||||
local DurabilityText = FontAssetManager.GenerateNormal("耐久度 " + (Equipment.Property ? Equipment.Property.Durability : Equipment.Durability) + "/" + Equipment.Durability, false, {
|
||||
color = sq_RGBA(133, 121, 80, 255)
|
||||
});
|
||||
Canvas.DrawActor(DurabilityText, 6, 121);
|
||||
|
|
@ -163,24 +157,6 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
//绘制分割
|
||||
AddSliceLine();
|
||||
|
||||
//绘制强化和增幅逻辑
|
||||
if ((Equipment.Upgrade + Equipment.SeparateLevel) > 0) {
|
||||
local UpgradeInfo;
|
||||
if (Equipment.Upgrade > 0) {
|
||||
UpgradeInfo = FontAssetManager.GenerateNormal("+" + Equipment.Upgrade + " 强化 ,", false, {
|
||||
color = sq_RGBA(103, 214, 236, 255)
|
||||
});
|
||||
Canvas.DrawActor(UpgradeInfo, 6, RealCanvasHeight);
|
||||
}
|
||||
if (Equipment.SeparateLevel > 0) {
|
||||
local SeparateLevelInfo = FontAssetManager.GenerateNormal("+" + Equipment.SeparateLevel + " 锻造", false, {
|
||||
color = sq_RGBA(180, 106, 254, 255)
|
||||
});
|
||||
Canvas.DrawActor(SeparateLevelInfo, UpgradeInfo ? UpgradeInfo.GetSize().w : 6, RealCanvasHeight);
|
||||
}
|
||||
AddHeight();
|
||||
}
|
||||
|
||||
//绘制物理攻击力
|
||||
DrawAttack("EquipmentPhysicalAttack", "物理攻击力");
|
||||
//绘制魔法攻击力
|
||||
|
|
@ -313,11 +289,12 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
if (typeof Equipment[Type] == "array") {
|
||||
local MaxValue = Equipment[Type][0];
|
||||
local MinValue = Equipment[Type][1];
|
||||
local Rate = 1.0;
|
||||
local Rate = Equipment.Property ? Equipment.Property[Type + "Rate"] : 100;
|
||||
Rate = Rate.tofloat() / 100.0;
|
||||
RealValue = (MinValue + ((MaxValue - MinValue).tofloat() * Rate).tointeger());
|
||||
}
|
||||
//百分比计算过的数据
|
||||
else if (typeof Equipment[Type] == "integer" || typeof Equipment[Type] == "float") {
|
||||
else if (typeof Equipment[Type] == "integer") {
|
||||
RealValue = Equipment[Type];
|
||||
}
|
||||
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + RealValue, false, {
|
||||
|
|
@ -374,18 +351,6 @@ class GameItem.Equipment extends GameItem.Item {
|
|||
Idx = -1;
|
||||
//装备名称
|
||||
Name = "";
|
||||
//强化或增幅等级
|
||||
Upgrade = 0;
|
||||
//锻造等级
|
||||
SeparateLevel = 0;
|
||||
//增幅属性 0 无 1 力量 2 智力 3 体力 4 精神
|
||||
EquipIncrease = 0;
|
||||
//是否封装
|
||||
IsWrap = 0;
|
||||
//在封装次数
|
||||
WrapCount = 0;
|
||||
//交易类型
|
||||
TradeType = 0;
|
||||
//装备类型
|
||||
Type = -1;
|
||||
//装备槽位
|
||||
|
|
@ -408,10 +373,6 @@ class GameItem.Equipment extends GameItem.Item {
|
|||
SellPrice = -1;
|
||||
//耐久度
|
||||
Durability = -1;
|
||||
//当前耐久度
|
||||
CurrentDurability = -1;
|
||||
//装备品质
|
||||
Percentage = 100;
|
||||
//冒险家名望
|
||||
AdventurerFame = 0;
|
||||
//装备可穿戴职业
|
||||
|
|
@ -455,10 +416,6 @@ class GameItem.Equipment extends GameItem.Item {
|
|||
EquipmentMagicalAttack = 0;
|
||||
//独立攻击力
|
||||
SeparateAttack = 0;
|
||||
//物理防御力
|
||||
EquipmentPhysicalDefense = 0;
|
||||
//魔法防御力
|
||||
EquipmentMagicalDefense = 0;
|
||||
|
||||
//攻击速度
|
||||
AttackSpeed = 0;
|
||||
|
|
@ -489,11 +446,6 @@ class GameItem.Equipment extends GameItem.Item {
|
|||
//描述
|
||||
FlavorText = null;
|
||||
|
||||
|
||||
function _typeof() {
|
||||
return "Equipment";
|
||||
}
|
||||
|
||||
constructor(...) {
|
||||
//直接裸构造
|
||||
if (vargv.len() == 0) {
|
||||
|
|
@ -501,155 +453,81 @@ class GameItem.Equipment extends GameItem.Item {
|
|||
}
|
||||
//通过参数构造
|
||||
else if (vargv.len() == 1) {
|
||||
local EquInfo;
|
||||
//通过ID构造
|
||||
if (typeof vargv[0] == "integer") {
|
||||
EquInfo = AssetManager.GetEquipment(vargv[0]);
|
||||
Idx = vargv[0];
|
||||
ConstructEquipmentFromScript(EquInfo);
|
||||
}
|
||||
//通过Table来构造
|
||||
else if (typeof vargv[0] == "table") {
|
||||
local Info = vargv[0];
|
||||
EquInfo = AssetManager.GetEquipment(Info.EquipId);
|
||||
Idx = Info.EquipId;
|
||||
ConstructEquipmentFromScript(EquInfo);
|
||||
IterateEquipmentBasedOnActualEquipmentInformation(Info);
|
||||
local EquInfo = AssetManager.GetEquipment(vargv[0]);
|
||||
if (EquInfo) {
|
||||
Idx = vargv[0];
|
||||
//名称
|
||||
if (EquInfo.rawin("name")) Name = EquInfo["name"];
|
||||
//类型
|
||||
if (EquInfo.rawin("type")) GetRealEquipmentType(EquInfo["type"].path);
|
||||
//最低使用等级
|
||||
if (EquInfo.rawin("minimum level")) Minimum_level = EquInfo["minimum level"];
|
||||
//等级组
|
||||
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("adventurerfame")) AdventurerFame = EquInfo["adventurerfame"];
|
||||
//职业
|
||||
if (EquInfo.rawin("usable_job")) Job = EquInfo["usable_job"];
|
||||
//图标
|
||||
if (EquInfo.rawin("icon")) Icon = EquInfo["icon"];
|
||||
if (EquInfo.rawin("Ani")) Animation_Job = EquInfo["Ani"];
|
||||
if (EquInfo.rawin("DirPath")) DirPath = EquInfo["DirPath"];
|
||||
if (EquInfo.rawin("aurora_effects")) Aurora_effects = EquInfo["aurora_effects"];
|
||||
|
||||
//四维
|
||||
if (EquInfo.rawin("physical attack")) PhysicalAttack = EquInfo["physical attack"];
|
||||
if (EquInfo.rawin("magical attack")) MagicalAttack = EquInfo["magical attack"];
|
||||
if (EquInfo.rawin("physical defense")) PhysicalDefense = EquInfo["physical defense"];
|
||||
if (EquInfo.rawin("magical defense")) MagicalDefense = EquInfo["magical defense"];
|
||||
//属强
|
||||
if (EquInfo.rawin("all elemental attack")) AllElementalAttack = EquInfo["all elemental attack"];
|
||||
if (EquInfo.rawin("dark attack")) DarkAttack = EquInfo["dark attack"];
|
||||
if (EquInfo.rawin("light attack")) LightAttack = EquInfo["light attack"];
|
||||
if (EquInfo.rawin("water attack")) WaterAttack = EquInfo["water attack"];
|
||||
if (EquInfo.rawin("fire attack")) FireAttack = EquInfo["fire attack"];
|
||||
//三攻
|
||||
if (EquInfo.rawin("equipment physical attack")) EquipmentPhysicalAttack = EquInfo["equipment physical attack"];
|
||||
if (EquInfo.rawin("equipment magical attack")) EquipmentMagicalAttack = EquInfo["equipment magical attack"];
|
||||
if (EquInfo.rawin("separate attack")) SeparateAttack = EquInfo["separate attack"];
|
||||
//三速
|
||||
if (EquInfo.rawin("attack speed")) AttackSpeed = EquInfo["attack speed"];
|
||||
if (EquInfo.rawin("cast speed")) CastSpeed = EquInfo["cast speed"];
|
||||
if (EquInfo.rawin("move speed")) MoveSpeed = EquInfo["move speed"];
|
||||
//双暴
|
||||
if (EquInfo.rawin("physical critical hit")) PhysicalCriticalHit = EquInfo["physical critical hit"];
|
||||
if (EquInfo.rawin("magical critical hit")) MagicalCriticalHit = EquInfo["magical critical hit"];
|
||||
//命中率
|
||||
if (EquInfo.rawin("stuck")) Stuck = -EquInfo["stuck"];
|
||||
//四属抗
|
||||
if (EquInfo.rawin("dark resistance")) DarkResistance = EquInfo["dark resistance"];
|
||||
if (EquInfo.rawin("light resistance")) LightResistance = EquInfo["light resistance"];
|
||||
if (EquInfo.rawin("water resistance")) WaterResistance = EquInfo["water resistance"];
|
||||
if (EquInfo.rawin("fire resistance")) FireResistance = EquInfo["fire resistance"];
|
||||
//属性攻击
|
||||
if (EquInfo.rawin("elemental property")) ElementalProperty = EquInfo["elemental property"];
|
||||
//描述
|
||||
if (EquInfo.rawin("flavor text")) FlavorText = EquInfo["flavor text"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//根据装备实际信息迭代装备
|
||||
function IterateEquipmentBasedOnActualEquipmentInformation(Info) {
|
||||
//装备附魔 //TODO
|
||||
//装备强化等级或增幅等级
|
||||
this.Upgrade = Info.EquipUpgrade;
|
||||
//装备锻造等级
|
||||
this.SeparateLevel = Info.EquipSeparate;
|
||||
//装备增幅属性
|
||||
this.EquipIncrease = Info.EquipIncrease;
|
||||
//装备力量百分比
|
||||
this.PhysicalAttack *= (Info.EquipPowerPercentage.tofloat() / 100.0);
|
||||
//装备智力百分比
|
||||
this.MagicalAttack *= (Info.EquipIntellectPercentage.tofloat() / 100.0);
|
||||
//装备体力百分比
|
||||
this.PhysicalDefense *= (Info.EquipStaminaPercentage.tofloat() / 100.0);
|
||||
//装备精神百分比
|
||||
this.MagicalDefense *= (Info.EquipSpiritPercentage.tofloat() / 100.0);
|
||||
|
||||
//装备物理攻击百分比
|
||||
this.EquipmentPhysicalAttack = this.EquipmentPhysicalAttack[0] + ((this.EquipmentPhysicalAttack[1] - this.EquipmentPhysicalAttack[0]) * (Info.EquipPhysicalAttackPercentage.tofloat() / 100.0));
|
||||
//装备魔法攻击百分比
|
||||
this.EquipmentMagicalAttack = this.EquipmentMagicalAttack[0] + ((this.EquipmentMagicalAttack[1] - this.EquipmentMagicalAttack[0]) * (Info.EquipMagicAttackPercentage.tofloat() / 100.0));
|
||||
//装备独立攻击百分比
|
||||
this.SeparateAttack = this.SeparateAttack[0] + ((this.SeparateAttack[1] - this.SeparateAttack[0]) * (Info.EquipIndependentAttackPercentage.tofloat() / 100.0));
|
||||
//装备物理防御百分比
|
||||
this.EquipmentPhysicalDefense = this.EquipmentPhysicalDefense[0] + ((this.EquipmentPhysicalDefense[1] - this.EquipmentPhysicalDefense[0]) * (Info.EquipPhysicalDefensePercentage.tofloat() / 100.0));
|
||||
//装备魔法防御百分比
|
||||
this.EquipmentMagicalDefense = this.EquipmentMagicalDefense[0] + ((this.EquipmentMagicalDefense[1] - this.EquipmentMagicalDefense[0]) * (Info.EquipMagicDefensePercentage.tofloat() / 100.0));
|
||||
|
||||
//装备全属强
|
||||
this.AllElementalAttack += Info.EquipAllElementalAttack;
|
||||
//装备水属强
|
||||
this.WaterAttack += Info.EquipWaterAttack;
|
||||
//装备火属强
|
||||
this.FireAttack += Info.EquipFireAttack;
|
||||
//装备光属强
|
||||
this.LightAttack += Info.EquipLightAttack;
|
||||
//装备暗属强
|
||||
this.DarkAttack += Info.EquipDarkAttack;
|
||||
//装备品质
|
||||
this.Percentage = Info.EquipPercentage;
|
||||
//装备再封装次数
|
||||
this.WrapCount = Info.EquipWrapCount;
|
||||
//装备是否封装
|
||||
this.IsWrap = Info.EquipIsWrap;
|
||||
//耐久度
|
||||
this.CurrentDurability = Info.EquipDurability;
|
||||
//交易类型
|
||||
this.TradeType = Info.EquipTradeType;
|
||||
}
|
||||
|
||||
//根据装备脚本信息构造装备
|
||||
function ConstructEquipmentFromScript(EquInfo) {
|
||||
//如果获取到对应的装备脚本信息
|
||||
if (EquInfo) {
|
||||
//名称
|
||||
if (EquInfo.rawin("name")) Name = EquInfo["name"];
|
||||
//类型
|
||||
if (EquInfo.rawin("type")) GetRealEquipmentType(EquInfo["type"].path);
|
||||
//最低使用等级
|
||||
if (EquInfo.rawin("minimum level")) Minimum_level = EquInfo["minimum level"];
|
||||
//等级组
|
||||
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("adventurerfame")) AdventurerFame = EquInfo["adventurerfame"];
|
||||
//职业
|
||||
if (EquInfo.rawin("usable_job")) Job = EquInfo["usable_job"];
|
||||
//图标
|
||||
if (EquInfo.rawin("icon")) Icon = EquInfo["icon"];
|
||||
if (EquInfo.rawin("Ani")) Animation_Job = EquInfo["Ani"];
|
||||
if (EquInfo.rawin("DirPath")) DirPath = EquInfo["DirPath"];
|
||||
if (EquInfo.rawin("aurora_effects")) Aurora_effects = EquInfo["aurora_effects"];
|
||||
|
||||
//四维
|
||||
if (EquInfo.rawin("physical attack")) PhysicalAttack = EquInfo["physical attack"];
|
||||
if (EquInfo.rawin("magical attack")) MagicalAttack = EquInfo["magical attack"];
|
||||
if (EquInfo.rawin("physical defense")) PhysicalDefense = EquInfo["physical defense"];
|
||||
if (EquInfo.rawin("magical defense")) MagicalDefense = EquInfo["magical defense"];
|
||||
//属强
|
||||
if (EquInfo.rawin("all elemental attack")) AllElementalAttack = EquInfo["all elemental attack"];
|
||||
if (EquInfo.rawin("dark attack")) DarkAttack = EquInfo["dark attack"];
|
||||
if (EquInfo.rawin("light attack")) LightAttack = EquInfo["light attack"];
|
||||
if (EquInfo.rawin("water attack")) WaterAttack = EquInfo["water attack"];
|
||||
if (EquInfo.rawin("fire attack")) FireAttack = EquInfo["fire attack"];
|
||||
//三攻
|
||||
if (EquInfo.rawin("equipment physical attack")) EquipmentPhysicalAttack = EquInfo["equipment physical attack"];
|
||||
else EquipmentPhysicalAttack = [0, 0];
|
||||
if (EquInfo.rawin("equipment magical attack")) EquipmentMagicalAttack = EquInfo["equipment magical attack"];
|
||||
else EquipmentMagicalAttack = [0, 0];
|
||||
if (EquInfo.rawin("separate attack")) SeparateAttack = EquInfo["separate attack"];
|
||||
else SeparateAttack = [0, 0];
|
||||
//物理防御和魔法防御
|
||||
if (EquInfo.rawin("equipment physical defense")) EquipmentPhysicalDefense = EquInfo["equipment physical defense"];
|
||||
else EquipmentPhysicalDefense = [0, 0];
|
||||
if (EquInfo.rawin("equipment magical defense")) EquipmentMagicalDefense = EquInfo["equipment magical defense"];
|
||||
else EquipmentMagicalDefense = [0, 0];
|
||||
//三速
|
||||
if (EquInfo.rawin("attack speed")) AttackSpeed = EquInfo["attack speed"];
|
||||
if (EquInfo.rawin("cast speed")) CastSpeed = EquInfo["cast speed"];
|
||||
if (EquInfo.rawin("move speed")) MoveSpeed = EquInfo["move speed"];
|
||||
//双暴
|
||||
if (EquInfo.rawin("physical critical hit")) PhysicalCriticalHit = EquInfo["physical critical hit"];
|
||||
if (EquInfo.rawin("magical critical hit")) MagicalCriticalHit = EquInfo["magical critical hit"];
|
||||
//命中率
|
||||
if (EquInfo.rawin("stuck")) Stuck = -EquInfo["stuck"];
|
||||
//四属抗
|
||||
if (EquInfo.rawin("dark resistance")) DarkResistance = EquInfo["dark resistance"];
|
||||
if (EquInfo.rawin("light resistance")) LightResistance = EquInfo["light resistance"];
|
||||
if (EquInfo.rawin("water resistance")) WaterResistance = EquInfo["water resistance"];
|
||||
if (EquInfo.rawin("fire resistance")) FireResistance = EquInfo["fire resistance"];
|
||||
//属性攻击
|
||||
if (EquInfo.rawin("elemental property")) ElementalProperty = EquInfo["elemental property"];
|
||||
//描述
|
||||
if (EquInfo.rawin("flavor text")) FlavorText = EquInfo["flavor text"];
|
||||
} else error("没有对应的装备信息");
|
||||
}
|
||||
|
||||
//设置真实装备类型
|
||||
function SetRealEquipmentType(AType, BType) {
|
||||
SlotType = AType;
|
||||
|
|
@ -670,6 +548,16 @@ class GameItem.Equipment extends GameItem.Item {
|
|||
else if (EType == "aurora avatar") SetRealEquipmentType("aurora", "aurora");
|
||||
}
|
||||
|
||||
//获取装备信息窗口
|
||||
function GetEquipmentInfoWindow() {
|
||||
return GameItem.EquipmentInfo(this);
|
||||
}
|
||||
|
||||
//获取装备图标精灵
|
||||
function GetEquipmentIconSprite() {
|
||||
return GameItem.EquipmentIcon(this);
|
||||
}
|
||||
|
||||
//穿戴装备回调
|
||||
function OnWearStart() {
|
||||
|
||||
|
|
|
|||
|
|
@ -7,31 +7,4 @@
|
|||
GameItem <- {};
|
||||
class GameItem.Item {
|
||||
|
||||
function _typeof() {
|
||||
return "Item";
|
||||
}
|
||||
|
||||
|
||||
//获取信息窗口
|
||||
function GetInfoWindow() {
|
||||
if (typeof this == "Equipment") {
|
||||
return GameItem.EquipmentInfo(this);
|
||||
} else if (typeof this == "Stackable") {
|
||||
return GameItem.StackableInfo(this);
|
||||
}
|
||||
|
||||
error("GameItem::Info:: 未知物品类型");
|
||||
}
|
||||
|
||||
//获取图标精灵
|
||||
function GetIconSprite() {
|
||||
if (typeof this == "Equipment") {
|
||||
return GameItem.EquipmentIcon(this);
|
||||
} else if (typeof this == "Stackable") {
|
||||
return GameItem.StackableIcon(this);
|
||||
}
|
||||
error("GameItem::Icon:: 未知物品类型");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,244 +0,0 @@
|
|||
/*
|
||||
文件名:Stackable.nut
|
||||
路径:User/Asset/Item/Stackable.nut
|
||||
创建日期:2025-01-18 01:46
|
||||
文件用途:可堆叠物品
|
||||
*/
|
||||
//消耗品图标窗口
|
||||
class GameItem.StackableIcon extends CL_CanvasObject {
|
||||
|
||||
constructor(Stackable) {
|
||||
base.constructor();
|
||||
ResizeAndClear(32, 32);
|
||||
BeginDraw();
|
||||
//构造图标 及图标边框
|
||||
if (Stackable.Icon) {
|
||||
//图标
|
||||
local Icon = CL_SpriteFrameObject(Stackable.Icon.path, Stackable.Icon.index);
|
||||
DrawSpriteFrame(Icon, 0, 0);
|
||||
|
||||
//边框
|
||||
local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + GameItem.EquipmentInfoTag.rarityframe_color_idx[Stackable.Rarity]);
|
||||
DrawSpriteFrame(IconFrame, 0, 0);
|
||||
}
|
||||
EndDraw();
|
||||
}
|
||||
}
|
||||
|
||||
//消耗品信息窗口
|
||||
class GameItem.StackableInfo extends Yosin_Window {
|
||||
//消耗品
|
||||
Stackable = null;
|
||||
//画布
|
||||
Canvas = null;
|
||||
//画布实际高度
|
||||
RealCanvasHeight = 0;
|
||||
|
||||
constructor(Stackable) {
|
||||
this.Stackable = Stackable.weakref();
|
||||
base.constructor(clock() + "StackableInfo" + Stackable.Idx, 0, 0, 0, 0, 0);
|
||||
|
||||
Init();
|
||||
|
||||
local background = Yosin_NineBoxStretch(211, RealCanvasHeight + 10, "sprite/interface/lenheartwindowcommon.img", 213);
|
||||
background.SetZOrder(-1);
|
||||
Addchild(background);
|
||||
}
|
||||
|
||||
function Init() {
|
||||
Canvas = CL_CanvasObject();
|
||||
Canvas.ResizeAndClear(210, 600);
|
||||
Canvas.SetFillBrush(sq_RGBA(59, 56, 57, 250));
|
||||
Canvas.SetStrokeBrush(sq_RGBA(59, 56, 57, 250));
|
||||
Canvas.BeginDraw();
|
||||
|
||||
//构造图标 及图标边框
|
||||
if (Stackable.Icon) {
|
||||
local Icon = GameItem.StackableIcon(Stackable);
|
||||
Canvas.DrawActor(Icon, 7, 7);
|
||||
}
|
||||
|
||||
//绘制名称
|
||||
if (Stackable.Name.len() > 0) {
|
||||
local DrawName = Stackable.Name;
|
||||
local EquName = FontAssetManager.GenerateNormal(DrawName, false, {
|
||||
color = GameItem.EquipmentInfoTag.rarity_color[Stackable.Rarity]
|
||||
});
|
||||
Canvas.DrawActor(EquName, 41, 7);
|
||||
}
|
||||
|
||||
//绘制分割线
|
||||
Canvas.DrawLine(3, 37, 207, 38);
|
||||
|
||||
|
||||
//绘制稀有度名称
|
||||
local RarityTagName = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.rarity_name_tag[Stackable.Rarity], false, {
|
||||
color = GameItem.EquipmentInfoTag.rarity_color[Stackable.Rarity]
|
||||
});
|
||||
Canvas.DrawActor(RarityTagName, 210 - RarityTagName.GetSize().w - 6, 41);
|
||||
|
||||
//绘制类型
|
||||
local RealGroupName = Stackable.GroupName ? Stackable.GroupName : "cube stuff";
|
||||
local GroupNameText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.item_group_name_table[RealGroupName], false, {
|
||||
color = sq_RGBA(194, 161, 56, 255)
|
||||
});
|
||||
Canvas.DrawActor(GroupNameText, 6, 41);
|
||||
|
||||
|
||||
//下面的绘制逻辑开始使用行put来做
|
||||
RealCanvasHeight = 64;
|
||||
|
||||
|
||||
//绘制交易类型 如果有主体属性读取 否则一律为封装
|
||||
local TradeType = Stackable.TradeType;
|
||||
local TradeTypeText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.trade_type_text[TradeType], false, {
|
||||
color = GameItem.EquipmentInfoTag.trade_type_color[TradeType]
|
||||
});
|
||||
Canvas.DrawActor(TradeTypeText, 6, 60);
|
||||
|
||||
//绘制售价
|
||||
local RealSellPrice = (Stackable.SellPrice == -1 ? (Stackable.Price == -1 ? 0 : Stackable.Price) : Stackable.SellPrice) / 5;
|
||||
local SellPriceText = FontAssetManager.GenerateNormal(RealSellPrice + "金币", false, {
|
||||
color = sq_RGBA(133, 121, 78, 255)
|
||||
});
|
||||
Canvas.DrawActor(SellPriceText, 210 - SellPriceText.GetSize().w - 6, 60);
|
||||
|
||||
//绘制分割
|
||||
AddSliceLine();
|
||||
|
||||
//绘制描述
|
||||
if (Stackable.FlavorText) {
|
||||
// //绘制分割
|
||||
// Canvas.DrawLine(3, RealCanvasHeight + 3, 207, RealCanvasHeight + 3);
|
||||
// RealCanvasHeight += 6;
|
||||
|
||||
local Text = FontAssetManager.GenerateNormal(Stackable.FlavorText, false, {
|
||||
color = sq_RGBA(133, 121, 80, 255),
|
||||
wrap_width = 200
|
||||
});
|
||||
Canvas.DrawActor(Text, 6, RealCanvasHeight);
|
||||
RealCanvasHeight += Text.GetSize().h;
|
||||
}
|
||||
|
||||
Canvas.EndDraw();
|
||||
Addchild(Canvas);
|
||||
}
|
||||
|
||||
//增加行高
|
||||
function AddHeight() {
|
||||
RealCanvasHeight += 16;
|
||||
}
|
||||
//增加分割行
|
||||
function AddSliceLine() {
|
||||
RealCanvasHeight += 18;
|
||||
Canvas.DrawLine(3, RealCanvasHeight, 207, RealCanvasHeight);
|
||||
RealCanvasHeight += 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class GameItem.Stackable extends GameItem.Item {
|
||||
|
||||
//物品ID
|
||||
Idx = -1;
|
||||
//物品名称
|
||||
Name = "";
|
||||
|
||||
//物品类型
|
||||
Type = null;
|
||||
//交易类型
|
||||
TradeType = 0;
|
||||
|
||||
//物品最低使用等级
|
||||
Minimum_level = 0;
|
||||
//物品等级组
|
||||
Grade = 0;
|
||||
//物品稀有度
|
||||
Rarity = 0;
|
||||
//物品重量
|
||||
Weight = 0;
|
||||
//物品组名
|
||||
GroupName = null;
|
||||
//物品购买价格
|
||||
Price = 0;
|
||||
//物品维修价格
|
||||
RepairPrice = 0;
|
||||
//物品出售价格
|
||||
SellPrice = 0;
|
||||
//物品职业
|
||||
Job = null;
|
||||
//物品图标
|
||||
Icon = null;
|
||||
//物品描述
|
||||
FlavorText = "";
|
||||
|
||||
function _typeof() {
|
||||
return "Stackable";
|
||||
}
|
||||
|
||||
constructor(...) {
|
||||
//直接裸构造
|
||||
if (vargv.len() == 0) {
|
||||
|
||||
}
|
||||
//通过参数构造
|
||||
else if (vargv.len() == 1) {
|
||||
local StkInfo;
|
||||
//通过ID构造
|
||||
if (typeof vargv[0] == "integer") {
|
||||
StkInfo = AssetManager.GetStackable(vargv[0]);
|
||||
Idx = vargv[0];
|
||||
ConstructStackableFromScript(StkInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//根据消耗品脚本信息构造消耗品
|
||||
function ConstructStackableFromScript(StkInfo) {
|
||||
//如果获取到对应的消耗品脚本信息
|
||||
if (StkInfo) {
|
||||
//名称
|
||||
if (StkInfo.rawin("name")) Name = StkInfo["name"];
|
||||
//类型
|
||||
// if (StkInfo.rawin("type")) GetRealStackableType(StkInfo["type"].path);
|
||||
//最低使用等级
|
||||
if (StkInfo.rawin("minimum level")) Minimum_level = StkInfo["minimum level"];
|
||||
//等级组
|
||||
if (StkInfo.rawin("grade")) Grade = StkInfo["grade"];
|
||||
//稀有度
|
||||
if (StkInfo.rawin("rarity")) Rarity = StkInfo["rarity"];
|
||||
//重量
|
||||
if (StkInfo.rawin("weight")) Weight = StkInfo["weight"];
|
||||
//组名
|
||||
if (StkInfo.rawin("item group name")) GroupName = StkInfo["item group name"];
|
||||
//购买价格
|
||||
if (StkInfo.rawin("price")) Price = StkInfo["price"];
|
||||
//维修价格
|
||||
if (StkInfo.rawin("repair price")) RepairPrice = StkInfo["repair price"];
|
||||
//出售价格
|
||||
if (StkInfo.rawin("value")) SellPrice = StkInfo["value"];
|
||||
//职业
|
||||
if (StkInfo.rawin("usable_job")) Job = StkInfo["usable_job"];
|
||||
//图标
|
||||
if (StkInfo.rawin("icon")) Icon = StkInfo["icon"];
|
||||
//描述
|
||||
if (StkInfo.rawin("explain")) FlavorText = StkInfo["explain"];
|
||||
//交易类型
|
||||
if (StkInfo.rawin("trade_type")) TradeType = StkInfo["trade_type"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
|
|
@ -423,6 +423,7 @@ class Map extends Actor {
|
|||
m_camera.MovableAreaY = m_height - m_data.wide_mode_camer_vertical_correction;
|
||||
|
||||
m_camera.BackgroundOffset = m_data.background_pos;
|
||||
|
||||
// OpenMovableAreaBorder();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,10 +71,10 @@ function RegisterFunctionalPack() {
|
|||
//背包类型
|
||||
local InventoryType = Pack.Get_Byte();
|
||||
//背包道具数量
|
||||
local InventoryItemCount = Pack.Get_Short();
|
||||
local InventoryItemCount = Pack.Get_Int();
|
||||
|
||||
//项目List
|
||||
local ItemList = {};
|
||||
local ItemList = [];
|
||||
|
||||
//道具数据
|
||||
for (local i = 0; i< InventoryItemCount; i++) {
|
||||
|
|
@ -87,8 +87,6 @@ function RegisterFunctionalPack() {
|
|||
Pos = Pack.Get_Short(),
|
||||
//装备ID
|
||||
EquipId = Pack.Get_Int(),
|
||||
//交易类型
|
||||
EquipTradeType = Pack.Get_Byte(),
|
||||
//装备附魔编号
|
||||
EquipEnchant = Pack.Get_Int(),
|
||||
//装备强化等级或增幅等级
|
||||
|
|
@ -115,47 +113,23 @@ function RegisterFunctionalPack() {
|
|||
EquipPhysicalDefensePercentage = Pack.Get_Byte(),
|
||||
//装备魔法防御百分比
|
||||
EquipMagicDefensePercentage = Pack.Get_Byte(),
|
||||
//装备全属强
|
||||
EquipAllElementalAttack = Pack.Get_Byte(),
|
||||
//装备水属强
|
||||
EquipWaterAttack = Pack.Get_Byte(),
|
||||
//装备火属强
|
||||
EquipFireAttack = Pack.Get_Byte(),
|
||||
//装备光属强
|
||||
EquipLightAttack = Pack.Get_Byte(),
|
||||
//装备暗属强
|
||||
EquipDarkAttack = Pack.Get_Byte(),
|
||||
//装备品质
|
||||
EquipPercentage = Pack.Get_Byte(),
|
||||
//装备再封装次数
|
||||
EquipWrapCount = Pack.Get_Byte(),
|
||||
//装备是否封装
|
||||
EquipIsWrap = Pack.Get_Byte(),
|
||||
//耐久度
|
||||
EquipDurability = Pack.Get_Byte(),
|
||||
}
|
||||
ItemList[EquInfo.Pos] <- GameItem.Equipment(EquInfo);
|
||||
//装备栏
|
||||
if (InventoryType == 2) {
|
||||
ClientCharacterInventory.EquipmentPage.SetItemCollectionList(0, ItemList);
|
||||
}
|
||||
ItemList.push(EquInfo);
|
||||
print("构造装备");
|
||||
}
|
||||
//消耗品类型
|
||||
if (Type == 2 || Type == 3) {
|
||||
if (Type == 2) {
|
||||
local ItemInfo = {
|
||||
//道具位置
|
||||
Pos = Pack.Get_Short(),
|
||||
//道具ID
|
||||
ItemId = Pack.Get_Int(),
|
||||
//交易类型
|
||||
ItemTradeType = Pack.Get_Byte(),
|
||||
//道具数量
|
||||
ItemCount = Pack.Get_Int(),
|
||||
}
|
||||
ItemList[ItemInfo.Pos] <- GameItem.Stackable(ItemInfo.ItemId);
|
||||
|
||||
|
||||
ClientCharacterInventory.EquipmentPage.SetItemCollectionList(InventoryType - 2, ItemList);
|
||||
ItemList.push(ItemInfo);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,68 +16,6 @@ function TestStage() {
|
|||
// T.Addchild(BackGround);
|
||||
|
||||
|
||||
// local Stk = GameItem.Stackable(3037);
|
||||
// local Window = Stk.GetInfoWindow();
|
||||
// Window.SetPosition(300, 80);
|
||||
// Window.ResetFocus();
|
||||
|
||||
// local EquInfo = {
|
||||
// //装备位置
|
||||
// Pos = 0,
|
||||
// //装备ID
|
||||
// EquipId = 27675,
|
||||
// //交易类型
|
||||
// EquipTradeType = 0,
|
||||
// //装备附魔编号
|
||||
// EquipEnchant = 1,
|
||||
// //装备强化等级或增幅等级
|
||||
// EquipUpgrade = 12,
|
||||
// //装备锻造
|
||||
// EquipSeparate = 6,
|
||||
// //装备增幅属性 0 无 1 力量 2 智力 3 体力 4 精神
|
||||
// EquipIncrease = 1,
|
||||
// //装备力量百分比
|
||||
// EquipPowerPercentage = 95,
|
||||
// //装备智力百分比
|
||||
// EquipIntellectPercentage = 95,
|
||||
// //装备体力百分比
|
||||
// EquipStaminaPercentage = 60,
|
||||
// //装备精神百分比
|
||||
// EquipSpiritPercentage = 75,
|
||||
// //装备物理攻击百分比
|
||||
// EquipPhysicalAttackPercentage = 90,
|
||||
// //装备魔法攻击百分比
|
||||
// EquipMagicAttackPercentage = 90,
|
||||
// //装备独立攻击百分比
|
||||
// EquipIndependentAttackPercentage = 80,
|
||||
// //装备物理防御百分比
|
||||
// EquipPhysicalDefensePercentage = 80,
|
||||
// //装备魔法防御百分比
|
||||
// EquipMagicDefensePercentage = 77,
|
||||
// ///装备全属强
|
||||
// EquipAllElementalAttack = 15,
|
||||
// //装备水属强
|
||||
// EquipWaterAttack = 15,
|
||||
// //装备火属强
|
||||
// EquipFireAttack = 15,
|
||||
// //装备光属强
|
||||
// EquipLightAttack = 15,
|
||||
// //装备暗属强
|
||||
// EquipDarkAttack = 15,
|
||||
// //装备品质
|
||||
// EquipPercentage = 15,
|
||||
// //装备再封装次数
|
||||
// EquipWrapCount = 2,
|
||||
// //装备是否封装
|
||||
// EquipIsWrap = 1,
|
||||
// //耐久度
|
||||
// EquipDurability = 15,
|
||||
// }
|
||||
// local Equ = GameItem.Equipment(EquInfo);
|
||||
// local Window = Equ.GetInfoWindow();
|
||||
// Window.SetPosition(100, 80);
|
||||
// Window.ResetFocus();
|
||||
|
||||
// local Equ = GameItem.Equipment(27675);
|
||||
// local Window = Equ.GetEquipmentInfoWindow();
|
||||
// Window.SetPosition(100, 80);
|
||||
|
|
@ -101,7 +39,7 @@ function TestStage() {
|
|||
|
||||
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 548, 20);
|
||||
|
||||
// Window.EquipmentPage.ItemCollection.SetItemList([{
|
||||
// Window.equipmentPage.ItemCollection.SetItemList([{
|
||||
// ItemId = 27675
|
||||
// }, {
|
||||
// ItemId = 101020048
|
||||
|
|
|
|||
|
|
@ -6,32 +6,14 @@
|
|||
*/
|
||||
//主类
|
||||
class _Inventory extends Yosin_Window {
|
||||
|
||||
// 装备页 /物品栏
|
||||
//物品栏
|
||||
EquipmentPage = null;
|
||||
// 装扮页E
|
||||
DressUpPage = null;
|
||||
|
||||
// 物品栏排列按钮
|
||||
permutationBtn = null;
|
||||
// 物品栏设置按钮
|
||||
setBtn = null;
|
||||
// 物品栏搜索按钮
|
||||
saerchBtn = null;
|
||||
|
||||
PageIndex = null;
|
||||
uiPageIndex = null;
|
||||
|
||||
// 物品栏排列搜索按钮 在显示物品栏页 时的Y坐标
|
||||
itemSetBtnY = 467;
|
||||
//是否可见
|
||||
Visible = false;
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
PageIndex = 0;
|
||||
uiPageIndex = 0;
|
||||
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
|
|
@ -69,8 +51,7 @@ class _Inventory extends Yosin_Window {
|
|||
local topBtn = Yosin_BaseButton(Width - 35, 2, 13, 13, "sprite/interface/lenheartwindowcommon.img", 455);
|
||||
topBtn.DownSimulateOffset = false;
|
||||
topBtn.OnClick = function(btn) {
|
||||
// btn.Parent.PageIndex += 1;
|
||||
print(btn.Parent.PageIndex);
|
||||
|
||||
}
|
||||
AddUIChild(topBtn);
|
||||
|
||||
|
|
@ -79,37 +60,34 @@ class _Inventory extends Yosin_Window {
|
|||
AddUIChild(titlesBtn);
|
||||
|
||||
titlesBtn.LBDownOnClick = function(btns, index) {
|
||||
btns.Parent.PageIndex = index;
|
||||
print(index);
|
||||
};
|
||||
|
||||
//物品栏 装备页
|
||||
|
||||
|
||||
//物品栏
|
||||
EquipmentPage = Inventory_EquipmentPage(2, titlesBtn.bottom(), 300, 441);
|
||||
AddUIChild(EquipmentPage);
|
||||
EquipmentPage.SetVisible(false);
|
||||
|
||||
// 装扮页
|
||||
DressUpPage = Inventory_DressUpPage(4, titlesBtn.bottom(), 300, 441);
|
||||
AddUIChild(DressUpPage);
|
||||
|
||||
// 钱包
|
||||
AddMoneyItem();
|
||||
|
||||
// 添加设置物品栏的按钮
|
||||
AddItemCollectSetBtn();
|
||||
|
||||
// 钱包
|
||||
AddMoneyItem();
|
||||
}
|
||||
|
||||
// 添加设置物品栏的按钮
|
||||
function AddItemCollectSetBtn() {
|
||||
// 排列按钮
|
||||
permutationBtn = Yosin_BaseButton(226, itemSetBtnY, 28, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 73);
|
||||
local permutationBtn = Yosin_BaseButton(226, 467, 28, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 73);
|
||||
AddUIChild(permutationBtn);
|
||||
|
||||
// 设置
|
||||
setBtn = Yosin_BaseButton(permutationBtn.X - 20, permutationBtn.Y, 18, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 77);
|
||||
local setBtn = Yosin_BaseButton(permutationBtn.X - 20, permutationBtn.Y, 18, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 77);
|
||||
AddUIChild(setBtn);
|
||||
|
||||
// 搜索
|
||||
saerchBtn = Yosin_BaseButton(setBtn.X - 24, permutationBtn.Y, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 94);
|
||||
local saerchBtn = Yosin_BaseButton(setBtn.X - 24, permutationBtn.Y, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 94);
|
||||
AddUIChild(saerchBtn);
|
||||
}
|
||||
|
||||
|
|
@ -177,36 +155,8 @@ class _Inventory extends Yosin_Window {
|
|||
function Proc(Dt) {
|
||||
SyncPos(X, Y);
|
||||
base.Proc(Dt);
|
||||
|
||||
if (PageIndex != uiPageIndex) {
|
||||
uiPageIndex = PageIndex;
|
||||
ChangPage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 切换页面
|
||||
function ChangPage() {
|
||||
|
||||
EquipmentPage.SetVisible(false);
|
||||
DressUpPage.SetVisible(false);
|
||||
|
||||
|
||||
if (PageIndex == 0) {
|
||||
EquipmentPage.SetVisible(true);
|
||||
permutationBtn.SetPosition(permutationBtn.X, itemSetBtnY);
|
||||
setBtn.SetPosition(setBtn.X, itemSetBtnY);
|
||||
saerchBtn.SetPosition(saerchBtn.X, itemSetBtnY);
|
||||
} else if (PageIndex == 1) {
|
||||
DressUpPage.SetVisible(true);
|
||||
permutationBtn.SetPosition(permutationBtn.X, itemSetBtnY + 28);
|
||||
setBtn.SetPosition(setBtn.X, permutationBtn.Y);
|
||||
saerchBtn.SetPosition(saerchBtn.X, permutationBtn.Y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// if (!getroottable().rawin("chongzaiflag")) {
|
||||
|
|
|
|||
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
文件名:Inventory_DressUpPage.nut
|
||||
路径:User/UI/Window/5_Inventory/Inventory_DressUpPage.nut
|
||||
创建日期:2025-01-11 15:06
|
||||
文件用途:背包装扮页面
|
||||
*/
|
||||
|
||||
// 背包装扮页面
|
||||
class Inventory_DressUpPage extends Yosin_CommonUi {
|
||||
|
||||
constructor(x, y, w, h) {
|
||||
base.constructor(x, y, w, h);
|
||||
|
||||
DrawWidget();
|
||||
}
|
||||
|
||||
function DrawWidget() {
|
||||
|
||||
// 人物装扮穿戴
|
||||
local CharactersDressUp = Inventory_CharactersDressUp();
|
||||
CharactersDressUp.SetPosition(0, 0);
|
||||
Addchild(CharactersDressUp);
|
||||
|
||||
}
|
||||
|
||||
// 添加按钮
|
||||
function AddBtn() {
|
||||
local ibtn = Yosin_BaseButton();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 上半部分 人物装扮穿戴
|
||||
class Inventory_CharactersDressUp extends CL_CanvasObject {
|
||||
|
||||
constructor() {
|
||||
local w = 254;
|
||||
local h = 178;
|
||||
base.constructor();
|
||||
|
||||
// 创建画布
|
||||
CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
ResizeAndClear(w, h);
|
||||
// 开始绘制
|
||||
BeginDraw();
|
||||
|
||||
// 绘制背景
|
||||
DrawBackground();
|
||||
|
||||
// 结束绘制
|
||||
EndDraw();
|
||||
}
|
||||
|
||||
|
||||
// 背景
|
||||
function DrawBackground() {
|
||||
|
||||
// 背景边框
|
||||
local bg = Yosin_NineBoxStretch(254, 178, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
DrawSprite(bg, 0, 0);
|
||||
|
||||
// 装备装扮背景
|
||||
local itemBg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 11);
|
||||
DrawSpriteFrame(itemBg, 116, 31);
|
||||
|
||||
// 魔法阵
|
||||
local MagicLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 179);
|
||||
DrawSpriteFrame(MagicLight, 5, 55);
|
||||
|
||||
// 人物打光
|
||||
local CharacterLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 178);
|
||||
DrawSpriteFrame(CharacterLight, -10, 4);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -67,14 +67,8 @@ class Inventory_EquipmentPage extends Yosin_CommonUi {
|
|||
AddUIChild(itemBtns);
|
||||
|
||||
itemBtns.LBDownOnClick = function(btns, index) {
|
||||
foreach(Iindex, ItemCollectionBuffer in ItemCollection) {
|
||||
if (Iindex == index) {
|
||||
ItemCollectionBuffer.SetVisible(true);
|
||||
} else {
|
||||
ItemCollectionBuffer.SetVisible(false);
|
||||
}
|
||||
}
|
||||
}.bindenv(this);
|
||||
print(index);
|
||||
};
|
||||
|
||||
// 物品栏边框
|
||||
local itemBg = Yosin_NineBoxStretch(253, 245, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
|
|
@ -84,11 +78,9 @@ class Inventory_EquipmentPage extends Yosin_CommonUi {
|
|||
// 物品栏
|
||||
ItemCollection = [];
|
||||
for (local i = 0; i< 5; i++) {
|
||||
local ItemCollectionBuffer = _ItemCollection(itemBg.X + 7, itemBg.Y + 3, 7);
|
||||
ItemCollection.push(ItemCollectionBuffer);
|
||||
AddUIChild(ItemCollectionBuffer);
|
||||
if (i != 0) ItemCollectionBuffer.SetVisible(false);
|
||||
ItemCollection.push(_ItemCollection(itemBg.X + 7, itemBg.Y + 3, 7));
|
||||
}
|
||||
AddUIChild(ItemCollection[0]);
|
||||
|
||||
|
||||
local itemBgBottom = itemBg.bottom();
|
||||
|
|
|
|||
|
|
@ -29,12 +29,12 @@ class ItemSlot {
|
|||
|
||||
function SetItem(Item) {
|
||||
this.Item = Item;
|
||||
this.ItemIcon = this.Item.GetIconSprite();
|
||||
this.ItemIcon = this.Item.GetEquipmentIconSprite();
|
||||
}
|
||||
|
||||
//生成详细信息
|
||||
function GenerateInfo() {
|
||||
this.ItemInfo = this.Item.GetInfoWindow();
|
||||
this.ItemInfo = this.Item.GetEquipmentInfoWindow();
|
||||
}
|
||||
|
||||
//显示详细信息
|
||||
|
|
@ -124,8 +124,11 @@ class _ItemCollection extends Yosin_CommonUi {
|
|||
|
||||
//创建道具
|
||||
foreach(Index, ItemObject in gItemList) {
|
||||
local ItemId = ItemObject.ItemId;
|
||||
//TODO
|
||||
local Item = GameItem.Equipment(ItemId);
|
||||
ItemList[Index] = ItemSlot();
|
||||
ItemList[Index].SetItem(ItemObject);
|
||||
ItemList[Index].SetItem(Item);
|
||||
}
|
||||
|
||||
RefreshItemList();
|
||||
|
|
@ -160,7 +163,6 @@ class _ItemCollection extends Yosin_CommonUi {
|
|||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y);
|
||||
|
||||
if (isInRect) {
|
||||
|
|
@ -168,8 +170,6 @@ class _ItemCollection extends Yosin_CommonUi {
|
|||
local xx = MousePos_X - WorldPosition.x;
|
||||
local yy = MousePos_Y - WorldPosition.y;
|
||||
local column = (yy / 30).tointeger();
|
||||
//悬停的时候有可能悬停到最下面的最后一条缝 会导致判定行数多了一行 所以这里做限制
|
||||
column = (column <= (RowNum - 1) ? column : (RowNum - 1));
|
||||
local row = (xx / 30).tointeger();
|
||||
//指向的项目位置
|
||||
local Idx = column * 8 + row;
|
||||
|
|
@ -190,7 +190,7 @@ class _ItemCollection extends Yosin_CommonUi {
|
|||
//如果当前没有拖拽物品时才打开详细信息窗口
|
||||
if (!DragItem) {
|
||||
//显示详细信息
|
||||
ItemList[Idx].ShowInfo(MousePos_X - 50, MousePos_Y - ((ItemList[Idx].ItemInfo.RealCanvasHeight + 10) / 2));
|
||||
ItemList[Idx].ShowInfo(MousePos_X - 50, MousePos_Y - 150);
|
||||
//记录当前显示的对象
|
||||
CurrentShowItem = ItemList[Idx];
|
||||
}
|
||||
|
|
@ -231,7 +231,7 @@ class _ItemCollection extends Yosin_CommonUi {
|
|||
DragItem = ItemList[ItemPos];
|
||||
DragItemPos = ItemPos;
|
||||
ItemList[ItemPos] = null;
|
||||
local IconBuffer = DragItem.Item.GetIconSprite();
|
||||
local IconBuffer = DragItem.Item.GetEquipmentIconSprite();
|
||||
IconBuffer.SetPosition(-15, -15);
|
||||
IMouse.AttachObjectBottom("ItemCollectDragItem", IconBuffer);
|
||||
RefreshItemList();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ function main(args) {
|
|||
local Game = GameWindow();
|
||||
Game.title = "Yosin & Kiwano";
|
||||
Game.bg_color = [255.0, 255.0, 255.0, 255.0];
|
||||
Game.size = [1066 + 332, 600];
|
||||
Game.size = [1066, 600];
|
||||
Game.v_sync = false;
|
||||
Game.frame_interval = 10000;
|
||||
Game.debug_mode = true;
|
||||
|
|
|
|||
|
|
@ -283,11 +283,5 @@
|
|||
},
|
||||
"User/UI/Window/4_Personalinfo/Personalinfo_RoleInfoPage.nut": {
|
||||
"description": "个人信息页"
|
||||
},
|
||||
"User/UI/Window/5_Inventory/Inventory_DressUpPage.nut": {
|
||||
"description": "背包装扮页"
|
||||
},
|
||||
"User/Asset/Item/Stackable.nut": {
|
||||
"description": "消耗品及材料"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue