背包 装备和装扮页切换
This commit is contained in:
parent
b12d4ed3a0
commit
c7dabbe069
|
|
@ -692,7 +692,7 @@ class Yosin_RowMoreTitleBtn extends Yosin_CommonUi {
|
|||
titleBtn.index = i;
|
||||
|
||||
titleBtn.LBDownOnClick = function(btn) {
|
||||
btn.Parent.LBDownOnClick(this, btn.index);
|
||||
btn.Parent.LBDownOnClick(btn.Parent, btn.index);
|
||||
|
||||
for (local i = 0; i< btn.Parent.btns.len(); i++) {
|
||||
btn.Parent.btns[i].SetSelect(false);
|
||||
|
|
|
|||
|
|
@ -8,12 +8,29 @@
|
|||
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 548, 20);
|
||||
class _Inventory extends Yosin_Window {
|
||||
|
||||
// 装备页
|
||||
equipmentPage = null;
|
||||
// 装扮页
|
||||
DressUpPage = null;
|
||||
|
||||
// 物品栏排列按钮
|
||||
permutationBtn = null;
|
||||
// 物品栏设置按钮
|
||||
setBtn = null;
|
||||
// 物品栏搜索按钮
|
||||
saerchBtn = null;
|
||||
|
||||
PageIndex = null;
|
||||
uiPageIndex = null;
|
||||
|
||||
// 物品栏排列搜索按钮 在显示物品栏页 时的Y坐标
|
||||
itemSetBtnY = 467;
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
|
||||
PageIndex = 1;
|
||||
uiPageIndex = 1;
|
||||
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
|
|
@ -36,7 +53,8 @@ class _Inventory extends Yosin_Window {
|
|||
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);
|
||||
}
|
||||
AddUIChild(topBtn);
|
||||
|
||||
|
|
@ -45,34 +63,37 @@ class _Inventory extends Yosin_Window {
|
|||
AddUIChild(titlesBtn);
|
||||
|
||||
titlesBtn.LBDownOnClick = function(btns, index) {
|
||||
print(index);
|
||||
btns.Parent.PageIndex = index;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//物品栏 装备页
|
||||
equipmentPage = Inventory_EquipmentPage(2, titlesBtn.bottom(), 300, 441);
|
||||
AddUIChild(equipmentPage);
|
||||
equipmentPage.SetVisible(false);
|
||||
|
||||
// 添加设置物品栏的按钮
|
||||
AddItemCollectSetBtn();
|
||||
// 装扮页
|
||||
DressUpPage = Inventory_DressUpPage(4, titlesBtn.bottom(), 300, 441);
|
||||
AddUIChild(DressUpPage);
|
||||
|
||||
// 钱包
|
||||
AddMoneyItem();
|
||||
|
||||
// 添加设置物品栏的按钮
|
||||
AddItemCollectSetBtn();
|
||||
}
|
||||
|
||||
// 添加设置物品栏的按钮
|
||||
function AddItemCollectSetBtn() {
|
||||
// 排列按钮
|
||||
local permutationBtn = Yosin_BaseButton(226, 467, 28, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 73);
|
||||
permutationBtn = Yosin_BaseButton(226, itemSetBtnY, 28, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 73);
|
||||
AddUIChild(permutationBtn);
|
||||
|
||||
// 设置
|
||||
local setBtn = Yosin_BaseButton(permutationBtn.X - 20, permutationBtn.Y, 18, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 77);
|
||||
setBtn = Yosin_BaseButton(permutationBtn.X - 20, permutationBtn.Y, 18, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 77);
|
||||
AddUIChild(setBtn);
|
||||
|
||||
// 搜索
|
||||
local saerchBtn = Yosin_BaseButton(setBtn.X - 24, permutationBtn.Y, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 94);
|
||||
saerchBtn = Yosin_BaseButton(setBtn.X - 24, permutationBtn.Y, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 94);
|
||||
AddUIChild(saerchBtn);
|
||||
}
|
||||
|
||||
|
|
@ -140,8 +161,36 @@ class _Inventory extends Yosin_Window {
|
|||
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);
|
||||
permutationBtn.SetPosition(permutationBtn.X, itemSetBtnY);
|
||||
setBtn.SetPosition(setBtn.X, itemSetBtnY);
|
||||
saerchBtn.SetPosition(saerchBtn.X, itemSetBtnY);
|
||||
} else if (PageIndex == 1) {
|
||||
DressUpPage.SetVisible(true);
|
||||
permutationBtn.SetPosition(permutationBtn.X, itemSetBtnY + 28);
|
||||
setBtn.SetPosition(setBtn.X, permutationBtn.Y);
|
||||
saerchBtn.SetPosition(saerchBtn.X, permutationBtn.Y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// if (!getroottable().rawin("chongzaiflag")) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue