Sqr/Plugins/Anton/antontownmainparty_user.nut

303 lines
11 KiB
Plaintext

/*
文件名:antontownmainparty_user.nut
路径:Plugins/Anton/antontownmainparty_user.nut
创建日期:2022-09-04 20:12
文件用途:城镇中打开安图恩攻坚队面板攻坚队玩家部分
*/
class AntonUserControl_C extends BasicsDrawTool
{
CaptainControl = null; //攻坚队长主控
PartyID = null; //队伍ID
PlayerLevel = null; //玩家等级
PlayerName = null; //玩家名字
PlayerJob = null; //玩家基础职业
PlayerJobEx = null; //玩家转职职业
PlayerGrowTypeJob = null; //玩家转职职业
PlayerSession = null; //玩家世界编号
PartyCaptain = null; //玩家是否小队队长
CaptainBool = null; //是否攻坚队队长
Material = null; //是否拥有材料
CID = null; //玩家CID
CheakPlayerInfoFunc = null;
FuncButtonSwitch = false; //功能界面是否打开
MyName = null;
ButtonObj = null;
X = 0;
Y = 0;
KickoutPlayerButtonObj = null; //踢出玩家按钮
CheckPlayerInfoButtonObj = null; //查看信息按钮
PartyFuncButtonObj = null; //组队按钮
TradingPlayerButtonObj = null; //交易按钮
//获取汉字偏移
function GetOffserFromLen(char, offset)
{
return (char.len() * offset)
}
constructor(gName, gX, gY, gCaptainControl)
{
MyName = gName;
X = gX;
Y = gY;
print("AntonUserControl_C ClassObject Succes");
CaptainControl = gCaptainControl;
}
//设置Player信息
function SetPlayerInfo(InfoTable)
{
PartyID = InfoTable.PartyID; //队伍ID
PlayerLevel = InfoTable.PlayerLevel; //玩家等级
PlayerName = InfoTable.PlayerName; //玩家名字
PlayerJob = InfoTable.PlayerJob; //玩家基础职业
PlayerJobEx = InfoTable.PlayerJobEx; //玩家转职职业
PlayerGrowTypeJob = InfoTable.PlayerGrowTypeJob; //玩家转职职业
PlayerSession = InfoTable.PlayerSession; //玩家世界编号
PartyCaptain = InfoTable.PartyCaptain; //玩家是否小队队长
CaptainBool = InfoTable.CaptainBool; //是否攻坚队队长
Material = InfoTable.Material; //是否拥有材料
CID = InfoTable.CID; //玩家CID
}
function FuncButtonC(obj, YposOffset, AniIndex)
{
local FuncThis = null;
if(FuncThis == null)
{
FuncThis = AntonButtonPro(obj, MyName + FuncThis + "Func", AntonTownControl_C.X + X - 110, AntonTownControl_C.Y + Y - 1 + YposOffset, "common/anton/funcbutton.ani", 100, 21, AniIndex);
FuncThis.SetRectEnble(true, MyName + FuncThis + "Func", AntonTownControl_C.X + X - 110, AntonTownControl_C.Y + Y - 1 + YposOffset, "common/anton/funcbutton.ani", AniIndex + 1);
FuncThis.SetCustomClickEnble(true, FuncThis + "FuncSwitchButtonc", AntonTownControl_C.X + X - 110, AntonTownControl_C.Y + Y - 1 + YposOffset, "common/anton/funcbutton.ani", AniIndex + 2);
}
FuncThis.Show();
return FuncThis;
}
//绘制功能按键
function DrawFucButton(obj)
{
if(FuncButtonSwitch) //功能函数开关
{
local Ypos = 0; //初始偏移
{ //邀请组队
if(PartyID == 0)
{
local CheakPlayer = FuncButtonC(obj, Ypos, 12);
if(CheakPlayer.isLBActive())
{
L_sq_SendPackType(10);
L_sq_SendPackWord(PlayerSession);
L_sq_SendPackByte(0);
L_sq_SendPackDWord(1);
L_sq_SendPackWord(0);
L_sq_SendPack();
}
Ypos += 21;
}
}
{ //查看信息
local CheakPlayer = FuncButtonC(obj, Ypos, 0);
if(CheakPlayer.isLBActive())
{
L_sq_SendPackType(8);
L_sq_SendPackWord(PlayerSession);
L_sq_SendPackByte(3);
L_sq_SendPack();
}
Ypos += 21;
}
{ //交易
local TradingPlayer = FuncButtonC(obj, Ypos, 6);
if(TradingPlayer.isLBActive())
{
L_sq_SendPackType(10);
L_sq_SendPackWord(PlayerSession);
L_sq_SendPackByte(1);
L_sq_SendPackDWord(22053);
L_sq_SendPack();
}
Ypos += 21;
}
}
}
//绘制主Ani
function DrawMainAni(obj)
{
if(ButtonObj == null)
{
ButtonObj = AntonButtonPro(obj, MyName, AntonTownControl_C.X + X, AntonTownControl_C.Y + Y, "common/anton/user.ani", 329, 17, 0);
ButtonObj.SetRectEnble(true, MyName + "SwitchButtonr", AntonTownControl_C.X + X - 8, AntonTownControl_C.Y + Y - 8, "common/anton/user.ani", 2);
}
ButtonObj.Show();
//绘制队伍
T_DrawStayAni(obj, "common/anton/partytype.ani", AntonTownControl_C.X + X + 6, AntonTownControl_C.Y + Y + 2, PartyID + 1, "安图恩队伍编号" + PartyID, 1.0);
//绘制材料准备情况
T_DrawStayAni(obj, "common/anton/material.ani", AntonTownControl_C.X + X + 272, AntonTownControl_C.Y + Y + 2, Material.tointeger(), "安图恩材料准备情况" + Material, 1.0);
}
//绘制头像
function DrawFaceAni(obj)
{
T_DrawStayAni(obj, "common/anton/face/" + PlayerJob + "/" + (PlayerJobEx % 16) + ".ani", X, Y, 0, "安图恩头像编号" + PlayerName);
//如果是攻坚队长主控
if(CaptainControl && !CaptainBool)
{
KickoutPlayerButtonObj = AntonButtonPro(obj, "AntonPartyKickoutButton" + PlayerName.tostring(), X - 9, Y - 10, "common/anton/new/newnull.ani", 38, 39, 0);
KickoutPlayerButtonObj.SetRectEnble(true, "AntonPartyKickoutButtonr" + PlayerName.tostring(), X - 9, Y - 10, "common/anton/new/newfunc.ani", 0);
KickoutPlayerButtonObj.Show();
if(KickoutPlayerButtonObj.isLBActive())
{
obj.sq_PlaySound("CLICK_BUTTON1");
local AntonKickoutPartyPlayer = Json_STL("AntonKickoutPartyPlayer");
AntonKickoutPartyPlayer.Put("op", 1015);
AntonKickoutPartyPlayer.Put("TCID", CID);
local str = AntonKickoutPartyPlayer.GetString();
L_sq_SendPackType(130);
L_sq_SendPackWChar(str);
L_sq_SendPack();
AntonKickoutPartyPlayer.Delete();
}
}
}
//绘制名字
function DrawPlayerName(obj)
{
L_Code_STL(PlayerName.tostring(), X + 40, Y - 1, 0xFF4990aa, 1);
}
//绘制等级
function DrawPlayerLevel(obj)
{
L_Code_STL("Lv." + PlayerLevel, X + 40, Y + 17, 0xFF29708a, 1);
}
//绘制职业名字
function DrawPlayerGrowTypeName(obj)
{
L_Code_STL(PlayerGrowTypeJob, X + 65 + GetOffserFromLen(PlayerLevel.tostring(), 3), Y + 17, 0xFF29708a, 1);
}
//绘制队伍图标
function DrawPlayerPartyType(obj)
{
if(CaptainBool == true)
{
T_DrawStayAni(obj, "common/anton/partytype.ani", X + 133, Y - 1, 0, "安图恩队伍编号队长");
}
else T_DrawStayAni(obj, "common/anton/partytype.ani", X + 133, Y - 1, PartyID + 1, "安图恩队伍编号" + PartyID);
}
//绘制材料准备情况
function DrawPlayerMaterial(obj)
{
T_DrawStayAni(obj, "common/anton/material.ani", X + 157, Y - 1, Material.tointeger(), "安图恩材料准备情况" + Material.tostring());
}
//绘制交互功能按钮
function DrawPlayerFunc(obj)
{
//绘制查看信息按钮
{
if(!CheckPlayerInfoButtonObj)
{
CheckPlayerInfoButtonObj = AntonButtonPro(obj, "AntonCheckPlayerInfoButton", X + 153, Y + 12, "common/anton/new/newfunc.ani", 16, 16, 1);
CheckPlayerInfoButtonObj.SetRectEnble(true, "AntonCheckPlayerInfoButtonr", X + 153, Y + 12, "common/anton/new/newfunc.ani", 2);
CheckPlayerInfoButtonObj.SetCustomClickEnble(true, "AntonCheckPlayerInfoButtonr", X + 153, Y + 13, "common/anton/new/newfunc.ani", 2);
}
CheckPlayerInfoButtonObj.Show();
if(CheckPlayerInfoButtonObj.isLBActive())
{
obj.sq_PlaySound("CLICK_BUTTON1");
L_sq_SendPackType(8);
L_sq_SendPackWord(PlayerSession);
L_sq_SendPackByte(3);
L_sq_SendPack();
}
}
//绘制交易按钮
{
if(!TradingPlayerButtonObj)
{
TradingPlayerButtonObj = AntonButtonPro(obj, "AntonTradingPlayerButton", X + 171, Y + 12, "common/anton/new/newfunc.ani", 16, 16, 3);
TradingPlayerButtonObj.SetRectEnble(true, "AntonTradingPlayerButtonr", X + 171, Y + 12, "common/anton/new/newfunc.ani", 4);
TradingPlayerButtonObj.SetCustomClickEnble(true, "AntonTradingPlayerButtonr", X + 171, Y + 13, "common/anton/new/newfunc.ani", 4);
}
TradingPlayerButtonObj.Show();
if(TradingPlayerButtonObj.isLBActive())
{
obj.sq_PlaySound("CLICK_BUTTON1");
L_sq_SendPackType(10);
L_sq_SendPackWord(PlayerSession);
L_sq_SendPackByte(1);
L_sq_SendPackDWord(22053);
L_sq_SendPack();
}
}
//绘制组队按钮
{
if(!PartyFuncButtonObj)
{
PartyFuncButtonObj = AntonButtonPro(obj, "AntonPartyFuncButton", X + 189, Y + 12, "common/anton/new/newfunc.ani", 16, 16, 5);
PartyFuncButtonObj.SetRectEnble(true, "AntonPartyFuncButtonr", X + 189, Y + 12, "common/anton/new/newfunc.ani", 6);
PartyFuncButtonObj.SetCustomClickEnble(true, "AntonPartyFuncButtonr", X + 189, Y + 13, "common/anton/new/newfunc.ani", 6);
}
PartyFuncButtonObj.Show();
if(PartyFuncButtonObj.isLBActive())
{
obj.sq_PlaySound("CLICK_BUTTON1");
L_sq_SendPackType(10);
L_sq_SendPackWord(PlayerSession);
L_sq_SendPackByte(0);
L_sq_SendPackDWord(1);
L_sq_SendPackWord(0);
L_sq_SendPack();
}
}
}
function Show(obj)
{
//绘制头像
DrawFaceAni(obj);
//绘制名字
DrawPlayerName(obj);
//绘制等级
DrawPlayerLevel(obj);
//绘制职业名字
DrawPlayerGrowTypeName(obj);
//绘制队伍图标
DrawPlayerPartyType(obj);
//绘制材料准备情况
DrawPlayerMaterial(obj);
//绘制交互功能按钮
DrawPlayerFunc(obj);
}
function Run(obj)
{
Show(obj);
}
}