新增消耗品类型 制作相应窗口 图标 背包收包逻辑新增消耗品和材料
This commit is contained in:
parent
334fce6c86
commit
75ffaba040
BIN
Yosin_Engine.exe
BIN
Yosin_Engine.exe
Binary file not shown.
|
|
@ -16,6 +16,8 @@ class _AssetManager_ {
|
||||||
TownList = null;
|
TownList = null;
|
||||||
//装备列表
|
//装备列表
|
||||||
EquipmentList = null;
|
EquipmentList = null;
|
||||||
|
//消耗品列表
|
||||||
|
StackableList = null;
|
||||||
//NPC列表
|
//NPC列表
|
||||||
NpcList = null;
|
NpcList = null;
|
||||||
|
|
||||||
|
|
@ -211,6 +213,20 @@ 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() {
|
function InitNpcList() {
|
||||||
NpcList = ScriptData.GetFileData("npc/npc.lst", function(DataTable, Data) {
|
NpcList = ScriptData.GetFileData("npc/npc.lst", function(DataTable, Data) {
|
||||||
while (!Data.Eof()) {
|
while (!Data.Eof()) {
|
||||||
|
|
@ -248,6 +264,8 @@ class _AssetManager_ {
|
||||||
InitCharacter();
|
InitCharacter();
|
||||||
//初始化装备列表
|
//初始化装备列表
|
||||||
InitEquipmentList();
|
InitEquipmentList();
|
||||||
|
//初始化消耗品列表
|
||||||
|
InitStackableList();
|
||||||
//初始化NPC列表
|
//初始化NPC列表
|
||||||
InitNpcList();
|
InitNpcList();
|
||||||
|
|
||||||
|
|
@ -283,8 +301,8 @@ class _AssetManager_ {
|
||||||
DataTable.usable_job.append(Ret.slice(1, -1).tolower());
|
DataTable.usable_job.append(Ret.slice(1, -1).tolower());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//读取三攻
|
//读取三攻 和 双防
|
||||||
else if (Pack == "[equipment physical attack]" || Pack == "[equipment magical attack]" || Pack == "[separate attack]") {
|
else if (Pack == "[equipment physical attack]" || Pack == "[equipment magical attack]" || Pack == "[separate attack]" || Pack == "[equipment physical defense]" || Pack == "[equipment magical defense]") {
|
||||||
local RealKey = Pack.slice(1, -1);
|
local RealKey = Pack.slice(1, -1);
|
||||||
DataTable[RealKey] <- [Data.Get(), Data.Get()];
|
DataTable[RealKey] <- [Data.Get(), Data.Get()];
|
||||||
}
|
}
|
||||||
|
|
@ -347,6 +365,60 @@ class _AssetManager_ {
|
||||||
return m_data;
|
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::
|
//Public::
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class GameItem.EquipmentIcon extends CL_CanvasObject {
|
||||||
DrawSpriteFrame(Icon, 0, 0);
|
DrawSpriteFrame(Icon, 0, 0);
|
||||||
|
|
||||||
//是否封装
|
//是否封装
|
||||||
local IsPackage = Equipment.Property ? Equipment.Property.IsPackage : 1;
|
local IsPackage = Equipment.IsWrap;
|
||||||
if (IsPackage && (Equipment.Rarity == 2 || Equipment.Rarity == 3)) {
|
if (IsPackage && (Equipment.Rarity == 2 || Equipment.Rarity == 3)) {
|
||||||
local IconFrame = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 634);
|
local IconFrame = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 634);
|
||||||
IconFrame.SetMode(0);
|
IconFrame.SetMode(0);
|
||||||
|
|
@ -70,7 +70,13 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
||||||
|
|
||||||
//绘制装备名称
|
//绘制装备名称
|
||||||
if (Equipment.Name.len() > 0) {
|
if (Equipment.Name.len() > 0) {
|
||||||
local EquName = FontAssetManager.GenerateNormal(Equipment.Name, false, {
|
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, {
|
||||||
color = GameItem.EquipmentInfoTag.rarity_color[Equipment.Rarity]
|
color = GameItem.EquipmentInfoTag.rarity_color[Equipment.Rarity]
|
||||||
});
|
});
|
||||||
Canvas.DrawActor(EquName, 41, 7);
|
Canvas.DrawActor(EquName, 41, 7);
|
||||||
|
|
@ -80,7 +86,7 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
||||||
Canvas.DrawLine(3, 37, 207, 38);
|
Canvas.DrawLine(3, 37, 207, 38);
|
||||||
|
|
||||||
//绘制品级
|
//绘制品级
|
||||||
local Percentage = Equipment.Property ? Equipment.Property.Percentage : 100;
|
local Percentage = Equipment.Percentage;
|
||||||
//品级文字
|
//品级文字
|
||||||
local PercentageGradeText = FontAssetManager.GenerateNormal(GetPercentageText(Percentage), false, {
|
local PercentageGradeText = FontAssetManager.GenerateNormal(GetPercentageText(Percentage), false, {
|
||||||
color = sq_RGBA(255, 240, 0, 255)
|
color = sq_RGBA(255, 240, 0, 255)
|
||||||
|
|
@ -115,7 +121,7 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
||||||
Canvas.DrawActor(MinUseLevelText, 210 - MinUseLevelText.GetSize().w - 6, 57);
|
Canvas.DrawActor(MinUseLevelText, 210 - MinUseLevelText.GetSize().w - 6, 57);
|
||||||
|
|
||||||
//绘制交易类型 如果有主体属性读取 否则一律为封装
|
//绘制交易类型 如果有主体属性读取 否则一律为封装
|
||||||
local TradeType = Equipment.Property ? Equipment.Property.TradeType : 0;
|
local TradeType = Equipment.TradeType;
|
||||||
local TradeTypeText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.trade_type_text[TradeType], false, {
|
local TradeTypeText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.trade_type_text[TradeType], false, {
|
||||||
color = GameItem.EquipmentInfoTag.trade_type_color[TradeType]
|
color = GameItem.EquipmentInfoTag.trade_type_color[TradeType]
|
||||||
});
|
});
|
||||||
|
|
@ -135,7 +141,7 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
||||||
Canvas.DrawActor(SellPriceText, 210 - SellPriceText.GetSize().w - 6, 105);
|
Canvas.DrawActor(SellPriceText, 210 - SellPriceText.GetSize().w - 6, 105);
|
||||||
|
|
||||||
//绘制耐久度
|
//绘制耐久度
|
||||||
local DurabilityText = FontAssetManager.GenerateNormal("耐久度 " + (Equipment.Property ? Equipment.Property.Durability : Equipment.Durability) + "/" + Equipment.Durability, false, {
|
local DurabilityText = FontAssetManager.GenerateNormal("耐久度 " + (Equipment.CurrentDurability == -1 ? Equipment.Durability : Equipment.CurrentDurability) + "/" + Equipment.Durability, false, {
|
||||||
color = sq_RGBA(133, 121, 80, 255)
|
color = sq_RGBA(133, 121, 80, 255)
|
||||||
});
|
});
|
||||||
Canvas.DrawActor(DurabilityText, 6, 121);
|
Canvas.DrawActor(DurabilityText, 6, 121);
|
||||||
|
|
@ -157,6 +163,24 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
||||||
//绘制分割
|
//绘制分割
|
||||||
AddSliceLine();
|
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", "物理攻击力");
|
DrawAttack("EquipmentPhysicalAttack", "物理攻击力");
|
||||||
//绘制魔法攻击力
|
//绘制魔法攻击力
|
||||||
|
|
@ -289,12 +313,11 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
||||||
if (typeof Equipment[Type] == "array") {
|
if (typeof Equipment[Type] == "array") {
|
||||||
local MaxValue = Equipment[Type][0];
|
local MaxValue = Equipment[Type][0];
|
||||||
local MinValue = Equipment[Type][1];
|
local MinValue = Equipment[Type][1];
|
||||||
local Rate = Equipment.Property ? Equipment.Property[Type + "Rate"] : 100;
|
local Rate = 1.0;
|
||||||
Rate = Rate.tofloat() / 100.0;
|
|
||||||
RealValue = (MinValue + ((MaxValue - MinValue).tofloat() * Rate).tointeger());
|
RealValue = (MinValue + ((MaxValue - MinValue).tofloat() * Rate).tointeger());
|
||||||
}
|
}
|
||||||
//百分比计算过的数据
|
//百分比计算过的数据
|
||||||
else if (typeof Equipment[Type] == "integer") {
|
else if (typeof Equipment[Type] == "integer" || typeof Equipment[Type] == "float") {
|
||||||
RealValue = Equipment[Type];
|
RealValue = Equipment[Type];
|
||||||
}
|
}
|
||||||
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + RealValue, false, {
|
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + RealValue, false, {
|
||||||
|
|
@ -351,6 +374,18 @@ class GameItem.Equipment extends GameItem.Item {
|
||||||
Idx = -1;
|
Idx = -1;
|
||||||
//装备名称
|
//装备名称
|
||||||
Name = "";
|
Name = "";
|
||||||
|
//强化或增幅等级
|
||||||
|
Upgrade = 0;
|
||||||
|
//锻造等级
|
||||||
|
SeparateLevel = 0;
|
||||||
|
//增幅属性 0 无 1 力量 2 智力 3 体力 4 精神
|
||||||
|
EquipIncrease = 0;
|
||||||
|
//是否封装
|
||||||
|
IsWrap = 0;
|
||||||
|
//在封装次数
|
||||||
|
WrapCount = 0;
|
||||||
|
//交易类型
|
||||||
|
TradeType = 0;
|
||||||
//装备类型
|
//装备类型
|
||||||
Type = -1;
|
Type = -1;
|
||||||
//装备槽位
|
//装备槽位
|
||||||
|
|
@ -373,6 +408,10 @@ class GameItem.Equipment extends GameItem.Item {
|
||||||
SellPrice = -1;
|
SellPrice = -1;
|
||||||
//耐久度
|
//耐久度
|
||||||
Durability = -1;
|
Durability = -1;
|
||||||
|
//当前耐久度
|
||||||
|
CurrentDurability = -1;
|
||||||
|
//装备品质
|
||||||
|
Percentage = 100;
|
||||||
//冒险家名望
|
//冒险家名望
|
||||||
AdventurerFame = 0;
|
AdventurerFame = 0;
|
||||||
//装备可穿戴职业
|
//装备可穿戴职业
|
||||||
|
|
@ -416,6 +455,10 @@ class GameItem.Equipment extends GameItem.Item {
|
||||||
EquipmentMagicalAttack = 0;
|
EquipmentMagicalAttack = 0;
|
||||||
//独立攻击力
|
//独立攻击力
|
||||||
SeparateAttack = 0;
|
SeparateAttack = 0;
|
||||||
|
//物理防御力
|
||||||
|
EquipmentPhysicalDefense = 0;
|
||||||
|
//魔法防御力
|
||||||
|
EquipmentMagicalDefense = 0;
|
||||||
|
|
||||||
//攻击速度
|
//攻击速度
|
||||||
AttackSpeed = 0;
|
AttackSpeed = 0;
|
||||||
|
|
@ -446,6 +489,11 @@ class GameItem.Equipment extends GameItem.Item {
|
||||||
//描述
|
//描述
|
||||||
FlavorText = null;
|
FlavorText = null;
|
||||||
|
|
||||||
|
|
||||||
|
function _typeof() {
|
||||||
|
return "Equipment";
|
||||||
|
}
|
||||||
|
|
||||||
constructor(...) {
|
constructor(...) {
|
||||||
//直接裸构造
|
//直接裸构造
|
||||||
if (vargv.len() == 0) {
|
if (vargv.len() == 0) {
|
||||||
|
|
@ -453,81 +501,155 @@ class GameItem.Equipment extends GameItem.Item {
|
||||||
}
|
}
|
||||||
//通过参数构造
|
//通过参数构造
|
||||||
else if (vargv.len() == 1) {
|
else if (vargv.len() == 1) {
|
||||||
|
local EquInfo;
|
||||||
//通过ID构造
|
//通过ID构造
|
||||||
if (typeof vargv[0] == "integer") {
|
if (typeof vargv[0] == "integer") {
|
||||||
local EquInfo = AssetManager.GetEquipment(vargv[0]);
|
EquInfo = AssetManager.GetEquipment(vargv[0]);
|
||||||
if (EquInfo) {
|
Idx = vargv[0];
|
||||||
Idx = vargv[0];
|
ConstructEquipmentFromScript(EquInfo);
|
||||||
//名称
|
}
|
||||||
if (EquInfo.rawin("name")) Name = EquInfo["name"];
|
//通过Table来构造
|
||||||
//类型
|
else if (typeof vargv[0] == "table") {
|
||||||
if (EquInfo.rawin("type")) GetRealEquipmentType(EquInfo["type"].path);
|
local Info = vargv[0];
|
||||||
//最低使用等级
|
EquInfo = AssetManager.GetEquipment(Info.EquipId);
|
||||||
if (EquInfo.rawin("minimum level")) Minimum_level = EquInfo["minimum level"];
|
Idx = Info.EquipId;
|
||||||
//等级组
|
ConstructEquipmentFromScript(EquInfo);
|
||||||
if (EquInfo.rawin("grade")) Grade = EquInfo["grade"];
|
IterateEquipmentBasedOnActualEquipmentInformation(Info);
|
||||||
//稀有度
|
|
||||||
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) {
|
function SetRealEquipmentType(AType, BType) {
|
||||||
SlotType = AType;
|
SlotType = AType;
|
||||||
|
|
@ -548,16 +670,6 @@ class GameItem.Equipment extends GameItem.Item {
|
||||||
else if (EType == "aurora avatar") SetRealEquipmentType("aurora", "aurora");
|
else if (EType == "aurora avatar") SetRealEquipmentType("aurora", "aurora");
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取装备信息窗口
|
|
||||||
function GetEquipmentInfoWindow() {
|
|
||||||
return GameItem.EquipmentInfo(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取装备图标精灵
|
|
||||||
function GetEquipmentIconSprite() {
|
|
||||||
return GameItem.EquipmentIcon(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//穿戴装备回调
|
//穿戴装备回调
|
||||||
function OnWearStart() {
|
function OnWearStart() {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,31 @@
|
||||||
GameItem <- {};
|
GameItem <- {};
|
||||||
class GameItem.Item {
|
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:: 未知物品类型");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,244 @@
|
||||||
|
/*
|
||||||
|
文件名: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,7 +423,6 @@ class Map extends Actor {
|
||||||
m_camera.MovableAreaY = m_height - m_data.wide_mode_camer_vertical_correction;
|
m_camera.MovableAreaY = m_height - m_data.wide_mode_camer_vertical_correction;
|
||||||
|
|
||||||
m_camera.BackgroundOffset = m_data.background_pos;
|
m_camera.BackgroundOffset = m_data.background_pos;
|
||||||
|
|
||||||
// OpenMovableAreaBorder();
|
// OpenMovableAreaBorder();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,10 @@ function RegisterFunctionalPack() {
|
||||||
//背包类型
|
//背包类型
|
||||||
local InventoryType = Pack.Get_Byte();
|
local InventoryType = Pack.Get_Byte();
|
||||||
//背包道具数量
|
//背包道具数量
|
||||||
local InventoryItemCount = Pack.Get_Int();
|
local InventoryItemCount = Pack.Get_Short();
|
||||||
|
|
||||||
//项目List
|
//项目List
|
||||||
local ItemList = [];
|
local ItemList = {};
|
||||||
|
|
||||||
//道具数据
|
//道具数据
|
||||||
for (local i = 0; i< InventoryItemCount; i++) {
|
for (local i = 0; i< InventoryItemCount; i++) {
|
||||||
|
|
@ -87,6 +87,8 @@ function RegisterFunctionalPack() {
|
||||||
Pos = Pack.Get_Short(),
|
Pos = Pack.Get_Short(),
|
||||||
//装备ID
|
//装备ID
|
||||||
EquipId = Pack.Get_Int(),
|
EquipId = Pack.Get_Int(),
|
||||||
|
//交易类型
|
||||||
|
EquipTradeType = Pack.Get_Byte(),
|
||||||
//装备附魔编号
|
//装备附魔编号
|
||||||
EquipEnchant = Pack.Get_Int(),
|
EquipEnchant = Pack.Get_Int(),
|
||||||
//装备强化等级或增幅等级
|
//装备强化等级或增幅等级
|
||||||
|
|
@ -113,23 +115,47 @@ function RegisterFunctionalPack() {
|
||||||
EquipPhysicalDefensePercentage = Pack.Get_Byte(),
|
EquipPhysicalDefensePercentage = Pack.Get_Byte(),
|
||||||
//装备魔法防御百分比
|
//装备魔法防御百分比
|
||||||
EquipMagicDefensePercentage = 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(),
|
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) {
|
if (Type == 2 || Type == 3) {
|
||||||
local ItemInfo = {
|
local ItemInfo = {
|
||||||
//道具位置
|
//道具位置
|
||||||
Pos = Pack.Get_Short(),
|
Pos = Pack.Get_Short(),
|
||||||
//道具ID
|
//道具ID
|
||||||
ItemId = Pack.Get_Int(),
|
ItemId = Pack.Get_Int(),
|
||||||
|
//交易类型
|
||||||
|
ItemTradeType = Pack.Get_Byte(),
|
||||||
//道具数量
|
//道具数量
|
||||||
ItemCount = Pack.Get_Int(),
|
ItemCount = Pack.Get_Int(),
|
||||||
}
|
}
|
||||||
ItemList.push(ItemInfo);
|
ItemList[ItemInfo.Pos] <- GameItem.Stackable(ItemInfo.ItemId);
|
||||||
|
|
||||||
|
|
||||||
|
ClientCharacterInventory.EquipmentPage.SetItemCollectionList(InventoryType - 2, ItemList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,68 @@ function TestStage() {
|
||||||
// T.Addchild(BackGround);
|
// 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 Equ = GameItem.Equipment(27675);
|
||||||
// local Window = Equ.GetEquipmentInfoWindow();
|
// local Window = Equ.GetEquipmentInfoWindow();
|
||||||
// Window.SetPosition(100, 80);
|
// Window.SetPosition(100, 80);
|
||||||
|
|
@ -39,7 +101,7 @@ function TestStage() {
|
||||||
|
|
||||||
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 548, 20);
|
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 548, 20);
|
||||||
|
|
||||||
// Window.equipmentPage.ItemCollection.SetItemList([{
|
// Window.EquipmentPage.ItemCollection.SetItemList([{
|
||||||
// ItemId = 27675
|
// ItemId = 27675
|
||||||
// }, {
|
// }, {
|
||||||
// ItemId = 101020048
|
// ItemId = 101020048
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ class _Inventory extends Yosin_Window {
|
||||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||||
|
|
||||||
PageIndex = 1;
|
PageIndex = 0;
|
||||||
uiPageIndex = 1;
|
uiPageIndex = 0;
|
||||||
|
|
||||||
//注册控件
|
//注册控件
|
||||||
RegisterWidget();
|
RegisterWidget();
|
||||||
|
|
@ -188,12 +188,12 @@ class _Inventory extends Yosin_Window {
|
||||||
// 切换页面
|
// 切换页面
|
||||||
function ChangPage() {
|
function ChangPage() {
|
||||||
|
|
||||||
equipmentPage.SetVisible(false);
|
EquipmentPage.SetVisible(false);
|
||||||
DressUpPage.SetVisible(false);
|
DressUpPage.SetVisible(false);
|
||||||
|
|
||||||
|
|
||||||
if (PageIndex == 0) {
|
if (PageIndex == 0) {
|
||||||
equipmentPage.SetVisible(true);
|
EquipmentPage.SetVisible(true);
|
||||||
permutationBtn.SetPosition(permutationBtn.X, itemSetBtnY);
|
permutationBtn.SetPosition(permutationBtn.X, itemSetBtnY);
|
||||||
setBtn.SetPosition(setBtn.X, itemSetBtnY);
|
setBtn.SetPosition(setBtn.X, itemSetBtnY);
|
||||||
saerchBtn.SetPosition(saerchBtn.X, itemSetBtnY);
|
saerchBtn.SetPosition(saerchBtn.X, itemSetBtnY);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class Inventory_CharactersDressUp extends CL_CanvasObject {
|
||||||
|
|
||||||
// 魔法阵
|
// 魔法阵
|
||||||
local MagicLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 179);
|
local MagicLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 179);
|
||||||
DrawSpriteFrame(MagicLight, 5,55);
|
DrawSpriteFrame(MagicLight, 5, 55);
|
||||||
|
|
||||||
// 人物打光
|
// 人物打光
|
||||||
local CharacterLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 178);
|
local CharacterLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 178);
|
||||||
|
|
@ -79,17 +79,3 @@ class Inventory_CharactersDressUp extends CL_CanvasObject {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
@ -67,8 +67,14 @@ class Inventory_EquipmentPage extends Yosin_CommonUi {
|
||||||
AddUIChild(itemBtns);
|
AddUIChild(itemBtns);
|
||||||
|
|
||||||
itemBtns.LBDownOnClick = function(btns, index) {
|
itemBtns.LBDownOnClick = function(btns, index) {
|
||||||
print(index);
|
foreach(Iindex, ItemCollectionBuffer in ItemCollection) {
|
||||||
};
|
if (Iindex == index) {
|
||||||
|
ItemCollectionBuffer.SetVisible(true);
|
||||||
|
} else {
|
||||||
|
ItemCollectionBuffer.SetVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.bindenv(this);
|
||||||
|
|
||||||
// 物品栏边框
|
// 物品栏边框
|
||||||
local itemBg = Yosin_NineBoxStretch(253, 245, "sprite/interface/lenheartwindowcommon.img", 97);
|
local itemBg = Yosin_NineBoxStretch(253, 245, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||||
|
|
@ -78,9 +84,11 @@ class Inventory_EquipmentPage extends Yosin_CommonUi {
|
||||||
// 物品栏
|
// 物品栏
|
||||||
ItemCollection = [];
|
ItemCollection = [];
|
||||||
for (local i = 0; i< 5; i++) {
|
for (local i = 0; i< 5; i++) {
|
||||||
ItemCollection.push(_ItemCollection(itemBg.X + 7, itemBg.Y + 3, 7));
|
local ItemCollectionBuffer = _ItemCollection(itemBg.X + 7, itemBg.Y + 3, 7);
|
||||||
|
ItemCollection.push(ItemCollectionBuffer);
|
||||||
|
AddUIChild(ItemCollectionBuffer);
|
||||||
|
if (i != 0) ItemCollectionBuffer.SetVisible(false);
|
||||||
}
|
}
|
||||||
AddUIChild(ItemCollection[0]);
|
|
||||||
|
|
||||||
|
|
||||||
local itemBgBottom = itemBg.bottom();
|
local itemBgBottom = itemBg.bottom();
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,12 @@ class ItemSlot {
|
||||||
|
|
||||||
function SetItem(Item) {
|
function SetItem(Item) {
|
||||||
this.Item = Item;
|
this.Item = Item;
|
||||||
this.ItemIcon = this.Item.GetEquipmentIconSprite();
|
this.ItemIcon = this.Item.GetIconSprite();
|
||||||
}
|
}
|
||||||
|
|
||||||
//生成详细信息
|
//生成详细信息
|
||||||
function GenerateInfo() {
|
function GenerateInfo() {
|
||||||
this.ItemInfo = this.Item.GetEquipmentInfoWindow();
|
this.ItemInfo = this.Item.GetInfoWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
//显示详细信息
|
//显示详细信息
|
||||||
|
|
@ -124,11 +124,8 @@ class _ItemCollection extends Yosin_CommonUi {
|
||||||
|
|
||||||
//创建道具
|
//创建道具
|
||||||
foreach(Index, ItemObject in gItemList) {
|
foreach(Index, ItemObject in gItemList) {
|
||||||
local ItemId = ItemObject.ItemId;
|
|
||||||
//TODO
|
|
||||||
local Item = GameItem.Equipment(ItemId);
|
|
||||||
ItemList[Index] = ItemSlot();
|
ItemList[Index] = ItemSlot();
|
||||||
ItemList[Index].SetItem(Item);
|
ItemList[Index].SetItem(ItemObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
RefreshItemList();
|
RefreshItemList();
|
||||||
|
|
@ -163,6 +160,7 @@ class _ItemCollection extends Yosin_CommonUi {
|
||||||
//override
|
//override
|
||||||
//鼠标事件回调
|
//鼠标事件回调
|
||||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||||
|
if (!Visible) return;
|
||||||
base.OnMouseProc(MousePos_X, MousePos_Y);
|
base.OnMouseProc(MousePos_X, MousePos_Y);
|
||||||
|
|
||||||
if (isInRect) {
|
if (isInRect) {
|
||||||
|
|
@ -170,6 +168,8 @@ class _ItemCollection extends Yosin_CommonUi {
|
||||||
local xx = MousePos_X - WorldPosition.x;
|
local xx = MousePos_X - WorldPosition.x;
|
||||||
local yy = MousePos_Y - WorldPosition.y;
|
local yy = MousePos_Y - WorldPosition.y;
|
||||||
local column = (yy / 30).tointeger();
|
local column = (yy / 30).tointeger();
|
||||||
|
//悬停的时候有可能悬停到最下面的最后一条缝 会导致判定行数多了一行 所以这里做限制
|
||||||
|
column = (column <= (RowNum - 1) ? column : (RowNum - 1));
|
||||||
local row = (xx / 30).tointeger();
|
local row = (xx / 30).tointeger();
|
||||||
//指向的项目位置
|
//指向的项目位置
|
||||||
local Idx = column * 8 + row;
|
local Idx = column * 8 + row;
|
||||||
|
|
@ -190,7 +190,7 @@ class _ItemCollection extends Yosin_CommonUi {
|
||||||
//如果当前没有拖拽物品时才打开详细信息窗口
|
//如果当前没有拖拽物品时才打开详细信息窗口
|
||||||
if (!DragItem) {
|
if (!DragItem) {
|
||||||
//显示详细信息
|
//显示详细信息
|
||||||
ItemList[Idx].ShowInfo(MousePos_X - 50, MousePos_Y - 150);
|
ItemList[Idx].ShowInfo(MousePos_X - 50, MousePos_Y - ((ItemList[Idx].ItemInfo.RealCanvasHeight + 10) / 2));
|
||||||
//记录当前显示的对象
|
//记录当前显示的对象
|
||||||
CurrentShowItem = ItemList[Idx];
|
CurrentShowItem = ItemList[Idx];
|
||||||
}
|
}
|
||||||
|
|
@ -231,7 +231,7 @@ class _ItemCollection extends Yosin_CommonUi {
|
||||||
DragItem = ItemList[ItemPos];
|
DragItem = ItemList[ItemPos];
|
||||||
DragItemPos = ItemPos;
|
DragItemPos = ItemPos;
|
||||||
ItemList[ItemPos] = null;
|
ItemList[ItemPos] = null;
|
||||||
local IconBuffer = DragItem.Item.GetEquipmentIconSprite();
|
local IconBuffer = DragItem.Item.GetIconSprite();
|
||||||
IconBuffer.SetPosition(-15, -15);
|
IconBuffer.SetPosition(-15, -15);
|
||||||
IMouse.AttachObjectBottom("ItemCollectDragItem", IconBuffer);
|
IMouse.AttachObjectBottom("ItemCollectDragItem", IconBuffer);
|
||||||
RefreshItemList();
|
RefreshItemList();
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ function main(args) {
|
||||||
local Game = GameWindow();
|
local Game = GameWindow();
|
||||||
Game.title = "Yosin & Kiwano";
|
Game.title = "Yosin & Kiwano";
|
||||||
Game.bg_color = [255.0, 255.0, 255.0, 255.0];
|
Game.bg_color = [255.0, 255.0, 255.0, 255.0];
|
||||||
Game.size = [1066, 600];
|
Game.size = [1066 + 332, 600];
|
||||||
Game.v_sync = false;
|
Game.v_sync = false;
|
||||||
Game.frame_interval = 10000;
|
Game.frame_interval = 10000;
|
||||||
Game.debug_mode = true;
|
Game.debug_mode = true;
|
||||||
|
|
|
||||||
|
|
@ -286,5 +286,8 @@
|
||||||
},
|
},
|
||||||
"User/UI/Window/5_Inventory/Inventory_DressUpPage.nut": {
|
"User/UI/Window/5_Inventory/Inventory_DressUpPage.nut": {
|
||||||
"description": "背包装扮页"
|
"description": "背包装扮页"
|
||||||
|
},
|
||||||
|
"User/Asset/Item/Stackable.nut": {
|
||||||
|
"description": "消耗品及材料"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue