Rindro-Sqr/Project/Anton/Rindro_Anton_FightSituation...

934 lines
34 KiB
Plaintext

/*
文件名:Rindro_AntonFightSituation.nut
路径:Plugins/Rindro_Anton/Rindro_AntonFightSituation.nut
创建日期:2024-04-10 21:28
文件用途:安图恩攻坚战况
*/
//复选框
class RinDro_Anton_LenheartNewUI_SwitchButton extends LenheartNewUI_CommonUi {
//透明度
AlphaValue = 1.0;
State = 0;
ImgIndex = null;
constructor(X, Y) {
LenheartNewUI_CommonUi.constructor(X, Y, 14, 15);
}
function SyncAlpha(Value) {
AlphaValue = Value;
}
function Show(obj) {
//不可用
if (State == 8) {
L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 3 : 141, X, Y + 1, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0);
} else {
//悬停
if (isLBDown) {
L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 2 : 140, X, Y + 1, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0);
}
//按下
else if (isInRect) {
if (State == 0)
L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 1 : 139, X, Y, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0);
if (State == 1)
L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 2 : 140, X, Y, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0);
}
//普通
else {
if (State == 0)
L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex : 138, X, Y, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0);
if (State == 1)
L_sq_DrawImg("interface/lenheartwindowcommon.img", ImgIndex ? ImgIndex + 2 : 140, X, Y, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0);
}
}
}
}
class Rindro_AntonFightSituationC extends LenheartNewUI_Windows {
Visible = false;
//调试模式
// DeBugMode = true;
//透明度
AlphaValue = 1.0;
//攻坚战况信息
Info = null;
//战况消息外部窗口
ExternalWindow = null;
//选择进入地下城指针状态
SelectDgnMarkFlag = 0;
//X Y 裁切开始X Y 裁切结束X Y
OffsetArr = [
//男鬼剑士
[56, 112, 220, 222],
//女格斗家
[54, 103, 240, 278],
//男神枪手
[55, 130, 236, 246],
//女魔法师
[57, 88, 234, 291],
//男圣职者
[57, 124, 208, 190],
//女神枪手
[56, 119, 226, 209],
//暗夜使者
[56, 117, 225, 212],
//男格斗家
[56, 118, 233, 212],
//男魔法师
[54, 103, 236, 276],
//黑暗武士
[56, 112, 220, 222],
//缔造者
[57, 88, 234, 291],
]
MapIndexTable = null; //判断孵化进入的操作表
MapMoveMark = false; //副本中移动的标志
HuoShanMonserTable = null; //火山怪物投放表
//获取攻坚信息
function GetInfo() {
local T = {
op = 20064053,
}
SendPackEx(T);
}
//火山怪物投放包
function HuoShanMonsterEvent(Chunk) {
local Info = Json.Decode(Chunk);
if (sq_GetCurrentModuleType() == 3) {
local obj = sq_GetMyMasterCharacter();
obj = sq_ObjectToSQRCharacter(obj);
obj.sq_SendCreatePassiveObjectPacket(HuoShanMonserTable[Info.FuHuaId], 0, 120, 1, 0);
}
}
//设置伤害值回调
function SetCharacterDamageRate(Chunk) {
local Jso = Json.Decode(Chunk);
local Rate = Jso.damageMarkup.tofloat() / 100.0;
//伤害设置
if (getroottable().rawin("LenheartRaidModuleDamageRate")) {
getroottable()["LenheartRaidModuleDamageRate"] = Rate;
}
}
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
Childrens = [];
//初始化判断孵化进入操作表
MapIndexTable = {};
MapIndexTable.rawset(33100, 7);
MapIndexTable.rawset(33103, 8);
MapIndexTable.rawset(33119, 9);
MapIndexTable.rawset(33116, 10);
//火山怪物投放表
HuoShanMonserTable = {};
HuoShanMonserTable.rawset(1, 202210052);
HuoShanMonserTable.rawset(2, 202210053);
HuoShanMonserTable.rawset(3, 202210054);
HuoShanMonserTable.rawset(4, 202210055);
Pack_Control.rawset(20064040, HuoShanMonsterEvent.bindenv(this));
Pack_Control.rawset(20064030, SetCharacterDamageRate.bindenv(this));
//注册控件
RegisterWidget();
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
ExternalWindow = Rindro_Anton_FightSituatioExternalC("安图恩攻坚战况表外部窗口", getroottable().Rindro_Scr_Width.tointeger() - 103, 8, 103, 22, 0);
ExternalWindow.AddParentWin(this);
GetInfo();
}
//副本List
DgnList = null;
//初始化信息
function InitInfo(InfoObj) {
Info = InfoObj;
//取出副本信息
InfoObj = InfoObj.dunList;
DgnList = [];
//当前构造时间
local Time_C = Clock();
foreach(DgnObj in InfoObj) {
//黑雾之源
if (DgnObj.id == 0) {
DgnObj.BackGroundIdx <- 6;
DgnObj.X <- 78;
DgnObj.Y <- 330;
DgnObj.BloodType <- 4;
DgnObj.NameIdx <- 0;
}
//震颤A
else if (DgnObj.id == 1) {
DgnObj.BackGroundIdx <- 15;
DgnObj.Timer <- Time_C;
DgnObj.X <- 246;
DgnObj.Y <- 286;
DgnObj.BloodType <- 1;
DgnObj.NameIdx <- 4;
//死了读复活 活着读爆炸
if (DgnObj.state == 0) DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.ZhenChan_BaoZhaShiJian;
else DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.ZhenChan_FuHuoShiJian;
}
//震颤B
else if (DgnObj.id == 11) {
DgnObj.BackGroundIdx <- 15;
DgnObj.Timer <- Time_C;
DgnObj.X <- 480;
DgnObj.Y <- 286;
DgnObj.BloodType <- 1;
DgnObj.NameIdx <- 5;
//死了读复活 活着读爆炸
if (DgnObj.state == 0) DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.ZhenChan_BaoZhaShiJian;
else DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.ZhenChan_FuHuoShiJian;
}
//舰炮
else if (DgnObj.id == 3) {
DgnObj.BackGroundIdx <- 15;
DgnObj.Timer <- Time_C;
DgnObj.X <- 340;
DgnObj.Y <- 168;
DgnObj.BloodType <- 1;
DgnObj.NameIdx <- 1;
//死了读复活 活着读爆炸
if (DgnObj.state == 0) DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.JianPao_BaoZhaShiJian;
else DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.JianPao_FuHuoShiJian;
}
//擎天A
else if (DgnObj.id == 2) {
DgnObj.BackGroundIdx <- 6;
DgnObj.X <- 200;
DgnObj.Y <- 400;
DgnObj.BloodType <- 2;
DgnObj.NameIdx <- 2;
}
//擎天B
else if (DgnObj.id == 21) {
DgnObj.BackGroundIdx <- 6;
DgnObj.X <- 510;
DgnObj.Y <- 400;
DgnObj.BloodType <- 2;
DgnObj.NameIdx <- 3;
}
//能源
else if (DgnObj.id == 4) {
DgnObj.BackGroundIdx <- 6;
DgnObj.X <- 340;
DgnObj.Y <- 210;
DgnObj.BloodType <- 2;
DgnObj.NameIdx <- 7;
}
//火山
else if (DgnObj.id == 5) {
DgnObj.BackGroundIdx <- 6;
DgnObj.X <- 336;
DgnObj.Y <- 75;
DgnObj.BloodType <- 2;
DgnObj.NameIdx <- 6;
}
//第1孵化
else if (DgnObj.id == 7) {
DgnObj.BackGroundIdx <- 15;
DgnObj.X <- 110;
DgnObj.Y <- 340;
DgnObj.BloodType <- 2;
DgnObj.NameIdx <- 9;
DgnObj.Timer <- Time_C;
//死了读复活 活着读爆炸
if (DgnObj.state == 0) DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_TouSon_ShiJian;
else DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_FuHuo_ShiJian;
}
//第2孵化
else if (DgnObj.id == 8) {
DgnObj.BackGroundIdx <- 6;
DgnObj.X <- 240;
DgnObj.Y <- 340;
DgnObj.BloodType <- 2;
DgnObj.NameIdx <- 10;
DgnObj.Timer <- Time_C;
//死了读复活 活着读爆炸
if (DgnObj.state == 0) DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_TouSon_ShiJian;
else DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_FuHuo_ShiJian;
}
//第3孵化
else if (DgnObj.id == 9) {
DgnObj.BackGroundIdx <- 6;
DgnObj.X <- 470;
DgnObj.Y <- 340;
DgnObj.BloodType <- 2;
DgnObj.NameIdx <- 11;
DgnObj.Timer <- Time_C;
//死了读复活 活着读爆炸
if (DgnObj.state == 0) DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_TouSon_ShiJian;
else DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_FuHuo_ShiJian;
}
//第4孵化
else if (DgnObj.id == 10) {
DgnObj.BackGroundIdx <- 6;
DgnObj.X <- 600;
DgnObj.Y <- 340;
DgnObj.BloodType <- 2;
DgnObj.NameIdx <- 12;
DgnObj.Timer <- Time_C;
//死了读复活 活着读爆炸
if (DgnObj.state == 0) DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_TouSon_ShiJian;
else DgnObj.MaxTime <- RinDro_Anton_Obj.FightConfig.FuHua_FuHuo_ShiJian;
}
//心脏
else if (DgnObj.id == 12) {
DgnObj.BackGroundIdx <- 15;
DgnObj.X <- 330;
DgnObj.Y <- 286;
DgnObj.BloodType <- 5;
DgnObj.NameIdx <- 8;
}
DgnList.append(clone(DgnObj));
}
/*
//初始化黑雾之源副本
local T = {
Id = 0, //相对ID 服务端进图逻辑
Timer = null,
BackGroundIdx = 6,
NameIdx = 0,
BloodType = 4,
NowBlood = InfoObj.HeiWu_State,
Party = InfoObj.HeiWu_Party,
X = 78,
Y = 330
}
DgnList.append(T);
//黑雾之源已经死亡
if (InfoObj.HeiWu_State == 4) {
}
*/
}
BaseSituationBtn = null;
//简易战况表是否开启
BaseSituationFlag = 1;
function RegisterWidget() {
//进入地下城
local GoDgnButton = LenheartNewUI_BaseButton(578, 519, 95, 29, "hud/newantondungeonbutton.img", 6);
GoDgnButton.OnClick = function() {
SelectDgnMarkFlag = 1;
}.bindenv(this);
Childrens.append(GoDgnButton);
//返回城镇
local ReturnTownButton = LenheartNewUI_BaseButton(678, 519, 95, 29, "hud/newantondungeonbutton.img", 9);
ReturnTownButton.OnClick = function() {
local T = {
op = 20064305,
}
SendPackEx(T);
}.bindenv(this);
Childrens.append(ReturnTownButton);
//简易战况表复选框
BaseSituationBtn = RinDro_Anton_LenheartNewUI_SwitchButton(220, 20);
BaseSituationBtn.State = 1;
BaseSituationBtn.ImgIndex = 358;
BaseSituationBtn.Width = 19;
BaseSituationBtn.Height = 19;
BaseSituationBtn.OnClick = function() {
switch (BaseSituationFlag) {
case 0:
BaseSituationFlag = 1;
break;
case 1:
BaseSituationFlag = 0;
break;
}
BaseSituationBtn.State = BaseSituationFlag;
}.bindenv(this);
AddChild(BaseSituationBtn);
// //关闭按钮
// local CloseButton = LenheartNewUI_BaseButton(696, 20, 103, 22, "hud/newantondungeonbutton.img", 3);
// CloseButton.OnClick = function() {
// CloseWindow();
// CloseFlag = Clock();
// }.bindenv(this);
// Childrens.append(CloseButton);
}
function DrawParty() {
//绘制待命房间
DrawImg("interface2/raid/anton/game_navigation/game_navigation.img", 33, X + 20, Y + 488);
// for (local i = 0; i< 20; i++) {
// sq_DrawBox(X + 26 + (i % 10) * 24, Y + 513 + (i / 10) * 20, 22, 18, 0XFFFFFFFF);
// }
//绘制我的队伍
if (RinDro_Anton_Obj.MyRaidTeam) {
local Mt = RinDro_Anton_Obj.MyRaidTeam;
if (!Mt) return;
local PartyMaster;
local PosI = 0;
foreach(index, PartyMasterIcon in Mt.MembersList) {
if (!("Standby" in PartyMasterIcon.InfoObj) || !PartyMasterIcon.InfoObj.Standby) continue;
local XOffset = 0;
local YOffset = 9 + (index * 22);
//绘制队长头像
foreach(AvatarObj in PartyMasterIcon.InfoObj.EquVos) {
local AXpos = AvatarObj.F[0][2] + X + OffsetArr[PartyMasterIcon.InfoObj.Job][0] - 17 + ((PosI % 10) * 24);
local AYpos = AvatarObj.F[0][3] + Y + OffsetArr[PartyMasterIcon.InfoObj.Job][1] + 512 + ((PosI / 10) * 20);
setClip(AXpos + OffsetArr[PartyMasterIcon.InfoObj.Job][2], AYpos + OffsetArr[PartyMasterIcon.InfoObj.Job][3], AXpos + OffsetArr[PartyMasterIcon.InfoObj.Job][2] + 22, AYpos + OffsetArr[PartyMasterIcon.InfoObj.Job][3] + 18); //开始裁切
L_sq_DrawImg("character/" + AvatarObj.B + ".img", AvatarObj.F[0][0], AXpos, AYpos);
releaseClip(); //裁切结束
}
PosI++;
}
}
}
PartyBackground = [
[10, -65, 24, -60, 25, 25],
[9, -65, 0, -60, 1, 1],
[11, -65, 42, -60, 48, 49],
[8, -65, -24, -60, -24, -23],
[12, -65, 64, -60, 71, 72],
]
//绘制副本
function DrawDungeon(DgnObj) {
//普通类型副本
if (DgnObj.type == 0) {
//绘制血条
if ("hp" in DgnObj && "BloodType" in DgnObj) {
//已经死亡
if (DgnObj.hp == DgnObj.BloodType) {
//绘制副本血槽背景
DrawImg("hud/newantondungeoninfo.img", DgnObj.BackGroundIdx, X + DgnObj.X, Y + DgnObj.Y);
DrawImg("hud/newantondungeoninfo.img", 6, X + DgnObj.X, Y + DgnObj.Y);
//绘制副本名称重生时间
DrawImg("hud/newantondungeoninfo2.img", 20, X + DgnObj.X + 42, Y + DgnObj.Y - 18);
} else {
//绘制副本血槽背景
DrawImg("hud/newantondungeoninfo.img", DgnObj.BackGroundIdx, X + DgnObj.X, Y + DgnObj.Y);
DrawImg("hud/newantondungeoninfo.img", 4, X + DgnObj.X, Y + DgnObj.Y);
//得出血条类型需要的img
local ImgIdx = 0;
if (DgnObj.BloodType == 5) ImgIdx = 0;
else if (DgnObj.BloodType == 4) ImgIdx = 5;
else if (DgnObj.BloodType == 2) ImgIdx = 9;
else if (DgnObj.BloodType == 1) ImgIdx = 11;
//绘制血条
DrawImg("hud/newantondungeonblood.img", ImgIdx + DgnObj.hp, X + DgnObj.X, Y + DgnObj.Y);
//绘制副本名称外框
DrawImg("hud/newantondungeoninfo.img", 5, X + DgnObj.X + 42, Y + DgnObj.Y - 18);
//绘制副本名称
DrawImg("hud/newantondungeonname.img", DgnObj.NameIdx, X + DgnObj.X + 40, Y + DgnObj.Y - 16);
}
}
}
//进度条类型副本
else if (DgnObj.type == 1) {
//绘制副本血槽背景
if ("gr" in DgnObj && DgnObj.gr == 1) {
DrawImg("hud/newantondungeoninfo.img", 18, X + DgnObj.X, Y + DgnObj.Y);
} else {
DrawImg("hud/newantondungeoninfo.img", DgnObj.BackGroundIdx, X + DgnObj.X, Y + DgnObj.Y);
}
//如果存活
if (DgnObj.state == 0) {
//绘制血量
DrawImg("hud/newantondungeonblood.img", 11, X + DgnObj.X, Y + DgnObj.Y);
// print(DgnObj.time);
local Remainder = DgnObj.time - (Clock() - DgnObj.Timer);
local Rate = Remainder.tofloat() / DgnObj.MaxTime;
local Idx = (Rate * 100.0).tointeger();
if (Idx< 0) Idx = 0;
//绘制时间进度条
DrawImg("hud/newantondungeonloading2.img", 99 - Idx, X + DgnObj.X, Y + DgnObj.Y);
//绘制时间
local TimeStr = (Remainder / 1000.0).tointeger().tostring();
L_sq_DrawCode(TimeStr, X + DgnObj.X + 36 - LenheartTextClass.GetStringLength(TimeStr) / 2, Y + DgnObj.Y + 26, sq_RGBA(255, 255, 255, 255), 0, 1);
//绘制副本名称外框
DrawImg("hud/newantondungeoninfo.img", 5, X + DgnObj.X + 42, Y + DgnObj.Y - 18);
//绘制副本名称
DrawImg("hud/newantondungeonname.img", DgnObj.NameIdx, X + DgnObj.X + 40, Y + DgnObj.Y - 16);
} else {
local Remainder = DgnObj.time - (Clock() - DgnObj.Timer);
local Rate = Remainder.tofloat() / DgnObj.MaxTime;
local Idx = (Rate * 100.0).tointeger();
//绘制时间进度条
L_sq_DrawImg("hud/newantondungeonloading2.img", 99 - Idx, X + DgnObj.X, Y + DgnObj.Y, 1, sq_RGBA(100, 0, 0, (250 * AlphaValue).tointeger()), 1.0, 1.0);
//绘制时间
local TimeStr = (Remainder / 1000.0).tointeger().tostring();
L_sq_DrawCode(TimeStr, X + DgnObj.X + 36 - LenheartTextClass.GetStringLength(TimeStr) / 2, Y + DgnObj.Y + 26, sq_RGBA(255, 85, 0, 255), 0, 1);
//绘制副本名称重生时间
DrawImg("hud/newantondungeoninfo2.img", 20, X + DgnObj.X + 42, Y + DgnObj.Y - 18);
}
}
//黑色火山
else if (DgnObj.type == 2) {
//绘制副本血槽背景
DrawImg("hud/newantondungeoninfo.img", 16, X + DgnObj.X, Y + DgnObj.Y);
//如果存活
if (DgnObj.state == 0) {
//绘制时间进度条
L_sq_DrawImg("hud/newantondungeonloading3.img", (100 - (DgnObj.time / 100)), X + DgnObj.X, Y + DgnObj.Y, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0);
local TimeStr = format("%03d", (DgnObj.time / 100));
DrawImg("hud/newantondungeoninfonum.img", TimeStr.slice(0, 1).tointeger(), X + DgnObj.X + 18, Y + DgnObj.Y + 40);
DrawImg("hud/newantondungeoninfonum.img", TimeStr.slice(1, 2).tointeger(), X + DgnObj.X + 28, Y + DgnObj.Y + 40);
DrawImg("hud/newantondungeoninfonum.img", TimeStr.slice(2, 3).tointeger(), X + DgnObj.X + 38, Y + DgnObj.Y + 40);
//绘制副本名称外框
DrawImg("hud/newantondungeoninfo.img", 5, X + DgnObj.X + 42, Y + DgnObj.Y - 18);
//绘制副本名称
DrawImg("hud/newantondungeonname.img", DgnObj.NameIdx, X + DgnObj.X + 42, Y + DgnObj.Y - 16);
}
}
//能源副本
else if (DgnObj.type == 3) {
//绘制副本血槽背景
DrawImg("hud/newantondungeoninfo.img", DgnObj.BackGroundIdx, X + DgnObj.X, Y + DgnObj.Y);
//如果存活
if (DgnObj.state == 0) {
DrawImg("hud/newantondungeoninfo.img", 17, X + DgnObj.X, Y + DgnObj.Y);
//绘制血量
DrawImg("hud/newantondungeonblood.img", 11, X + DgnObj.X, Y + DgnObj.Y);
//绘制副本名称外框
DrawImg("hud/newantondungeoninfo.img", 5, X + DgnObj.X + 42, Y + DgnObj.Y - 18);
//绘制副本名称
DrawImg("hud/newantondungeonname.img", DgnObj.NameIdx, X + DgnObj.X + 40, Y + DgnObj.Y - 16);
}
}
//绘制队伍信息
local PartyCount = DgnObj.Party.len();
for (local i = 0; i< PartyCount; i++) {
local ImgInfo = PartyBackground[i];
DrawImg("hud/newantondungeoninfo.img", ImgInfo[0], X + DgnObj.X + ImgInfo[1], Y + DgnObj.Y + ImgInfo[2]);
local cid = DgnObj.Party[i][0];
local count = DgnObj.Party[i][1] - 1;
local CharacV = RinDro_Anton_Obj.Portrait[cid];
local XOffset = 0;
local YOffset = 9;
//绘制队长头像
foreach(AvatarObj in CharacV.EquVos) {
local AXpos = AvatarObj.F[0][2] + X + OffsetArr[CharacV.Job][0] + DgnObj.X + ImgInfo[3] - 28;
local AYpos = AvatarObj.F[0][3] + Y + OffsetArr[CharacV.Job][1] + DgnObj.Y + ImgInfo[4] + 2;
setClip(AXpos + OffsetArr[CharacV.Job][2], AYpos + OffsetArr[CharacV.Job][3], AXpos + OffsetArr[CharacV.Job][2] + 22, AYpos + OffsetArr[CharacV.Job][3] + 18); //开始裁切
L_sq_DrawImg("character/" + AvatarObj.B + ".img", AvatarObj.F[0][0], AXpos, AYpos);
releaseClip(); //裁切结束
}
//绘制队伍人数
for (local z = 0; z< count; z++) {
DrawImg("hud/newantondungeoninfo.img", 13, X + DgnObj.X + ImgInfo[3] + 40, Y + DgnObj.Y + 4 + ImgInfo[5] + (z * 6));
}
//绘制队伍编号
DrawImg("hud/newantondungeonpartymark.img", CharacV.TeamId, X + DgnObj.X + ImgInfo[3] - 3, Y + DgnObj.Y + 3 + ImgInfo[4]);
}
}
DgnIdTName = {
d0 = "黑雾之源",
d2 = "擎天之柱\nA区",
d21 = "擎天之柱\nB区",
d1 = "震颤的大地\nA区",
d11 = "震颤的大地\nB区",
d3 = "舰炮防御战",
d4 = "能量阻截战",
d5 = "黑色火山",
d7 = "第一孵化中心",
d8 = "第二孵化中心",
d9 = "第三孵化中心",
d10 = "第四孵化中心",
d12 = "安图恩的心脏",
}
//高级绘制文字(带换行)
function L_sq_DrawCode_Ex(str, x, y, rgba, mb, jc) {
local strarr = [];
if (str.find("\n") == null) L_sq_DrawCode(str, x, y, rgba, mb, jc);
else {
local Bpos = 0;
while (true) {
local Npos = str.find("\n", Bpos);
if (!Npos) {
local strbuff = str.slice(Bpos, str.len());
strarr.append(strbuff);
break;
}
local strbuff = str.slice(Bpos, Npos);
strarr.append(strbuff);
Bpos = Npos + 1;
}
for (local z = 0; z< strarr.len(); z++) {
L_sq_DrawCode(strarr[z], x, y + (z * 14), rgba, mb, jc);
}
}
}
//绘制简易战况表
function DrawSimpleSituation() {
if (!BaseSituationFlag || !DgnList) return;
local X = 0;
//绘制背景
foreach(Index, d_obj in DgnList) {
local Obj_X = 0;
local Obj_Y = 0 + (Index * 35);
local ImgIdX = 80;
if (d_obj.id == 2 || d_obj.id == 21 || d_obj.id == 1 || d_obj.id == 11) ImgIdX = 81;
DrawImg("hud/newantondungeoninfo2.img", ImgIdX, X + Obj_X, Y + 300 + Obj_Y);
// L_sq_DrawWindow(X + Obj_X, Y + 300 + Obj_Y, 180, 40, "interface/lenheartwindowcommon.img", 204, 4, 14, 4, 14);
}
//绘制上层
foreach(Index, d_obj in DgnList) {
local Obj_X = 0;
local Obj_Y = 0 + (Index * 35);
//绘制队伍底槽
for (local i = 0; i< 4; i++) {
DrawImg("hud/partytype.img", 22, X + 2 + Obj_X + (i * 24), Y + 300 + Obj_Y + 20);
}
foreach(pos, pobj in d_obj.Party) {
local cid = pobj[0];
local CharacV = RinDro_Anton_Obj.Portrait[cid];
//绘制队伍编号
DrawImg("hud/partytype.img", 1 + CharacV.TeamId, X + 2 + Obj_X + (pos * 24), Y + 300 + Obj_Y + 20);
}
local DgnName = DgnIdTName["d" + d_obj.id];
local Yoffset = 16;
if (d_obj.id == 2 || d_obj.id == 21 || d_obj.id == 1 || d_obj.id == 11) Yoffset = 0;
local RGBA = sq_RGBA(255, 177, 0, 250);
if (d_obj.id != 5) RGBA = sq_RGBA(255, 255, 255, 255);
//绘制名字
L_sq_DrawCode_Ex(DgnName, X + 102, Y + 305 + Obj_Y + Yoffset, RGBA, 0, 1);
//绘制血槽背景
DrawImg("hud/newantondungeoninfo2.img", 82, X + Obj_X + 2, Y + 300 + Obj_Y + 2);
local BloodIdx = 83;
if (d_obj.id == 5 || d_obj.id == 2 || d_obj.id == 21) BloodIdx = 84;
local Rate = (88.0 - 88.0 * (d_obj.hp.tofloat() / d_obj.BloodType.tofloat())).tointeger();
if (d_obj.type == 1) {
local Remainder = d_obj.time - (Clock() - d_obj.Timer);
local RateBuf = Remainder.tofloat() / d_obj.MaxTime;
Rate = (RateBuf * 88.0).tointeger();
} else if (d_obj.type == 2) {
Rate = 88;
} else if (d_obj.type == 3) {
Rate = 88;
}
//绘制生命值
setClip(X + Obj_X + 6, Y + 300 + Obj_Y + 6, X + Obj_X + 6 + Rate, Y + 300 + Obj_Y + 6 + 9); //开始裁切
DrawImg("hud/newantondungeoninfo2.img", BloodIdx, X + Obj_X + 6, Y + 300 + Obj_Y + 6);
releaseClip(); //裁切结束
}
}
//绘制主界面
function DrawMain(obj) {
//绘制背景框
DrawImg("hud/newantondungeoninfo.img", 0, X + 7, Y);
//绘制乌龟
DrawImg("hud/newantondungeoninfo.img", 3, X + 28, Y + 50);
//绘制简易战况表
DrawImg("hud/newantondungeoninfo2.img", 62, X + 220, Y + 19);
//绘制待命房间
DrawParty();
//绘制小队移动
DrawImg("hud/newantondungeoninfo.img", 14, X + 570, Y + 488);
if (DgnList) {
foreach(d_obj in DgnList) {
DrawDungeon(d_obj);
}
}
//绘制主界面复活币剩余
DrawImg("hud/newantondungeoninfo2.img", 85, X + 45 + 350, Y + 488);
//绘制主界面复活币剩余
local CoinCount = (RinDro_Anton_Obj.FightConfig.rebornNum - Info.ResurrectionNum).tostring();
for (local i = 0; i< 2; i++) {
if (CoinCount.len() >= (i + 1))
DrawImg("hud/newantonrewardtime.img", CoinCount.slice(0 + i, 1 + i).tointeger(), X + 45 + 75 + (i * 18) + 350, Y + 515);
}
}
function DrawImg(Path, Index, XPos, YPos) {
L_sq_DrawImg(Path, Index, XPos, YPos, 1, sq_RGBA(255, 255, 255, (250 * AlphaValue).tointeger()), 1.0, 1.0);
}
function Show(obj) {
DrawMain(obj);
LenheartNewUI_Windows.Show(obj);
//结束时间
if (RinDro_Anton_Obj.EndTime) {
DrawFightTime(obj);
}
}
//攻坚时间
function DrawFightTime(obj) {
local X = ((getroottable().Rindro_Scr_Width - 146 - 103 - 550)).tointeger()
L_sq_DrawImg("hud/newantondungeoninfo.img", 1, X + 542, Y);
L_sq_DrawImg("hud/newantondungeoninfo.img", 2, X + 542 + 38, Y + 2);
if (RinDro_Anton_Obj.EndTime != null) {
if (RinDro_Anton_Obj.EndTime< 0) RinDro_Anton_Obj.EndTime = 0;
local RealTime = RinDro_Anton_Obj.EndTime - (Clock() - RinDro_Anton_Obj.PackCurT);
local seconds = RealTime / 1000;
local hours = seconds / 3600;
local minutes = seconds / 60;
seconds %= 60;
hours = format("%02d", hours);
seconds = format("%02d", seconds).slice(-2);
minutes = format("%02d", minutes).slice(-2);
local X1 = 551;
local X2 = X1 + 18;
local Offset = 0;
L_sq_DrawImg("hud/newantondungeonnum.img", hours.slice(0, 1).tointeger(), X + X1 + Offset, Y + 28);
L_sq_DrawImg("hud/newantondungeonnum.img", hours.slice(1).tointeger(), X + X2 + Offset, Y + 28);
Offset += 46;
L_sq_DrawImg("hud/newantondungeonnum.img", minutes.slice(0, 1).tointeger(), X + X1 + Offset, Y + 28);
L_sq_DrawImg("hud/newantondungeonnum.img", minutes.slice(1).tointeger(), X + X2 + Offset, Y + 28);
Offset += 46;
L_sq_DrawImg("hud/newantondungeonnum.img", seconds.slice(0, 1).tointeger(), X + X1 + Offset, Y + 28);
L_sq_DrawImg("hud/newantondungeonnum.img", seconds.slice(1).tointeger(), X + X2 + Offset, Y + 28);
}
}
//判断是否可重合
function PosEvent(Pos, MPos) {
local Offset = abs(Pos - MPos);
if (Offset< 10) return true;
else return false;
}
//判断自身地图相关事件
function MapEventTest(obj) {
if (sq_GetCurrentModuleType() != 3) return;
local stage = sq_GetGlobaludpModuleStage();
local MapIndex = sq_GetMapIndex(stage);
if (MapIndexTable.rawin(MapIndex)) {
local X = obj.getXPos();
local Y = obj.getYPos();
local Mark = false;
if (MapIndex == 33103 && PosEvent(X, 737) && PosEvent(Y, 354)) Mark = true;
if (MapIndex == 33100 && PosEvent(X, 369) && PosEvent(Y, 387)) Mark = true;
if (MapIndex == 33116 && PosEvent(X, 365) && PosEvent(Y, 374)) Mark = true;
if (MapIndex == 33119 && PosEvent(X, 838) && PosEvent(Y, 424)) Mark = true;
if (Mark == true && MapMoveMark == false) {
local T = {
op = 20064303,
DunId = MapIndexTable[MapIndex]
}
SendPackEx(T);
MapMoveMark = true;
} else if (Mark == false) MapMoveMark = false;
} else {
MapMoveMark = false;
}
}
//逻辑入口
function Proc(obj) {
LenheartNewUI_Windows.SyncPos(X, Y);
MapEventTest(obj);
if (SelectDgnMarkFlag) {
R_Mouse.SetType(151);
}
}
//鼠标左键弹起回调
function OnMouseLbUp(MousePos_X, MousePos_Y) {
if (SelectDgnMarkFlag != 0) {
SelectDgnMarkFlag = 0;
R_Mouse.SetType(0);
foreach(d_obj in DgnList) {
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X + d_obj.X, Y + d_obj.Y, 71, 71)) {
local T = {
op = 20064301,
DunId = d_obj.id
}
SendPackEx(T);
//关闭攻坚战况表窗口
CloseWindow();
//关闭攻坚队窗口
RinDro_Anton_Obj.PartyWindow_Object.CloseWindow();
//关闭攻坚队大厅窗口
RinDro_Anton_Obj.PartyHallWindow_Object.CloseWindow();
}
}
}
LenheartNewUI_Windows.OnMouseLbUp(MousePos_X, MousePos_Y);
}
MainButton = null;
CloseMainButton = null;
CloseFlag = false;
//顶层绘制
function TopDraw(obj) {
//界面未打开
if (!this.Visible) {
//在甲板
if (RinDro_Anton_Obj.BaseConfig && "channel_index" in RinDro_Anton_Obj.BaseConfig && RinDro_Anton_Obj.BaseConfig.channel_index.find("18") && "town_index" in RinDro_Anton_Obj.BaseConfig && L_sq_GetTownIndex() == RinDro_Anton_Obj.BaseConfig.town_index && (RinDro_Anton_Obj.MyRaidState == 1 || RinDro_Anton_Obj.MyRaidState == 3) && !CloseFlag) {
}
if (CloseFlag) {
if (Clock() - CloseFlag >= 10)
CloseFlag = false;
}
} else {
}
}
}
class Rindro_Anton_FightSituatioExternalC extends LenheartNewUI_Windows {
//调试模式
// DeBugMode = true;
//不是窗口
NoWindow = true;
//操作窗口
Window = null;
//是否可见
// Visible = false;
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
Childrens = [];
//注册控件
RegisterWidget();
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
}
function RegisterWidget() {
//开启按钮
local CloseButton = LenheartNewUI_BaseButton(0, 0, 103, 22, "hud/newantondungeonbutton.img", 0);
CloseButton.OnClick = function() {
if (!Window.Visible) {
Window.Visible = true;
Window.ResetFocus();
Window.GetInfo();
} else {
Window.CloseWindow();
}
}.bindenv(this);
CloseButton.SetCallBackFunc(function(button) {
if (!Window.Visible) {
button.Idx = 0;
} else {
button.Idx = 3;
}
}.bindenv(this));
Childrens.append(CloseButton);
}
function AddParentWin(Win) {
Window = Win;
}
//绘制主界面
function DrawMain(obj) {}
function Show(obj) {
DrawMain(obj);
LenheartNewUI_Windows.Show(obj);
}
function TopShow(obj) {
//结束时间
if (RinDro_Anton_Obj.EndTime) {
Window.DrawFightTime(obj);
}
Window.DrawSimpleSituation();
}
//逻辑入口
function Proc(obj) {
LenheartNewUI_Windows.SyncPos(X, Y);
//在甲板
if (RinDro_Anton_Obj.BaseConfig && "channel_index" in RinDro_Anton_Obj.BaseConfig && RinDro_Anton_Obj.BaseConfig.channel_index.find("18") && "town_index" in RinDro_Anton_Obj.BaseConfig && L_sq_GetTownIndex() == RinDro_Anton_Obj.BaseConfig.town_index && (RinDro_Anton_Obj.MyRaidState == 1 || RinDro_Anton_Obj.MyRaidState == 3)) {
Visible = true;
} else {
Visible = false;
}
}
}