Rindro-Sqr/Project/Anton/Rindro_Anton_PlayerInteract...

223 lines
7.4 KiB
Plaintext

/*
文件名:Rindro_Anton_PlayerInteractive.nut
路径:Plugins/New_Anton/Rindro_Anton_PlayerInteractive.nut
创建日期:2024-07-16 11:02
文件用途:安图恩攻坚队玩家交互按钮
*/
//角色交互按钮需要传递参数所以重写
class Rindro_AntonInteractive_BaseButton extends LenheartNewUI_BaseButton {
OnShow = null;
constructor(X, Y, W, H, Path, Idx) {
LenheartNewUI_BaseButton.constructor(X, Y, W, H, Path, Idx);
}
//鼠标左键弹起回调
function OnMouseLbUp(MousePos_X, MousePos_Y) {
Y--;
if (isLBDown && OnClick) {
OnClick();
}
isLBDown = false;
local Each = LenheartNewUI_CreateWindow(Rindro_AntonPlayerInteractiveC, "安图恩玩家交互", X, Y, 100, 21, 0);
Each.Visible = false;
}
function Show(obj) {
//不可用
if (State == 8) {
L_sq_DrawImg(Path, Idx + 3, X, Y + 1);
} else {
//按下
if (isLBDown) {
Y++;
L_sq_DrawImg(Path, (Idx * 2) + 2, X, Y);
}
//悬停
else if (isInRect) {
L_sq_DrawImg(Path, (Idx * 2) + 1, X, Y);
}
//普通
else {
L_sq_DrawImg(Path, 0, X, Y);
}
}
if (OnShow) OnShow(X, Y);
}
}
//角色交互类
class Rindro_AntonPlayerInteractiveC extends LenheartNewUI_Windows {
// DeBugMode = true;
//信息对象
InfoObj = null;
//初始化Flag 初始化以后才显示
InitInfoFlag = false;
//有多少个标签
InitIndexFlag = 1;
//头像框颜色
HandBoxColor = [
0xff717272,
0xff7b2a29,
0xff874e0d,
0xff8b8108,
0xff658e2d,
0xff0f5c8a,
0xff27238f,
0xff4e2491,
0xff932586,
]
//X Y 裁切开始X Y 裁切结束X Y
OffsetArr = [
//男鬼剑士
[56, 112, 220, 222],
//女格斗家
[54, 103, 240, 278],
//男神枪手
[55, 130, 236, 246],
//女魔法师
[57, 88, 234, 291],
//男圣职者
[57, 124, 208, 190],
//女神枪手
[56, 119, 226, 209],
//暗夜使者
[56, 117, 225, 212],
//男格斗家
[56, 118, 233, 212],
//男魔法师
[54, 103, 236, 276],
//黑暗武士
[56, 112, 220, 222],
//缔造者
[57, 88, 234, 291],
]
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
Childrens = [];
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
}
//初始化信息
function InitInfo() {
Childrens = [];
//还原标签数量
InitIndexFlag = 1;
//还原高度
Height = 21;
//还原可见性
Visible = true;
//置顶窗口
ResetFocus();
RegisterWidget();
InitInfoFlag = true;
}
function RegisterWidget() {
//是团长才能委任 并且不是我自己 并且我们在同一个攻坚队
if (RinDro_Anton_Obj.IsCaptain && !("IsMyself" in InfoObj) && RinDro_Anton_Obj.MyRaidTeamId == InfoObj.PartyId) {
//委任团长按钮
local GiveMasterButton = Rindro_AntonInteractive_BaseButton(0, 0 + (InitIndexFlag * 21), 100, 21, "interface2/popup_menu/popup_back.img", 0);
GiveMasterButton.OnShow = function(X, Y) {
L_sq_DrawImg("interface2/popup_menu/popup_icon_character.img", 11, X, Y + 2);
L_sq_DrawCode("委任团长", X + 36, Y + 5, sq_RGBA(104, 213, 237, 255), 0, 1);
}
GiveMasterButton.OnClick = function() {
}.bindenv(this);
AddChild(GiveMasterButton);
InitIndexFlag++;
Height += 21;
}
//查看信息按钮
local CheckInfoButton = Rindro_AntonInteractive_BaseButton(0, 0 + (InitIndexFlag * 21), 100, 21, "interface2/popup_menu/popup_back.img", 0);
CheckInfoButton.OnShow = function(X, Y) {
L_sq_DrawImg("interface2/popup_menu/popup_icon_character.img", 10, X, Y + 2);
L_sq_DrawCode("查看信息", X + 36, Y + 5, sq_RGBA(104, 213, 237, 255), 0, 1);
}
CheckInfoButton.OnClick = function() {
local obj = sq_GetMyMasterCharacter();
//obj.sq_PlaySound("CLICK_BUTTON1");
L_sq_SendPackType(8);
L_sq_SendPackWord(InfoObj.PlayerSession);
L_sq_SendPackByte(3);
L_sq_SendPack();
getroottable().WindowsShowABFlag <- false; //让原生窗口置顶
}.bindenv(this);
AddChild(CheckInfoButton);
InitIndexFlag++;
Height += 21;
if (!("IsMyself" in InfoObj)) {
//交易按钮
local TransactionButton = Rindro_AntonInteractive_BaseButton(0, 0 + (InitIndexFlag * 21), 100, 21, "interface2/popup_menu/popup_back.img", 0);
TransactionButton.OnShow = function(X, Y) {
L_sq_DrawImg("interface2/popup_menu/popup_icon_character.img", 0, X, Y + 2);
L_sq_DrawCode("交易", X + 46, Y + 5, sq_RGBA(104, 213, 237, 255), 0, 1);
}
TransactionButton.OnClick = function() {
local obj = sq_GetMyMasterCharacter();
//obj.sq_PlaySound("CLICK_BUTTON1");
L_sq_SendPackType(10);
L_sq_SendPackWord(InfoObj.PlayerSession);
L_sq_SendPackByte(1);
L_sq_SendPackDWord(22053);
L_sq_SendPack();
getroottable().WindowsShowABFlag <- false; //让原生窗口置顶
}.bindenv(this);
AddChild(TransactionButton);
InitIndexFlag++;
Height += 21;
if (RinDro_Anton_Obj.IsCaptain && RinDro_Anton_Obj.MyRaidTeamId == InfoObj.PartyId) {
//攻坚队员强退按钮
local KickMemberButton = Rindro_AntonInteractive_BaseButton(0, 0 + (InitIndexFlag * 21), 100, 21, "interface2/popup_menu/popup_back.img", 4);
KickMemberButton.OnShow = function(X, Y) {
L_sq_DrawImg("interface2/popup_menu/popup_icon_warning.img", 3, X, Y + 2);
L_sq_DrawCode("攻坚队员强退", X + 24, Y + 5, sq_RGBA(255, 50, 50, 255), 0, 1);
}
KickMemberButton.OnClick = function() {
local obj = sq_GetMyMasterCharacter();
//obj.sq_PlaySound("CLICK_BUTTON1");
local T = {
op = 20064021,
teamsId = InfoObj.PartyId,
charCid = InfoObj.Cid
}
SendPackEx(T);
}.bindenv(this);
AddChild(KickMemberButton);
InitIndexFlag++;
Height += 21;
}
}
}
function Show(obj) {
if (!InitInfoFlag) return;
L_sq_DrawImg("interface2/popup_menu/popup_back.img", 0, X, Y);
//绘制角色名
L_sq_DrawCode(InfoObj.Name, X + 61 - LenheartTextClass.GetStringLength(InfoObj.Name) / 2, Y + 4, sq_RGBA(169, 255, 171, 255), 0, 1);
//绘制头像
local AXpos = X;
local AYpos = Y + 1;
InfoObj.EquVos.DrawFace(AXpos, AYpos);
LenheartNewUI_Windows.Show(obj);
}
function Proc(obj) {
LenheartNewUI_Windows.SyncPos(X, Y);
}
}