将 SquirrelFileConfig 移除版本控制
This commit is contained in:
commit
a4cea1bc55
BIN
Yosin_Engine.exe
BIN
Yosin_Engine.exe
Binary file not shown.
|
|
@ -141,79 +141,6 @@ class Yosin_BaseButton extends Yosin_CommonUi {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 2图按钮
|
|
||||||
class Yosin_TwoImgButton extends Yosin_CommonUi {
|
|
||||||
|
|
||||||
//按钮状态
|
|
||||||
State = 0;
|
|
||||||
Path = null;
|
|
||||||
Idx = null;
|
|
||||||
|
|
||||||
Sprite = null;
|
|
||||||
NormalSpriteFrame = null;
|
|
||||||
SlectSpriteFrame = null;
|
|
||||||
SpriteState = -1;
|
|
||||||
|
|
||||||
//按下时的模拟偏移
|
|
||||||
DownSimulateOffset = true;
|
|
||||||
|
|
||||||
constructor(X, Y, W, H, Path, Idx) {
|
|
||||||
this.Path = Path;
|
|
||||||
this.Idx = Idx;
|
|
||||||
base.constructor(X, Y, W, H);
|
|
||||||
|
|
||||||
Sprite = CL_SpriteObject();
|
|
||||||
Addchild(Sprite);
|
|
||||||
|
|
||||||
NormalSpriteFrame = CL_SpriteFrameObject(this.Path, this.Idx);
|
|
||||||
SlectSpriteFrame = CL_SpriteFrameObject(this.Path, this.Idx + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ChangeFrame() {
|
|
||||||
//状态更改 刷新精灵帧
|
|
||||||
if (State != SpriteState) {
|
|
||||||
//按下时模拟偏移的Flag 如果按下 调整Y坐标向下一个单位
|
|
||||||
if (DownSimulateOffset) {
|
|
||||||
if (State == 2) {
|
|
||||||
Y += 1;
|
|
||||||
SyncPos(X, Y);
|
|
||||||
} else if (SpriteState == 2) {
|
|
||||||
Y -= 1;
|
|
||||||
SyncPos(X, Y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SpriteState = State;
|
|
||||||
Sprite.SetFrame(State != 0 ? SlectSpriteFrame : NormalSpriteFrame );
|
|
||||||
Sprite.SetPosition(0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Proc(Dt) {
|
|
||||||
//不可用
|
|
||||||
if (State == 3) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//按下
|
|
||||||
if (isLBDown) {
|
|
||||||
State = 2;
|
|
||||||
}
|
|
||||||
//悬停
|
|
||||||
else if (isInRect) {
|
|
||||||
State = 1;
|
|
||||||
}
|
|
||||||
//普通
|
|
||||||
else {
|
|
||||||
State = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ChangeFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//三分法拉伸
|
//三分法拉伸
|
||||||
class Yosin_EmeStretch extends Yosin_CommonUi {
|
class Yosin_EmeStretch extends Yosin_CommonUi {
|
||||||
|
|
||||||
|
|
@ -230,7 +157,7 @@ class Yosin_EmeStretch extends Yosin_CommonUi {
|
||||||
// 创建画布
|
// 创建画布
|
||||||
local Canvas = CL_CanvasObject();
|
local Canvas = CL_CanvasObject();
|
||||||
// 重设大小并清空
|
// 重设大小并清空
|
||||||
Canvas.ResizeAndClear( W, H);
|
Canvas.ResizeAndClear(W, H);
|
||||||
// 开始绘制
|
// 开始绘制
|
||||||
Canvas.BeginDraw();
|
Canvas.BeginDraw();
|
||||||
|
|
||||||
|
|
@ -326,41 +253,41 @@ function Yosin_NineBoxStretch(X, Y, width, height, path, imgId) {
|
||||||
|
|
||||||
// 上边
|
// 上边
|
||||||
backgroundTop.SetScale(scaleW, 1);
|
backgroundTop.SetScale(scaleW, 1);
|
||||||
backgroundTop.SetPosition(TopLeftRight + 1, 0);
|
backgroundTop.SetPosition(TopLeftRight, 0);
|
||||||
Canvas.DrawSprite(backgroundTop);
|
Canvas.DrawSprite(backgroundTop);
|
||||||
|
|
||||||
// 右上角
|
// 右上角
|
||||||
backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w, 0);
|
backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w - 1, 0);
|
||||||
Canvas.DrawSprite(backgroundTopRight);
|
Canvas.DrawSprite(backgroundTopRight);
|
||||||
|
|
||||||
// 左边
|
// 左边
|
||||||
backgroundLeft.SetScale(1, scaleH);
|
backgroundLeft.SetScale(1, scaleH);
|
||||||
backgroundLeft.SetPosition(0, TopLeftBottom + 1);
|
backgroundLeft.SetPosition(0, TopLeftBottom);
|
||||||
Canvas.DrawSprite(backgroundLeft);
|
Canvas.DrawSprite(backgroundLeft);
|
||||||
|
|
||||||
// 中间
|
// 中间
|
||||||
backgroundCenter.SetScale(scaleW, scaleH);
|
backgroundCenter.SetScale(scaleW, scaleH);
|
||||||
// Addchild(backgroundCenter);
|
// Addchild(backgroundCenter);
|
||||||
backgroundCenter.SetPosition(TopLeftRight + 1, backgroundLeft.Y);
|
backgroundCenter.SetPosition(TopLeftRight, backgroundLeft.Y);
|
||||||
Canvas.DrawSprite(backgroundCenter);
|
Canvas.DrawSprite(backgroundCenter);
|
||||||
|
|
||||||
// 右边
|
// 右边
|
||||||
backgroundRight.SetScale(1, scaleH);
|
backgroundRight.SetScale(1, scaleH);
|
||||||
backgroundRight.SetPosition(width - backgroundRight.GetSize().w, backgroundCenter.Y);
|
backgroundRight.SetPosition(width - backgroundRight.GetSize().w - 1, backgroundCenter.Y);
|
||||||
Canvas.DrawSprite(backgroundRight);
|
Canvas.DrawSprite(backgroundRight);
|
||||||
|
|
||||||
// 左下角
|
// 左下角
|
||||||
backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h);
|
backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h - 1);
|
||||||
Canvas.DrawSprite(backgroundBottomLeft);
|
Canvas.DrawSprite(backgroundBottomLeft);
|
||||||
|
|
||||||
// 下边
|
// 下边
|
||||||
backgroundBottom.SetScale(scaleW, 1);
|
backgroundBottom.SetScale(scaleW, 1);
|
||||||
backgroundBottom.SetPosition(TopLeftRight + 1, backgroundBottomLeft.Y);
|
backgroundBottom.SetPosition(TopLeftRight, backgroundBottomLeft.Y);
|
||||||
Canvas.DrawSprite(backgroundBottom);
|
Canvas.DrawSprite(backgroundBottom);
|
||||||
|
|
||||||
// 右下角
|
// 右下角
|
||||||
backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w, backgroundBottomLeft.Y);
|
backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w - 1, backgroundBottomLeft.Y);
|
||||||
Canvas.DrawSprite(backgroundBottomRight );
|
Canvas.DrawSprite(backgroundBottomRight);
|
||||||
|
|
||||||
// 结束绘制
|
// 结束绘制
|
||||||
Canvas.EndDraw();
|
Canvas.EndDraw();
|
||||||
|
|
@ -370,6 +297,115 @@ function Yosin_NineBoxStretch(X, Y, width, height, path, imgId) {
|
||||||
return Canvas;
|
return Canvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// //九宫格拉伸
|
||||||
|
// class Yosin_NineBoxStretch extends Yosin_CommonUi {
|
||||||
|
|
||||||
|
// constructor(X, Y, W, H, Path, Idx) {
|
||||||
|
// base.constructor(X, Y, W, H);
|
||||||
|
// DrawBackground(W, H, Path, Idx);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// // 绘制
|
||||||
|
// function DrawBackground(width, height, path, imgId) {
|
||||||
|
|
||||||
|
|
||||||
|
// // 创建画布
|
||||||
|
// local Canvas = CL_CanvasObject();
|
||||||
|
// // 重设大小并清空
|
||||||
|
// Canvas.ResizeAndClear(width, height);
|
||||||
|
// // 开始绘制
|
||||||
|
// Canvas.BeginDraw();
|
||||||
|
|
||||||
|
// // 左上角
|
||||||
|
// // local backgroundTopLeft = CL_SpriteObject(path, imgId);
|
||||||
|
// local backgroundTopLeft = CL_SpriteObject(path, imgId);
|
||||||
|
// // 上边
|
||||||
|
// local backgroundTop = CL_SpriteObject(path, imgId + 1);
|
||||||
|
// // 右上角
|
||||||
|
// local backgroundTopRight = CL_SpriteObject(path, imgId + 2);
|
||||||
|
// // 左边
|
||||||
|
// local backgroundLeft = CL_SpriteObject(path, imgId + 3);
|
||||||
|
// // 中间
|
||||||
|
// local backgroundCenter = CL_SpriteObject(path, imgId + 4);
|
||||||
|
// // 右边
|
||||||
|
// local backgroundRight = CL_SpriteObject(path, imgId + 5);
|
||||||
|
// // 左下角
|
||||||
|
// local backgroundBottomLeft = CL_SpriteObject(path, imgId + 6);
|
||||||
|
// // 下边
|
||||||
|
// local backgroundBottom = CL_SpriteObject(path, imgId + 7);
|
||||||
|
// // 右下角
|
||||||
|
// local backgroundBottomRight = CL_SpriteObject(path, imgId + 8);
|
||||||
|
|
||||||
|
|
||||||
|
// // 左上角
|
||||||
|
// Canvas.DrawSprite(backgroundTopLeft);
|
||||||
|
|
||||||
|
// local TopLeftSize = backgroundTopLeft.GetSize();
|
||||||
|
// local TopLeftBottom = TopLeftSize.h;
|
||||||
|
// local TopLeftRight = TopLeftSize.w;
|
||||||
|
|
||||||
|
// // 中间图片大小
|
||||||
|
// local centerImgSize = backgroundCenter.GetSize();
|
||||||
|
// local centerImgWidth = centerImgSize.w;
|
||||||
|
// local centerImgHeight = centerImgSize.h;
|
||||||
|
|
||||||
|
// local centerWidth = width - backgroundTopLeft.GetSize().w - backgroundTopRight.GetSize().w;
|
||||||
|
// local centerHeight = height - backgroundTopLeft.GetSize().h - backgroundBottomLeft.GetSize().h;
|
||||||
|
|
||||||
|
|
||||||
|
// local scaleW = (centerWidth - 1).tofloat() / centerImgWidth.tofloat();
|
||||||
|
// local scaleH = (centerHeight - 1).tofloat() / centerImgHeight.tofloat();
|
||||||
|
|
||||||
|
// // 上边
|
||||||
|
// backgroundTop.SetScale(scaleW, 1);
|
||||||
|
// backgroundTop.SetPosition(TopLeftRight + 1, 0);
|
||||||
|
// Canvas.DrawSprite(backgroundTop);
|
||||||
|
|
||||||
|
// // 右上角
|
||||||
|
// backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w, 0);
|
||||||
|
// Canvas.DrawSprite(backgroundTopRight);
|
||||||
|
|
||||||
|
// // 左边
|
||||||
|
// backgroundLeft.SetScale(1, scaleH);
|
||||||
|
// backgroundLeft.SetPosition(0, TopLeftBottom + 1);
|
||||||
|
// Canvas.DrawSprite(backgroundLeft);
|
||||||
|
|
||||||
|
// // 中间
|
||||||
|
// backgroundCenter.SetScale(scaleW, scaleH);
|
||||||
|
// // Addchild(backgroundCenter);
|
||||||
|
// backgroundCenter.SetPosition(TopLeftRight + 1, backgroundLeft.Y);
|
||||||
|
// Canvas.DrawSprite(backgroundCenter);
|
||||||
|
|
||||||
|
// // 右边
|
||||||
|
// backgroundRight.SetScale(1, scaleH);
|
||||||
|
// backgroundRight.SetPosition(width - backgroundRight.GetSize().w, backgroundCenter.Y);
|
||||||
|
// Canvas.DrawSprite(backgroundRight);
|
||||||
|
|
||||||
|
// // 左下角
|
||||||
|
// backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h);
|
||||||
|
// Canvas.DrawSprite(backgroundBottomLeft);
|
||||||
|
|
||||||
|
// // 下边
|
||||||
|
// backgroundBottom.SetScale(scaleW, 1);
|
||||||
|
// backgroundBottom.SetPosition(TopLeftRight + 1, backgroundBottomLeft.Y);
|
||||||
|
// Canvas.DrawSprite(backgroundBottom);
|
||||||
|
|
||||||
|
// // 右下角
|
||||||
|
// backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w, backgroundBottomLeft.Y);
|
||||||
|
// Canvas.DrawSprite(backgroundBottomRight );
|
||||||
|
|
||||||
|
// // 结束绘制
|
||||||
|
// Canvas.EndDraw();
|
||||||
|
// // 添加画布
|
||||||
|
// Addchild(Canvas);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
//拼接按钮
|
//拼接按钮
|
||||||
class Yosin_SplicingButton extends Yosin_CommonUi {
|
class Yosin_SplicingButton extends Yosin_CommonUi {
|
||||||
//按钮状态
|
//按钮状态
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,57 @@ class _AssetManager_ {
|
||||||
if (Ret == "[/elemental property tag]") break;
|
if (Ret == "[/elemental property tag]") break;
|
||||||
DataTable.elemental_property_tag.rawset(Ret, Data.Get());
|
DataTable.elemental_property_tag.rawset(Ret, Data.Get());
|
||||||
}
|
}
|
||||||
|
} else if (Pack == "[rarity frame color idx]") {
|
||||||
|
DataTable.rarityframe_color_idx <- [];
|
||||||
|
while (true) {
|
||||||
|
local Ret = Data.Get();
|
||||||
|
if (Ret == "[/rarity frame color idx]") break;
|
||||||
|
DataTable.rarityframe_color_idx.push(Ret);
|
||||||
|
}
|
||||||
|
} else if (Pack == "[rarity name tag]") {
|
||||||
|
DataTable.rarity_name_tag <- [];
|
||||||
|
while (true) {
|
||||||
|
local Ret = Data.Get();
|
||||||
|
if (Ret == "[/rarity name tag]") break;
|
||||||
|
DataTable.rarity_name_tag.push(Ret);
|
||||||
|
}
|
||||||
|
} else if (Pack == "[rarity color]") {
|
||||||
|
DataTable.rarity_color <- [];
|
||||||
|
while (true) {
|
||||||
|
local Ret = Data.Get();
|
||||||
|
if (Ret == "[/rarity color]") break;
|
||||||
|
local color = HexStringToInt(Ret);
|
||||||
|
DataTable.rarity_color.push(color);
|
||||||
|
}
|
||||||
|
} else if (Pack == "[percentage text]") {
|
||||||
|
DataTable.percentage_text <- [];
|
||||||
|
while (true) {
|
||||||
|
local Ret = Data.Get();
|
||||||
|
if (Ret == "[/percentage text]") break;
|
||||||
|
DataTable.percentage_text.push(Ret);
|
||||||
|
}
|
||||||
|
} else if (Pack == "[percentage range boundaries]") {
|
||||||
|
DataTable.percentage_range_boundaries <- [];
|
||||||
|
while (true) {
|
||||||
|
local Ret = Data.Get();
|
||||||
|
if (Ret == "[/percentage range boundaries]") break;
|
||||||
|
DataTable.percentage_range_boundaries.push(Ret);
|
||||||
|
}
|
||||||
|
} else if (Pack == "[trade type text]") {
|
||||||
|
DataTable.trade_type_text <- [];
|
||||||
|
while (true) {
|
||||||
|
local Ret = Data.Get();
|
||||||
|
if (Ret == "[/trade type text]") break;
|
||||||
|
DataTable.trade_type_text.push(Ret);
|
||||||
|
}
|
||||||
|
} else if (Pack == "[trade type color]") {
|
||||||
|
DataTable.trade_type_color <- [];
|
||||||
|
while (true) {
|
||||||
|
local Ret = Data.Get();
|
||||||
|
if (Ret == "[/trade type color]") break;
|
||||||
|
local color = HexStringToInt(Ret);
|
||||||
|
DataTable.trade_type_color.push(color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -6,44 +6,53 @@
|
||||||
*/
|
*/
|
||||||
//装备信息标签类(信息类)
|
//装备信息标签类(信息类)
|
||||||
if (!GameItem.rawin("EquipmentInfoTag")) GameItem.EquipmentInfoTag <- null;
|
if (!GameItem.rawin("EquipmentInfoTag")) GameItem.EquipmentInfoTag <- null;
|
||||||
|
//装备图标窗口
|
||||||
|
class GameItem.EquipmentIcon extends CL_CanvasObject {
|
||||||
|
|
||||||
|
constructor(Equipment) {
|
||||||
|
base.constructor();
|
||||||
|
ResizeAndClear(32, 32);
|
||||||
|
BeginDraw();
|
||||||
|
//构造图标 及图标边框
|
||||||
|
if (Equipment.Icon) {
|
||||||
|
//图标
|
||||||
|
local Icon = CL_SpriteFrameObject(Equipment.Icon.path, Equipment.Icon.index);
|
||||||
|
DrawSpriteFrame(Icon, 0, 0);
|
||||||
|
|
||||||
|
//是否封装
|
||||||
|
local IsPackage = Equipment.Property ? Equipment.Property.IsPackage : 1;
|
||||||
|
if (IsPackage && (Equipment.Rarity == 2 || Equipment.Rarity == 3)) {
|
||||||
|
local IconFrame = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 634);
|
||||||
|
IconFrame.SetMode(0);
|
||||||
|
DrawSprite(IconFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
//边框
|
||||||
|
local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + GameItem.EquipmentInfoTag.rarityframe_color_idx[Equipment.Rarity]);
|
||||||
|
DrawSpriteFrame(IconFrame, 0, 0);
|
||||||
|
}
|
||||||
|
EndDraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//装备信息窗口
|
//装备信息窗口
|
||||||
class GameItem.EquipmentInfo extends Yosin_Window {
|
class GameItem.EquipmentInfo extends Yosin_Window {
|
||||||
|
|
||||||
//装备
|
//装备
|
||||||
Equipment = null;
|
Equipment = null;
|
||||||
//画布
|
//画布
|
||||||
Canvas = null;
|
Canvas = null;
|
||||||
//画布实际高度
|
//画布实际高度
|
||||||
RealCanvasHeight = 0;
|
RealCanvasHeight = 0;
|
||||||
//稀有度边框颜色对应Idx表
|
|
||||||
//白装 蓝装 紫装 粉装 金装 红装 橙装
|
|
||||||
RarityFrameColorIdx = [0, 1, 2, 4, 6, 3, 5];
|
|
||||||
//稀有度对应名称
|
|
||||||
RarityNameTag = ["普通", "高级", "稀有", "神器", "史诗", "勇者", "传说"];
|
|
||||||
//稀有度对应颜色
|
|
||||||
RarityColor = [0xffffffff, 0xff68d5ed, 0xffb36bff, 0xffff00f0, 0xffffb100, 0xffff6666, 0xffff5500];
|
|
||||||
//品级对应的文字显示
|
|
||||||
PercentageText = ["最下级", "下级", "中级", "上级", "最上级"];
|
|
||||||
// 定义每个品级对应的数值范围边界
|
|
||||||
PercentageRangeBoundaries = [20, 40, 60, 80];
|
|
||||||
//交易类型对应的文字显示
|
|
||||||
TradeTypeText = ["自由交易", "不可交易", "封装", "账号绑定"];
|
|
||||||
//交易类型对应的文字颜色
|
|
||||||
TradeTypeColor = [0xffffffff, 0xffbb3332, 0xff4ba157, 0xffff5500];
|
|
||||||
//装备类型描述
|
|
||||||
GroupNameTag = ["武器", "防具", "饰品", "光环"];
|
|
||||||
|
|
||||||
|
|
||||||
constructor(Equipment) {
|
constructor(Equipment) {
|
||||||
this.Equipment = Equipment.weakref();
|
this.Equipment = Equipment.weakref();
|
||||||
base.constructor(clock() + "EquipmentInfo" + Equipment.Idx, 0, 0, 0, 0, 0);
|
base.constructor(clock() + "EquipmentInfo" + Equipment.Idx, 0, 0, 0, 0, 0);
|
||||||
|
|
||||||
//210
|
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
local background = Yosin_NineBoxStretch(0, 0, 208, RealCanvasHeight + 10, "sprite/interface/lenheartwindowcommon.img", 213);
|
local background = Yosin_NineBoxStretch(0, 0, 211, RealCanvasHeight + 10, "sprite/interface/lenheartwindowcommon.img", 213);
|
||||||
background.SetZOrder(-1);
|
background.SetZOrder(-1);
|
||||||
AddUIChild(background);
|
Addchild(background);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Init() {
|
function Init() {
|
||||||
|
|
@ -55,26 +64,14 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
||||||
|
|
||||||
//构造图标 及图标边框
|
//构造图标 及图标边框
|
||||||
if (Equipment.Icon) {
|
if (Equipment.Icon) {
|
||||||
local Icon = CL_SpriteFrameObject(Equipment.Icon.path, Equipment.Icon.index);
|
local Icon = GameItem.EquipmentIcon(Equipment);
|
||||||
Canvas.DrawSpriteFrame(Icon, 7, 7);
|
Canvas.DrawActor(Icon, 7, 7);
|
||||||
|
|
||||||
local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + RarityFrameColorIdx[Equipment.Rarity]);
|
|
||||||
Canvas.DrawSpriteFrame(IconFrame, 7, 7);
|
|
||||||
|
|
||||||
//是否封装
|
|
||||||
local IsPackage = Equipment.Property ? Equipment.Property.IsPackage : 1;
|
|
||||||
if (IsPackage && (Equipment.Rarity == 2 || Equipment.Rarity == 3)) {
|
|
||||||
local IconFrame = CL_SpriteObject("sprite/item/iconmark.img", 46);
|
|
||||||
IconFrame.SetMode(0);
|
|
||||||
IconFrame.SetPosition(8, 6);
|
|
||||||
Canvas.DrawSprite(IconFrame);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//绘制装备名称
|
//绘制装备名称
|
||||||
if (Equipment.Name.len() > 0) {
|
if (Equipment.Name.len() > 0) {
|
||||||
local EquName = FontAssetManager.GenerateNormal(Equipment.Name, false, {
|
local EquName = FontAssetManager.GenerateNormal(Equipment.Name, false, {
|
||||||
color = RarityColor[Equipment.Rarity]
|
color = GameItem.EquipmentInfoTag.rarity_color[Equipment.Rarity]
|
||||||
});
|
});
|
||||||
Canvas.DrawActor(EquName, 41, 7);
|
Canvas.DrawActor(EquName, 41, 7);
|
||||||
}
|
}
|
||||||
|
|
@ -100,8 +97,8 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
||||||
Canvas.DrawActor(PercentageGradeText, 6, 41);
|
Canvas.DrawActor(PercentageGradeText, 6, 41);
|
||||||
Canvas.DrawActor(PercentageText, 130, 41);
|
Canvas.DrawActor(PercentageText, 130, 41);
|
||||||
//绘制稀有度名称
|
//绘制稀有度名称
|
||||||
local RarityTagName = FontAssetManager.GenerateNormal(RarityNameTag[Equipment.Rarity], false, {
|
local RarityTagName = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.rarity_name_tag[Equipment.Rarity], false, {
|
||||||
color = RarityColor[Equipment.Rarity]
|
color = GameItem.EquipmentInfoTag.rarity_color[Equipment.Rarity]
|
||||||
});
|
});
|
||||||
Canvas.DrawActor(RarityTagName, 210 - RarityTagName.GetSize().w - 6, 41);
|
Canvas.DrawActor(RarityTagName, 210 - RarityTagName.GetSize().w - 6, 41);
|
||||||
|
|
||||||
|
|
@ -119,8 +116,8 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
||||||
|
|
||||||
//绘制交易类型 如果有主体属性读取 否则一律为封装
|
//绘制交易类型 如果有主体属性读取 否则一律为封装
|
||||||
local TradeType = Equipment.Property ? Equipment.Property.TradeType : 0;
|
local TradeType = Equipment.Property ? Equipment.Property.TradeType : 0;
|
||||||
local TradeTypeText = FontAssetManager.GenerateNormal(TradeTypeText[TradeType], false, {
|
local TradeTypeText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.trade_type_text[TradeType], false, {
|
||||||
color = TradeTypeColor[TradeType]
|
color = GameItem.EquipmentInfoTag.trade_type_color[TradeType]
|
||||||
});
|
});
|
||||||
Canvas.DrawActor(TradeTypeText, 210 - TradeTypeText.GetSize().w - 6, 73);
|
Canvas.DrawActor(TradeTypeText, 210 - TradeTypeText.GetSize().w - 6, 73);
|
||||||
|
|
||||||
|
|
@ -321,30 +318,31 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
||||||
|
|
||||||
// 根据数值获取对应的品级文字
|
// 根据数值获取对应的品级文字
|
||||||
function GetPercentageText(num) {
|
function GetPercentageText(num) {
|
||||||
if (num< PercentageRangeBoundaries[0]) {
|
if (num< GameItem.EquipmentInfoTag.percentage_range_boundaries[0]) {
|
||||||
return PercentageText[0];
|
return GameItem.EquipmentInfoTag.percentage_text[0];
|
||||||
}
|
}
|
||||||
for (local i = 0; i< PercentageRangeBoundaries.len(); i++) {
|
for (local i = 0; i< GameItem.EquipmentInfoTag.percentage_range_boundaries.len(); i++) {
|
||||||
if (num <= PercentageRangeBoundaries[i]) {
|
if (num <= GameItem.EquipmentInfoTag.percentage_range_boundaries[i]) {
|
||||||
return PercentageText[i + 1];
|
return GameItem.EquipmentInfoTag.percentage_text[i + 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PercentageText.top();
|
return GameItem.EquipmentInfoTag.percentage_text.top();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!getroottable().rawin("chongzaiflag")) {
|
|
||||||
getroottable()["chongzaiflag"] <- true;
|
// if (!getroottable().rawin("chongzaiflag")) {
|
||||||
} else {
|
// getroottable()["chongzaiflag"] <- true;
|
||||||
//遍历窗口队列 如果可见则调用Show
|
// } else {
|
||||||
for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
// //遍历窗口队列 如果可见则调用Show
|
||||||
local Window = _SYS_WINDOW_LIST_[i];
|
// for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
||||||
Window.Visible = false;
|
// local Window = _SYS_WINDOW_LIST_[i];
|
||||||
Window.RemoveSelf();
|
// Window.Visible = false;
|
||||||
}
|
// Window.RemoveSelf();
|
||||||
TestStage();
|
// }
|
||||||
}
|
// TestStage();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -552,11 +550,12 @@ class GameItem.Equipment extends GameItem.Item {
|
||||||
|
|
||||||
//获取装备信息窗口
|
//获取装备信息窗口
|
||||||
function GetEquipmentInfoWindow() {
|
function GetEquipmentInfoWindow() {
|
||||||
if (Property) {
|
return GameItem.EquipmentInfo(this);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
//获取装备图标精灵
|
||||||
return GameItem.EquipmentInfo(this);
|
function GetEquipmentIconSprite() {
|
||||||
}
|
return GameItem.EquipmentIcon(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//穿戴装备回调
|
//穿戴装备回调
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class GameObject.NPC extends GameObject.BaseClass {
|
||||||
//设置Ani描边
|
//设置Ani描边
|
||||||
Ani.SetOutline(true, sq_RGBA(155, 255, 0, 250));
|
Ani.SetOutline(true, sq_RGBA(155, 255, 0, 250));
|
||||||
//设置鼠标
|
//设置鼠标
|
||||||
Yosin_Cursor.ChangeActive(120, 4);
|
IMouse.ChangeActive(120, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,7 +80,7 @@ class GameObject.NPC extends GameObject.BaseClass {
|
||||||
IsHover = false;
|
IsHover = false;
|
||||||
Ani.SetOutline(false);
|
Ani.SetOutline(false);
|
||||||
//设置鼠标
|
//设置鼠标
|
||||||
Yosin_Cursor.Change(0);
|
IMouse.Change(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,24 +12,39 @@ function TestStage() {
|
||||||
|
|
||||||
// local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
|
// local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
|
||||||
|
|
||||||
|
// local BackGround = CL_SpriteObject("sprite/loding.img", 0);
|
||||||
|
// T.Addchild(BackGround);
|
||||||
|
|
||||||
|
// local Equ = GameItem.Equipment(27675);
|
||||||
|
// local Window = Equ.GetEquipmentInfoWindow();
|
||||||
|
// Window.SetPosition(100, 80);
|
||||||
|
// Window.ResetFocus();
|
||||||
|
|
||||||
|
// local Equ = GameItem.Equipment(101020048);
|
||||||
|
// local Window = Equ.GetEquipmentInfoWindow();
|
||||||
|
// Window.SetPosition(350, 80);
|
||||||
|
// Window.ResetFocus();
|
||||||
|
|
||||||
|
// local Equ = GameItem.Equipment(24144);
|
||||||
|
// local Window = Equ.GetEquipmentInfoWindow();
|
||||||
|
// Window.SetPosition(580, 80);
|
||||||
|
// Window.ResetFocus();
|
||||||
|
|
||||||
|
|
||||||
local Equ = GameItem.Equipment(27675);
|
local TownObj = Town(1);
|
||||||
local Window = Equ.GetEquipmentInfoWindow();
|
local Charc = GameObject.CreateCharacter(0, [101590007, 27675, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]);
|
||||||
Window.SetPosition(100, 80);
|
TownObj.AddObject(Charc, true);
|
||||||
Window.ResetFocus();
|
ClientCharacter = Charc;
|
||||||
|
|
||||||
local Equ = GameItem.Equipment(101020048);
|
local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20);
|
||||||
local Window = Equ.GetEquipmentInfoWindow();
|
|
||||||
Window.SetPosition(350, 80);
|
|
||||||
Window.ResetFocus();
|
|
||||||
|
|
||||||
local Equ = GameItem.Equipment(24144);
|
Window.equipmentPage.Item.ItemCollection.SetItemList([{
|
||||||
local Window = Equ.GetEquipmentInfoWindow();
|
ItemId = 27675
|
||||||
Window.SetPosition(580, 80);
|
}, {
|
||||||
Window.ResetFocus();
|
ItemId = 101020048
|
||||||
|
}, {
|
||||||
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20);
|
ItemId = 24144
|
||||||
|
}]);
|
||||||
|
|
||||||
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20);
|
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20);
|
||||||
// //大背景
|
// //大背景
|
||||||
|
|
@ -44,10 +59,6 @@ function TestStage() {
|
||||||
// NPCobj.SetPosition(400, 400, 0);
|
// NPCobj.SetPosition(400, 400, 0);
|
||||||
// T.Addchild(NPCobj);
|
// T.Addchild(NPCobj);
|
||||||
|
|
||||||
// local TownObj = Town(1);
|
|
||||||
// local Charc = GameObject.CreateCharacter(0, [101590007, 27675, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]);
|
|
||||||
// TownObj.AddObject(Charc, true);
|
|
||||||
// ClientCharacter = Charc;
|
|
||||||
|
|
||||||
|
|
||||||
// local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0);
|
// local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0);
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,12 @@ class _IMouse_ extends _Yosin_Cursor {
|
||||||
//动态帧 Timer
|
//动态帧 Timer
|
||||||
ActiveFrameTimer = 0;
|
ActiveFrameTimer = 0;
|
||||||
|
|
||||||
|
//挂载的对象List
|
||||||
|
AttachObjList = null;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
NormalC = [];
|
NormalC = [];
|
||||||
|
AttachObjList = {};
|
||||||
base.constructor();
|
base.constructor();
|
||||||
getroottable().IMouse <- this;
|
getroottable().IMouse <- this;
|
||||||
|
|
||||||
|
|
@ -61,6 +65,26 @@ class _IMouse_ extends _Yosin_Cursor {
|
||||||
this.ActiveCurrentFrame = 0;
|
this.ActiveCurrentFrame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//挂载一个对象位于鼠标下
|
||||||
|
function AttachObjectBottom(KeyName, Obj) {
|
||||||
|
AttachObjList.rawset(KeyName, {
|
||||||
|
Object = Obj,
|
||||||
|
ZOrder = Obj.GetZOrder
|
||||||
|
});
|
||||||
|
Obj.SetZOrder(-1);
|
||||||
|
Addchild(Obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
//移除一个挂载的对象
|
||||||
|
function RemoveObject(KeyName) {
|
||||||
|
if (AttachObjList.rawin(KeyName)) {
|
||||||
|
local Obj = AttachObjList[KeyName].Object;
|
||||||
|
Obj.SetZOrder(AttachObjList[KeyName].ZOrder);
|
||||||
|
Removechild(Obj);
|
||||||
|
AttachObjList.rawdelete(KeyName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
文件名:5_Inventory.nut
|
||||||
|
路径:User/UI/Window/5_Inventory.nut
|
||||||
|
创建日期:2025-01-02 12:37
|
||||||
|
文件用途: 背包窗口
|
||||||
|
*/
|
||||||
|
|
||||||
|
class _Inventory extends Yosin_Window {
|
||||||
|
|
||||||
|
item = null;
|
||||||
|
dressUpTitleBtn = null;
|
||||||
|
petTitleBtn = null;
|
||||||
|
stoneTitleBtn = null;
|
||||||
|
|
||||||
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||||
|
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||||
|
|
||||||
|
local title = Yosin_TopTitle(gWidth, gHeight, "装备栏(I)");
|
||||||
|
AddUIChild(title);
|
||||||
|
|
||||||
|
local item2 = Yosin_EmeStretch(100, 100, 80, 25, "sprite/interface/lenheartwindowcommon.img", 160);
|
||||||
|
Addchild(item2);
|
||||||
|
|
||||||
|
//注册控件
|
||||||
|
RegisterWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
function RegisterWidget() {
|
||||||
|
|
||||||
|
//, "装扮", "宠物", "护石"
|
||||||
|
local titlesBtn = Yosin_RowMoreTitleBtn(10, 25, ["物品栏"]);
|
||||||
|
AddUIChild(titlesBtn);
|
||||||
|
|
||||||
|
titlesBtn.LBDownOnClick = function(btns, index) {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
local item = Yosin_SplicingButton(10, 50, 80, 25, "sprite/interface/lenheartwindowcommon.img", 160, true, false);
|
||||||
|
AddUIChild(item);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//逻辑入口
|
||||||
|
function Proc(Dt) {
|
||||||
|
SyncPos(X, Y);
|
||||||
|
base.Proc(Dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
//local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 555, 20);
|
//local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 555, 20);
|
||||||
class _Inventory extends Yosin_Window {
|
class _Inventory extends Yosin_Window {
|
||||||
|
|
||||||
|
equipmentPage = null;
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
|
@ -29,7 +31,7 @@ class _Inventory extends Yosin_Window {
|
||||||
};
|
};
|
||||||
|
|
||||||
//物品栏 装备页
|
//物品栏 装备页
|
||||||
local equipmentPage = Inventory_EquipmentPage( 2, titlesBtn.bottom() + 4, 300, Height - titlesBtn.bottom() - 4);
|
equipmentPage = Inventory_EquipmentPage(2, titlesBtn.bottom() + 4, 300, Height - titlesBtn.bottom() - 4);
|
||||||
AddUIChild(equipmentPage);
|
AddUIChild(equipmentPage);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -41,5 +43,4 @@ class _Inventory extends Yosin_Window {
|
||||||
base.Proc(Dt);
|
base.Proc(Dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
// 背包装备页面
|
// 背包装备页面
|
||||||
class Inventory_EquipmentPage extends Yosin_CommonUi {
|
class Inventory_EquipmentPage extends Yosin_CommonUi {
|
||||||
|
|
||||||
|
Item = null;
|
||||||
|
|
||||||
constructor(x, y, w, h) {
|
constructor(x, y, w, h) {
|
||||||
base.constructor(x, y, w, h);
|
base.constructor(x, y, w, h);
|
||||||
|
|
||||||
|
|
@ -17,8 +19,8 @@ class Inventory_EquipmentPage extends Yosin_CommonUi {
|
||||||
AddUIChild(charactersEquipment);
|
AddUIChild(charactersEquipment);
|
||||||
|
|
||||||
// 物品栏
|
// 物品栏
|
||||||
local item = InventoryItem(0, charactersEquipment.bottom(), Width, Height - charactersEquipment.bottom());
|
Item = InventoryItem(0, charactersEquipment.bottom(), Width, Height - charactersEquipment.bottom());
|
||||||
AddUIChild(item);
|
AddUIChild(Item);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,28 +72,28 @@ class Inventory_CharactersEquipment extends Yosin_CommonUi {
|
||||||
// 添加按钮
|
// 添加按钮
|
||||||
function AddButton() {
|
function AddButton() {
|
||||||
// 称号
|
// 称号
|
||||||
local designation = Yosin_TwoImgButton(2, Height - 30, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 50);
|
local designation = Yosin_BaseButton(2, Height - 30, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 50);
|
||||||
//点击事件回调
|
//点击事件回调
|
||||||
// permutationBtn.OnClick = function(Button) {
|
// permutationBtn.OnClick = function(Button) {
|
||||||
// }.bindenv(this);
|
// }.bindenv(this);
|
||||||
AddUIChild(designation);
|
AddUIChild(designation);
|
||||||
|
|
||||||
// 增益强化
|
// 增益强化
|
||||||
local intensify = Yosin_TwoImgButton(designation.right() +2, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 128);
|
local intensify = Yosin_BaseButton(designation.right() + 2, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 128);
|
||||||
AddUIChild(intensify);
|
AddUIChild(intensify);
|
||||||
// 皮肤仓库
|
// 皮肤仓库
|
||||||
local skin = Yosin_TwoImgButton(intensify.right() + 2, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 134);
|
local skin = Yosin_BaseButton(intensify.right() + 2, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 134);
|
||||||
AddUIChild(skin);
|
AddUIChild(skin);
|
||||||
|
|
||||||
// 穿戴中的装备
|
// 穿戴中的装备
|
||||||
local wear = Yosin_TwoImgButton(Width - 29, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 172);
|
local wear = Yosin_BaseButton(Width - 29, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 172);
|
||||||
AddUIChild(wear);
|
AddUIChild(wear);
|
||||||
// 装备特性
|
// 装备特性
|
||||||
local peculiarity = Yosin_TwoImgButton(wear.X - 21, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 203);
|
local peculiarity = Yosin_BaseButton(wear.X - 21, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 203);
|
||||||
AddUIChild(peculiarity);
|
AddUIChild(peculiarity);
|
||||||
// 未央环境装备
|
// 未央环境装备
|
||||||
local weiyangBtn = Yosin_TwoImgButton(peculiarity.X - 21, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory_cn.img", 26);
|
// local permutationBtn = Yosin_BaseButton(peculiarity.X - 21, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 128);
|
||||||
AddUIChild(weiyangBtn);
|
// AddUIChild(permutationBtn);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -148,6 +150,7 @@ class Inventory_CharactersEquipment extends Yosin_CommonUi {
|
||||||
|
|
||||||
// 物品栏
|
// 物品栏
|
||||||
class InventoryItem extends Yosin_CommonUi {
|
class InventoryItem extends Yosin_CommonUi {
|
||||||
|
ItemCollection = null;
|
||||||
|
|
||||||
constructor(gX, gY, gWidth, gHeight) {
|
constructor(gX, gY, gWidth, gHeight) {
|
||||||
base.constructor(gX, gY, gWidth, gHeight);
|
base.constructor(gX, gY, gWidth, gHeight);
|
||||||
|
|
@ -165,8 +168,8 @@ class InventoryItem extends Yosin_CommonUi {
|
||||||
Addchild(itemBg);
|
Addchild(itemBg);
|
||||||
|
|
||||||
// 物品栏
|
// 物品栏
|
||||||
local itemCollection = itemCollection(itemBg.X + 7, itemBg.Y + 7, 239, 209, 7, 8);
|
ItemCollection = _ItemCollection(itemBg.X + 7, itemBg.Y + 7, 7);
|
||||||
AddUIChild(itemCollection);
|
AddUIChild(ItemCollection);
|
||||||
|
|
||||||
|
|
||||||
local itemBgBottom = itemBg.bottom();
|
local itemBgBottom = itemBg.bottom();
|
||||||
|
|
@ -174,7 +177,7 @@ class InventoryItem extends Yosin_CommonUi {
|
||||||
local weight = FontAssetManager.GenerateNormal("重量", true, {
|
local weight = FontAssetManager.GenerateNormal("重量", true, {
|
||||||
color = sq_RGBA(160, 132, 75, 255)
|
color = sq_RGBA(160, 132, 75, 255)
|
||||||
});
|
});
|
||||||
weight.SetPosition(itemCollection.X + 5, itemBgBottom - weight.GetSize().h - 5);
|
weight.SetPosition(ItemCollection.X + 5, itemBgBottom - weight.GetSize().h - 5);
|
||||||
Addchild(weight);
|
Addchild(weight);
|
||||||
|
|
||||||
// 重量进度条
|
// 重量进度条
|
||||||
|
|
@ -203,7 +206,10 @@ class InventoryItem extends Yosin_CommonUi {
|
||||||
local moneyItem = MoneyItem(5, itemBgBottom + 3, 3);
|
local moneyItem = MoneyItem(5, itemBgBottom + 3, 3);
|
||||||
AddUIChild(moneyItem);
|
AddUIChild(moneyItem);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetItemList(gItemList) {
|
||||||
|
ItemCollection.SetItemList(gItemList);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -233,7 +239,7 @@ class MoneyItem extends Yosin_CommonUi {
|
||||||
local winNum = FontAssetManager.GenerateNormal("23434个", true, {
|
local winNum = FontAssetManager.GenerateNormal("23434个", true, {
|
||||||
color = txtColor
|
color = txtColor
|
||||||
});
|
});
|
||||||
winNum.SetPosition( 245 - winNum.GetSize().w, 2);
|
winNum.SetPosition(245 - winNum.GetSize().w, 2);
|
||||||
Addchild(winNum);
|
Addchild(winNum);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,62 +4,159 @@
|
||||||
创建日期:2025-01-06 13:50
|
创建日期:2025-01-06 13:50
|
||||||
文件用途: 物品栏
|
文件用途: 物品栏
|
||||||
*/
|
*/
|
||||||
|
//物品槽
|
||||||
|
class ItemSlot {
|
||||||
|
X = null;
|
||||||
|
Y = null;
|
||||||
|
|
||||||
|
//物品对象
|
||||||
|
Item = null;
|
||||||
|
//物品对象的图标
|
||||||
|
ItemIcon = null;
|
||||||
|
//物品对象的详细信息窗口
|
||||||
|
ItemInfo = null;
|
||||||
|
//详细信息窗口显示Flag
|
||||||
|
ItemInfoShowFlag = false;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function SyncPos(x, y) {
|
||||||
|
this.X = x;
|
||||||
|
this.Y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetItem(Item) {
|
||||||
|
this.Item = Item;
|
||||||
|
this.ItemIcon = this.Item.GetEquipmentIconSprite();
|
||||||
|
}
|
||||||
|
|
||||||
|
//生成详细信息
|
||||||
|
function GenerateInfo() {
|
||||||
|
this.ItemInfo = this.Item.GetEquipmentInfoWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
//显示详细信息
|
||||||
|
function ShowInfo(x, y) {
|
||||||
|
if (!this.ItemInfo) GenerateInfo();
|
||||||
|
this.ItemInfoShowFlag = true;
|
||||||
|
//设置位置
|
||||||
|
this.ItemInfo.SetPosition(x, y);
|
||||||
|
this.ItemInfo.ResetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
//关闭显示详细信息
|
||||||
|
function CloseInfo() {
|
||||||
|
if (this.ItemInfo) {
|
||||||
|
this.ItemInfoShowFlag = false;
|
||||||
|
this.ItemInfo.CloseWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 物品栏
|
// 物品栏
|
||||||
class itemCollection extends Yosin_CommonUi {
|
class _ItemCollection extends Yosin_CommonUi {
|
||||||
|
|
||||||
// 行
|
|
||||||
column = null;
|
|
||||||
// 列
|
|
||||||
row = null;
|
|
||||||
|
|
||||||
// 悬浮时显示的框
|
// 悬浮时显示的框
|
||||||
rect = null;
|
HoverEffect = null;
|
||||||
|
//行数
|
||||||
|
RowNum = null;
|
||||||
|
//底层画布对象
|
||||||
|
BottomCanvas = null;
|
||||||
|
//顶层画布对象
|
||||||
|
TopCanvas = null;
|
||||||
|
//物品对象List
|
||||||
|
ItemList = null;
|
||||||
|
//当前显示详细信息的物品对象
|
||||||
|
CurrentShowItem = null;
|
||||||
|
//当前鼠标指向的位置
|
||||||
|
ItemPos = null;
|
||||||
|
//拖拽中的物品对象
|
||||||
|
DragItem = null;
|
||||||
|
//拖拽物品原来的位置
|
||||||
|
DragItemPos = null;
|
||||||
|
|
||||||
columnNum = null;
|
|
||||||
rowNum = null;
|
|
||||||
|
|
||||||
Canvas = null;
|
constructor(x, y, rowNum) {
|
||||||
|
this.RowNum = rowNum;
|
||||||
|
//计算实际需要的高度
|
||||||
|
local RealH = 30 * rowNum;
|
||||||
|
base.constructor(x, y, 239, RealH);
|
||||||
|
|
||||||
constructor(x, y, w, h, columnNum, rowNum) {
|
//构造相应数量的槽
|
||||||
base.constructor(x, y, w, h);
|
ItemList = array(8 * rowNum, null);
|
||||||
this.columnNum = columnNum;
|
|
||||||
this.rowNum = rowNum;
|
|
||||||
|
|
||||||
|
//整体底板
|
||||||
|
InitOverallBasePlate();
|
||||||
|
|
||||||
|
|
||||||
|
HoverEffect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 131);
|
||||||
|
HoverEffect.SetZOrder(1);
|
||||||
|
HoverEffect.SetVisible(false);
|
||||||
|
Addchild(HoverEffect);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据高度绘制整体底板
|
||||||
|
function InitOverallBasePlate() {
|
||||||
// 创建画布
|
// 创建画布
|
||||||
Canvas = CL_CanvasObject();
|
BottomCanvas = CL_CanvasObject();
|
||||||
// 重设大小并清空
|
// 重设大小并清空
|
||||||
Canvas.ResizeAndClear(w, h);
|
BottomCanvas.ResizeAndClear(239, this.RowNum * 30);
|
||||||
// 开始绘制
|
// 开始绘制
|
||||||
Canvas.BeginDraw();
|
BottomCanvas.BeginDraw();
|
||||||
|
foreach(pos, ItemObj in ItemList) {
|
||||||
|
local XPos = (pos % 8) * 30;
|
||||||
|
local YPos = (pos / 8) * 30;
|
||||||
|
local bg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 49);
|
||||||
|
BottomCanvas.DrawSpriteFrame(bg, XPos, YPos);
|
||||||
|
}
|
||||||
|
// 结束绘制
|
||||||
|
BottomCanvas.EndDraw();
|
||||||
|
// 添加画布
|
||||||
|
Addchild(BottomCanvas);
|
||||||
|
}
|
||||||
|
|
||||||
local itemX = 0;
|
//设置道具列表
|
||||||
local itemY = 0;
|
function SetItemList(gItemList) {
|
||||||
for (local i = 0; i< columnNum; i++) {
|
|
||||||
local cells = [];
|
|
||||||
for (local i = 0; i< rowNum; i++) {
|
|
||||||
local bg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 49);
|
|
||||||
Canvas.DrawSpriteFrame(bg, itemX, itemY);
|
|
||||||
|
|
||||||
itemX += 30;
|
//创建道具
|
||||||
|
foreach(Index, ItemObject in gItemList) {
|
||||||
}
|
local ItemId = ItemObject.ItemId;
|
||||||
itemX = 0;
|
//TODO
|
||||||
itemY += 30;
|
local Item = GameItem.Equipment(ItemId);
|
||||||
|
ItemList[Index] = ItemSlot();
|
||||||
|
ItemList[Index].SetItem(Item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RefreshItemList();
|
||||||
|
}
|
||||||
|
|
||||||
|
//刷新道具列表
|
||||||
|
function RefreshItemList() {
|
||||||
|
//如果不存在则构造画布
|
||||||
|
if (!TopCanvas) {
|
||||||
|
// 创建画布
|
||||||
|
TopCanvas = CL_CanvasObject();
|
||||||
|
// 添加画布
|
||||||
|
Addchild(TopCanvas);
|
||||||
|
}
|
||||||
|
// 重设大小并清空
|
||||||
|
TopCanvas.ResizeAndClear(239, this.RowNum * 30);
|
||||||
|
// 开始绘制
|
||||||
|
TopCanvas.BeginDraw();
|
||||||
|
foreach(pos, ItemObj in ItemList) {
|
||||||
|
if (ItemObj) {
|
||||||
|
local XPos = (pos % 8) * 30;
|
||||||
|
local YPos = (pos / 8) * 30;
|
||||||
|
ItemObj.ItemIcon.SetPosition(XPos, YPos);
|
||||||
|
TopCanvas.DrawSprite(ItemObj.ItemIcon, XPos, YPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
// 结束绘制
|
// 结束绘制
|
||||||
Canvas.EndDraw();
|
TopCanvas.EndDraw();
|
||||||
// 添加画布
|
|
||||||
Addchild(Canvas);
|
|
||||||
|
|
||||||
|
|
||||||
rect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 131);
|
|
||||||
rect.SetVisible(false);
|
|
||||||
Addchild(rect);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -70,30 +167,109 @@ class itemCollection extends Yosin_CommonUi {
|
||||||
|
|
||||||
if (isInRect) {
|
if (isInRect) {
|
||||||
local WorldPosition = this.GetWorldPosition();
|
local WorldPosition = this.GetWorldPosition();
|
||||||
local xx = MousePos_X - WorldPosition.x -5;
|
local xx = MousePos_X - WorldPosition.x;
|
||||||
local yy = MousePos_Y - WorldPosition.y -5;
|
local yy = MousePos_Y - WorldPosition.y;
|
||||||
local column = (yy / 30).tointeger();
|
local column = (yy / 30).tointeger();
|
||||||
local row = (xx / 30).tointeger();
|
local row = (xx / 30).tointeger();
|
||||||
|
//指向的项目位置
|
||||||
|
local Idx = column * 8 + row;
|
||||||
local inRadius = column< columnNum && row< rowNum;
|
ItemPos = Idx;
|
||||||
local change = column != this.column || row != this.row;
|
//如果有道具
|
||||||
// 移动到另一个槽
|
if (ItemList[Idx]) {
|
||||||
if (change && inRadius) {
|
//设置透明度
|
||||||
|
HoverEffect.SetOpacity(0.4);
|
||||||
this.column = column;
|
//如果没有物品信息窗口
|
||||||
this.row = row;
|
if (!ItemList[Idx].ItemInfo) {
|
||||||
|
ItemList[Idx].GenerateInfo();
|
||||||
rect.SetVisible(true);
|
}
|
||||||
rect.SetPosition(row * 30, column * 30);
|
if (!ItemList[Idx].ItemInfoShowFlag) {
|
||||||
|
//关闭上一个显示的对象
|
||||||
|
if (CurrentShowItem) {
|
||||||
|
CurrentShowItem.CloseInfo();
|
||||||
|
}
|
||||||
|
//如果当前没有拖拽物品时才打开详细信息窗口
|
||||||
|
if (!DragItem) {
|
||||||
|
//显示详细信息
|
||||||
|
ItemList[Idx].ShowInfo(MousePos_X - 50, MousePos_Y - 150);
|
||||||
|
//记录当前显示的对象
|
||||||
|
CurrentShowItem = ItemList[Idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//关闭上一个显示的对象
|
||||||
|
if (CurrentShowItem) {
|
||||||
|
CurrentShowItem.CloseInfo();
|
||||||
|
}
|
||||||
|
HoverEffect.SetOpacity(1);
|
||||||
}
|
}
|
||||||
|
//设置悬停槽
|
||||||
|
HoverEffect.SetVisible(true);
|
||||||
|
HoverEffect.SetPosition(row * 30, column * 30);
|
||||||
} else {
|
} else {
|
||||||
this.column = null;
|
ItemPos = null;
|
||||||
this.row = null;
|
HoverEffect.SetVisible(false);
|
||||||
rect.SetVisible(false);
|
//关闭所有详细信息显示
|
||||||
|
foreach(ItemObj in ItemList) {
|
||||||
|
if (ItemObj && ItemObj.ItemInfoShowFlag) {
|
||||||
|
ItemObj.CloseInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//override
|
||||||
|
//鼠标左键按下回调
|
||||||
|
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||||
|
if (!Visible) return;
|
||||||
|
base.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||||
|
//关闭显示的对象
|
||||||
|
if (CurrentShowItem) {
|
||||||
|
CurrentShowItem.CloseInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ItemPos != null && ItemList[ItemPos]) {
|
||||||
|
DragItem = ItemList[ItemPos];
|
||||||
|
DragItemPos = ItemPos;
|
||||||
|
ItemList[ItemPos] = null;
|
||||||
|
local IconBuffer = DragItem.Item.GetEquipmentIconSprite();
|
||||||
|
IconBuffer.SetPosition(-15, -15);
|
||||||
|
IMouse.AttachObjectBottom("ItemCollectDragItem", IconBuffer);
|
||||||
|
RefreshItemList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//override
|
||||||
|
//鼠标左键弹起回调
|
||||||
|
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||||
|
if (!Visible) return;
|
||||||
|
base.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||||
|
|
||||||
|
if (DragItem) {
|
||||||
|
//如果这个格子不是空的 要把他放回交换的位置
|
||||||
|
if (ItemList[ItemPos] != null) {
|
||||||
|
local Temp = ItemList[ItemPos];
|
||||||
|
ItemList[DragItemPos] = Temp;
|
||||||
|
DragItemPos = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemList[ItemPos] = DragItem;
|
||||||
|
DragItem = null;
|
||||||
|
IMouse.RemoveObject("ItemCollectDragItem");
|
||||||
|
RefreshItemList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!getroottable().rawin("chongzaiflag")) {
|
||||||
|
getroottable()["chongzaiflag"] <- true;
|
||||||
|
} else {
|
||||||
|
//遍历窗口队列 如果可见则调用Show
|
||||||
|
for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
||||||
|
local Window = _SYS_WINDOW_LIST_[i];
|
||||||
|
Window.Visible = false;
|
||||||
|
Window.RemoveSelf();
|
||||||
|
}
|
||||||
|
TestStage();
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
equipment/equipmentinfo.etc 装备信息界面的配置
|
||||||
|
|
||||||
|
角色chr文件新增了[default avatar] 的标签用于设置 角色默认装备
|
||||||
Loading…
Reference in New Issue