626 lines
20 KiB
Plaintext
626 lines
20 KiB
Plaintext
|
|
/*
|
||
|
|
文件名:RoleInfoPage.nut
|
||
|
|
路径:User/UI/Window/4_Personalinfo/RoleInfoPage.nut
|
||
|
|
创建日期:2025-02-15 02:03
|
||
|
|
文件用途:
|
||
|
|
*/
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// 角色信息
|
||
|
|
class UISpace_PersonalInfo.RoleInfoPage extends Yosin_CommonUi {
|
||
|
|
|
||
|
|
w = 266;
|
||
|
|
h = 465;
|
||
|
|
|
||
|
|
brown = sq_RGBA(160, 132, 75, 255);
|
||
|
|
green = sq_RGBA(74, 161, 87, 255);
|
||
|
|
|
||
|
|
CanvasObj = null;
|
||
|
|
|
||
|
|
CharactersObject = null;
|
||
|
|
|
||
|
|
constructor(gX, gY) {
|
||
|
|
base.constructor(gX, gY, w, h);
|
||
|
|
|
||
|
|
//背景
|
||
|
|
local BackGround = CL_SpriteObject("sprite/interface2/profile/profile.img", 60);
|
||
|
|
BackGround.SetZOrder(-2);
|
||
|
|
Addchild(BackGround);
|
||
|
|
|
||
|
|
|
||
|
|
// 上半部分 装备展示
|
||
|
|
CharactersObject = UISpace_PersonalInfo.CharactersEquipment();
|
||
|
|
CharactersObject.SetPosition(0, 0);
|
||
|
|
CharactersObject.SetZOrder(-1);
|
||
|
|
AddUIChild(CharactersObject);
|
||
|
|
|
||
|
|
Refresh();
|
||
|
|
|
||
|
|
|
||
|
|
// // 名称变更记录按钮
|
||
|
|
// local nameChangeRecordBtn = Yosin_BaseButton(70, 7, 18, 17, "sprite/interface/newstyle/windows/inventory/inventory.img", 106);
|
||
|
|
// nameChangeRecordBtn.DownSimulateOffset = false;
|
||
|
|
// AddUIChild(nameChangeRecordBtn);
|
||
|
|
|
||
|
|
// 底部四个按钮
|
||
|
|
RegisterBottomButton();
|
||
|
|
}
|
||
|
|
|
||
|
|
//刷新
|
||
|
|
function Refresh() {
|
||
|
|
// 创建画布
|
||
|
|
if (CanvasObj) Removechild(CanvasObj);
|
||
|
|
CanvasObj = CL_CanvasObject();
|
||
|
|
// 重设大小并清空
|
||
|
|
CanvasObj.ResizeAndClear(w, h);
|
||
|
|
// 开始绘制
|
||
|
|
CanvasObj.BeginDraw();
|
||
|
|
|
||
|
|
// 绘制
|
||
|
|
DrawWidget();
|
||
|
|
|
||
|
|
// 结束绘制
|
||
|
|
CanvasObj.EndDraw();
|
||
|
|
Addchild(CanvasObj);
|
||
|
|
|
||
|
|
//刷新装备 如果背包对象存在
|
||
|
|
if (ClientCharacterInventory) {
|
||
|
|
local Slot = ClientCharacterInventory.PageList[0].CharactersObject.EquipmentSlot;
|
||
|
|
foreach(Index, SlotObj in Slot) {
|
||
|
|
if (SlotObj.Item) CharactersObject.SetEquipment(Index, SlotObj.Item);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
function DrawWidget() {
|
||
|
|
// 名称 等级 其他
|
||
|
|
RegisterNameAndOther();
|
||
|
|
// 属性
|
||
|
|
RegisterPropertyItems();
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
// 名称 等级 其他
|
||
|
|
function RegisterNameAndOther() {
|
||
|
|
//获取角色
|
||
|
|
local Chr = ClientCharacter ? ClientCharacter : null;
|
||
|
|
if (!Chr) return;
|
||
|
|
|
||
|
|
// 名称
|
||
|
|
local nameY = 130;
|
||
|
|
local name = FontAssetManager.GenerateNormal("暂无冒险团", true, {
|
||
|
|
color = sq_RGBA(161, 240, 163, 255)
|
||
|
|
});
|
||
|
|
CanvasObj.DrawActor(name, Width / 2 - name.GetSize().w / 2, nameY);
|
||
|
|
// 等级
|
||
|
|
local level = FontAssetManager.GenerateNormal(format("%d级 %s", Chr.Level, Chr.Name), true, {
|
||
|
|
color = green
|
||
|
|
});
|
||
|
|
CanvasObj.DrawActor(level, Width / 2 - level.GetSize().w / 2, nameY + 15);
|
||
|
|
|
||
|
|
// 角色定位
|
||
|
|
local jobType = CL_SpriteFrameObject("sprite/interface2/profile/profile.img", 74);
|
||
|
|
|
||
|
|
// 职业
|
||
|
|
local job = FontAssetManager.GenerateNormal(format("[%s]", Chr.Info.Attribute[Chr.GrowJob].name), true, {
|
||
|
|
color = brown
|
||
|
|
});
|
||
|
|
|
||
|
|
local jobSize = job.GetSize();
|
||
|
|
local iconX = Width / 2 - (jobSize.w + 12) / 2;
|
||
|
|
|
||
|
|
CanvasObj.DrawSpriteFrame(jobType, iconX, nameY + 33);
|
||
|
|
CanvasObj.DrawActor(job, iconX + 12, nameY + 30);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// 冒险家名望Icon
|
||
|
|
local adventurerFameY = 187;
|
||
|
|
local adventurerFameX = 70;
|
||
|
|
local adventurerFame = CL_SpriteFrameObject("sprite/interface2/profile/profile_icon.img", 53);
|
||
|
|
local adventurerFameRight = adventurerFameX + adventurerFame.GetSize().w;
|
||
|
|
// print(adventurerFameX);
|
||
|
|
// print(adventurerFameY);
|
||
|
|
|
||
|
|
CanvasObj.DrawSpriteFrame(adventurerFame, adventurerFameX, adventurerFameY);
|
||
|
|
|
||
|
|
|
||
|
|
// 冒险家名望
|
||
|
|
local adventurerFameText = FontAssetManager.GenerateNormal("冒险家名望", true, {
|
||
|
|
color = brown
|
||
|
|
});
|
||
|
|
local adventurerFameTextRight = adventurerFameRight + 5 + adventurerFameText.GetSize().w;
|
||
|
|
|
||
|
|
CanvasObj.DrawActor(adventurerFameText, adventurerFameRight + 5, 185);
|
||
|
|
|
||
|
|
// 冒险家名望数值
|
||
|
|
local adventurerFameNum = FontAssetManager.GenerateNormal("0", true, {
|
||
|
|
color = green
|
||
|
|
});
|
||
|
|
CanvasObj.DrawActor(adventurerFameNum, adventurerFameTextRight + 5, 185);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
// 属性
|
||
|
|
function RegisterPropertyItems() {
|
||
|
|
// 属性
|
||
|
|
local leftListX = 0;
|
||
|
|
local rightListX = 132;
|
||
|
|
local rowY = 213;
|
||
|
|
local rowH = 18;
|
||
|
|
|
||
|
|
//获取角色
|
||
|
|
local Chr = ClientCharacter ? ClientCharacter : null;
|
||
|
|
if (!Chr) return;
|
||
|
|
// 生命
|
||
|
|
local life = roleInfoPropertyItem(0, "生命", format("%d/%d", Chr.HP.tointeger(), Chr.Attr.HPMax.tointeger()));
|
||
|
|
CanvasObj.DrawSprite(life, leftListX, rowY);
|
||
|
|
// 魔法
|
||
|
|
local magic = roleInfoPropertyItem(1, "魔法", format("%d/%d", Chr.MP.tointeger(), Chr.Attr.MPMax.tointeger()));
|
||
|
|
CanvasObj.DrawSprite(magic, rightListX, rowY);
|
||
|
|
|
||
|
|
rowY += rowH;
|
||
|
|
|
||
|
|
// 物理防御力
|
||
|
|
local physicalDefense = roleInfoPropertyItem(8, "物理防御力", format("%d", Chr.Attr.EquipmentPhysicalDefense));
|
||
|
|
CanvasObj.DrawSprite(physicalDefense, leftListX, rowY);
|
||
|
|
|
||
|
|
// 魔法防御力
|
||
|
|
local magicDefense = roleInfoPropertyItem(9, "魔法防御力", format("%d", Chr.Attr.EquipmentMagicalDefense));
|
||
|
|
CanvasObj.DrawSprite(magicDefense, rightListX, rowY);
|
||
|
|
|
||
|
|
rowY += rowH;
|
||
|
|
|
||
|
|
// 力量
|
||
|
|
local strength = roleInfoPropertyItem(2, "力量", format("%d", Chr.Attr.PhysicalAttack));
|
||
|
|
CanvasObj.DrawSprite(strength, leftListX, rowY);
|
||
|
|
// 智力
|
||
|
|
local intelligence = roleInfoPropertyItem(3, "智力", format("%d", Chr.Attr.MagicalAttack));
|
||
|
|
CanvasObj.DrawSprite(intelligence, rightListX, rowY);
|
||
|
|
|
||
|
|
rowY += rowH;
|
||
|
|
|
||
|
|
// 体力
|
||
|
|
local vitality = roleInfoPropertyItem(4, "体力", format("%d", Chr.Attr.PhysicalDefense));
|
||
|
|
CanvasObj.DrawSprite(vitality, leftListX, rowY);
|
||
|
|
// 精神
|
||
|
|
local spirit = roleInfoPropertyItem(5, "精神", format("%d", Chr.Attr.MagicalDefense));
|
||
|
|
CanvasObj.DrawSprite(spirit, rightListX, rowY);
|
||
|
|
|
||
|
|
rowY += rowH;
|
||
|
|
|
||
|
|
// 物理攻击力
|
||
|
|
local physicalATK = roleInfoPropertyItem(6, "物理攻击力", format("%d", Chr.Attr.EquipmentPhysicalAttack));
|
||
|
|
CanvasObj.DrawSprite(physicalATK, leftListX, rowY);
|
||
|
|
// 魔法攻击力
|
||
|
|
local magicATK = roleInfoPropertyItem(7, "魔法攻击力", format("%d", Chr.Attr.EquipmentMagicalAttack));
|
||
|
|
CanvasObj.DrawSprite(magicATK, rightListX, rowY);
|
||
|
|
|
||
|
|
rowY += rowH;
|
||
|
|
|
||
|
|
// 物理暴击
|
||
|
|
local physicalCrit = roleInfoPropertyItem(10, "物理暴击", format("%d%%", Chr.Attr.PhysicalCriticalHit));
|
||
|
|
CanvasObj.DrawSprite(physicalCrit, leftListX, rowY);
|
||
|
|
// 魔法暴击
|
||
|
|
local magicCrit = roleInfoPropertyItem(11, "魔法暴击", format("%d%%", Chr.Attr.MagicalCriticalHit));
|
||
|
|
CanvasObj.DrawSprite(magicCrit, rightListX, rowY);
|
||
|
|
|
||
|
|
|
||
|
|
rowY += rowH;
|
||
|
|
|
||
|
|
// 独立攻击
|
||
|
|
local independentAttack = roleInfoPropertyItem(12, "独立攻击", format("%d", Chr.Attr.SeparateAttack));
|
||
|
|
CanvasObj.DrawSprite(independentAttack, leftListX, rowY);
|
||
|
|
|
||
|
|
rowY += rowH;
|
||
|
|
|
||
|
|
// 攻击速度
|
||
|
|
local attackSpeed = roleInfoPropertyItem(13, "攻击速度", format("%.1f%%", Chr.Attr.AttackSpeed.tofloat() / 100.0));
|
||
|
|
CanvasObj.DrawSprite(attackSpeed, leftListX, rowY);
|
||
|
|
|
||
|
|
// 释放速度
|
||
|
|
local releaseSpeed = roleInfoPropertyItem(14, "释放速度", format("%.1f%%", Chr.Attr.CastSpeed.tofloat() / 100.0));
|
||
|
|
CanvasObj.DrawSprite(releaseSpeed, rightListX, rowY);
|
||
|
|
|
||
|
|
rowY += rowH;
|
||
|
|
|
||
|
|
// 移动速度
|
||
|
|
local moveSpeed = roleInfoPropertyItem(15, "移动速度", format("%.1f%%", Chr.Attr.MoveSpeed.tofloat() / 100.0));
|
||
|
|
CanvasObj.DrawSprite(moveSpeed, leftListX, rowY);
|
||
|
|
|
||
|
|
rowY += rowH;
|
||
|
|
|
||
|
|
// 攻击属性
|
||
|
|
local attackProperty = roleInfoPropertyItem(16, "攻击属性", format("火(%d)/冰(%d)/光(%d)/暗(%d)", Chr.Attr.FireAttack, Chr.Attr.WaterAttack, Chr.Attr.LightAttack, Chr.Attr.DarkAttack), true, 260);
|
||
|
|
CanvasObj.DrawSprite(attackProperty, leftListX, rowY);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
// 底部四个按钮
|
||
|
|
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 CL_CanvasObject {
|
||
|
|
|
||
|
|
// additionReaction 属性是否有加成 加成为绿色 不加成灰色
|
||
|
|
constructor(idx, title, numText, additionReaction = true, width = 125) {
|
||
|
|
local w = width;
|
||
|
|
local h = 18;
|
||
|
|
base.constructor();
|
||
|
|
|
||
|
|
// 重设大小并清空
|
||
|
|
ResizeAndClear(w, 18);
|
||
|
|
// 开始绘制
|
||
|
|
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 iconX = 5;
|
||
|
|
local icon = CL_SpriteFrameObject("sprite/interface2/profile/profile_icon.img", idx);
|
||
|
|
local iconRight = iconX + icon.GetSize().w;
|
||
|
|
DrawSpriteFrame(icon, iconX, h / 2 - icon.GetSize().h / 2);
|
||
|
|
|
||
|
|
|
||
|
|
// 属性名称
|
||
|
|
local property = FontAssetManager.GenerateNormal(title, true, {
|
||
|
|
color = titlecolor
|
||
|
|
});
|
||
|
|
DrawActor(property, iconRight + 5, 0);
|
||
|
|
|
||
|
|
// 属性数值
|
||
|
|
local propertyNum = FontAssetManager.GenerateNormal(numText, true, {
|
||
|
|
color = numColor
|
||
|
|
});
|
||
|
|
local numX = w - propertyNum.GetSize().w;
|
||
|
|
DrawActor(propertyNum, numX, 0);
|
||
|
|
|
||
|
|
// 结束绘制
|
||
|
|
EndDraw();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
// 其他面板按钮
|
||
|
|
class otherButton extends Yosin_CommonUi {
|
||
|
|
|
||
|
|
// 是否启用按钮
|
||
|
|
enabled = true;
|
||
|
|
|
||
|
|
iconX = null;
|
||
|
|
iconY = null;
|
||
|
|
icon = null;
|
||
|
|
|
||
|
|
// 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";
|
||
|
|
icon = CL_SpriteObject(path, enabled ? idx : idx + 1);
|
||
|
|
|
||
|
|
iconX = 32 - icon.GetSize().w / 2;
|
||
|
|
iconY = 45 / 2 - icon.GetSize().h / 2 + 3;
|
||
|
|
icon.SetPosition(iconX, iconY);
|
||
|
|
Addchild(icon);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
function Proc(DT) {
|
||
|
|
if (isLBDown) {
|
||
|
|
icon.SetPosition(iconX, iconY + 1);
|
||
|
|
} else {
|
||
|
|
icon.SetPosition(iconX, iconY);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
//装备槽
|
||
|
|
class UISpace_PersonalInfo.EquipmentSlot extends Yosin_CommonUi {
|
||
|
|
Pos = null;
|
||
|
|
|
||
|
|
//悬停特效
|
||
|
|
HoverEffect = null;
|
||
|
|
|
||
|
|
//物品对象
|
||
|
|
Item = null;
|
||
|
|
//物品对象的图标
|
||
|
|
ItemIcon = null;
|
||
|
|
//物品对象的详细信息窗口
|
||
|
|
ItemInfo = null;
|
||
|
|
//详细信息窗口显示Flag
|
||
|
|
ItemInfoShowFlag = false;
|
||
|
|
|
||
|
|
constructor(gPos) {
|
||
|
|
this.Pos = gPos;
|
||
|
|
base.constructor(0, 0, 28, 28);
|
||
|
|
// OpenDeBug();
|
||
|
|
HoverEffect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 131);
|
||
|
|
HoverEffect.SetZOrder(1);
|
||
|
|
HoverEffect.SetVisible(false);
|
||
|
|
Addchild(HoverEffect);
|
||
|
|
}
|
||
|
|
|
||
|
|
function SetItem(Item) {
|
||
|
|
//关闭所有详细信息显示
|
||
|
|
if (ItemInfoShowFlag) {
|
||
|
|
CloseInfo();
|
||
|
|
}
|
||
|
|
|
||
|
|
if (Item) {
|
||
|
|
this.Item = Item;
|
||
|
|
//如果原先有图标则先移除图标在添加
|
||
|
|
if (this.ItemIcon) {
|
||
|
|
Removechild(this.ItemIcon);
|
||
|
|
}
|
||
|
|
this.ItemIcon = this.Item.GetIconSprite();
|
||
|
|
Addchild(this.ItemIcon);
|
||
|
|
this.ItemInfo = this.Item.GetInfoWindow();
|
||
|
|
} else {
|
||
|
|
this.Item = null;
|
||
|
|
if (this.ItemIcon) {
|
||
|
|
Removechild(this.ItemIcon);
|
||
|
|
this.ItemIcon = null;
|
||
|
|
}
|
||
|
|
this.ItemInfo = null;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//显示详细信息
|
||
|
|
function ShowInfo(x, y) {
|
||
|
|
if (!Item) return;
|
||
|
|
if (!this.ItemInfo) GenerateInfo();
|
||
|
|
this.ItemInfoShowFlag = true;
|
||
|
|
|
||
|
|
// 获取信息框尺寸
|
||
|
|
local infoW = 211;
|
||
|
|
local infoH = this.ItemInfo.RealCanvasHeight;
|
||
|
|
|
||
|
|
// X轴边界修正
|
||
|
|
if (x< 0) {
|
||
|
|
x = 0;
|
||
|
|
} else if (x + infoW > 1067) {
|
||
|
|
x = 1067 - infoW;
|
||
|
|
}
|
||
|
|
// Y轴边界修正
|
||
|
|
if (y< 0) {
|
||
|
|
y = 0;
|
||
|
|
} else if (y + infoH > 600) {
|
||
|
|
y = 600 - infoH;
|
||
|
|
}
|
||
|
|
|
||
|
|
//设置位置
|
||
|
|
this.ItemInfo.SetPosition(x, y);
|
||
|
|
this.ItemInfo.ResetFocus();
|
||
|
|
}
|
||
|
|
|
||
|
|
//关闭显示详细信息
|
||
|
|
function CloseInfo() {
|
||
|
|
if (this.ItemInfo) {
|
||
|
|
this.ItemInfoShowFlag = false;
|
||
|
|
this.ItemInfo.CloseWindow();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//override
|
||
|
|
//鼠标事件回调
|
||
|
|
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||
|
|
if (!Visible) return;
|
||
|
|
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||
|
|
if (isInRect && !IMouse.DragObj && !WindowInteractiveFlag) {
|
||
|
|
//如果有道具
|
||
|
|
if (Item) {
|
||
|
|
//设置透明度
|
||
|
|
HoverEffect.SetOpacity(0.4);
|
||
|
|
if (!ItemInfoShowFlag) {
|
||
|
|
//显示详细信息
|
||
|
|
ShowInfo(MousePos_X - 50, MousePos_Y - ((ItemInfo.RealCanvasHeight + 10) / 2));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
//设置悬停槽
|
||
|
|
HoverEffect.SetVisible(true);
|
||
|
|
} else {
|
||
|
|
HoverEffect.SetVisible(false);
|
||
|
|
//关闭所有详细信息显示
|
||
|
|
if (ItemInfoShowFlag) {
|
||
|
|
CloseInfo();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//override
|
||
|
|
//鼠标左键单击回调
|
||
|
|
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||
|
|
//调用原生方法
|
||
|
|
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||
|
|
//关闭所有详细信息显示
|
||
|
|
if (ItemInfoShowFlag) {
|
||
|
|
CloseInfo();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// 上半部分 人物装备穿戴
|
||
|
|
class UISpace_PersonalInfo.CharactersEquipment extends Yosin_CommonUi {
|
||
|
|
|
||
|
|
//背景画布对象
|
||
|
|
CanvasObject = null;
|
||
|
|
//角色显示对象
|
||
|
|
CharacterObject = null;
|
||
|
|
//装备格子槽 0护肩 1上衣 2下装 3腰带 4鞋子 5武器 6手镯 7项链 8戒指 9称号 10辅助装备 11魔法石 12耳环
|
||
|
|
EquipmentSlot = null;
|
||
|
|
EquipmentSlotPos = [
|
||
|
|
[10, 7],
|
||
|
|
[42, 7],
|
||
|
|
[10, 39],
|
||
|
|
[42, 39],
|
||
|
|
[10, 71],
|
||
|
|
[197, 7],
|
||
|
|
[197, 39],
|
||
|
|
[229, 39],
|
||
|
|
[229, 71],
|
||
|
|
[229, 7],
|
||
|
|
[197, 71],
|
||
|
|
[229, 103],
|
||
|
|
[197, 103],
|
||
|
|
];
|
||
|
|
|
||
|
|
//悬停特效
|
||
|
|
HoverEffect = null;
|
||
|
|
|
||
|
|
constructor() {
|
||
|
|
base.constructor(0, 0, 264, 179);
|
||
|
|
EquipmentSlot = [];
|
||
|
|
HoverEffect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 225);
|
||
|
|
HoverEffect.SetMode(0);
|
||
|
|
HoverEffect.SetZOrder(1);
|
||
|
|
HoverEffect.SetVisible(false);
|
||
|
|
Addchild(HoverEffect);
|
||
|
|
|
||
|
|
// 绘制背景
|
||
|
|
DrawBackground();
|
||
|
|
// 初始化装备栏
|
||
|
|
InitEquipment();
|
||
|
|
//初始化角色
|
||
|
|
InitCharacter();
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
// 背景
|
||
|
|
function DrawBackground() {
|
||
|
|
|
||
|
|
local w = 264;
|
||
|
|
local h = 179;
|
||
|
|
// 创建画布
|
||
|
|
CanvasObject = CL_CanvasObject();
|
||
|
|
// 重设大小并清空
|
||
|
|
CanvasObject.ResizeAndClear(w, h);
|
||
|
|
// 开始绘制
|
||
|
|
CanvasObject.BeginDraw();
|
||
|
|
|
||
|
|
// 装备栏背景
|
||
|
|
local equipmentBackground = CL_SpriteFrameObject("sprite/interface2/profile/profile.img", 14);
|
||
|
|
CanvasObject.DrawSpriteFrame(equipmentBackground, 8, 5);
|
||
|
|
|
||
|
|
|
||
|
|
// 顶部光线
|
||
|
|
local topLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 178);
|
||
|
|
CanvasObject.DrawSpriteFrame(topLight, Width / 2 - topLight.GetSize().w / 2, 0);
|
||
|
|
|
||
|
|
// todo 角色展示
|
||
|
|
|
||
|
|
// // 结婚戒指槽位
|
||
|
|
// local ringSlotBg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory_cn.img", 0);
|
||
|
|
// DrawSpriteFrame(ringSlotBg, Width / 2 - ringSlotBg.GetSize().w / 2, 5);
|
||
|
|
|
||
|
|
|
||
|
|
// 辅助装备
|
||
|
|
local assist = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 19);
|
||
|
|
CanvasObject.DrawSpriteFrame(assist, 195, 69);
|
||
|
|
|
||
|
|
// 耳环
|
||
|
|
local earrings = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 122);
|
||
|
|
CanvasObject.DrawSpriteFrame(earrings, 195, 102);
|
||
|
|
|
||
|
|
// 魔法石
|
||
|
|
local MagicStone = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 20);
|
||
|
|
CanvasObject.DrawSpriteFrame(MagicStone, 227, 101);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// 结束绘制
|
||
|
|
CanvasObject.EndDraw();
|
||
|
|
Addchild(CanvasObject);
|
||
|
|
}
|
||
|
|
|
||
|
|
// 初始化装备栏
|
||
|
|
function InitEquipment() {
|
||
|
|
for (local i = 0; i< 13; i++) {
|
||
|
|
local SlotBuffer = UISpace_PersonalInfo.EquipmentSlot(i);
|
||
|
|
SlotBuffer.SetPosition(EquipmentSlotPos[i][0], EquipmentSlotPos[i][1]);
|
||
|
|
AddUIChild(SlotBuffer);
|
||
|
|
EquipmentSlot.push(SlotBuffer);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//初始化角色
|
||
|
|
function InitCharacter() {
|
||
|
|
if (!ClientCharacter) return;
|
||
|
|
if (CharacterObject) Removechild(CharacterObject);
|
||
|
|
CharacterObject = ClientCharacter.CreateTempAni("WaitingAni");
|
||
|
|
CharacterObject.SetPosition(200 - CharacterObject.GetSize().w, 260 - CharacterObject.GetSize().h);
|
||
|
|
Addchild(CharacterObject);
|
||
|
|
}
|
||
|
|
|
||
|
|
//设置装备栏装备
|
||
|
|
function SetEquipment(Slot, Equipment) {
|
||
|
|
EquipmentSlot[Slot].SetItem(Equipment);
|
||
|
|
}
|
||
|
|
}
|