Add map name during the intro

This commit is contained in:
Beu 2022-03-08 19:57:50 +01:00
parent 099556c0e1
commit 4e91c5bbac

View File

@ -193,14 +193,32 @@ declare netwrite Integer Net_RoundsPerMap for Teams[0] = 0;
declare netwrite Integer Net_CurrentRoundNb for Teams[0] = 0; declare netwrite Integer Net_CurrentRoundNb for Teams[0] = 0;
// Map Intro // Map Intro
declare Integer WaitingScreenDuration = 0; declare Boolean MapIsCompatible;
declare CMapLandmark[] Landmarks = Map::GetFinishesAndMultilaps();
foreach (Landmark in Landmarks) {
if (Map::IsMultilap(Landmark)) {
MapIsCompatible = True;
break;
}
}
if (!MapIsCompatible) {
UIManager.UIAll.QueueMessage(3000, 1, CUIConfig::EMessageDisplay::Big, _("This map is not valid"));
MB_Sleep(3000);
MB_StopMap();
} else if (S_IntroTime > 0) {
declare netwrite Boolean Net_LMS_IsIntro for Teams[0];
Net_LMS_IsIntro = True;
StateMgr::ForcePlayersStates([StateMgr::C_State_Waiting]); StateMgr::ForcePlayersStates([StateMgr::C_State_Waiting]);
ModeUtils::PushAndApplyUISequence(UIManager.UIAll, CUIConfig::EUISequence::RollingBackgroundIntro); ModeUtils::PushAndApplyUISequence(UIManager.UIAll, CUIConfig::EUISequence::RollingBackgroundIntro);
declare Integer WaitingScreenDuration = 0;
while (MB_MapIsRunning() && S_IntroTime - WaitingScreenDuration > 0) { while (MB_MapIsRunning() && S_IntroTime - WaitingScreenDuration > 0) {
WaitingScreenDuration = WaitingScreenDuration + 1; WaitingScreenDuration = WaitingScreenDuration + 1;
MB_Sleep(1000); MB_Sleep(1000);
} }
ModeUtils::PopAndApplyUISequence(UIManager.UIAll); ModeUtils::PopAndApplyUISequence(UIManager.UIAll);
Net_LMS_IsIntro = False;
}
*** ***
***Match_StartMap*** ***Match_StartMap***
@ -240,20 +258,7 @@ MalusQueue = [];
---Rounds_CanSpawn--- ---Rounds_CanSpawn---
declare Text[] AccountIdsOfPlayers for This = []; declare Text[] AccountIdsOfPlayers for This = [];
declare CMapLandmark[] Landmarks = Map::GetFinishesAndMultilaps();
declare Boolean MapIsCompatible;
foreach (Landmark in Landmarks) {
if (Map::IsMultilap(Landmark)) {
MapIsCompatible = True;
break;
}
}
if (!MapIsCompatible) {
UIManager.UIAll.QueueMessage(3000, 1, CUIConfig::EMessageDisplay::Big, _("This map is not valid"));
MB_Sleep(3000);
MB_StopMap();
} else {
declare CMapLandmark PlayerLM; declare CMapLandmark PlayerLM;
declare Integer LandmarkIndex for This = 0; declare Integer LandmarkIndex for This = 0;
AccountIdsOfPlayers = []; AccountIdsOfPlayers = [];
@ -297,7 +302,7 @@ if (!MapIsCompatible) {
CarRank::Update(CarRank::C_SortCriteria_BestRace); CarRank::Update(CarRank::C_SortCriteria_BestRace);
Race::EnableIntroDuringMatch(False); Race::EnableIntroDuringMatch(False);
UIManager.UIAll.SendChat("$<$ff3$> Stay the most time on the structure. $<$ff9GL HF!$>"); UIManager.UIAll.SendChat("$<$ff3$> Stay the most time on the structure. $<$ff9GL HF!$>");
}
*** ***
/***Match_InitPlayLoop*** /***Match_InitPlayLoop***
@ -740,7 +745,7 @@ Void SetML() {
declare TotalWidth = 44.5; declare TotalWidth = 44.5;
declare Text MLText = """ declare Text MLText = """
<manialink name="LMS_UI" version="3"> <manialink name="LMS_InfoPanel" version="3">
<script><!-- <script><!--
#Include "TextLib" as TL #Include "TextLib" as TL
@ -860,9 +865,58 @@ Void SetML() {
</manialink> </manialink>
"""; """;
Layers::Create("LMS_UI", MLText); Layers::Create("LMS_InfoPanel", MLText);
Layers::SetType("LMS_UI", CUILayer::EUILayerType::Normal); Layers::SetType("LMS_InfoPanel", CUILayer::EUILayerType::Normal);
Layers::Attach("LMS_UI"); Layers::Attach("LMS_InfoPanel");
MLText = """
<manialink name="LMS_MapInfo" version="3">
<script><!--
#Include "TextLib" as TL
main() {
declare netread Boolean Net_LMS_IsIntro for Teams[0];
declare Boolean Last_IsIntro;
declare CMlFrame Frame_Global = (Page.GetFirstChild("frame-global") as CMlFrame);
declare CMlLabel Label_MapInfo_Name = (Page.GetFirstChild("label-mapinfo-name") as CMlLabel);
declare CMlLabel Label_MapInfo_Author = (Page.GetFirstChild("label-mapinfo-author") as CMlLabel);
while(True) {
yield;
if (Last_IsIntro != Net_LMS_IsIntro) {
Last_IsIntro = Net_LMS_IsIntro;
if (Last_IsIntro) {
Label_MapInfo_Name.Value = Map.MapName;
Label_MapInfo_Author.Value = "by " ^ Map.AuthorNickName;
AnimMgr.Flush(Frame_Global);
AnimMgr.Add(Frame_Global, "<anim hidden=\"0\" pos=\"0 60\"/>", 200 , CAnimManager::EAnimManagerEasing::SineInOut);
} else {
AnimMgr.Flush(Frame_Global);
AnimMgr.Add(Frame_Global, "<anim hidden=\"1\" pos=\"0 115\"/>", 200 , CAnimManager::EAnimManagerEasing::SineInOut);
}
}
}
}
--></script>
<stylesheet>
<style class="text" textfont="GameFontBlack" textcolor="ffffffff" textsize="8" valign="center2" halign="center"/>
</stylesheet>
<frame id="frame-global" pos="0 115" hidden="1">
<quad size="150 25" halign="center" z-index="-1" bgcolor="000" opacity="0.7"/>
<label id="label-mapinfo-name" class="text" pos="0 -8" size="140 10"/>
<label id="label-mapinfo-author" class="text" pos="0 -18" size="140 10" textsize="6"/>
</frame>
</manialink>
""";
Layers::Create("LMS_MapInfo", MLText);
Layers::SetType("LMS_MapInfo", CUILayer::EUILayerType::Normal);
Layers::Attach("LMS_MapInfo");
} }