Compare commits

...

3 Commits

Author SHA1 Message Date
WONIU 72d2e37fb0 背包界面完成 2025-01-08 16:39:29 +08:00
WONIU a61d91db67 Merge remote-tracking branch 'origin/dong' into yi 2025-01-08 13:53:31 +08:00
Lenheart 75a6cd6415 画布新增 DrawSprite 方法 2025-01-08 13:49:58 +08:00
9 changed files with 221 additions and 206 deletions

Binary file not shown.

View File

@ -63,11 +63,17 @@ class CL_CanvasObject extends CL_BaseObject {
}
//绘制演员
function DrawActor(Actor, XPos, YPos) {
function DrawActor(Actor, XPos = 0, YPos = 0) {
if (!Context) error("请先刷新上下文");
Canvas_DrawActor(this.C_Object, Context, Actor.C_Object, XPos, YPos);
}
//绘制精灵
function DrawSprite(Actor, XPos = 0, YPos = 0) {
if (!Context) error("请先刷新上下文");
Canvas_DrawSprite(this.C_Object, Context, Actor.C_Object, XPos, YPos);
}
//绘制精灵帧
function DrawSpriteFrame(SpriteFrame, XPos, YPos, Width = null, Height = null) {
if (!Context) error("请先刷新上下文");

View File

@ -154,6 +154,13 @@ class Yosin_EmeStretch extends Yosin_CommonUi {
this.Idx = Idx;
base.constructor(X, Y, W, H);
// 创建画布
local Canvas = CL_CanvasObject();
// 重设大小并清空
Canvas.ResizeAndClear( W, H);
// 开始绘制
Canvas.BeginDraw();
SpriteList = [];
SpriteList.push(CL_SpriteObject(Path, Idx));
SpriteList.push(CL_SpriteObject(Path, Idx + 1));
@ -179,142 +186,26 @@ class Yosin_EmeStretch extends Yosin_CommonUi {
}
foreach(Child in SpriteList) {
Addchild(Child);
// Addchild(Child);
Canvas.DrawSprite(Child);
}
// 结束绘制
Canvas.EndDraw();
// 添加画布
Addchild(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 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);
// // 左上角
// // backgroundTopLeft.SetPosition(0, 0);
// // Addchild(backgroundTopLeft);
// Canvas.DrawActor(backgroundTopLeft, 0, 0);
// 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.SetPosition(backgroundTopLeft.right() + 1, 0);
// backgroundTop.SetScale(scaleW, 1);
// // Addchild(backgroundTop);
// Canvas.DrawActor(backgroundTop, TopLeftRight + 1, 0);
// // 右上角
// // backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w, 0);
// // Addchild(backgroundTopRight);
// Canvas.DrawActor(backgroundTopRight, width - backgroundTopRight.GetSize().w, 0);
// // 左边
// // backgroundLeft.SetPosition(0, backgroundTopLeft.bottom() + 1);
// backgroundLeft.SetScale(1, scaleH);
// // Addchild(backgroundLeft);
// Canvas.DrawActor(backgroundLeft, 0, TopLeftBottom + 1);
// // 中间
// // backgroundCenter.SetPosition(backgroundLeft.right() + 1, backgroundLeft.Y);
// backgroundCenter.SetScale(scaleW, scaleH);
// // Addchild(backgroundCenter);
// Canvas.DrawActor(backgroundCenter, TopLeftRight + 1, backgroundLeft.Y);
// // 右边
// // backgroundRight.SetPosition(width - backgroundRight.GetSize().w, backgroundCenter.Y);
// backgroundRight.SetScale(1, scaleH);
// // Addchild(backgroundRight);
// Canvas.DrawActor(backgroundRight, width - backgroundRight.GetSize().w, backgroundCenter.Y);
// // 左下角
// // backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h);
// // Addchild(backgroundBottomLeft);
// Canvas.DrawActor(backgroundBottomLeft, 0, height - backgroundBottomLeft.GetSize().h);
// // 下边
// // backgroundBottom.SetPosition(backgroundBottomLeft.right() + 1, backgroundBottomLeft.Y);
// backgroundBottom.SetScale(scaleW, 1);
// // Addchild(backgroundBottom);
// Canvas.DrawActor(backgroundBottom, TopLeftRight + 1, backgroundBottomLeft.Y);
// // 右下角
// // backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w, backgroundBottomLeft.Y);
// // Addchild(backgroundBottomRight);
// Canvas.DrawActor(backgroundBottomRight,width - backgroundBottomRight.GetSize().w, backgroundBottomLeft.Y );
// // 结束绘制
// Canvas.EndDraw();
// // 添加画布
// Addchild(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) {
// 九宫格拉伸
function Yosin_NineBoxStretch(X, Y, width, height, path, imgId) {
// 创建画布
local Canvas = CL_CanvasObject();
Canvas.SetPosition(X, Y);
// 重设大小并清空
Canvas.ResizeAndClear(width, height);
// 开始绘制
@ -342,9 +233,7 @@ class Yosin_NineBoxStretch extends Yosin_CommonUi {
// 左上角
// backgroundTopLeft.SetPosition(0, 0);
// Addchild(backgroundTopLeft);
Canvas.DrawActor(backgroundTopLeft, 0, 0);
Canvas.DrawSprite(backgroundTopLeft);
local TopLeftSize = backgroundTopLeft.GetSize();
local TopLeftBottom = TopLeftSize.h;
@ -363,45 +252,159 @@ class Yosin_NineBoxStretch extends Yosin_CommonUi {
local scaleH = (centerHeight - 1).tofloat() / centerImgHeight.tofloat();
// 上边
// backgroundTop.SetScale(scaleW, 1);
// Canvas.DrawActor(backgroundTop, TopLeftRight + 1, 0);
// Canvas.DrawActor(backgroundTop, 20, 30);
backgroundTop.SetScale(scaleW, 1);
backgroundTop.SetPosition(TopLeftRight + 1, 0);
Canvas.DrawSprite(backgroundTop);
// // 右上角
// Canvas.DrawActor(backgroundTopRight, width - backgroundTopRight.GetSize().w, 0);
// 右上角
backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w, 0);
Canvas.DrawSprite(backgroundTopRight);
// // 左边
// backgroundLeft.SetScale(1, scaleH);
// Canvas.DrawActor(backgroundLeft, 0, TopLeftBottom + 1);
// 左边
backgroundLeft.SetScale(1, scaleH);
backgroundLeft.SetPosition(0, TopLeftBottom + 1);
Canvas.DrawSprite(backgroundLeft);
// // 中间
// backgroundCenter.SetScale(scaleW, scaleH);
// // Addchild(backgroundCenter);
// Canvas.DrawActor(backgroundCenter, TopLeftRight + 1, backgroundLeft.Y);
// 中间
backgroundCenter.SetScale(scaleW, scaleH);
// Addchild(backgroundCenter);
backgroundCenter.SetPosition(TopLeftRight + 1, backgroundLeft.Y);
Canvas.DrawSprite(backgroundCenter);
// // 右边
// backgroundRight.SetScale(1, scaleH);
// Canvas.DrawActor(backgroundRight, width - backgroundRight.GetSize().w, backgroundCenter.Y);
// 右边
backgroundRight.SetScale(1, scaleH);
backgroundRight.SetPosition(width - backgroundRight.GetSize().w, backgroundCenter.Y);
Canvas.DrawSprite(backgroundRight);
// // 左下角
// Canvas.DrawActor(backgroundBottomLeft, 0, height - backgroundBottomLeft.GetSize().h);
// 左下角
backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h);
Canvas.DrawSprite(backgroundBottomLeft);
// // 下边
// backgroundBottom.SetScale(scaleW, 1);
// Canvas.DrawActor(backgroundBottom, TopLeftRight + 1, backgroundBottomLeft.Y);
// 下边
backgroundBottom.SetScale(scaleW, 1);
backgroundBottom.SetPosition(TopLeftRight + 1, backgroundBottomLeft.Y);
Canvas.DrawSprite(backgroundBottom);
// // 右下角
// Canvas.DrawActor(backgroundBottomRight,width - backgroundBottomRight.GetSize().w, backgroundBottomLeft.Y );
// 右下角
backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w, backgroundBottomLeft.Y);
Canvas.DrawSprite(backgroundBottomRight );
// 结束绘制
Canvas.EndDraw();
// 添加画布
Addchild(Canvas);
}
// Addchild(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 {
//按钮状态
@ -675,14 +678,14 @@ class Yosin_RowMoreTitleBtn extends Yosin_CommonUi {
btns = null;
tests = null;
constructor(X, Y, titles, path, idx, selectIndex = 0, baseWidth = 34) {
constructor(X, Y, W, titles, path, idx, baseWidth = 48) {
this.tests = titles;
btns = [];
local btnX = 0;
local btnX = 5;
for (local i = 0; i< titles.len(); i++) {
local textW = FontAssetManager.GenerateNormal(titles[i], true).GetSize().w + 10;
local btnW = baseWidth + 10;
local btnW = baseWidth;
btnW = textW > btnW ? textW : btnW;
local titleBtn = Yosin_StretchTitleButton(btnX, 1, btnW, 19, path, idx, titles[i]);
@ -702,7 +705,7 @@ class Yosin_RowMoreTitleBtn extends Yosin_CommonUi {
};
btns.push(titleBtn);
btnX += btnW + 1;
btnX += btnW;
}
base.constructor(X, Y, btnX, 21);
@ -713,6 +716,27 @@ class Yosin_RowMoreTitleBtn extends Yosin_CommonUi {
btns[0].SetSelect(true);
// 创建画布
local Canvas = CL_CanvasObject();
Canvas.SetPosition(0, 19);
// 重设大小并清空
Canvas.ResizeAndClear(W, 1);
// 设置填充画刷 用于绘制边框和线条
Canvas.SetFillBrush(sq_RGBA(66, 61, 59, 250));
// 设置轮廓画刷 用于绘制边框和线条
Canvas.SetStrokeBrush(sq_RGBA(66, 61, 59, 250));
// 开始绘制
Canvas.BeginDraw();
// 画线段
Canvas.DrawLine(0, 1, W, 1);
// 结束绘制
Canvas.EndDraw();
// 添加画布
Addchild(Canvas);
}
}
@ -745,16 +769,3 @@ class Yosin_Schedule extends Yosin_CommonUi {
BarSprite.SetSize(barW, barSize.h);
}
}
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();
}

View File

@ -60,6 +60,15 @@ class GameItem.EquipmentInfo extends Yosin_Window {
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);
}
}
//绘制装备名称
@ -108,12 +117,12 @@ class GameItem.EquipmentInfo extends Yosin_Window {
});
Canvas.DrawActor(MinUseLevelText, 210 - MinUseLevelText.GetSize().w - 6, 57);
//绘制是否封装 如果有主体属性读取 否则一律为封装
local IsPackage = Equipment.Property ? Equipment.Property.IsPackage : 0;
local IsPackageText = FontAssetManager.GenerateNormal(TradeTypeText[IsPackage], false, {
color = TradeTypeColor[IsPackage]
//绘制交易类型 如果有主体属性读取 否则一律为封装
local TradeType = Equipment.Property ? Equipment.Property.TradeType : 0;
local TradeTypeText = FontAssetManager.GenerateNormal(TradeTypeText[TradeType], false, {
color = TradeTypeColor[TradeType]
});
Canvas.DrawActor(IsPackageText, 210 - IsPackageText.GetSize().w - 6, 73);
Canvas.DrawActor(TradeTypeText, 210 - TradeTypeText.GetSize().w - 6, 73);
//绘制装备类型
local GroupNameText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.item_group_name_table[Equipment.GroupName], false, {

View File

@ -14,22 +14,22 @@ function TestStage() {
// local Equ = GameItem.Equipment(27675);
// local Window = Equ.GetEquipmentInfoWindow();
// Window.SetPosition(100, 80);
// Window.ResetFocus();
local Equ = GameItem.Equipment(27675);
local Window = Equ.GetEquipmentInfoWindow();
Window.SetPosition(100, 80);
Window.ResetFocus();
// local Equ = GameItem.Equipment(101020048);
// local Window = Equ.GetEquipmentInfoWindow();
// Window.SetPosition(350, 80);
// Window.ResetFocus();
local Equ = GameItem.Equipment(101020048);
local Window = Equ.GetEquipmentInfoWindow();
Window.SetPosition(350, 80);
Window.ResetFocus();
// local Equ = GameItem.Equipment(24144);
// local Window = Equ.GetEquipmentInfoWindow();
// Window.SetPosition(580, 80);
// Window.ResetFocus();
local Equ = GameItem.Equipment(24144);
local Window = Equ.GetEquipmentInfoWindow();
Window.SetPosition(580, 80);
Window.ResetFocus();
local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20);
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20);
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20);
// //大背景

View File

@ -14,7 +14,7 @@ class Yosin_TopTitle extends Yosin_CommonUi {
//内容背景
if (drawBackground) {
local background = Yosin_NineBoxStretch(-1, 15, W + 1, H - 15, "sprite/interface/lenheartwindowcommon.img", 97);
AddUIChild(background);
Addchild(background);
}
// 标题背景

View File

@ -5,7 +5,7 @@
文件用途: 背包窗口
*/
//local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 258, 555, 20);
//local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 555, 20);
class _Inventory extends Yosin_Window {
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
@ -14,18 +14,14 @@ class _Inventory extends Yosin_Window {
local title = Yosin_TopTitle(gWidth, gHeight, "装备栏(I)");
Addchild(title);
local dd = Yosin_NineBoxStretch(100, 200, 100,100 "sprite/interface/lenheartwindowcommon.img", 97);
dd.SetPosition(100, 50);
Addchild(dd);
//注册控件
// RegisterWidget();
RegisterWidget();
}
function RegisterWidget() {
//标题按钮
local titlesBtn = Yosin_RowMoreTitleBtn(10, 25, ["物品栏", "装扮", "宠物", "护石"],"sprite/interface/lenheartwindowcommon.img", 160);
local titlesBtn = Yosin_RowMoreTitleBtn(5, 22, 252, ["物品栏", "装扮", "宠物", "护石"], "sprite/interface/lenheartwindowcommon.img", 160);
AddUIChild(titlesBtn);
titlesBtn.LBDownOnClick = function(btns, index) {
@ -33,7 +29,7 @@ class _Inventory extends Yosin_Window {
};
//物品栏 装备页
local equipmentPage = Inventory_EquipmentPage( 0, titlesBtn.bottom() + 4, 300, Height - titlesBtn.bottom() - 4);
local equipmentPage = Inventory_EquipmentPage( 2, titlesBtn.bottom() + 4, 300, Height - titlesBtn.bottom() - 4);
AddUIChild(equipmentPage);

View File

@ -153,24 +153,28 @@ class InventoryItem extends Yosin_CommonUi {
base.constructor(gX, gY, gWidth, gHeight);
//物品分类按钮
local itemBtns = Yosin_RowMoreTitleBtn(10, 4, ["装备", "消耗品", "材料", "任务"], "sprite/interface/lenheartwindowcommon.img", 160);
local itemBtns = Yosin_RowMoreTitleBtn(3, 4, 252, ["装备", "消耗品", "材料", "副职业", "任务"], "sprite/interface/lenheartwindowcommon.img", 160);
AddUIChild(itemBtns);
itemBtns.LBDownOnClick = function(btns, index) {
print(index);
};
// 物品栏边框
local itemBg = Yosin_NineBoxStretch(2, itemBtns.bottom(), 253, 245, "sprite/interface/lenheartwindowcommon.img", 97);
Addchild(itemBg);
// 物品栏
local itemCollection = itemCollection(5, itemBtns.bottom(), 247, 244, 7, 8);
local itemCollection = itemCollection(itemBg.X + 7, itemBg.Y + 7, 239, 209, 7, 8);
AddUIChild(itemCollection);
local itemBottom = itemCollection.bottom();
local itemBgBottom = itemBg.bottom();
// 重量
local weight = FontAssetManager.GenerateNormal("重量", true, {
color = sq_RGBA(160, 132, 75, 255)
});
weight.SetPosition(itemCollection.X + 5, itemBottom - weight.GetSize().h - 2);
weight.SetPosition(itemCollection.X + 5, itemBgBottom - weight.GetSize().h - 5);
Addchild(weight);
// 重量进度条
@ -178,31 +182,25 @@ class InventoryItem extends Yosin_CommonUi {
weightSchedule.SetPercentage(0.6);
Addchild(weightSchedule);
// 搜索
//登录按钮
local saerchBtn = Yosin_BaseButton(weightSchedule.right() + 12, itemBottom - 23, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 94);
//点击事件回调
// saerchBtn.OnClick = function(Button) {
// }.bindenv(this);
AddUIChild(saerchBtn);
// 排列按钮
local permutationBtn = Yosin_BaseButton(itemBg.right() - 30, itemBgBottom - 26, 28, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 73);
AddUIChild(permutationBtn);
// 设置
local setBtn = Yosin_BaseButton(saerchBtn.right() + 2, saerchBtn.Y, 18, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 77);
//点击事件回调
// setBtn.OnClick = function(Button) {
// }.bindenv(this);
local setBtn = Yosin_BaseButton(permutationBtn.X - 20, permutationBtn.Y, 18, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 77);
AddUIChild(setBtn);
// 排列按钮
local permutationBtn = Yosin_BaseButton(setBtn.right(), saerchBtn.Y, 28, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 73);
//点击事件回调
// permutationBtn.OnClick = function(Button) {
// }.bindenv(this);
AddUIChild(permutationBtn);
// 搜索
local saerchBtn = Yosin_BaseButton(setBtn.X - 24, permutationBtn.Y, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 94);
AddUIChild(saerchBtn);
// 复活币
local moneyItem = MoneyItem(5, itemBottom + 3, 3);
local moneyItem = MoneyItem(5, itemBgBottom + 3, 3);
AddUIChild(moneyItem);

View File

@ -28,8 +28,6 @@ class itemCollection extends Yosin_CommonUi {
this.columnNum = columnNum;
this.rowNum = rowNum;
// 创建画布
Canvas = CL_CanvasObject();
// 重设大小并清空
@ -37,11 +35,8 @@ class itemCollection extends Yosin_CommonUi {
// 开始绘制
Canvas.BeginDraw();
local background = Yosin_NineBoxStretch(0, 0, w + 6, h + 6, "sprite/interface/lenheartwindowcommon.img", 97);
Canvas.DrawActor(background, 0, 0);
local itemX = 4;
local itemY = 3;
local itemX = 0;
local itemY = 0;
for (local i = 0; i< columnNum; i++) {
local cells = [];
for (local i = 0; i< rowNum; i++) {
@ -51,7 +46,7 @@ class itemCollection extends Yosin_CommonUi {
itemX += 30;
}
itemX = 3;
itemX = 0;
itemY += 30;
}
@ -75,8 +70,8 @@ class itemCollection extends Yosin_CommonUi {
if (isInRect) {
local WorldPosition = this.GetWorldPosition();
local xx = MousePos_X - WorldPosition.x;
local yy = MousePos_Y - WorldPosition.y;
local xx = MousePos_X - WorldPosition.x -5;
local yy = MousePos_Y - WorldPosition.y -5;
local column = (yy / 30).tointeger();
local row = (xx / 30).tointeger();