Rindro-Sqr/Project/Fiendwar copy/FiendwarPlayerInteractive.nut

227 lines
7.8 KiB
Plaintext

/*
文件名:FiendwarPlayerInteractive.nut
路径:Plugins/Fiendwar/FiendwarPlayerInteractive.nut
创建日期:2024-04-02 10:55
文件用途:超时空玩家交互
*/
//角色交互按钮需要传递参数所以重写
class FiendwarPlayerInteractive_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(FiendwarHallPlayerInteractiveC, "超时空玩家交互", 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 FiendwarHallPlayerInteractiveC 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 = [
//男鬼剑士
[45, 103, 230, 231],
//女格斗家
[56, 102, 235, 279],
//男神枪手
[52, 130, 238, 246],
//女魔法师
[55, 87, 234, 293],
//男圣职者
[42, 115, 223, 200],
//女神枪手
[52, 119, 226, 209],
//暗夜使者
[56, 102, 225, 226],
//男格斗家
[50, 114, 239, 216],
//男魔法师
[54, 103, 236, 276],
//黑暗武士
[46, 102, 229, 232],
//缔造者
[56, 86, 235, 293],
]
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 (FiendwarTotal.GetInstance().IsCaptain && !("IsMyself" in InfoObj) && FiendwarTotal.GetInstance().MyPartyId == InfoObj.PartyId) {
//委任团长按钮
local GiveMasterButton = FiendwarPlayerInteractive_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 = FiendwarPlayerInteractive_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 = FiendwarPlayerInteractive_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 (FiendwarTotal.GetInstance().IsCaptain && FiendwarTotal.GetInstance().MyPartyId == InfoObj.PartyId) {
//攻坚队员强退按钮
local KickMemberButton = FiendwarPlayerInteractive_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 = 20063021,
teamsId = InfoObj.PartyId,
charCid = InfoObj.Cid
}
Rindro_BaseToolClass.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);
//绘制头像
foreach(AvatarObj in InfoObj.EquVos) {
local AXpos = AvatarObj.D[0] + X + OffsetArr[InfoObj.Job][0] - 40;
local AYpos = AvatarObj.D[1] + Y + OffsetArr[InfoObj.Job][1];
setClip(AXpos + OffsetArr[InfoObj.Job][2], AYpos + OffsetArr[InfoObj.Job][3], AXpos + OffsetArr[InfoObj.Job][2] + 22, AYpos + OffsetArr[InfoObj.Job][3] + 18); //开始裁切
L_sq_DrawImg("character/" + AvatarObj.B + ".img", AvatarObj.C, AXpos, AYpos);
releaseClip(); //裁切结束
}
LenheartNewUI_Windows.Show(obj);
}
function Proc(obj) {
LenheartNewUI_Windows.SyncPos(X, Y);
}
}