no message

This commit is contained in:
WONIU 2025-01-08 13:51:17 +08:00
parent e464fb899d
commit 0d1b146235
3 changed files with 203 additions and 45 deletions

View File

@ -185,7 +185,120 @@ class Yosin_EmeStretch extends Yosin_CommonUi {
}
}
// //九宫格拉伸
// 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 {
@ -200,7 +313,15 @@ class Yosin_NineBoxStretch extends Yosin_CommonUi {
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);
@ -221,8 +342,13 @@ class Yosin_NineBoxStretch extends Yosin_CommonUi {
// 左上角
backgroundTopLeft.SetPosition(0, 0);
Addchild(backgroundTopLeft);
// 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();
@ -237,41 +363,40 @@ class Yosin_NineBoxStretch extends Yosin_CommonUi {
local scaleH = (centerHeight - 1).tofloat() / centerImgHeight.tofloat();
// 上边
backgroundTop.SetPosition(backgroundTopLeft.right() + 1, 0);
backgroundTop.SetScale(scaleW, 1);
Addchild(backgroundTop);
// backgroundTop.SetScale(scaleW, 1);
// Canvas.DrawActor(backgroundTop, TopLeftRight + 1, 0);
// Canvas.DrawActor(backgroundTop, 20, 30);
// 右上角
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);
// // 左边
// backgroundLeft.SetScale(1, scaleH);
// Canvas.DrawActor(backgroundLeft, 0, TopLeftBottom + 1);
// 中间
backgroundCenter.SetPosition(backgroundLeft.right() + 1, backgroundLeft.Y);
backgroundCenter.SetScale(scaleW, scaleH);
Addchild(backgroundCenter);
// // 中间
// 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);
// // 右边
// backgroundRight.SetScale(1, scaleH);
// 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);
// // 下边
// backgroundBottom.SetScale(scaleW, 1);
// 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);
}

View File

@ -14,12 +14,12 @@ class _Inventory extends Yosin_Window {
local title = Yosin_TopTitle(gWidth, gHeight, "装备栏(I)");
Addchild(title);
// local dd = Yosin_CanvasDraw.NineBoxStretch(100, 200, "sprite/interface/lenheartwindowcommon.img", 97);
// dd.SetPosition(100, 50);
// Addchild(dd);
local dd = Yosin_NineBoxStretch(100, 200, 100,100 "sprite/interface/lenheartwindowcommon.img", 97);
dd.SetPosition(100, 50);
Addchild(dd);
//注册控件
RegisterWidget();
// RegisterWidget();
}
function RegisterWidget() {

View File

@ -62,8 +62,41 @@ class Inventory_CharactersEquipment extends Yosin_CommonUi {
Canvas.EndDraw();
// 添加画布
Addchild(Canvas);
AddButton();
}
// 添加按钮
function AddButton() {
// 称号
local designation = Yosin_BaseButton(2, Height - 30, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 50);
//点击事件回调
// permutationBtn.OnClick = function(Button) {
// }.bindenv(this);
AddUIChild(designation);
// 增益强化
local intensify = Yosin_BaseButton(designation.right() +2, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 128);
AddUIChild(intensify);
// 皮肤仓库
local skin = Yosin_BaseButton(intensify.right() + 2, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 134);
AddUIChild(skin);
// 穿戴中的装备
local wear = Yosin_BaseButton(Width - 29, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 172);
AddUIChild(wear);
// 装备特性
local peculiarity = Yosin_BaseButton(wear.X - 21, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 203);
AddUIChild(peculiarity);
// 未央环境装备
// local permutationBtn = Yosin_BaseButton(peculiarity.X - 21, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 128);
// AddUIChild(permutationBtn);
}
// 背景
function DrawBackground() {
@ -252,14 +285,14 @@ class MoneyItem extends Yosin_CommonUi {
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();
}
// 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();
// }