From b52f6126d240ab48e37b3567cbf76fb8c9b02845 Mon Sep 17 00:00:00 2001 From: WONIU Date: Fri, 3 Jan 2025 19:47:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=E8=A7=92=E8=89=B2=E5=9F=8E?= =?UTF-8?q?=E9=95=87=E7=A7=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqr/Core/UI_Class/UI_Widget.nut | 322 +++++++++++++++++++++--- sqr/User/UI/Window/4_PersonalInfo.nut | 336 ++++++++++++++++++++++++++ sqr/User/UI/Window/5_Inventory.nut | 53 ++++ sqr/folder-alias.json | 6 + 4 files changed, 680 insertions(+), 37 deletions(-) create mode 100644 sqr/User/UI/Window/4_PersonalInfo.nut create mode 100644 sqr/User/UI/Window/5_Inventory.nut diff --git a/sqr/Core/UI_Class/UI_Widget.nut b/sqr/Core/UI_Class/UI_Widget.nut index 1cf9d9f..434bbaf 100644 --- a/sqr/Core/UI_Class/UI_Widget.nut +++ b/sqr/Core/UI_Class/UI_Widget.nut @@ -165,7 +165,8 @@ class Yosin_EmeStretch extends Yosin_CommonUi { local ScaleRate = ScaleW / SpriteList[1].GetSize().w; local ScaleRateH = H / SpriteList[1].GetSize().h; - SpriteList[1].SetPosition(SpriteList[0].GetSize().w, 0); + SpriteList[1].SetPosition(SpriteList[0].GetSize().w, -30); + SpriteList[1].SetScale(ScaleRate, ScaleRateH); SpriteList[2].SetPosition(SpriteList[0].GetSize().w + ScaleW, 0); if (H != SpriteList[1].GetSize().h) { @@ -209,71 +210,79 @@ class Yosin_NineBoxStretch extends Yosin_CommonUi { // 绘制 function DrawBackground(width, height, path, imgId) { - local x = 0; - local y = 0; // 左上角 local backgroundTopLeft = CL_SpriteObject(path, imgId); - backgroundTopLeft.SetPosition(x, y); - Addchild(backgroundTopLeft); - // 左上角图片大小 - local cornerImgSize = backgroundTopLeft.GetSize(); - local cornerWidth = cornerImgSize.w; - local cornerHeight = cornerImgSize.h; - - // 中间 - local backgroundCenter = CL_SpriteObject(path, imgId + 4); - backgroundCenter.SetPosition(cornerWidth, y + cornerHeight); - Addchild(backgroundCenter); - // 中间图片大小 - local centerImgSize = backgroundCenter.GetSize(); - local centerWidth = centerImgSize.w; - local centerHeight = centerImgSize.h; - - - local scaleW = (width.tofloat() - cornerWidth.tofloat() * 2.0) / centerWidth.tofloat(); - local scaleH = (height.tofloat() - y.tofloat() - cornerHeight.tofloat()) / centerHeight.tofloat(); - // 上边 local backgroundTop = CL_SpriteObject(path, imgId + 1); - backgroundTop.SetPosition(cornerWidth, y); + // 右上角 + 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); + + // 中间图片大小 + 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); // 右上角 - local backgroundTopRight = CL_SpriteObject(path, imgId + 2); - backgroundTopRight.SetPosition(width - cornerWidth, y); + backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w, 0); Addchild(backgroundTopRight); // 左边 local backgroundLeft = CL_SpriteObject(path, imgId + 3); - backgroundLeft.SetPosition(x, y + cornerHeight); + backgroundLeft.SetPosition(0, backgroundTopLeft.bottom() + 1); backgroundLeft.SetScale(1, scaleH); Addchild(backgroundLeft); // 中间 + backgroundCenter.SetPosition(backgroundLeft.right() + 1, backgroundLeft.Y); backgroundCenter.SetScale(scaleW, scaleH); + Addchild(backgroundCenter); // 右边 - local backgroundRight = CL_SpriteObject(path, imgId + 5); - backgroundRight.SetPosition(width - cornerWidth, y + cornerHeight); + backgroundRight.SetPosition(width - backgroundRight.GetSize().w, backgroundCenter.Y); backgroundRight.SetScale(1, scaleH); Addchild(backgroundRight); // 左下角 - local backgroundBottomLeft = CL_SpriteObject(path, imgId + 6); - backgroundBottomLeft.SetPosition(x, height - cornerHeight); + backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h); Addchild(backgroundBottomLeft); // 下边 - local backgroundBottom = CL_SpriteObject(path, imgId + 7); - backgroundBottom.SetPosition(cornerWidth, height - cornerHeight); + backgroundBottom.SetPosition(backgroundBottomLeft.right() + 1, backgroundBottomLeft.Y); backgroundBottom.SetScale(scaleW, 1); Addchild(backgroundBottom); // 右下角 - local backgroundBottomRight = CL_SpriteObject(path, imgId + 8); - backgroundBottomRight.SetPosition(width - cornerWidth, height - cornerHeight); + backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w, backgroundBottomLeft.Y); Addchild(backgroundBottomRight); } @@ -309,7 +318,7 @@ class Yosin_SplicingButton extends Yosin_CommonUi { //悬停态 SpriteList[1] = Yosin_EmeStretch(0, 0, W, H, Path, Idx + (UnavailableFlag ? 4 : 3), Direction); //按下态 - SpriteList[2] = Yosin_EmeStretch(0, 0, W, H, Path, Idx + (UnavailableFlag ? 8 : 3), Direction); + SpriteList[2] = Yosin_EmeStretch(0, 0, W, H, Path, Idx + (UnavailableFlag ? 8 : 6), Direction); if (UnavailableFlag) { //不可用态 SpriteList[3] = Yosin_EmeStretch(0, 0, W, H, Path, Idx + 12, Direction); @@ -357,4 +366,243 @@ class Yosin_SplicingButton extends Yosin_CommonUi { } ChangeFrame(); } -} \ No newline at end of file +} + + + + +// 窗口顶部标题 +class Yosin_TopTitle extends Yosin_CommonUi { + + constructor(W, H, title, drawBackground = true) { + base.constructor(0, 0, W, H); + + //内容背景 + if (drawBackground){ + local background = Yosin_NineBoxStretch(-1, 15, W + 1, H - 15, "sprite/interface/lenheartwindowcommon.img", 97); + AddUIChild(background); + } + + // 标题背景 + local Background = Yosin_EmeStretch(0, 0, W, 22, "sprite/interface/lenheartwindowcommon.img", 609); + Addchild(Background); + + // 标题亮色背景 + local BackgroundBright = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 483); + local scaleW = (W / BackgroundBright.GetSize().w).tofloat(); + BackgroundBright.SetScale( scaleW , 1); + Addchild(BackgroundBright); + + + // 标题 + local titleTextActor = FontAssetManager.GenerateNormal(title, true, { + color = sq_RGBA(206, 189, 140, 255) + }); + local titleX = W / 2 - titleTextActor.GetSize().w / 2; + // 绘制标题 + titleTextActor.SetPosition(titleX, 2); + Addchild(titleTextActor); + + local closeBtn = Yosin_BaseButton(W - 20, 4, 12, 12, "sprite/interface/lenheartwindowcommon.img", 544); + closeBtn.DownSimulateOffset = false; + closeBtn.OnClick = function(btn) { + + } + AddUIChild(closeBtn); + + local topBtn = Yosin_BaseButton(W - 40, 2, 13, 13, "sprite/interface/lenheartwindowcommon.img", 455); + topBtn.DownSimulateOffset = false; + topBtn.OnClick = function(btn) { + + } + AddUIChild(topBtn); + + } + + + +} + + + +// 标题按钮 +class titleButton extends Yosin_BaseButton { + + index = null; + select = false; + cacheSelect = false; + cacheY = null; + + LBDownOnClick = null; + + constructor(X, Y, W, H, Path, Idx, title) { + base.constructor(X, Y, W, H, Path, Idx); + + cacheY = Y; + DownSimulateOffset = false; + + local backText = FontAssetManager.GenerateNormal( title , true, { + color = sq_RGBA(130, 114, 84, 255) + }); + backText.SetUpdateFunc(function(Text, Dt) { + if (select == cacheSelect) return; + if (select) { + Text.SetFillColor(sq_RGBA(187,176,149, 255)); + } else { + Text.SetFillColor(sq_RGBA(130,114,84, 255)); + } + cacheSelect = select; + }) + + backText.SetPosition(9, 2); + Addchild(backText); + + } + + function ChangeFrame() { + //状态更改 刷新精灵帧 + if (State != SpriteState) { + if (State == 2) { + Y -= 1; + SyncPos(X, Y); + } else if (SpriteState == 2) { + Y += 1; + SyncPos(X, Y); + } + SpriteState = State; + Sprite.SetFrame(FrameList[SpriteState]); + Sprite.SetPosition(0, 0); + } + } + + function Proc(Dt) { + + if (select) return; + + //不可用 + if (State == 3) { + + } else { + //按下 + if (isLBDown) { + State = 2; + select = true; + if (LBDownOnClick != null) { + LBDownOnClick(this); + } + } + //悬停 + else if (isInRect) { + State = 1; + } + //普通 + else { + State = 0; + } + } + ChangeFrame(); + } + +} + + +// 拉伸标题按钮 +class Yosin_StretchTitleButton extends Yosin_SplicingButton { + + index = null; + select = false; + cacheSelect = false; + LBDownOnClick = null; + + titleText = null; + + constructor(X, Y, W, H, Path, Idx, title,) { + base.constructor(X, Y, W, H, Path, Idx, true, false) + + titleText = FontAssetManager.GenerateNormal( title , true, { + color = sq_RGBA(130, 114, 84, 255) + }); + titleText.SetUpdateFunc(function(Text, Dt) { + if (select == cacheSelect) return; + if (select) { + Text.SetFillColor(sq_RGBA(187,176,149, 255)); + } else { + Text.SetFillColor(sq_RGBA(130,114,84, 255)); + } + cacheSelect = select; + }) + + titleText.SetPosition(9, 2); + Addchild(titleText); + + } + + function Proc(Dt) { + if (select) return; + + if (State != 3 && isLBDown) { + State = 2; + select = true; + if (LBDownOnClick != null) { + LBDownOnClick(this); + } + } + if (State == 2) { + Y -= 1; + SyncPos(X, Y); + } else if (SpriteState == 2) { + Y += 1; + SyncPos(X, Y); + } + + base.Proc(Dt); + } + +} + + +// 横向多个标题单选按钮 +class Yosin_RowMoreTitleBtn extends Yosin_CommonUi { + + LBDownOnClick = null; + btns = []; + tests = []; + + constructor(X, Y, titles, baseWidth = 44, path = "sprite/interface/lenheartwindowcommon.img", idx = 160) { + this.tests = titles; + local btnX = 0; + for(local i = 0; i < titles.len(); i++) { + + local textW = FontAssetManager.GenerateNormal(titles[i], true).GetSize().w + 20; + local btnW = baseWidth + 20; + btnW = textW > btnW ? textW : btnW ; + + local titleBtn = Yosin_StretchTitleButton(btnX, 1, btnW, 19, path, idx, titles[i]); + titleBtn.index = i; + + titleBtn.LBDownOnClick = function (btn) { + btn.Parent.LBDownOnClick(this, btn.index); + + for (local i = 0; i < btn.Parent.btns.len(); i++) { + btn.Parent.btns[i].select = false; + btn.Parent.btns[i].titleText.SetFillColor(sq_RGBA(130,114,84, 255)); + } + + btn.select = true; + btn.Parent.btns[btn.index].titleText.SetFillColor(sq_RGBA(187,176,149, 255)); + + }; + + btns.push(titleBtn); + btnX += btnW + 1; + } + + base.constructor(X, Y, btnX, 21); + + for (local i = 0; i < btns.len(); i++) { + AddUIChild(btns[i]); + } + + } + +} diff --git a/sqr/User/UI/Window/4_PersonalInfo.nut b/sqr/User/UI/Window/4_PersonalInfo.nut new file mode 100644 index 0000000..b1438a9 --- /dev/null +++ b/sqr/User/UI/Window/4_PersonalInfo.nut @@ -0,0 +1,336 @@ +/* +文件名:4_PersonalInfo.nut +路径:User/UI/Window/4_PersonalInfo.nut +创建日期:2024-12-26 00:32 +文件用途: 个人信息 +*/ + +// 个人信息 250, 60, 286, 530 +class _PersonalInfo extends Yosin_Window { + + roleTitleBtn = null; + dressUpTitleBtn = null; + stoneTitleBtn = null; + + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + local title = Yosin_TopTitle(gWidth, gHeight, "个人信息(M)"); + AddUIChild(title); + + //注册控件 + RegisterWidget(); + } + + function RegisterWidget() { + // 角色按钮 + roleTitleBtn = titleButton(10, 25, 40, 19, "sprite/interface/lenheartwindowcommon.img", 82, "角色"); + AddUIChild(roleTitleBtn); + // 装扮/宠物按钮 + dressUpTitleBtn = titleButton(roleTitleBtn.right() + 1, 25, 71, 19, "sprite/interface/lenheartwindowcommon.img", 86, "装扮/宠物"); + AddUIChild(dressUpTitleBtn); + // 护石按钮 + stoneTitleBtn = titleButton(dressUpTitleBtn.right() + 1, 25, 40, 19, "sprite/interface/lenheartwindowcommon.img", 82, "护石"); + AddUIChild(stoneTitleBtn); + + roleTitleBtn.LBDownOnClick = function (btn) { + titleClick(btn); + }.bindenv(this); + dressUpTitleBtn.LBDownOnClick = function (btn) { + titleClick(btn); + }.bindenv(this); + stoneTitleBtn.LBDownOnClick = function (btn) { + titleClick(btn); + }.bindenv(this); + + + + // 角色信息 + local roleInfo = roleInfo("个人角色信息", roleTitleBtn.X, roleTitleBtn.bottom() + 2 ); + AddUIChild(roleInfo); + + + + } + + function titleClick(btn) { + btn.Parent.roleTitleBtn.select = false; + btn.Parent.dressUpTitleBtn.select = false; + btn.Parent.stoneTitleBtn.select = false; + btn.select = true; + } + + + //逻辑入口 + function Proc(Dt) { + SyncPos(X, Y); + base.Proc(Dt); + } + +} + + +// 角色信息 +class roleInfo extends Yosin_Window { + + //是否为独立窗口 + IsIndependent = false; + + brown = sq_RGBA(160, 132, 75, 255); + green = sq_RGBA(74, 161, 87, 255); + + btn = null; + + constructor(gObjectId, gX, gY) { + base.constructor(gObjectId, gX, gY, 266, 355, 0); + + //注册控件 + RegisterWidget(); + } + + function RegisterWidget() { + // 背景 + local backGround = CL_SpriteObject("sprite/interface2/profile/profile.img", 60); + Addchild(backGround); + + // 装备 + RegisterEquipment(); + // 名称 等级 其他 + RegisterNameAndOther(); + // 属性 + RegisterPropertyItems(); + // 底部四个按钮 + RegisterBottomButton(); + + + } + + // 装备 + function RegisterEquipment() { + // 装备背景 + local equipmentBackground = CL_SpriteObject("sprite/interface2/profile/profile.img", 14); + equipmentBackground.SetPosition(7.5, 8); + Addchild(equipmentBackground); + + // 中间装备背景 + local centerBackground = CL_SpriteObject("sprite/interface2/profile/profile.img", 77); + centerBackground.SetPosition( 124 , 10); + Addchild(centerBackground); + + + } + + + + // 名称 等级 其他 + function RegisterNameAndOther() { + // 冒险家名望 + local adventurerFame = CL_SpriteObject("sprite/interface2/profile/profile_icon.img", 53); + adventurerFame.SetPosition(70, 185); + Addchild(adventurerFame); + + local adventurerFameText = FontAssetManager.GenerateNormal("冒险家名望", true, { + color = brown + }); + adventurerFameText.SetPosition(adventurerFame.right() + 5, adventurerFame.Y); + Addchild(adventurerFameText); + + // 冒险家名望数值 + local adventurerFameNum = FontAssetManager.GenerateNormal("7", true, { + color = green + }); + adventurerFameNum.SetPosition(adventurerFameText.right() + 5, adventurerFameText.Y); + Addchild(adventurerFameNum); + } + + + + function RegisterPropertyItems() { + // 属性 + + // 生命 + local life = roleInfoPropertyItem(0, 213, 0, "生命", "100"); + Addchild(life); + // 魔法 + local magic = roleInfoPropertyItem(life.right() + 16, life.Y, 1, "魔法", "100"); + Addchild(magic); + // 物理防御力 + local physicalDefense = roleInfoPropertyItem(life.X, life.bottom(), 8, "物理防御力", "100", false); + Addchild(physicalDefense); + // 魔法防御力 + local magicDefense = roleInfoPropertyItem(physicalDefense.right() + 16, physicalDefense.Y, 9, "魔法防御力", "100"); + Addchild(magicDefense); + + // 力量 + local strength = roleInfoPropertyItem(life.X, physicalDefense.bottom(), 2, "力量", "100"); + Addchild(strength); + // 智力 + local intelligence = roleInfoPropertyItem(strength.right() + 16, strength.Y, 3, "智力", "100"); + Addchild(intelligence); + // 体力 + local vitality = roleInfoPropertyItem(strength.X, strength.bottom(), 4, "体力", "100"); + Addchild(vitality); + // 精神 + local spirit = roleInfoPropertyItem(vitality.right() + 16, vitality.Y, 5, "精神", "100"); + Addchild(spirit); + // 物理攻击力 + local physicalATK = roleInfoPropertyItem(life.X, spirit.bottom(), 6, "物理攻击力", "100"); + Addchild(physicalATK); + // 魔法攻击力 + local magicATK = roleInfoPropertyItem(physicalATK.right() + 16, physicalATK.Y, 7, "魔法攻击力", "100"); + Addchild(magicATK); + // 物理暴击 + local physicalCrit = roleInfoPropertyItem(life.X, magicATK.bottom(), 10, "物理暴击", "100"); + Addchild(physicalCrit); + // 魔法暴击 + local magicCrit = roleInfoPropertyItem(physicalCrit.right() + 16, physicalCrit.Y, 11, "魔法暴击", "100"); + Addchild(magicCrit); + // 独立攻击 + local independentAttack = roleInfoPropertyItem(life.X, magicCrit.bottom(), 12, "独立攻击", "100"); + Addchild(independentAttack); + + // 攻击速度 + local attackSpeed = roleInfoPropertyItem(life.X, independentAttack.bottom(), 13, "攻击速度", "100"); + Addchild(attackSpeed); + // 释放速度 + local releaseSpeed = roleInfoPropertyItem(attackSpeed.right() + 16, attackSpeed.Y, 14, "释放速度", "100"); + Addchild(releaseSpeed); + // 移动速度 + local moveSpeed = roleInfoPropertyItem(life.X, releaseSpeed.bottom(), 15, "移动速度", "100"); + Addchild(moveSpeed); + + // 攻击属性 + local attackProperty = roleInfoPropertyItem(life.X, moveSpeed.bottom(), 16, "攻击属性", "火(0)/冰(0)/光(0)/暗(0)", true, 260); + Addchild(attackProperty); + } + + + // 底部四个按钮 + function RegisterBottomButton() { + // 副职业 + local subJob = otherButton(0, 401, 62, "副职业", false); + AddUIChild(subJob); + subJob.OnClick = function (btn) { + //todo 打开副职业面板 + print(11111); + }.bindenv(this); + + local separation = CL_SpriteObject("sprite/interface2/profile/profile.img", 70 ); + separation.SetPosition(subJob.right(), subJob.Y + 7.5); + Addchild(separation); + + // 战斗分析 + local battleAnalysis = otherButton(subJob.right() + 1, subJob.Y, 64, "战斗分析"); + AddUIChild(battleAnalysis); + battleAnalysis.OnClick = function (btn) { + //todo 打开面板 + print(11111); + }.bindenv(this); + + local separationOne = CL_SpriteObject("sprite/interface2/profile/profile.img", 70 ); + separationOne.SetPosition(battleAnalysis.right(), battleAnalysis.Y + 7.5); + Addchild(separationOne); + + // 决斗信息 // 根据决斗场等级 显示 sprite/interface2/pvp02/pvprank_icon/tier_icon.img 24 + local duelInfo = otherButton(battleAnalysis.right() + 1, battleAnalysis.Y, 14, "决斗信息", true); + AddUIChild(duelInfo); + duelInfo.OnClick = function (btn) { + //todo 打开面板 + print(11111); + }.bindenv(this); + + local separationTwo = CL_SpriteObject("sprite/interface2/profile/profile.img", 70 ); + separationTwo.SetPosition(duelInfo.right(), duelInfo.Y + 7.5); + Addchild(separationTwo); + + // 详细信息 + local detailedInformation = otherButton(duelInfo.right() + 1, duelInfo.Y, 66, "详细信息"); + AddUIChild(detailedInformation); + detailedInformation.OnClick = function (btn) { + //todo 打开面板 + print(11111); + }.bindenv(this); + } + + //逻辑入口 + function Proc(Dt) { + SyncPos(X, Y); + base.Proc(Dt); + } + +} + +// 属性项 +class roleInfoPropertyItem extends Yosin_CommonUi { + + // additionReaction 属性是否有加成 加成为绿色 不加成灰色 + constructor(gX, gY, idx, title, numText, additionReaction = true, width = 120) { + base.constructor(gX, gY, width, 18); + + 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_SpriteObject("sprite/interface2/profile/profile_icon.img", idx); + icon.SetPosition(5, 0); + Addchild(icon); + + // 属性名称 + local property = FontAssetManager.GenerateNormal(title, true, { + color = titlecolor + }); + property.SetPosition(icon.right() + 5, icon.Y); + Addchild(property); + + // 属性数值 + local propertyNum = FontAssetManager.GenerateNormal(numText, true, { + color = numColor + }); + local numX = width - propertyNum.GetSize().w; + propertyNum.SetPosition( numX, icon.Y); + Addchild(propertyNum); + + + } + + + //逻辑入口 + function Proc(Dt) { + SyncPos(X, Y); + base.Proc(Dt); + } + +} + + +// 其他面板按钮 +class otherButton extends Yosin_CommonUi { + + // 是否启用按钮 + enabled = true; + // pvp 是否是pvp 按钮 + constructor(gX, gY, idx, title, pvp = false, enabled = true, ) { + base.constructor(gX, gY, 65, 65); + + this.enabled = enabled; + + local titlecolor = enabled? sq_RGBA(160, 132, 75, 255) : sq_RGBA(79, 79, 79, 255); + // 属性名称 + local property = FontAssetManager.GenerateNormal(title, true, { + color = titlecolor + }); + property.SetPosition( 32 - property.GetSize().w / 2 , 45 ); + Addchild(property); + + local path = pvp? "sprite/interface2/profile/profile_pvp_icon.img" : "sprite/interface2/profile/profile.img"; + local icon = CL_SpriteObject(path, enabled ? idx : idx +1 ); + icon.SetPosition(32 - icon.GetSize().w / 2, 45/2 - icon.GetSize().h / 2 + 3 ); + Addchild(icon); + + + + } + +} + + diff --git a/sqr/User/UI/Window/5_Inventory.nut b/sqr/User/UI/Window/5_Inventory.nut new file mode 100644 index 0000000..0170568 --- /dev/null +++ b/sqr/User/UI/Window/5_Inventory.nut @@ -0,0 +1,53 @@ +/* +文件名:5_Inventory.nut +路径:User/UI/Window/5_Inventory.nut +创建日期:2025-01-02 12:37 +文件用途: 背包窗口 +*/ + +class _Inventory extends Yosin_Window { + + item = null; + dressUpTitleBtn = null; + petTitleBtn = null; + stoneTitleBtn = null; + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + // local title = Yosin_TopTitle(gWidth, gHeight, "装备栏(I)"); + // AddUIChild(title); + + local item2 = Yosin_EmeStretch(100, 100, 80, 25, "sprite/interface/lenheartwindowcommon.img", 160); + Addchild(item2); + + //注册控件 + RegisterWidget(); + } + + function RegisterWidget() { + + //, "装扮", "宠物", "护石" + local titlesBtn = Yosin_RowMoreTitleBtn(10, 25, ["物品栏"]); + AddUIChild(titlesBtn); + + titlesBtn.LBDownOnClick = function(btns, index) { + + }; + + + local item = Yosin_SplicingButton(10, 50, 80, 25, "sprite/interface/lenheartwindowcommon.img", 160, true, false); + AddUIChild(item); + + + + + } + + //逻辑入口 + function Proc(Dt) { + SyncPos(X, Y); + base.Proc(Dt); + } + +} \ No newline at end of file diff --git a/sqr/folder-alias.json b/sqr/folder-alias.json index 748d940..465e4c3 100644 --- a/sqr/folder-alias.json +++ b/sqr/folder-alias.json @@ -241,5 +241,11 @@ }, "User/Object/ActiveObject/NpcObjectClass.nut": { "description": "NPC对象" + }, + "User/UI/Window/5_Inventory.nut": { + "description": "背包窗口" + }, + "User/UI/Window/4_PersonalInfo.nut": { + "description": "个人信息窗口" } } \ No newline at end of file