个人信息 画布处理
This commit is contained in:
		
							parent
							
								
									ed606f570f
								
							
						
					
					
						commit
						8eac6b971a
					
				|  | @ -1,311 +0,0 @@ | ||||||
| /* |  | ||||||
| 文件名:4_PersonalInfo.nut |  | ||||||
| 路径:User/UI/Window/4_PersonalInfo.nut |  | ||||||
| 创建日期:2024-12-26	00:32 |  | ||||||
| 文件用途: 个人信息 |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| // local infoWindow = Sq_CreateWindow(_PersonalInfo, "个人信息窗口", 250, 60, 286, 530, 20); |  | ||||||
| // todo 图和尺寸比例都需要修改 |  | ||||||
| // todo Yosin_Window 和 Yosin_CommonUi 会有性能开销需要检查 |  | ||||||
| class _PersonalInfo extends Yosin_Window { |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     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() { |  | ||||||
| 
 |  | ||||||
|         // 标题按钮 |  | ||||||
|         local titlesBtn = Yosin_RowMoreTitleBtn(10, 25, ["角色", "装扮/宠物", "护石"],"sprite/interface/lenheartwindowcommon.img", 160); |  | ||||||
|         AddUIChild(titlesBtn); |  | ||||||
| 
 |  | ||||||
|         titlesBtn.LBDownOnClick = function(btns, index) { |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         // 角色信息 |  | ||||||
|         local roleInfo = roleInfo("个人角色信息", 10, titlesBtn.bottom() + 2 ); |  | ||||||
|         AddUIChild(roleInfo); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     //逻辑入口 |  | ||||||
|     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); |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|  | @ -0,0 +1,47 @@ | ||||||
|  | /* | ||||||
|  | 文件名:4_PersonalInfo.nut | ||||||
|  | 路径:User/UI/Window/4_Personalinfo/4_PersonalInfo.nut | ||||||
|  | 创建日期:2025-01-09	13:55 | ||||||
|  | 文件用途: 个人信息窗口 | ||||||
|  | */ | ||||||
|  | 
 | ||||||
