1 背包 将钱包 Item 移动到背包层
2 背包 将书本按钮 移动到装备页面层 3 将 物品栏item 移动到装备页面层 4 修改九格拉伸相关的调用
This commit is contained in:
parent
ecd1ec694e
commit
b12d4ed3a0
|
|
@ -200,12 +200,10 @@ class Yosin_EmeStretch extends Yosin_CommonUi {
|
||||||
|
|
||||||
|
|
||||||
// 九宫格拉伸
|
// 九宫格拉伸
|
||||||
function Yosin_NineBoxStretch(X, Y, width, height, path, imgId) {
|
function Yosin_NineBoxStretch(width, height, path, imgId) {
|
||||||
|
|
||||||
|
|
||||||
// 创建画布
|
// 创建画布
|
||||||
local Canvas = CL_CanvasObject();
|
local Canvas = CL_CanvasObject();
|
||||||
Canvas.SetPosition(X, Y);
|
|
||||||
// 重设大小并清空
|
// 重设大小并清空
|
||||||
Canvas.ResizeAndClear(width, height);
|
Canvas.ResizeAndClear(width, height);
|
||||||
// 开始绘制
|
// 开始绘制
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
local background = Yosin_NineBoxStretch(0, 0, 211, RealCanvasHeight + 10, "sprite/interface/lenheartwindowcommon.img", 213);
|
local background = Yosin_NineBoxStretch(211, RealCanvasHeight + 10, "sprite/interface/lenheartwindowcommon.img", 213);
|
||||||
background.SetZOrder(-1);
|
background.SetZOrder(-1);
|
||||||
Addchild(background);
|
Addchild(background);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ function TestStage() {
|
||||||
// ClientCharacter = Charc;
|
// ClientCharacter = Charc;
|
||||||
|
|
||||||
|
|
||||||
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20);
|
local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 548, 20);
|
||||||
|
|
||||||
// Window.equipmentPage.Item.ItemCollection.SetItemList([{
|
// Window.equipmentPage.Item.ItemCollection.SetItemList([{
|
||||||
// ItemId = 27675
|
// ItemId = 27675
|
||||||
|
|
|
||||||
|
|
@ -13,19 +13,27 @@ class Yosin_TopTitle extends Yosin_CommonUi {
|
||||||
|
|
||||||
//内容背景
|
//内容背景
|
||||||
if (drawBackground) {
|
if (drawBackground) {
|
||||||
local background = Yosin_NineBoxStretch(0, 15, W + 4, H - 15, "sprite/interface/lenheartwindowcommon.img", 97);
|
local background = Yosin_NineBoxStretch( W, H, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||||
|
background.SetPosition(0, 0);
|
||||||
Addchild(background);
|
Addchild(background);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 标题背景
|
// 绘制标题背景
|
||||||
local Background = Yosin_EmeStretch(0, 0, W + 3, 22, "sprite/interface/lenheartwindowcommon.img", 609);
|
local titleX = drawBackground ? 2 : 0;
|
||||||
Addchild(Background);
|
local titleW = drawBackground ? W - 4 : W;
|
||||||
|
local titleBackground = Yosin_EmeStretch(titleX, 0, titleW, 20, "sprite/interface/lenheartwindowcommon.img", 609);
|
||||||
|
titleBackground.SetScale(1, 1.3);
|
||||||
|
Addchild(titleBackground);
|
||||||
|
|
||||||
// 标题亮色背景
|
// 标题背景光
|
||||||
local BackgroundBright = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 483);
|
local BackgroundBright = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 483);
|
||||||
local scaleW = (Background.GetSize().w / BackgroundBright.GetSize().w).tofloat();
|
local BackgroundBrightSize = BackgroundBright.GetSize();
|
||||||
|
// 计算光的缩放比例
|
||||||
|
local scaleW = (W / BackgroundBrightSize.w).tofloat();
|
||||||
|
|
||||||
BackgroundBright.SetScale(scaleW, 1);
|
BackgroundBright.SetScale(scaleW, 1);
|
||||||
BackgroundBright.SetPosition(0, 1);
|
BackgroundBright.SetPosition(0, 1);
|
||||||
|
|
||||||
Addchild(BackgroundBright);
|
Addchild(BackgroundBright);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -549,7 +549,8 @@ class _Select_Character_Window extends Yosin_Window {
|
||||||
ChangeBackground(Info.loginImg);
|
ChangeBackground(Info.loginImg);
|
||||||
|
|
||||||
//角色遮罩栏
|
//角色遮罩栏
|
||||||
CharacterMaskBox = Yosin_NineBoxStretch(-4, 320, 1074, 680, "sprite/interface/lenheartwindowcommon.img", 0);
|
CharacterMaskBox = Yosin_NineBoxStretch(1074, 680, "sprite/interface/lenheartwindowcommon.img", 0);
|
||||||
|
CharacterMaskBox.SetPosition(-4, 320);
|
||||||
Addchild(CharacterMaskBox);
|
Addchild(CharacterMaskBox);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,19 +72,28 @@ class _Yosin_MessageBox extends Yosin_Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
function RegisterWidget() {
|
function RegisterWidget() {
|
||||||
|
|
||||||
//背景
|
//背景
|
||||||
local background = Yosin_NineBoxStretch(-1, 15, cacheW + 1, cacheH, "sprite/interface/lenheartwindowcommon.img", 97);
|
local background = Yosin_NineBoxStretch( cacheW + 1, cacheH, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||||
|
background.SetPosition(-1, 15);
|
||||||
Addchild(background);
|
Addchild(background);
|
||||||
local twoBackground = Yosin_NineBoxStretch(4, 20, cacheW - 8, cacheH - 36, "sprite/interface/lenheartwindowcommon.img", 97);
|
|
||||||
|
//文字背景
|
||||||
|
local twoBackground = Yosin_NineBoxStretch( cacheW - 8, cacheH - 36, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||||
|
twoBackground.SetPosition(4, 20);
|
||||||
Addchild(twoBackground);
|
Addchild(twoBackground);
|
||||||
|
|
||||||
// 绘制标题背景
|
// 绘制标题背景
|
||||||
local titleBackground = Yosin_EmeStretch(0, 0, cacheW, 20, "sprite/interface/lenheartwindowcommon.img", 609);
|
local titleBackground = Yosin_EmeStretch(0, 0, cacheW, 20, "sprite/interface/lenheartwindowcommon.img", 609);
|
||||||
|
titleBackground.SetScale(1, 1.2);
|
||||||
AddUIChild(titleBackground);
|
AddUIChild(titleBackground);
|
||||||
|
|
||||||
|
// 标题背景光
|
||||||
local BackgroundBright = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 483);
|
local BackgroundBright = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 483);
|
||||||
local scaleW = (cacheW / BackgroundBright.GetSize().w).tofloat();
|
local BackgroundBrightSize = BackgroundBright.GetSize();
|
||||||
|
local scaleW = (cacheW / BackgroundBrightSize.w).tofloat();
|
||||||
BackgroundBright.SetScale(scaleW, 1);
|
BackgroundBright.SetScale(scaleW, 1);
|
||||||
|
BackgroundBright.SetPosition( 0, 1);
|
||||||
Addchild(BackgroundBright);
|
Addchild(BackgroundBright);
|
||||||
|
|
||||||
//确认按钮
|
//确认按钮
|
||||||
|
|
|
||||||
|
|
@ -791,11 +791,8 @@ class _create_Character_enterName extends Yosin_Window {
|
||||||
base.constructor("输入角色名称", 0, 0, 1066, 600, 0);
|
base.constructor("输入角色名称", 0, 0, 1066, 600, 0);
|
||||||
|
|
||||||
//背景
|
//背景
|
||||||
local background = Yosin_NineBoxStretch(-2, 0, 1070, 604, "sprite/interface/lenheartwindowcommon.img", 97);
|
local background = Yosin_NineBoxStretch( 240, 140, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||||
Addchild(background);
|
background.SetPosition(413, 228);
|
||||||
|
|
||||||
//背景
|
|
||||||
local background = Yosin_NineBoxStretch(413, 228, 240, 140, "sprite/interface/lenheartwindowcommon.img", 97);
|
|
||||||
Addchild(background);
|
Addchild(background);
|
||||||
|
|
||||||
// 标题文字
|
// 标题文字
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// local infoWindow = Sq_CreateWindow(_PersonalInfo, "个人信息窗口", 250, 60, 286, 530, 20);
|
// local infoWindow = Sq_CreateWindow(_PersonalInfo, "个人信息窗口", 250, 60, 286, 530, 20);
|
||||||
// todo 图和尺寸比例都需要修改
|
|
||||||
// todo Yosin_Window 和 Yosin_CommonUi 会有性能开销需要检查
|
|
||||||
class _PersonalInfo extends Yosin_Window {
|
class _PersonalInfo extends Yosin_Window {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -308,41 +308,6 @@ class roleInfoPropertyItem extends CL_CanvasObject {
|
||||||
EndDraw();
|
EndDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
// additionReaction 属性是否有加成 加成为绿色 不加成灰色
|
|
||||||
// function Draw(idx, title, numText, additionReaction = true, width = 120) {
|
|
||||||
|
|
||||||
// // 创建画布
|
|
||||||
// local Canvas = CL_CanvasObject();
|
|
||||||
// // 重设大小并清空
|
|
||||||
// Canvas.ResizeAndClear(width, 18);
|
|
||||||
// // 开始绘制
|
|
||||||
// Canvas.BeginDraw();
|
|
||||||
|
|
||||||
// local titlecolor = additionReaction ? sq_RGBA(160, 132, 75, 255) : sq_RGBA(79, 79, 79, 255);
|
|
||||||
// local numColor = additionReaction ? sq_RGBA(75, 161, 85, 255) : sq_RGBA(79, 79, 79, 255);
|
|
||||||
|
|
||||||
// local icon = CL_SpriteFrameObject("sprite/interface2/profile/profile_icon.img", idx);
|
|
||||||
// Canvas.DrawSpriteFrame(icon, 5, 0);
|
|
||||||
|
|
||||||
// // 属性名称
|
|
||||||
// local property = FontAssetManager.GenerateNormal(title, true, {
|
|
||||||
// color = titlecolor
|
|
||||||
// });
|
|
||||||
// Canvas.DrawActor(property, icon.right() + 5, icon.Y);
|
|
||||||
|
|
||||||
// // 属性数值
|
|
||||||
// local propertyNum = FontAssetManager.GenerateNormal(numText, true, {
|
|
||||||
// color = numColor
|
|
||||||
// });
|
|
||||||
// local numX = width - propertyNum.GetSize().w;
|
|
||||||
// Canvas.DrawActor(property, numX, icon.Y);
|
|
||||||
|
|
||||||
// // 结束绘制
|
|
||||||
// Canvas.EndDraw();
|
|
||||||
|
|
||||||
// return Canvas;
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -381,11 +346,6 @@ class otherButton extends Yosin_CommonUi {
|
||||||
}
|
}
|
||||||
|
|
||||||
function Proc(DT) {
|
function Proc(DT) {
|
||||||
// if (isLBDown){
|
|
||||||
// SyncPos(X, cacheY + 1);
|
|
||||||
// }else{
|
|
||||||
// SyncPos(X, cacheY);
|
|
||||||
// }
|
|
||||||
if (isLBDown){
|
if (isLBDown){
|
||||||
icon.SetPosition( iconX , iconY + 1 );
|
icon.SetPosition( iconX , iconY + 1 );
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -448,7 +408,6 @@ class Personalinfo_CharactersEquipment extends CL_CanvasObject {
|
||||||
// 顶部光线
|
// 顶部光线
|
||||||
local topLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 178);
|
local topLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 178);
|
||||||
DrawSpriteFrame(topLight, Width / 2 - topLight.GetSize().w / 2, 0);
|
DrawSpriteFrame(topLight, Width / 2 - topLight.GetSize().w / 2, 0);
|
||||||
// DrawSpriteFrame(topLight, 0, 0);
|
|
||||||
|
|
||||||
// todo 角色展示
|
// todo 角色展示
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
文件用途: 背包窗口
|
文件用途: 背包窗口
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 555, 20);
|
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 548, 20);
|
||||||
class _Inventory extends Yosin_Window {
|
class _Inventory extends Yosin_Window {
|
||||||
|
|
||||||
equipmentPage = null;
|
equipmentPage = null;
|
||||||
|
|
@ -25,7 +25,7 @@ class _Inventory extends Yosin_Window {
|
||||||
Addchild(title);
|
Addchild(title);
|
||||||
|
|
||||||
//关闭按钮
|
//关闭按钮
|
||||||
local closeBtn = Yosin_BaseButton(Width - 15, 4, 12, 12, "sprite/interface/lenheartwindowcommon.img", 544);
|
local closeBtn = Yosin_BaseButton(Width - 20, 4, 12, 12, "sprite/interface/lenheartwindowcommon.img", 544);
|
||||||
closeBtn.DownSimulateOffset = false;
|
closeBtn.DownSimulateOffset = false;
|
||||||
closeBtn.SetZOrder(1);
|
closeBtn.SetZOrder(1);
|
||||||
closeBtn.OnClick = function(btn) {
|
closeBtn.OnClick = function(btn) {
|
||||||
|
|
@ -40,25 +40,118 @@ class _Inventory extends Yosin_Window {
|
||||||
}
|
}
|
||||||
AddUIChild(topBtn);
|
AddUIChild(topBtn);
|
||||||
|
|
||||||
//标题按钮
|
//分页按钮
|
||||||
local titlesBtn = Yosin_RowMoreTitleBtn(5, 22, 252, ["物品栏", "装扮", "宠物", "护石"], "sprite/interface/lenheartwindowcommon.img", 160);
|
local titlesBtn = Yosin_RowMoreTitleBtn(5, 25, 250, ["物品栏", "装扮", "宠物", "护石"], "sprite/interface/lenheartwindowcommon.img", 160);
|
||||||
AddUIChild(titlesBtn);
|
AddUIChild(titlesBtn);
|
||||||
|
|
||||||
titlesBtn.LBDownOnClick = function(btns, index) {
|
titlesBtn.LBDownOnClick = function(btns, index) {
|
||||||
print(index);
|
print(index);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//物品栏 装备页
|
//物品栏 装备页
|
||||||
equipmentPage = Inventory_EquipmentPage(2, titlesBtn.bottom() + 4, 300, Height - titlesBtn.bottom() - 4);
|
equipmentPage = Inventory_EquipmentPage(2, titlesBtn.bottom(), 300, 441);
|
||||||
AddUIChild(equipmentPage);
|
AddUIChild(equipmentPage);
|
||||||
|
|
||||||
|
// 添加设置物品栏的按钮
|
||||||
|
AddItemCollectSetBtn();
|
||||||
|
|
||||||
|
// 钱包
|
||||||
|
AddMoneyItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加设置物品栏的按钮
|
||||||
|
function AddItemCollectSetBtn() {
|
||||||
|
// 排列按钮
|
||||||
|
local permutationBtn = Yosin_BaseButton(226, 467, 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);
|
||||||
|
AddUIChild(setBtn);
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
local saerchBtn = Yosin_BaseButton(setBtn.X - 24, permutationBtn.Y, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 94);
|
||||||
|
AddUIChild(saerchBtn);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 钱包
|
||||||
|
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 Proc(Dt) {
|
function Proc(Dt) {
|
||||||
SyncPos(X, Y);
|
SyncPos(X, Y);
|
||||||
base.Proc(Dt);
|
base.Proc(Dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
// }
|
||||||
|
|
@ -8,71 +8,32 @@
|
||||||
// 背包装备页面
|
// 背包装备页面
|
||||||
class Inventory_EquipmentPage extends Yosin_CommonUi {
|
class Inventory_EquipmentPage extends Yosin_CommonUi {
|
||||||
|
|
||||||
Item = null;
|
// Item = null;
|
||||||
|
|
||||||
|
ItemCollection = null;
|
||||||
|
|
||||||
constructor(x, y, w, h) {
|
constructor(x, y, w, h) {
|
||||||
base.constructor(x, y, w, h);
|
base.constructor(x, y, w, h);
|
||||||
|
|
||||||
|
|
||||||
// 人物装备
|
// 人物装备
|
||||||
local charactersEquipment = Inventory_CharactersEquipment(5, 0);
|
local charactersEquipment = Inventory_CharactersEquipment();
|
||||||
AddUIChild(charactersEquipment);
|
charactersEquipment.SetPosition(5, 0);
|
||||||
|
Addchild(charactersEquipment);
|
||||||
|
|
||||||
|
// 添加书本按钮
|
||||||
|
AddBookButton();
|
||||||
|
|
||||||
// 物品栏
|
// 物品栏
|
||||||
Item = InventoryItem(0, charactersEquipment.bottom(), Width, Height - charactersEquipment.bottom());
|
AddItem();
|
||||||
AddUIChild(Item);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 上半部分 人物装备穿戴
|
|
||||||
class Inventory_CharactersEquipment extends Yosin_CommonUi {
|
|
||||||
|
|
||||||
// 展示其他装备
|
|
||||||
showOtherEquipment = null;
|
|
||||||
// 允许更换装备
|
|
||||||
allowChangeEquipment = null;
|
|
||||||
// 画布
|
|
||||||
Canvas = null;
|
|
||||||
|
|
||||||
constructor(x, y) {
|
|
||||||
local w = 248;
|
|
||||||
local h = 179;
|
|
||||||
base.constructor(x, y, w, h);
|
|
||||||
|
|
||||||
showOtherEquipment = true;
|
|
||||||
allowChangeEquipment = true;
|
|
||||||
|
|
||||||
// 创建画布
|
|
||||||
Canvas = CL_CanvasObject();
|
|
||||||
// 重设大小并清空
|
|
||||||
Canvas.ResizeAndClear(w, h);
|
|
||||||
// 设置填充画刷 用于绘制边框和线条
|
|
||||||
// Canvas.SetFillBrush(sq_RGBA(59, 56, 57, 250));
|
|
||||||
// 设置轮廓画刷 用于绘制边框和线条
|
|
||||||
// Canvas.SetStrokeBrush(sq_RGBA(59, 56, 57, 250));
|
|
||||||
// 开始绘制
|
|
||||||
Canvas.BeginDraw();
|
|
||||||
|
|
||||||
// 绘制背景
|
|
||||||
DrawBackground();
|
|
||||||
|
|
||||||
// 结束绘制
|
|
||||||
Canvas.EndDraw();
|
|
||||||
// 添加画布
|
|
||||||
Addchild(Canvas);
|
|
||||||
|
|
||||||
|
|
||||||
AddButton();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加按钮
|
// 添加按钮
|
||||||
function AddButton() {
|
function AddBookButton() {
|
||||||
// 称号
|
// 称号
|
||||||
local designation = Yosin_BaseButton(2, Height - 30, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 50);
|
local designation = Yosin_BaseButton(7, 145, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 50);
|
||||||
//点击事件回调
|
//点击事件回调
|
||||||
// permutationBtn.OnClick = function(Button) {
|
// permutationBtn.OnClick = function(Button) {
|
||||||
// }.bindenv(this);
|
// }.bindenv(this);
|
||||||
|
|
@ -86,77 +47,20 @@ class Inventory_CharactersEquipment extends Yosin_CommonUi {
|
||||||
AddUIChild(skin);
|
AddUIChild(skin);
|
||||||
|
|
||||||
// 穿戴中的装备
|
// 穿戴中的装备
|
||||||
local wear = Yosin_BaseButton(Width - 29, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 172);
|
local wear = Yosin_BaseButton(225, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 172);
|
||||||
AddUIChild(wear);
|
AddUIChild(wear);
|
||||||
// 装备特性
|
// 装备特性
|
||||||
local peculiarity = Yosin_BaseButton(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 permutationBtn = Yosin_BaseButton(peculiarity.X - 21, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 128);
|
local permutationBtn = Yosin_BaseButton(peculiarity.X - 21, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 128);
|
||||||
// AddUIChild(permutationBtn);
|
AddUIChild(permutationBtn);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加物品栏
|
||||||
// 背景
|
function AddItem() {
|
||||||
function DrawBackground() {
|
|
||||||
|
|
||||||
// 背景图
|
|
||||||
local bgimg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventorybackground.img", 0);
|
|
||||||
// 画布绘制背景
|
|
||||||
Canvas.DrawSpriteFrame(bgimg, 0, 0);
|
|
||||||
|
|
||||||
|
|
||||||
// 装备栏背景
|
|
||||||
local equipmentBackground = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 21);
|
|
||||||
Canvas.DrawSpriteFrame(equipmentBackground, 5, 5);
|
|
||||||
|
|
||||||
|
|
||||||
// 顶部光线
|
|
||||||
local topLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 178);
|
|
||||||
Canvas.DrawSpriteFrame(topLight, Width / 2 - topLight.GetSize().w / 2, 0);
|
|
||||||
|
|
||||||
// todo 角色展示
|
|
||||||
|
|
||||||
// 结婚戒指槽位
|
|
||||||
local ringSlotBg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory_cn.img", 0);
|
|
||||||
Canvas.DrawSpriteFrame(ringSlotBg, Width / 2 - ringSlotBg.GetSize().w / 2, 5);
|
|
||||||
|
|
||||||
// 首饰
|
|
||||||
if (showOtherEquipment) {
|
|
||||||
// 辅助装备
|
|
||||||
local assist = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 19);
|
|
||||||
Canvas.DrawSpriteFrame(assist, 179, 69);
|
|
||||||
|
|
||||||
// 耳环
|
|
||||||
local earrings = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 122);
|
|
||||||
Canvas.DrawSpriteFrame(earrings, 179, 102);
|
|
||||||
|
|
||||||
// 魔法石
|
|
||||||
local MagicStone = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 20);
|
|
||||||
Canvas.DrawSpriteFrame(MagicStone, 211, 101);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 物品栏
|
|
||||||
class InventoryItem extends Yosin_CommonUi {
|
|
||||||
ItemCollection = null;
|
|
||||||
|
|
||||||
constructor(gX, gY, gWidth, gHeight) {
|
|
||||||
base.constructor(gX, gY, gWidth, gHeight);
|
|
||||||
|
|
||||||
//物品分类按钮
|
//物品分类按钮
|
||||||
local itemBtns = Yosin_RowMoreTitleBtn(3, 4, 252, ["装备", "消耗品", "材料", "副职业", "任务"], "sprite/interface/lenheartwindowcommon.img", 160);
|
local itemBtns = Yosin_RowMoreTitleBtn(5, 182, 248, ["装备", "消耗品", "材料", "副职业", "任务"], "sprite/interface/lenheartwindowcommon.img", 160);
|
||||||
AddUIChild(itemBtns);
|
AddUIChild(itemBtns);
|
||||||
|
|
||||||
itemBtns.LBDownOnClick = function(btns, index) {
|
itemBtns.LBDownOnClick = function(btns, index) {
|
||||||
|
|
@ -164,11 +68,12 @@ class InventoryItem extends Yosin_CommonUi {
|
||||||
};
|
};
|
||||||
|
|
||||||
// 物品栏边框
|
// 物品栏边框
|
||||||
local itemBg = Yosin_NineBoxStretch(2, itemBtns.bottom(), 253, 245, "sprite/interface/lenheartwindowcommon.img", 97);
|
local itemBg = Yosin_NineBoxStretch(253, 245, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||||
|
itemBg.SetPosition(2, itemBtns.bottom());
|
||||||
Addchild(itemBg);
|
Addchild(itemBg);
|
||||||
|
|
||||||
// 物品栏
|
// 物品栏
|
||||||
ItemCollection = _ItemCollection(itemBg.X + 7, itemBg.Y + 7, 7);
|
ItemCollection = _ItemCollection(itemBg.X + 7, itemBg.Y + 3, 7);
|
||||||
AddUIChild(ItemCollection);
|
AddUIChild(ItemCollection);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -185,110 +90,77 @@ class InventoryItem extends Yosin_CommonUi {
|
||||||
weightSchedule.SetPercentage(0.6);
|
weightSchedule.SetPercentage(0.6);
|
||||||
Addchild(weightSchedule);
|
Addchild(weightSchedule);
|
||||||
|
|
||||||
// 排列按钮
|
|
||||||
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(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);
|
|
||||||
AddUIChild(saerchBtn);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 复活币
|
|
||||||
local moneyItem = MoneyItem(5, itemBgBottom + 3, 3);
|
|
||||||
AddUIChild(moneyItem);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function SetItemList(gItemList) {
|
|
||||||
ItemCollection.SetItemList(gItemList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 金币相关数值
|
|
||||||
class MoneyItem extends Yosin_CommonUi {
|
|
||||||
|
|
||||||
constructor(x, y, idx) {
|
|
||||||
|
// 上半部分 人物装备穿戴
|
||||||
|
class Inventory_CharactersEquipment extends CL_CanvasObject {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
local w = 248;
|
local w = 248;
|
||||||
local h = 49;
|
local h = 179;
|
||||||
base.constructor(x, y, w, h);
|
base.constructor();
|
||||||
|
|
||||||
local txtColor = sq_RGBA(130, 105, 61, 255);
|
// 创建画布
|
||||||
|
CL_CanvasObject();
|
||||||
|
// 重设大小并清空
|
||||||
|
ResizeAndClear(w, h);
|
||||||
|
// 开始绘制
|
||||||
|
BeginDraw();
|
||||||
|
|
||||||
local bg = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 27);
|
// 绘制背景
|
||||||
Addchild(bg);
|
DrawBackground(w);
|
||||||
|
|
||||||
// 复活币个数
|
// 结束绘制
|
||||||
local ReviveNum = FontAssetManager.GenerateNormal("23434个", true, {
|
EndDraw();
|
||||||
color = txtColor
|
}
|
||||||
});
|
|
||||||
ReviveNum.SetPosition(120 - ReviveNum.GetSize().w, 2);
|
|
||||||
Addchild(ReviveNum);
|
|
||||||
|
|
||||||
|
|
||||||
// 胜利的证明
|
// 背景
|
||||||
local winNum = FontAssetManager.GenerateNormal("23434个", true, {
|
function DrawBackground(Width) {
|
||||||
color = txtColor
|
|
||||||
});
|
// 背景图
|
||||||
winNum.SetPosition(245 - winNum.GetSize().w, 2);
|
local bgimg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventorybackground.img", 0);
|
||||||
Addchild(winNum);
|
// 画布绘制背景
|
||||||
|
DrawSpriteFrame(bgimg, 0, 0);
|
||||||
|
|
||||||
|
// 装备栏背景
|
||||||
|
local equipmentBackground = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 21);
|
||||||
|
DrawSpriteFrame(equipmentBackground, 5, 5);
|
||||||
|
|
||||||
|
|
||||||
|
// 顶部光线
|
||||||
|
local topLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 178);
|
||||||
|
DrawSpriteFrame(topLight, Width / 2 - topLight.GetSize().w / 2, 0);
|
||||||
|
|
||||||
// 商城
|
// todo 角色展示
|
||||||
local storeBtn = Yosin_BaseButton(1, 25, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 3);
|
|
||||||
// local storeBtn = Yosin_BaseButton(0, 0, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 3);
|
// 结婚戒指槽位
|
||||||
//点击事件回调
|
local ringSlotBg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory_cn.img", 0);
|
||||||
// storeBtn.OnClick = function(Button) {
|
DrawSpriteFrame(ringSlotBg, Width / 2 - ringSlotBg.GetSize().w / 2, 5);
|
||||||
// }.bindenv(this);
|
|
||||||
AddUIChild(storeBtn);
|
|
||||||
|
|
||||||
|
|
||||||
// 点券
|
// 辅助装备
|
||||||
local storeNum = FontAssetManager.GenerateNormal("23434点券", true, {
|
local assist = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 19);
|
||||||
color = txtColor
|
DrawSpriteFrame(assist, 179, 69);
|
||||||
});
|
|
||||||
storeNum.SetPosition(120 - storeNum.GetSize().w, 27);
|
|
||||||
Addchild(storeNum);
|
|
||||||
|
|
||||||
// 金币按钮
|
|
||||||
local moneyBtn = Yosin_BaseButton(126, 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(245 - storeNum.GetSize().w, 27);
|
|
||||||
Addchild(storeNum);
|
|
||||||
|
|
||||||
|
// 耳环
|
||||||
|
local earrings = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 122);
|
||||||
|
DrawSpriteFrame(earrings, 179, 102);
|
||||||
|
|
||||||
|
// 魔法石
|
||||||
|
local MagicStone = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 20);
|
||||||
|
DrawSpriteFrame(MagicStone, 211, 101);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if (!getroottable().rawin("chongzaiflag")) {
|
// if (!getroottable().rawin("chongzaiflag")) {
|
||||||
// getroottable()["chongzaiflag"] <- true;
|
// getroottable()["chongzaiflag"] <- true;
|
||||||
// } else {
|
// } else {
|
||||||
|
|
|
||||||
|
|
@ -262,14 +262,14 @@ class _ItemCollection extends Yosin_CommonUi {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!getroottable().rawin("chongzaiflag")) {
|
// if (!getroottable().rawin("chongzaiflag")) {
|
||||||
getroottable()["chongzaiflag"] <- true;
|
// getroottable()["chongzaiflag"] <- true;
|
||||||
} else {
|
// } else {
|
||||||
//遍历窗口队列 如果可见则调用Show
|
// //遍历窗口队列 如果可见则调用Show
|
||||||
for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
// for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
||||||
local Window = _SYS_WINDOW_LIST_[i];
|
// local Window = _SYS_WINDOW_LIST_[i];
|
||||||
Window.Visible = false;
|
// Window.Visible = false;
|
||||||
Window.RemoveSelf();
|
// Window.RemoveSelf();
|
||||||
}
|
// }
|
||||||
TestStage();
|
// TestStage();
|
||||||
}
|
// }
|
||||||
Loading…
Reference in New Issue