111
This commit is contained in:
171
Plugins/LaunchAnnouncement/LaunchAnnouncement.nut
Normal file
171
Plugins/LaunchAnnouncement/LaunchAnnouncement.nut
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
文件名:LaunchAnnouncement.nut
|
||||
路径:Plugins/LaunchAnnouncement/LaunchAnnouncement.nut
|
||||
创建日期:2023-08-21 12:52
|
||||
文件用途:上线公告
|
||||
*/
|
||||
|
||||
class LaunchAnnouncementC extends BasicsDrawTool {
|
||||
|
||||
//公告组
|
||||
NotiArr = null;
|
||||
Timer = null;
|
||||
|
||||
//收到信息包
|
||||
function LaunchAnnouncementCallBack(Chunk) {
|
||||
|
||||
local Buffer = Json_STL("CheckLaunchAnnouncementCallBack");
|
||||
Buffer.Parse(Chunk, 0, false);
|
||||
local RootTab = getroottable();
|
||||
if (RootTab.rawin("Lenheart_LaunchAnnouncementCObj")) {
|
||||
local Tobj = RootTab["Lenheart_LaunchAnnouncementCObj"];
|
||||
|
||||
local ArrBuf = Tobj.NotiArr;
|
||||
local T = {
|
||||
NotiStrR = Buffer.Get("NotiStrR"),
|
||||
NotiStrG = Buffer.Get("NotiStrG"),
|
||||
NotiStrB = Buffer.Get("NotiStrB"),
|
||||
NotiStrA = Buffer.Get("NotiStrA"),
|
||||
NotiStrXpos = Buffer.Get("NotiStrXpos"),
|
||||
NotiStrYpos = Buffer.Get("NotiStrYpos"),
|
||||
//对应的话语
|
||||
NotiStr = Buffer.Get("NotiStr"),
|
||||
//对应话语渐入时间
|
||||
NotiStrUpTime = Buffer.Get("NotiStrUpTime"),
|
||||
//对应话语显示时间
|
||||
NotiStrPrintTime = Buffer.Get("NotiStrPrintTime"),
|
||||
//对应话语渐出时间
|
||||
NotiStrDownTime = Buffer.Get("NotiStrDownTime"),
|
||||
//对应出现的Img路径
|
||||
ImgPath = Buffer.Get("ImgPath"),
|
||||
//对应出现的Img帧数
|
||||
ImgFrame = Buffer.Get("ImgFrame"),
|
||||
ImgXpos = Buffer.Get("ImgXpos"),
|
||||
ImgYpos = Buffer.Get("ImgYpos"),
|
||||
//对应出现的Img渐入时间
|
||||
ImgUpTime = Buffer.Get("ImgUpTime"),
|
||||
//对应出现的Img渐出时间
|
||||
ImgDownTime = Buffer.Get("ImgDownTime"),
|
||||
}
|
||||
ArrBuf.append(T);
|
||||
Tobj.NotiArr = ArrBuf;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function SendUp() {
|
||||
local T = {
|
||||
op = 20053001,
|
||||
}
|
||||
local str = Json.Encode(T);
|
||||
L_sq_SendPackType(130);
|
||||
L_sq_SendPackWChar(str);
|
||||
L_sq_SendPack();
|
||||
}
|
||||
|
||||
constructor() {
|
||||
Timer = TimeSTL("LaunchAnnouncementCTimer" + Clock(), 60000);
|
||||
|
||||
NotiArr = [];
|
||||
|
||||
SendUp();
|
||||
Pack_Control.rawset(20053002, LaunchAnnouncementCallBack);
|
||||
/*
|
||||
Timer = TimeSTL("LaunchAnnouncementCTimer" + Clock(), 60000);
|
||||
local T = {
|
||||
NotiStrR = 230,
|
||||
NotiStrG = 200,
|
||||
NotiStrB = 155,
|
||||
NotiStrA = 250,
|
||||
NotiStrXpos = 300,
|
||||
NotiStrYpos = 305,
|
||||
//对应的话语
|
||||
NotiStr = "这是一段测试文本",
|
||||
//对应话语渐入时间
|
||||
NotiStrUpTime = 320,
|
||||
//对应话语显示时间
|
||||
NotiStrPrintTime = 1000,
|
||||
//对应话语渐出时间
|
||||
NotiStrDownTime = 1000,
|
||||
//对应出现的Img路径
|
||||
ImgPath = "common/announcement/leveche_cutscene.ani",
|
||||
//对应出现的Img帧数
|
||||
ImgFrame = 99999999,
|
||||
ImgXpos = 0,
|
||||
ImgYpos = 200,
|
||||
//对应出现的Img渐入时间
|
||||
ImgUpTime = 0,
|
||||
//对应出现的Img渐出时间
|
||||
ImgDownTime = 0,
|
||||
}
|
||||
NotiArr.append(T);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
function Proc(obj) {
|
||||
|
||||
}
|
||||
|
||||
function Draw(obj) {
|
||||
|
||||
if (NotiArr.len() > 0) {
|
||||
local T = NotiArr[0];
|
||||
|
||||
if (Timer.Get() == false || Timer.Get() == 60000) {
|
||||
Timer.Start();
|
||||
}
|
||||
if (Timer.Get() != false && Timer.Get() > 0) {
|
||||
|
||||
local Ani = null;
|
||||
if (T.ImgFrame == 99999999) {
|
||||
Ani = T_DrawDynamicAni(obj, T.ImgPath, T.ImgXpos, T.ImgYpos, T.ImgPath);
|
||||
}
|
||||
|
||||
if (Timer.Get() > (T.NotiStrPrintTime + T.NotiStrUpTime + T.NotiStrDownTime)) {
|
||||
Timer.Reset();
|
||||
if (Ani) sq_Rewind(Ani);
|
||||
NotiArr.remove(0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
local AlaphValue;
|
||||
//如果时间小于 文字渐入时间
|
||||
if (Timer.Get() <= T.NotiStrUpTime) {
|
||||
AlaphValue = sq_GetUniformVelocity(0, T.NotiStrA, Timer.Get(), T.NotiStrUpTime);
|
||||
}
|
||||
if (Timer.Get() > T.NotiStrUpTime && Timer.Get() <= (T.NotiStrPrintTime + T.NotiStrUpTime)) {
|
||||
AlaphValue = T.NotiStrA;
|
||||
}
|
||||
if (Timer.Get() > (T.NotiStrPrintTime + T.NotiStrUpTime) && Timer.Get() <= (T.NotiStrPrintTime + T.NotiStrUpTime + T.NotiStrDownTime)) {
|
||||
AlaphValue = sq_GetUniformVelocity(T.NotiStrA, 0, Timer.Get(), (T.NotiStrPrintTime + T.NotiStrUpTime + T.NotiStrDownTime));
|
||||
}
|
||||
|
||||
L_sq_DrawCode(T.NotiStr, T.NotiStrXpos, T.NotiStrYpos, sq_RGBA(T.NotiStrR, T.NotiStrG, T.NotiStrB, AlaphValue), 1, 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Lenheart_LaunchAnnouncement(obj) {
|
||||
local RootTab = getroottable();
|
||||
if (!RootTab.rawin("Lenheart_LaunchAnnouncementCObj")) {
|
||||
local Cobj = LaunchAnnouncementC();
|
||||
RootTab.rawset("Lenheart_LaunchAnnouncementCObj", Cobj);
|
||||
} else {
|
||||
RootTab["Lenheart_LaunchAnnouncementCObj"].Proc(obj);
|
||||
RootTab["Lenheart_LaunchAnnouncementCObj"].Draw(obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (getroottable().rawin("LenheartFuncTab")) {
|
||||
getroottable()["LenheartFuncTab"].rawset("Lenheart_LaunchAnnouncementFunc", Lenheart_LaunchAnnouncement);
|
||||
} else {
|
||||
local T = {};
|
||||
T.rawset("Lenheart_LaunchAnnouncementFunc", Lenheart_LaunchAnnouncement);
|
||||
getroottable().rawset("LenheartFuncTab", T);
|
||||
}
|
||||
Reference in New Issue
Block a user