|  | // local infoWindow = Sq_CreateWindow(_PersonalInfo, "个人信息窗口", 250, 60, 286, 530, 20); | ||||||
|  | // todo 图和尺寸比例都需要修改 | ||||||
|  | // todo Yosin_Window 和 Yosin_CommonUi 会有性能开销需要检查 | ||||||
|  | class _PersonalInfo extends Yosin_Window { | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     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() { | ||||||
|  | 
 | ||||||
|  |         // 标题按钮 | ||||||
|  |         local titlesBtn = Yosin_RowMoreTitleBtn(10, 25, 252, ["角色", "装扮/宠物", "护石"], "sprite/interface/lenheartwindowcommon.img", 160); | ||||||
|  |         AddUIChild(titlesBtn); | ||||||
|  | 
 | ||||||
|  |         titlesBtn.LBDownOnClick = function(btns, index) { | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         // 角色信息 | ||||||
|  |         local roleInfo = roleInfoPage(10, titlesBtn.bottom() + 2 ); | ||||||
|  |         AddUIChild(roleInfo); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     //逻辑入口 | ||||||
|  |     function Proc(Dt) { | ||||||
|  |         SyncPos(X, Y); | ||||||
|  |         base.Proc(Dt); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1,346 @@ | ||||||
|  | 
 | ||||||
|  | /* | ||||||
|  | 文件名:Personalinfo_RoleInfoPage.nut | ||||||
|  | 路径:User/UI/Window/4_Personalinfo/Personalinfo_RoleInfoPage.nut | ||||||
|  | 创建日期:2025-01-09	13:51 | ||||||
|  | 文件用途: 个人信息-角色信息页面 | ||||||
|  | */ | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | // 角色信息 | ||||||
|  | class roleInfoPage extends Yosin_CommonUi { | ||||||
|  | 
 | ||||||
|  |     brown = sq_RGBA(160, 132, 75, 255); | ||||||
|  |     green = sq_RGBA(74, 161, 87, 255); | ||||||
|  | 
 | ||||||
|  |     Canvas = null; | ||||||
|  | 
 | ||||||
|  |     constructor(gX, gY) { | ||||||
|  |         local w = 266; | ||||||
|  |         local h = 355; | ||||||
|  |         base.constructor( gX, gY, w, h); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         // 创建画布 | ||||||
|  |         Canvas = CL_CanvasObject(); | ||||||
|  |         // 重设大小并清空 | ||||||
|  |         Canvas.ResizeAndClear(w, h); | ||||||
|  |         // 开始绘制 | ||||||
|  |         Canvas.BeginDraw(); | ||||||
|  | 
 | ||||||
|  |         // 绘制 | ||||||
|  |         DrawWidget(); | ||||||
|  | 
 | ||||||
|  |         // 结束绘制 | ||||||
|  |         Canvas.EndDraw(); | ||||||
|  |         // 添加画布 | ||||||
|  |         Addchild(Canvas); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     function DrawWidget() { | ||||||
|  |         // 背景 | ||||||
|  |         local backGround = CL_SpriteFrameObject("sprite/interface2/profile/profile.img", 60); | ||||||
|  |         Canvas.DrawSpriteFrame(backGround, 0, 0); | ||||||
|  | 
 | ||||||
|  |         // 上半部分 装备展示 | ||||||
|  |         local equipment = Personalinfo_CharactersEquipment(0, 0); | ||||||
|  |         Canvas.DrawSprite(equipment); | ||||||
|  | 
 | ||||||
|  |         // 名称 等级 其他 | ||||||
|  |         RegisterNameAndOther(); | ||||||
|  |         // 属性 | ||||||
|  |         // RegisterPropertyItems(); | ||||||
|  | 
 | ||||||
|  |         // 底部四个按钮 | ||||||
|  |         RegisterBottomButton(); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     // 名称 等级 其他 | ||||||
|  |     function RegisterNameAndOther() { | ||||||
|  |         // 冒险家名望 | ||||||
|  |         local adventurerFame = CL_SpriteFrameObject("sprite/interface2/profile/profile_icon.img", 53); | ||||||
|  |         Canvas.DrawSpriteFrame(adventurerFame, 70, 185); | ||||||
|  | 
 | ||||||
|  |         local adventurerFameText = FontAssetManager.GenerateNormal("冒险家名望", true, { | ||||||
|  |             color = brown | ||||||
|  |         }); | ||||||
|  |         Canvas.DrawActor(adventurerFameText, adventurerFame.right() + 5, adventurerFame.Y); | ||||||
|  | 
 | ||||||
|  |         // 冒险家名望数值 | ||||||
|  |         local adventurerFameNum = FontAssetManager.GenerateNormal("7", true, { | ||||||
|  |             color = green | ||||||
|  |         }); | ||||||
|  |         Canvas.DrawActor(adventurerFameNum, adventurerFameText.right() + 5, adventurerFameText.Y); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     // 属性 | ||||||
|  |     function RegisterPropertyItems() { | ||||||
|  |         // 属性 | ||||||
|  | 
 | ||||||
|  |         // 生命 | ||||||
|  |         local life = roleInfoPropertyItem.Draw( 0, "生命", "100"); | ||||||
|  |         Canvas.DrawSprite(life, 0, 213); | ||||||
|  |         // 魔法 | ||||||
|  |         local magic = roleInfoPropertyItem.Draw( 1, "魔法", "100"); | ||||||
|  |         Canvas.DrawSprite(magic, life.right() + 16, life.Y); | ||||||
|  |         // 物理防御力 | ||||||
|  |         local physicalDefense = roleInfoPropertyItem.Draw( "物理防御力", "100", false); | ||||||
|  |         Canvas.DrawSprite(physicalDefense, life.X, life.bottom(), 8); | ||||||
|  |         // 魔法防御力 | ||||||
|  |         local magicDefense = roleInfoPropertyItem.Draw( 9, "魔法防御力", "100"); | ||||||
|  |         Canvas.DrawSprite(magicDefense, physicalDefense.right() + 16, physicalDefense.Y); | ||||||
|  | 
 | ||||||
|  |         // 力量 | ||||||
|  |         local strength = roleInfoPropertyItem.Draw( 2, "力量", "100"); | ||||||
|  |         Canvas.DrawSprite(strength, life.X, physicalDefense.bottom()); | ||||||
|  |         // 智力 | ||||||
|  |         local intelligence = roleInfoPropertyItem.Draw( 3, "智力", "100"); | ||||||
|  |         Canvas.DrawSprite(intelligence, strength.right() + 16, strength.Y); | ||||||
|  |         // 体力 | ||||||
|  |         local vitality = roleInfoPropertyItem.Draw( 4, "体力", "100"); | ||||||
|  |         Canvas.DrawSprite(vitality, strength.X, strength.bottom()); | ||||||
|  |         // 精神 | ||||||
|  |         local spirit = roleInfoPropertyItem.Draw( 5, "精神", "100"); | ||||||
|  |         Canvas.DrawSprite(spirit, vitality.right() + 16, vitality.Y); | ||||||
|  |         // 物理攻击力 | ||||||
|  |         local physicalATK = roleInfoPropertyItem.Draw( 6, "物理攻击力", "100"); | ||||||
|  |         Canvas.DrawSprite(physicalATK, life.X, spirit.bottom()); | ||||||
|  |         // 魔法攻击力 | ||||||
|  |         local magicATK = roleInfoPropertyItem.Draw( 7, "魔法攻击力", "100"); | ||||||
|  |         Canvas.DrawSprite(magicATK, physicalATK.right() + 16, physicalATK.Y); | ||||||
|  |         // 物理暴击 | ||||||
|  |         local physicalCrit = roleInfoPropertyItem.Draw( 10, "物理暴击", "100"); | ||||||
|  |         Canvas.DrawSprite(physicalCrit, life.X, magicATK.bottom()); | ||||||
|  |         // 魔法暴击 | ||||||
|  |         local magicCrit = roleInfoPropertyItem.Draw( 11, "魔法暴击", "100"); | ||||||
|  |         Canvas.DrawSprite(magicCrit, physicalCrit.right() + 16, physicalCrit.Y); | ||||||
|  |         // 独立攻击 | ||||||
|  |         local independentAttack = roleInfoPropertyItem.Draw( 12, "独立攻击", "100"); | ||||||
|  |         Canvas.DrawSprite(independentAttack, life.X, magicCrit.bottom()); | ||||||
|  | 
 | ||||||
|  |         // 攻击速度 | ||||||
|  |         local attackSpeed = roleInfoPropertyItem.Draw(13, "攻击速度", "100"); | ||||||
|  |         Canvas.DrawSprite(attackSpeed, life.X, independentAttack.bottom()); | ||||||
|  |         // 释放速度 | ||||||
|  |         local releaseSpeed = roleInfoPropertyItem.Draw( 14, "释放速度", "100"); | ||||||
|  |         Canvas.DrawSprite(releaseSpeed, attackSpeed.right() + 16, attackSpeed.Y); | ||||||
|  |         // 移动速度 | ||||||
|  |         local moveSpeed = roleInfoPropertyItem.Draw( 15, "移动速度", "100"); | ||||||
|  |         Canvas.DrawSprite(moveSpeed, life.X, releaseSpeed.bottom()); | ||||||
|  | 
 | ||||||
|  |         // 攻击属性 | ||||||
|  |         local attackProperty = roleInfoPropertyItem.Draw( 16, "攻击属性", "火(0)/冰(0)/光(0)/暗(0)", true, 260); | ||||||
|  |         Canvas.DrawSprite(attackProperty, life.X, moveSpeed.bottom()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     // 底部四个按钮 | ||||||
|  |     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{ | ||||||
|  | 
 | ||||||
|  |     // 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; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | // 其他面板按钮 | ||||||
|  | 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); | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | // 上半部分 人物装备穿戴 | ||||||
|  | class Personalinfo_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 = false; | ||||||
|  |         allowChangeEquipment = false; | ||||||
|  | 
 | ||||||
|  |         // 创建画布 | ||||||
|  |         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); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     // 背景 | ||||||
|  |     function DrawBackground() { | ||||||
|  | 
 | ||||||
|  |         // 装备栏背景 | ||||||
|  |         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); | ||||||
|  | 
 | ||||||
|  |         // todo 根据是否装备 显示装备 | ||||||
|  |         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); | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | @ -271,5 +271,17 @@ | ||||||
|     }, |     }, | ||||||
|     "Core/BaseClass/AudioClass.nut": { |     "Core/BaseClass/AudioClass.nut": { | ||||||
|         "description": "音频类" |         "description": "音频类" | ||||||
|  |     }, | ||||||
|  |     "User/UI/Window/5_Inventory": { | ||||||
|  |         "description": "背包" | ||||||
|  |     }, | ||||||
|  |     "User/UI/Window/4_Personalinfo": { | ||||||
|  |         "description": "个人信息" | ||||||
|  |     }, | ||||||
|  |     "User/UI/Window/4_Personalinfo/4_PersonalInfo.nut": { | ||||||
|  |         "description": "个人信息窗口" | ||||||
|  |     }, | ||||||
|  |     "User/UI/Window/4_Personalinfo/Personalinfo_RoleInfoPage.nut": { | ||||||
|  |         "description": "个人信息页" | ||||||
|     } |     } | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue