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

112 lines
3.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
文件名:FiendwarNoti.nut
路径:Plugins/Fiendwar/FiendwarNoti.nut
创建日期:2024-04-12 22:12
文件用途:超时空攻坚战队伍消息
*/
class FiendwarNotiC extends LenheartNewUI_Windows {
//调试模式
// DeBugMode = true;
//消息内容
Msg = null;
//队长名称
Name = null;
//消息时间
Timer = null;
//队伍聊天消息分发
function FiendwarPartyNotiCallBack(Chunk) {
local Jso = Json.Decode(Chunk);
Name = Jso.Name;
Msg = Jso.msg;
Timer = Clock();
}
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
Childrens = [];
//注册控件
RegisterWidget();
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
//队伍聊天消息分发
Pack_Control.rawset(20063018, FiendwarPartyNotiCallBack.bindenv(this));
}
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);
}
//队长头像
PartyMasterIcon = null;
//绘制主界面
function DrawMain(obj) {
if (!Name || !Msg) return;
//绘制背景框
L_sq_DrawImg("hud/fiendwarl.img", 24, X + 134, Y + 180);
//绘制队长图标
// L_sq_DrawImg
if (FiendwarTotal.GetInstance().MyTeam) {
local Mt = FiendwarTotal.GetInstance().MyTeam;
local PartyMaster;
foreach(index, value in Mt.MembersList) {
if (value.InfoObj.Captain) {
PartyMasterIcon = clone(value);
}
}
sq_DrawBox(X + 42 + 118, Y + 1 + 185, 22, 18, PartyMasterIcon.HandBoxColor[PartyMasterIcon.InfoObj.TeamId]);
//绘制队长头像
foreach(AvatarObj in PartyMasterIcon.InfoObj.EquVos) {
local AXpos = AvatarObj.D[0] + X + PartyMasterIcon.OffsetArr[PartyMasterIcon.InfoObj.Job][0] + 118;
local AYpos = AvatarObj.D[1] + Y + PartyMasterIcon.OffsetArr[PartyMasterIcon.InfoObj.Job][1] + 185;
setClip(AXpos + PartyMasterIcon.OffsetArr[PartyMasterIcon.InfoObj.Job][2], AYpos + PartyMasterIcon.OffsetArr[PartyMasterIcon.InfoObj.Job][3], AXpos + PartyMasterIcon.OffsetArr[PartyMasterIcon.InfoObj.Job][2] + 22, AYpos + PartyMasterIcon.OffsetArr[PartyMasterIcon.InfoObj.Job][3] + 18); //开始裁切
L_sq_DrawImg("character/" + AvatarObj.B + ".img", AvatarObj.C, AXpos, AYpos);
releaseClip(); //裁切结束
}
}
//绘制队长名字
L_sq_DrawCode(Name, X + 184, Y + 189, sq_RGBA(247, 214, 90, 255), 0, 1);
//绘制点
L_sq_DrawCode(" ", X + 210, Y + 189, sq_RGBA(230, 200, 155, 255), 0, 1);
//绘制消息
L_sq_DrawCode(Msg, X + 190 + LenheartTextClass.GetStringLength(Name), Y + 189, sq_RGBA(230, 200, 155, 255), 0, 1);
}
function Show(obj) {
DrawMain(obj);
LenheartNewUI_Windows.Show(obj);
}
//逻辑入口
function Proc(obj) {
LenheartNewUI_Windows.SyncPos(X, Y);
if (Name && Msg)
Visible = true;
else
Visible = false;
if (Timer) {
if (Clock() - Timer >= 3500) {
Timer = null;
Name = null;
Msg = null;
}
}
}
}