451 lines
15 KiB
Plaintext
451 lines
15 KiB
Plaintext
/*
|
|
文件名:FiendwarHallMyParty.nut
|
|
路径:Plugins/Fiendwar/FiendwarHallMyParty.nut
|
|
创建日期:2024-03-27 19:18
|
|
文件用途:
|
|
*/
|
|
//编队用按钮需要传递参数所以重写
|
|
class FiendwarHallMyPartyEdit_BaseButton extends LenheartNewUI_BaseButton {
|
|
MyInfoIndex = 0;
|
|
constructor(X, Y, W, H, Path, Idx, InfoIndex) {
|
|
MyInfoIndex = InfoIndex;
|
|
LenheartNewUI_BaseButton.constructor(X, Y, W, H, Path, Idx);
|
|
}
|
|
|
|
//鼠标左键弹起回调
|
|
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
|
if (isLBDown && OnClick) {
|
|
OnClick(MyInfoIndex);
|
|
}
|
|
isLBDown = false;
|
|
}
|
|
}
|
|
|
|
class FiendwarHallMyPartyEditC extends LenheartNewUI_Windows {
|
|
//调试模式
|
|
// DeBugMode = true;
|
|
|
|
PartyMarkFlag = 0;
|
|
|
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
|
Childrens = [];
|
|
//注册控件
|
|
RegisterWidget();
|
|
|
|
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
|
}
|
|
|
|
|
|
function RegisterWidget() {
|
|
//关闭按钮
|
|
local CloseButton = LenheartNewUI_BaseButton(278, 0, 11, 12, "interface/lenheartwindowcommon.img", 276);
|
|
CloseButton.OnClick = function() {
|
|
this.Visible = false;
|
|
}.bindenv(this);
|
|
Childrens.append(CloseButton);
|
|
|
|
//搜索按钮
|
|
local QdButton = LenheartNewUI_ButtonText(10, 157, 5, "签到");
|
|
QdButton.State = 8;
|
|
QdButton.SetTextOffset(0, 1);
|
|
QdButton.OnClick = function() {
|
|
if (InputObject.str.len() > 0) {
|
|
|
|
}
|
|
}.bindenv(this);
|
|
Childrens.append(QdButton);
|
|
|
|
//解散队伍按钮
|
|
local BreakPartyButton = LenheartNewUI_ButtonText(80, 158, 5, "解散队伍");
|
|
BreakPartyButton.SetTextOffset(-12, 1);
|
|
BreakPartyButton.OnClick = function() {
|
|
|
|
}.bindenv(this);
|
|
Childrens.append(BreakPartyButton);
|
|
|
|
//关闭按钮
|
|
local CloseButton = LenheartNewUI_ButtonText(150, 158, 5, "关闭");
|
|
CloseButton.SetTextOffset(0, 1);
|
|
CloseButton.OnClick = function() {
|
|
this.Visible = false;
|
|
}.bindenv(this);
|
|
Childrens.append(CloseButton);
|
|
|
|
for (local i = 0; i< 8; i++) {
|
|
//右翻页按钮
|
|
local PartyIndexButton = FiendwarHallMyPartyEdit_BaseButton(12 + (i % 2 * 136), 35 + ((i / 2) * 30), 41, 17, "interface/newstyle/windows/party/party_icon.img", 3 + (i * 3), i + 1);
|
|
//继承类 并重写 调用时传入InfoIndex
|
|
PartyIndexButton.OnClick = function(MyInfoIndex) {
|
|
PartyMarkFlag = MyInfoIndex;
|
|
}.bindenv(this);
|
|
Childrens.append(PartyIndexButton);
|
|
}
|
|
}
|
|
|
|
//绘制主界面
|
|
function DrawMain(obj) {
|
|
//标题栏
|
|
L_sq_DrawButton(X - 1, Y, 284, "interface/lenheartwindowcommon.img", 609, 2, 7);
|
|
//Item信息框一般为211的宽度
|
|
L_sq_DrawWindow(X, Y + 17, 272, 154, "interface/lenheartwindowcommon.img", 213, 12, 2, 13, 2);
|
|
|
|
for (local q = 0; q< 8; q++) {
|
|
L_sq_DrawImg("interface/lenheartwindowcommon.img", 358, X + 60 + (q % 2 * 136), Y + 34 + ((q / 2) * 30));
|
|
for (local i = 0; i< 3; i++) {
|
|
L_sq_DrawImg("interface/lenheartwindowcommon.img", 361, X + 80 + (q % 2 * 136) + (i * 20), Y + 34 + ((q / 2) * 30));
|
|
}
|
|
}
|
|
|
|
if (PartyMarkFlag != 0) {
|
|
L_sq_WA(0x1b46898, 2);
|
|
}
|
|
}
|
|
|
|
function Show(obj) {
|
|
DrawMain(obj);
|
|
LenheartNewUI_Windows.Show(obj);
|
|
|
|
}
|
|
|
|
//逻辑入口
|
|
function Proc(obj) {
|
|
LenheartNewUI_Windows.SyncPos(X, Y);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//队员显示类
|
|
class FiendwarHallMyPartyMemberC extends LenheartNewUI_CommonUi {
|
|
X = 0;
|
|
Y = 0;
|
|
Width = null;
|
|
Height = null;
|
|
InfoObj = null;
|
|
//选中状态
|
|
SelectState = false;
|
|
//攻坚状态
|
|
OffensiveState = 0;
|
|
|
|
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(gInfoObj) {
|
|
InfoObj = gInfoObj;
|
|
this.Width = 458;
|
|
this.Height = 21;
|
|
|
|
this.OnClick = function() {
|
|
local Win = LenheartNewUI_CreateWindow(FiendwarHallMyPartyC, "超时空我的队伍窗口", 430, 15, 354, 290, 18);
|
|
//还原其他 选中自己
|
|
foreach(Obj in Win.MembersList) {
|
|
Obj.SelectState = false;
|
|
}
|
|
SelectState = !SelectState;
|
|
}
|
|
LenheartNewUI_CommonUi.constructor(10, 82, this.Width, this.Height);
|
|
|
|
|
|
//如果没有材料要建立一个购买材料的Button 并且要判断是否是自己 //TODO 这里还不行 要拓展一个函数来比对名字
|
|
/*
|
|
local Name = L_Sq_GetObjectName(sq_GetMyMasterCharacter());
|
|
local Name2 = "夜刃";
|
|
Name == Name2 失败了
|
|
*/
|
|
if (!InfoObj.StkHasFlag && InfoObj.Name == L_Sq_GetObjectName(sq_GetMyMasterCharacter())) {
|
|
|
|
}
|
|
}
|
|
|
|
function Show(obj) {
|
|
//绘制底槽
|
|
L_sq_DrawImg("hud/fiendwarl.img", 12, X, Y);
|
|
|
|
//绘制队伍编号
|
|
// L_sq_DrawImg("interface2/raid/raidcommon/partypinslot_medium/partypinslot_medium.img", 0, X, Y);
|
|
L_sq_DrawImg("interface/newstyle/windows/party/party_icon.img", InfoObj.TeamId * 3, X, Y + 1);
|
|
// L_sq_DrawCode(TeamObj.TeamId, X + 22 - LenheartTextClass.GetStringLength(TeamObj.TeamId) / 2, Y + 5, sq_RGBA(134, 120, 79, 255), 0, 1);
|
|
|
|
sq_DrawBox(X + 42, Y + 1, 22, 18, HandBoxColor[InfoObj.TeamId]);
|
|
//绘制队长头像
|
|
foreach(AvatarObj in InfoObj.EquVos) {
|
|
local AXpos = AvatarObj.D[0] + X + OffsetArr[InfoObj.Job][0];
|
|
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(); //裁切结束
|
|
// }
|
|
}
|
|
|
|
|
|
//绘制等级
|
|
L_sq_DrawCode(InfoObj.Level, X + 76 - LenheartTextClass.GetStringLength(InfoObj.Level) / 2, Y + 5, sq_RGBA(134, 120, 79, 255), 0, 1);
|
|
//绘制角色名
|
|
L_sq_DrawCode(InfoObj.Name, X + 138 - LenheartTextClass.GetStringLength(InfoObj.Name) / 2, Y + 5, sq_RGBA(134, 120, 79, 255), 0, 1);
|
|
//绘制职业名
|
|
L_sq_DrawCode(InfoObj.JobName, X + 234 - LenheartTextClass.GetStringLength(InfoObj.JobName) / 2, Y + 5, sq_RGBA(134, 120, 79, 255), 0, 1);
|
|
|
|
if (!InfoObj.StkHasFlag) {
|
|
L_sq_DrawImg("hud/fiendwarlstk.img", 0, X + 280, Y + 3);
|
|
} else if (InfoObj.Name != L_Sq_GetObjectName(sq_GetMyMasterCharacter())) {
|
|
L_sq_DrawImg("hud/fiendwarlstk.img", 1, X + 280, Y + 3);
|
|
}
|
|
|
|
if (SelectState) {
|
|
L_sq_DrawImg("hud/fiendwarl.img", 13, X, Y);
|
|
}
|
|
|
|
if (isInRect) {
|
|
L_sq_DrawImg("hud/fiendwarl.img", 13, X, Y);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
class FiendwarHallMyPartyC extends LenheartNewUI_Windows {
|
|
//调试模式
|
|
// DeBugMode = true;
|
|
|
|
//队员列表
|
|
MembersList = null;
|
|
|
|
//队伍名称
|
|
TeamName = "";
|
|
//队伍ID
|
|
TeamID = 99999999;
|
|
|
|
//是否是我的攻坚队
|
|
IsMyTeam = false;
|
|
|
|
|
|
//收到请求加入攻坚队包
|
|
function JoinTeamCallBack(Chunk) {
|
|
Sout("收到请求加入包 : \n\n\n %L", Chunk);
|
|
local Jso = Json.Decode(Chunk);
|
|
local win = LenheartNewUI_CreateWindow(FiendwarHallApplyJoinC, "超时空申请加入队伍窗口", 542, 348, 244, 240, 18);
|
|
|
|
local T = {
|
|
Level = Jso.charac.PlayerLevel,
|
|
Name = Jso.charac.PlayerName,
|
|
Job = Jso.charac.PlayerJob,
|
|
PvpLevel = Jso.charac.pvp,
|
|
JobName = Jso.charac.PlayerGrowTypeJob,
|
|
Coin = Jso.charac.PlayCoin,
|
|
Fatigue = Jso.charac.PlayFatigue,
|
|
Combat = Jso.charac.ZL,
|
|
ClearanceCount = Jso.charac.ClearanceCount,
|
|
AvatarArr = Jso.charac.equVos,
|
|
}
|
|
//没人
|
|
if (win.RequestJoinTeamArr.len() == 0) {
|
|
win.RequestJoinTeamArr.append(T);
|
|
win.InitInfo();
|
|
} else win.RequestJoinTeamArr.append(T);
|
|
|
|
print(win.RequestJoinTeamArr.len());
|
|
}
|
|
|
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
|
Childrens = [];
|
|
//注册控件
|
|
RegisterWidget();
|
|
|
|
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
|
|
|
//测试数据
|
|
// MembersList = [];
|
|
// for (local i = 0; i< 8; i++) {
|
|
// local T = {
|
|
// TeamId = i + 1,
|
|
// Level = "100",
|
|
// Name = "玩家" + i,
|
|
// JobName = "银月",
|
|
// Job = i,
|
|
// StkHasFlag = i % 2
|
|
// EquVos = JobAniArr[i]
|
|
// }
|
|
// local TeamBuf = FiendwarHallMyPartyMemberC(T);
|
|
// Childrens.append(TeamBuf);
|
|
// MembersList.append(TeamBuf);
|
|
// }
|
|
|
|
Pack_Control.rawset(20063006, JoinTeamCallBack.bindenv(this));
|
|
}
|
|
|
|
function RegisterWidget() {
|
|
//关闭按钮
|
|
local CloseButton = LenheartNewUI_BaseButton(336, 0, 11, 12, "interface/lenheartwindowcommon.img", 276);
|
|
CloseButton.OnClick = function() {
|
|
this.Visible = false;
|
|
}.bindenv(this);
|
|
Childrens.append(CloseButton);
|
|
|
|
if (!IsMyTeam) {
|
|
local JoinPartyButton = LenheartNewUI_ButtonText(10, 268, 10, "参加攻坚队");
|
|
JoinPartyButton.SetTextOffset(-15, 1);
|
|
JoinPartyButton.OnClick = function() {
|
|
local T = {
|
|
op = 20063005,
|
|
teamsId = TeamID,
|
|
items = [L_sq_GetCharacterAttribute(0x1c, 21), L_sq_GetCharacterAttribute(0x1c, 15), L_sq_GetCharacterAttribute(0x1c, 14), L_sq_GetCharacterAttribute(0x1c, 13)],
|
|
}
|
|
BasicsDrawTool.SendPackEx(T);
|
|
}.bindenv(this);
|
|
Childrens.append(JoinPartyButton);
|
|
return;
|
|
}
|
|
|
|
//队伍按钮
|
|
local ModelButton = LenheartNewUI_ButtonText(9, 60, -18, "队伍");
|
|
ModelButton.Idx = 163;
|
|
ModelButton.DWidth = -8;
|
|
ModelButton.SetTextOffset(-9, 1);
|
|
Childrens.append(ModelButton);
|
|
|
|
//等级按钮
|
|
local StateButton = LenheartNewUI_ButtonText(51, 60, -18, "等级");
|
|
StateButton.Idx = 163;
|
|
StateButton.DWidth = -8;
|
|
StateButton.SetTextOffset(-9, 1);
|
|
Childrens.append(StateButton);
|
|
|
|
//角色名按钮
|
|
local ChannelButton = LenheartNewUI_ButtonText(93, 60, 44, "角色名");
|
|
ChannelButton.Idx = 163;
|
|
ChannelButton.DWidth = 120;
|
|
ChannelButton.FillWidth = 1;
|
|
ChannelButton.FirstWidth = 21;
|
|
ChannelButton.SetTextOffset(17, 1);
|
|
Childrens.append(ChannelButton);
|
|
|
|
//攻坚队名称按钮
|
|
local PartyNameButton = LenheartNewUI_ButtonText(196, 60, 36, "职业名");
|
|
PartyNameButton.Idx = 163;
|
|
PartyNameButton.DWidth = 100;
|
|
PartyNameButton.FillWidth = 1;
|
|
PartyNameButton.FirstWidth = 21;
|
|
PartyNameButton.SetTextOffset(11, 1);
|
|
Childrens.append(PartyNameButton);
|
|
|
|
//入场材料按钮
|
|
local StageButton = LenheartNewUI_ButtonText(289, 60, 0, "入场材料");
|
|
StageButton.Idx = 163;
|
|
StageButton.DWidth = 26;
|
|
StageButton.FillWidth = 1;
|
|
StageButton.FirstWidth = 21;
|
|
StageButton.SetTextOffset(-14, 1);
|
|
Childrens.append(StageButton);
|
|
|
|
|
|
|
|
//队伍编制按钮 //TODO 需要先知道自己是不是队长只有队长才可以编队
|
|
local PartyEditButton = LenheartNewUI_ButtonText(10, 268, 5, "队伍编制");
|
|
PartyEditButton.SetTextOffset(-12, 1);
|
|
PartyEditButton.OnClick = function() {
|
|
local win = LenheartNewUI_CreateWindow(FiendwarHallMyPartyEditC, "超时空我的队伍编队窗口", 105, 40, 294, 192, 18);
|
|
win.Visible = true;
|
|
}.bindenv(this);
|
|
Childrens.append(PartyEditButton);
|
|
|
|
//修改信息按钮
|
|
local FqButton = LenheartNewUI_ButtonText(100, 267, 5, "修改信息");
|
|
FqButton.State = 8;
|
|
FqButton.SetTextOffset(-12, 1);
|
|
Childrens.append(FqButton);
|
|
|
|
//队伍招募按钮
|
|
local FqButton1 = LenheartNewUI_ButtonText(160, 267, 5, "队伍招募");
|
|
FqButton1.State = 8;
|
|
FqButton1.SetTextOffset(-12, 1);
|
|
Childrens.append(FqButton1);
|
|
|
|
//退出按钮
|
|
local ExitButton = LenheartNewUI_ButtonText(220, 268, 5, "退出");
|
|
ExitButton.SetTextOffset(-1, 1);
|
|
ExitButton.OnClick = function() {
|
|
local T = {
|
|
op = 20063009,
|
|
teamsId = TeamID
|
|
}
|
|
BasicsDrawTool.SendPackEx(T);
|
|
}.bindenv(this);
|
|
Childrens.append(ExitButton);
|
|
}
|
|
|
|
//绘制主界面
|
|
function DrawMain(obj) {
|
|
//标题栏
|
|
L_sq_DrawButton(X, Y, 344, "interface/lenheartwindowcommon.img", 609, 2, 7);
|
|
//绘制队伍名字
|
|
L_sq_DrawCode(TeamName, X + 178 - LenheartTextClass.GetStringLength(TeamName) / 2, Y + 5, sq_RGBA(134, 120, 79, 255), 0, 1);
|
|
|
|
//Item信息框一般为211的宽度
|
|
L_sq_DrawWindow(X, Y + 17, 340, 250, "interface/lenheartwindowcommon.img", 97, 11, 12, 11, 13);
|
|
//绘制头图
|
|
L_sq_DrawImg("interface2/gcontents/180621_fiendwar/raid/memberwindow.img", 0, X + 10, Y + 24);
|
|
//绘制阶段图 //TODO 根据阶段绘制img
|
|
L_sq_DrawImg("hud/fiendwarl.img", 7, X + 296, Y + 34);
|
|
|
|
//绘制队伍List
|
|
DrawMembersList(obj);
|
|
|
|
|
|
}
|
|
|
|
//绘制队伍信息
|
|
function DrawMembersList(obj) {
|
|
if (MembersList.len() <= 0) return;
|
|
//遍历需要显示的同步坐标
|
|
foreach(Index, TeamObj in MembersList) {
|
|
TeamObj.SyncPos(X, Y + 2 + Index * 23);
|
|
}
|
|
}
|
|
|
|
function Show(obj) {
|
|
DrawMain(obj);
|
|
LenheartNewUI_Windows.Show(obj);
|
|
|
|
}
|
|
|
|
//逻辑入口
|
|
function Proc(obj) {
|
|
LenheartNewUI_Windows.SyncPos(X, Y);
|
|
}
|
|
|
|
} |