优化背包界面 更改几个UI基类
This commit is contained in:
parent
ea2d779fcb
commit
5d38428f30
|
|
@ -57,66 +57,77 @@ class Yosin_BaseWindow extends Layer {
|
|||
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseProc(MousePos_X, MousePos_Y);
|
||||
}
|
||||
}
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||
}
|
||||
}
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseLbClick(MousePos_X, MousePos_Y);
|
||||
}
|
||||
}
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||
}
|
||||
}
|
||||
//鼠标右键按下回调
|
||||
function OnMouseRbDown(MousePos_X, MousePos_Y) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseRbDown(MousePos_X, MousePos_Y);
|
||||
}
|
||||
}
|
||||
//鼠标右键单击回调
|
||||
function OnMouseRbClick(MousePos_X, MousePos_Y) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseRbClick(MousePos_X, MousePos_Y);
|
||||
}
|
||||
}
|
||||
//鼠标右键弹起回调
|
||||
function OnMouseRbUp(MousePos_X, MousePos_Y) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseRbUp(MousePos_X, MousePos_Y);
|
||||
}
|
||||
}
|
||||
//鼠标中键按下回调
|
||||
function OnMouseMbDown(MousePos_X, MousePos_Y) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseMbDown(MousePos_X, MousePos_Y);
|
||||
}
|
||||
}
|
||||
//鼠标中键单击回调
|
||||
function OnMouseMbClick(MousePos_X, MousePos_Y) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseMbClick(MousePos_X, MousePos_Y);
|
||||
}
|
||||
}
|
||||
//鼠标中键弹起回调
|
||||
function OnMouseMbUp(MousePos_X, MousePos_Y) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseMbUp(MousePos_X, MousePos_Y);
|
||||
}
|
||||
}
|
||||
//鼠标滚轮事件回调
|
||||
function OnMouseWheel(Wheel, MousePos_X, MousePos_Y) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseWheel(Wheel, MousePos_X, MousePos_Y);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,104 +257,104 @@ class Yosin_EmeStretch extends CL_CanvasObject {
|
|||
|
||||
|
||||
//九宫格拉伸
|
||||
// function Yosin_NineBoxStretch(width, height, path, imgId) {
|
||||
function Yosin_NineBoxStretch(width, height, path, imgId) {
|
||||
|
||||
// // 创建画布
|
||||
// local Canvas = CL_CanvasObject();
|
||||
// // 重设大小并清空
|
||||
// Canvas.ResizeAndClear(width, height);
|
||||
// // 开始绘制
|
||||
// Canvas.BeginDraw();
|
||||
// 创建画布
|
||||
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);
|
||||
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);
|
||||
// 左上角
|
||||
Canvas.DrawSprite(backgroundTopLeft);
|
||||
|
||||
// local TopLeftSize = backgroundTopLeft.GetSize();
|
||||
// local TopLeftBottom = TopLeftSize.h;
|
||||
// local TopLeftRight = TopLeftSize.w;
|
||||
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 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 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();
|
||||
local scaleW = (centerWidth - 1).tofloat() / centerImgWidth.tofloat();
|
||||
local scaleH = (centerHeight - 1).tofloat() / centerImgHeight.tofloat();
|
||||
|
||||
// // 上边
|
||||
// backgroundTop.SetScale(scaleW, 1);
|
||||
// backgroundTop.SetPosition(TopLeftRight, 0);
|
||||
// Canvas.DrawSprite(backgroundTop);
|
||||
// 上边
|
||||
backgroundTop.SetScale(scaleW, 1);
|
||||
backgroundTop.SetPosition(TopLeftRight, 0);
|
||||
Canvas.DrawSprite(backgroundTop);
|
||||
|
||||
// // 右上角
|
||||
// backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w - 1, 0);
|
||||
// Canvas.DrawSprite(backgroundTopRight);
|
||||
// 右上角
|
||||
backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w - 1, 0);
|
||||
Canvas.DrawSprite(backgroundTopRight);
|
||||
|
||||
// // 左边
|
||||
// backgroundLeft.SetScale(1, scaleH);
|
||||
// backgroundLeft.SetPosition(0, TopLeftBottom);
|
||||
// Canvas.DrawSprite(backgroundLeft);
|
||||
// 左边
|
||||
backgroundLeft.SetScale(1, scaleH);
|
||||
backgroundLeft.SetPosition(0, TopLeftBottom);
|
||||
Canvas.DrawSprite(backgroundLeft);
|
||||
|
||||
// // 中间
|
||||
// backgroundCenter.SetScale(scaleW, scaleH);
|
||||
// // Addchild(backgroundCenter);
|
||||
// backgroundCenter.SetPosition(TopLeftRight, backgroundLeft.Y);
|
||||
// Canvas.DrawSprite(backgroundCenter);
|
||||
// 中间
|
||||
backgroundCenter.SetScale(scaleW, scaleH);
|
||||
// Addchild(backgroundCenter);
|
||||
backgroundCenter.SetPosition(TopLeftRight, backgroundLeft.Y);
|
||||
Canvas.DrawSprite(backgroundCenter);
|
||||
|
||||
// // 右边
|
||||
// backgroundRight.SetScale(1, scaleH);
|
||||
// backgroundRight.SetPosition(width - backgroundRight.GetSize().w - 1, backgroundCenter.Y);
|
||||
// Canvas.DrawSprite(backgroundRight);
|
||||
// 右边
|
||||
backgroundRight.SetScale(1, scaleH);
|
||||
backgroundRight.SetPosition(width - backgroundRight.GetSize().w - 1, backgroundCenter.Y);
|
||||
Canvas.DrawSprite(backgroundRight);
|
||||
|
||||
// // 左下角
|
||||
// backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h - 1);
|
||||
// Canvas.DrawSprite(backgroundBottomLeft);
|
||||
// 左下角
|
||||
backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h - 1);
|
||||
Canvas.DrawSprite(backgroundBottomLeft);
|
||||
|
||||
// // 下边
|
||||
// backgroundBottom.SetScale(scaleW, 1);
|
||||
// backgroundBottom.SetPosition(TopLeftRight, backgroundBottomLeft.Y);
|
||||
// Canvas.DrawSprite(backgroundBottom);
|
||||
// 下边
|
||||
backgroundBottom.SetScale(scaleW, 1);
|
||||
backgroundBottom.SetPosition(TopLeftRight, backgroundBottomLeft.Y);
|
||||
Canvas.DrawSprite(backgroundBottom);
|
||||
|
||||
// // 右下角
|
||||
// backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w - 1, backgroundBottomLeft.Y);
|
||||
// Canvas.DrawSprite(backgroundBottomRight);
|
||||
|
||||
// // 结束绘制
|
||||
// Canvas.EndDraw();
|
||||
// // 添加画布
|
||||
// // Addchild(Canvas);
|
||||
// local Sp = CL_SpriteObject();
|
||||
// Sp.SetFrame(Canvas.ExportSpriteFrame());
|
||||
// return Sp;
|
||||
// }
|
||||
// 右下角
|
||||
backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w - 1, backgroundBottomLeft.Y);
|
||||
Canvas.DrawSprite(backgroundBottomRight);
|
||||
|
||||
// 结束绘制
|
||||
Canvas.EndDraw();
|
||||
// 添加画布
|
||||
// Addchild(Canvas);
|
||||
local Sp = CL_SpriteObject();
|
||||
Sp.SetFrame(Canvas.ExportSpriteFrame());
|
||||
return Sp;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
//九宫格拉伸
|
||||
class Yosin_NineBoxStretch extends CL_CanvasObject {
|
||||
|
||||
|
|
@ -451,6 +451,7 @@ class Yosin_NineBoxStretch extends CL_CanvasObject {
|
|||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
//拼接按钮
|
||||
class Yosin_SplicingButton extends Yosin_CommonUi {
|
||||
|
|
@ -739,17 +740,17 @@ class Yosin_RowMoreTitleBtn extends Yosin_CommonUi {
|
|||
titleBtn.index = i;
|
||||
|
||||
titleBtn.LBDownOnClick = function(btn) {
|
||||
btn.Parent.LBDownOnClick(btn.Parent, btn.index);
|
||||
LBDownOnClick(btn.Parent, btn.index);
|
||||
|
||||
for (local i = 0; i< btn.Parent.btns.len(); i++) {
|
||||
btn.Parent.btns[i].SetSelect(false);
|
||||
btn.Parent.btns[i].titleText.SetFillColor(sq_RGBA(130, 114, 84, 255));
|
||||
for (local i = 0; i< btns.len(); i++) {
|
||||
btns[i].SetSelect(false);
|
||||
btns[i].titleText.SetFillColor(sq_RGBA(130, 114, 84, 255));
|
||||
}
|
||||
|
||||
btn.SetSelect(true);
|
||||
btn.Parent.btns[btn.index].titleText.SetFillColor(sq_RGBA(187, 176, 149, 255));
|
||||
btns[btn.index].titleText.SetFillColor(sq_RGBA(187, 176, 149, 255));
|
||||
|
||||
};
|
||||
}.bindenv(this);
|
||||
|
||||
btns.push(titleBtn);
|
||||
btnX += btnW;
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ function RegisterFunctionalPack() {
|
|||
ItemList[EquInfo.Pos] <- GameItem.Equipment(EquInfo);
|
||||
//装备栏
|
||||
if (InventoryType == 2) {
|
||||
ClientCharacterInventory.EquipmentPage.SetItemCollectionList(0, ItemList);
|
||||
ClientCharacterInventory.PageList[0].SetItemCollectionList(0, ItemList);
|
||||
}
|
||||
}
|
||||
//消耗品类型
|
||||
|
|
@ -155,7 +155,7 @@ function RegisterFunctionalPack() {
|
|||
ItemList[ItemInfo.Pos] <- GameItem.Stackable(ItemInfo.ItemId);
|
||||
|
||||
|
||||
ClientCharacterInventory.EquipmentPage.SetItemCollectionList(InventoryType - 2, ItemList);
|
||||
ClientCharacterInventory.PageList[0].SetItemCollectionList(InventoryType - 2, ItemList);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ function InitGame() {
|
|||
// MySocket("127.0.0.1", 19666);
|
||||
|
||||
//设定全局默认音量
|
||||
_Globa_Audio_Volume_ = 0.03;
|
||||
_Globa_Sound_Volume_ = 0.03;
|
||||
_Globa_Audio_Volume_ = 0.001;
|
||||
_Globa_Sound_Volume_ = 0.001;
|
||||
|
||||
Script();
|
||||
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ function TestStage() {
|
|||
|
||||
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 548, 20);
|
||||
|
||||
|
||||
// Window.EquipmentPage.ItemCollection.SetItemList([{
|
||||
// ItemId = 27675
|
||||
// }, {
|
||||
|
|
|
|||
|
|
@ -4,13 +4,125 @@
|
|||
创建日期:2025-01-06 14:06
|
||||
文件用途: 背包窗口
|
||||
*/
|
||||
|
||||
//钱包类
|
||||
class Inventory_Wallet extends Yosin_CommonUi {
|
||||
|
||||
//复活币数量
|
||||
ReviveCoinCount = 0;
|
||||
ReviveCoinText = null;
|
||||
//胜利的证明数量
|
||||
WinCoinCount = 0;
|
||||
WinCoinText = null;
|
||||
//点卷数量
|
||||
CeraCount = 0;
|
||||
CeraText = null;
|
||||
//金币数量
|
||||
GoldCount = 0;
|
||||
GoldText = null;
|
||||
|
||||
//override
|
||||
function _set(idx, val) {
|
||||
switch (idx) {
|
||||
case "ReviveCoin": {
|
||||
ReviveCoinCount = val;
|
||||
ReviveCoinText.SetText(ReviveCoinCount + "个");
|
||||
ReviveCoinText.SetPosition(120 - ReviveCoinText.GetSize().w, 2);
|
||||
break;
|
||||
}
|
||||
case "WinCoin": {
|
||||
WinCoinCount = val;
|
||||
WinCoinText.SetText(WinCoinCount + "个");
|
||||
WinCoinText.SetPosition(245 - WinCoinText.GetSize().w, 2);
|
||||
break;
|
||||
}
|
||||
case "Cera": {
|
||||
CeraCount = val;
|
||||
CeraText.SetText(CeraCount + "点券");
|
||||
CeraText.SetPosition(120 - CeraText.GetSize().w, 27);
|
||||
break;
|
||||
}
|
||||
case "Gold": {
|
||||
GoldCount = val;
|
||||
GoldText.SetText(GoldCount + "金币");
|
||||
GoldText.SetPosition(245 - GoldText.GetSize().w, 27);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
constructor(x, y, w, h) {
|
||||
base.constructor(x, y, w, h);
|
||||
|
||||
RegisterWidget();
|
||||
}
|
||||
|
||||
|
||||
// 钱包
|
||||
function RegisterWidget() {
|
||||
|
||||
local txtColor = sq_RGBA(130, 105, 61, 255);
|
||||
local bg = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 27);
|
||||
Addchild(bg);
|
||||
|
||||
// 复活币个数
|
||||
ReviveCoinText = FontAssetManager.GenerateNormal(ReviveCoinCount + "个", true, {
|
||||
color = txtColor
|
||||
});
|
||||
ReviveCoinText.SetPosition(120 - ReviveCoinText.GetSize().w + bg.X, 2);
|
||||
Addchild(ReviveCoinText);
|
||||
|
||||
|
||||
// 胜利的证明
|
||||
WinCoinText = FontAssetManager.GenerateNormal(WinCoinCount + "个", true, {
|
||||
color = txtColor
|
||||
});
|
||||
WinCoinText.SetPosition(245 - WinCoinText.GetSize().w + bg.X, 2);
|
||||
Addchild(WinCoinText);
|
||||
|
||||
|
||||
// 商城
|
||||
local storeBtn = Yosin_BaseButton(1 + bg.X, 25, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 3);
|
||||
//点击事件回调
|
||||
// storeBtn.OnClick = function(Button) {
|
||||
// }.bindenv(this);
|
||||
AddUIChild(storeBtn);
|
||||
|
||||
|
||||
// 点券
|
||||
CeraText = FontAssetManager.GenerateNormal(CeraCount + "点券", true, {
|
||||
color = txtColor
|
||||
});
|
||||
CeraText.SetPosition(120 - CeraText.GetSize().w, 27);
|
||||
Addchild(CeraText);
|
||||
|
||||
// 金币按钮
|
||||
local moneyBtn = Yosin_BaseButton(126 + bg.X, storeBtn.Y, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 7);
|
||||
//点击事件回调
|
||||
// moneyBtn.OnClick = function(Button) {
|
||||
// }.bindenv(this);
|
||||
AddUIChild(moneyBtn);
|
||||
|
||||
// 金币数量
|
||||
GoldText = FontAssetManager.GenerateNormal(GoldCount + "金币", true, {
|
||||
color = txtColor
|
||||
});
|
||||
GoldText.SetPosition(245 - GoldText.GetSize().w, 27);
|
||||
Addchild(GoldText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//主类
|
||||
class _Inventory extends Yosin_Window {
|
||||
|
||||
// 装备页 /物品栏
|
||||
EquipmentPage = null;
|
||||
// 装扮页E
|
||||
DressUpPage = null;
|
||||
//分页集合 0装备 1装扮 2宠物
|
||||
PageList = null;
|
||||
//钱包
|
||||
Wallet = null;
|
||||
|
||||
// 物品栏排列按钮
|
||||
permutationBtn = null;
|
||||
|
|
@ -19,23 +131,22 @@ class _Inventory extends Yosin_Window {
|
|||
// 物品栏搜索按钮
|
||||
saerchBtn = null;
|
||||
|
||||
PageIndex = null;
|
||||
uiPageIndex = null;
|
||||
|
||||
// 物品栏排列搜索按钮 在显示物品栏页 时的Y坐标
|
||||
itemSetBtnY = 467;
|
||||
//是否可见
|
||||
Visible = false;
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
PageList = [];
|
||||
//调用父类构造函数
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
PageIndex = 0;
|
||||
uiPageIndex = 0;
|
||||
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
|
||||
//注册背包页面
|
||||
RegisterPage();
|
||||
|
||||
//注册按键回调事件
|
||||
Input.RegisterGameKeyCode(CONTROLLER.OPTION_HOTKEY_ITEM_INVENTORY, function(Flag) {
|
||||
//抬起的时候
|
||||
|
|
@ -63,160 +174,80 @@ class _Inventory extends Yosin_Window {
|
|||
closeBtn.SetZOrder(1);
|
||||
closeBtn.OnClick = function(btn) {
|
||||
CloseWindow();
|
||||
}
|
||||
}.bindenv(this);
|
||||
AddUIChild(closeBtn);
|
||||
//置顶按钮
|
||||
local topBtn = Yosin_BaseButton(Width - 35, 2, 13, 13, "sprite/interface/lenheartwindowcommon.img", 455);
|
||||
topBtn.DownSimulateOffset = false;
|
||||
topBtn.OnClick = function(btn) {
|
||||
// btn.Parent.PageIndex += 1;
|
||||
print(btn.Parent.PageIndex);
|
||||
}
|
||||
topBtn.OnClick = function(btn) {}
|
||||
AddUIChild(topBtn);
|
||||
|
||||
//分页按钮
|
||||
local titlesBtn = Yosin_RowMoreTitleBtn(5, 25, 250, ["物品栏", "装扮", "宠物", "护石"], "sprite/interface/lenheartwindowcommon.img", 160);
|
||||
AddUIChild(titlesBtn);
|
||||
|
||||
titlesBtn.LBDownOnClick = function(btns, index) {
|
||||
btns.Parent.PageIndex = index;
|
||||
};
|
||||
ChangPage(index);
|
||||
}.bindenv(this);
|
||||
|
||||
//物品栏 装备页
|
||||
EquipmentPage = Inventory_EquipmentPage(2, titlesBtn.bottom(), 300, 441);
|
||||
AddUIChild(EquipmentPage);
|
||||
EquipmentPage.SetVisible(false);
|
||||
|
||||
// 装扮页
|
||||
DressUpPage = Inventory_DressUpPage(4, titlesBtn.bottom(), 300, 441);
|
||||
AddUIChild(DressUpPage);
|
||||
|
||||
// 钱包
|
||||
AddMoneyItem();
|
||||
|
||||
// 添加设置物品栏的按钮
|
||||
AddItemCollectSetBtn();
|
||||
}
|
||||
|
||||
// 添加设置物品栏的按钮
|
||||
function AddItemCollectSetBtn() {
|
||||
// 排列按钮
|
||||
permutationBtn = Yosin_BaseButton(226, itemSetBtnY, 28, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 73);
|
||||
permutationBtn.SetZOrder(1);
|
||||
AddUIChild(permutationBtn);
|
||||
|
||||
// 设置
|
||||
setBtn = Yosin_BaseButton(permutationBtn.X - 20, permutationBtn.Y, 18, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 77);
|
||||
setBtn.SetZOrder(1);
|
||||
AddUIChild(setBtn);
|
||||
|
||||
// 搜索
|
||||
saerchBtn = Yosin_BaseButton(setBtn.X - 24, permutationBtn.Y, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 94);
|
||||
saerchBtn.SetZOrder(1);
|
||||
AddUIChild(saerchBtn);
|
||||
|
||||
//钱包类
|
||||
Wallet = Inventory_Wallet(7, Height - 55, 248, 49);
|
||||
AddUIChild(Wallet);
|
||||
}
|
||||
|
||||
// 钱包
|
||||
function AddMoneyItem() {
|
||||
|
||||
local txtColor = sq_RGBA(130, 105, 61, 255);
|
||||
|
||||
local bg = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 27);
|
||||
bg.SetPosition(7, Height - 55);
|
||||
Addchild(bg);
|
||||
|
||||
// 复活币个数
|
||||
local ReviveNum = FontAssetManager.GenerateNormal("23434个", true, {
|
||||
color = txtColor
|
||||
});
|
||||
ReviveNum.SetPosition(120 - ReviveNum.GetSize().w + bg.X, bg.Y + 2);
|
||||
Addchild(ReviveNum);
|
||||
|
||||
|
||||
// 胜利的证明
|
||||
local winNum = FontAssetManager.GenerateNormal("23434个", true, {
|
||||
color = txtColor
|
||||
});
|
||||
winNum.SetPosition(245 - winNum.GetSize().w + bg.X, bg.Y + 2);
|
||||
Addchild(winNum);
|
||||
|
||||
|
||||
|
||||
// 商城
|
||||
local storeBtn = Yosin_BaseButton(1 + bg.X, bg.Y + 25, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 3);
|
||||
//点击事件回调
|
||||
// storeBtn.OnClick = function(Button) {
|
||||
// }.bindenv(this);
|
||||
AddUIChild(storeBtn);
|
||||
|
||||
|
||||
// 点券
|
||||
local storeNum = FontAssetManager.GenerateNormal("23434点券", true, {
|
||||
color = txtColor
|
||||
});
|
||||
storeNum.SetPosition(bg.X + 120 - storeNum.GetSize().w, bg.Y + 27);
|
||||
Addchild(storeNum);
|
||||
|
||||
// 金币按钮
|
||||
local moneyBtn = Yosin_BaseButton(126 + bg.X, storeBtn.Y, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 7);
|
||||
//点击事件回调
|
||||
// moneyBtn.OnClick = function(Button) {
|
||||
// }.bindenv(this);
|
||||
AddUIChild(moneyBtn);
|
||||
|
||||
// 金币数量
|
||||
local storeNum = FontAssetManager.GenerateNormal("23434金币", true, {
|
||||
color = txtColor
|
||||
});
|
||||
storeNum.SetPosition(bg.X + 245 - storeNum.GetSize().w, bg.Y + 27);
|
||||
Addchild(storeNum);
|
||||
function RegisterPage() {
|
||||
//物品栏 装备页
|
||||
local EquipmentPage = Inventory_EquipmentPage(2, 46, 300, 441);
|
||||
PageList.push(EquipmentPage);
|
||||
AddUIChild(EquipmentPage);
|
||||
|
||||
// 装扮页
|
||||
local DressUpPage = Inventory_DressUpPage(4, 46, 300, 441);
|
||||
PageList.push(DressUpPage);
|
||||
AddUIChild(DressUpPage);
|
||||
DressUpPage.SetVisible(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//override
|
||||
//逻辑入口
|
||||
function Proc(Dt) {
|
||||
SyncPos(X, Y);
|
||||
base.Proc(Dt);
|
||||
|
||||
if (PageIndex != uiPageIndex) {
|
||||
uiPageIndex = PageIndex;
|
||||
ChangPage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 切换页面
|
||||
function ChangPage() {
|
||||
|
||||
EquipmentPage.SetVisible(false);
|
||||
DressUpPage.SetVisible(false);
|
||||
|
||||
|
||||
if (PageIndex == 0) {
|
||||
EquipmentPage.SetVisible(true);
|
||||
function ChangPage(gIndex) {
|
||||
foreach(Index, Page in PageList) {
|
||||
Page.SetVisible(false);
|
||||
if (gIndex == Index) {
|
||||
Page.SetVisible(true);
|
||||
if (gIndex == 0) {
|
||||
permutationBtn.SetPosition(permutationBtn.X, itemSetBtnY);
|
||||
setBtn.SetPosition(setBtn.X, itemSetBtnY);
|
||||
saerchBtn.SetPosition(saerchBtn.X, itemSetBtnY);
|
||||
} else if (PageIndex == 1) {
|
||||
DressUpPage.SetVisible(true);
|
||||
} else if (gIndex == 1) {
|
||||
permutationBtn.SetPosition(permutationBtn.X, itemSetBtnY + 28);
|
||||
setBtn.SetPosition(setBtn.X, permutationBtn.Y);
|
||||
saerchBtn.SetPosition(saerchBtn.X, permutationBtn.Y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 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();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
@ -30,7 +30,9 @@ class Inventory_DressUpPage extends Yosin_CommonUi {
|
|||
local titlesBtn = Yosin_RowMoreTitleBtn(2, 180, 250, ["装扮", "徽章"], "sprite/interface/lenheartwindowcommon.img", 160);
|
||||
AddUIChild(titlesBtn);
|
||||
|
||||
// titlesBtn.LBDownOnClick = function(btns, index) {
|
||||
|
||||
// };
|
||||
}
|
||||
|
||||
// 添加按钮
|
||||
|
|
@ -88,17 +90,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();
|
||||
// }
|
||||
Loading…
Reference in New Issue