Add map name during the intro
This commit is contained in:
parent
099556c0e1
commit
4e91c5bbac
@ -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;
|
||||||
StateMgr::ForcePlayersStates([StateMgr::C_State_Waiting]);
|
declare CMapLandmark[] Landmarks = Map::GetFinishesAndMultilaps();
|
||||||
ModeUtils::PushAndApplyUISequence(UIManager.UIAll, CUIConfig::EUISequence::RollingBackgroundIntro);
|
foreach (Landmark in Landmarks) {
|
||||||
while (MB_MapIsRunning() && S_IntroTime - WaitingScreenDuration > 0) {
|
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]);
|
||||||
|
ModeUtils::PushAndApplyUISequence(UIManager.UIAll, CUIConfig::EUISequence::RollingBackgroundIntro);
|
||||||
|
declare Integer 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);
|
||||||
|
Net_LMS_IsIntro = False;
|
||||||
}
|
}
|
||||||
ModeUtils::PopAndApplyUISequence(UIManager.UIAll);
|
|
||||||
***
|
***
|
||||||
|
|
||||||
***Match_StartMap***
|
***Match_StartMap***
|
||||||
@ -240,28 +258,15 @@ MalusQueue = [];
|
|||||||
---Rounds_CanSpawn---
|
---Rounds_CanSpawn---
|
||||||
|
|
||||||
declare Text[] AccountIdsOfPlayers for This = [];
|
declare Text[] AccountIdsOfPlayers for This = [];
|
||||||
declare CMapLandmark[] Landmarks = Map::GetFinishesAndMultilaps();
|
|
||||||
|
|
||||||
declare Boolean MapIsCompatible;
|
declare CMapLandmark PlayerLM;
|
||||||
foreach (Landmark in Landmarks) {
|
declare Integer LandmarkIndex for This = 0;
|
||||||
if (Map::IsMultilap(Landmark)) {
|
AccountIdsOfPlayers = [];
|
||||||
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 Integer LandmarkIndex for This = 0;
|
|
||||||
AccountIdsOfPlayers = [];
|
|
||||||
|
|
||||||
// Suffle Players list to randomise spawn
|
// Suffle Players list to randomise spawn
|
||||||
declare CSmPlayer[] ShuffledPlayers = Players;
|
declare CSmPlayer[] ShuffledPlayers = Players;
|
||||||
declare Integer i=0;
|
declare Integer i=0;
|
||||||
while(i<ShuffledPlayers.count) { // this should be enough, you can use arbitrary values, should the need arise
|
while(i<ShuffledPlayers.count) { // this should be enough, you can use arbitrary values, should the need arise
|
||||||
// find a pair (a,b) of valid indices to swap
|
// find a pair (a,b) of valid indices to swap
|
||||||
declare a=ML::Rand(0, ShuffledPlayers.count-1);
|
declare a=ML::Rand(0, ShuffledPlayers.count-1);
|
||||||
declare b=ML::Rand(0, ShuffledPlayers.count-1);
|
declare b=ML::Rand(0, ShuffledPlayers.count-1);
|
||||||
@ -272,9 +277,9 @@ if (!MapIsCompatible) {
|
|||||||
ShuffledPlayers[a]=tmp;
|
ShuffledPlayers[a]=tmp;
|
||||||
|
|
||||||
i=i+1;
|
i=i+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Player in ShuffledPlayers) {
|
foreach (Player in ShuffledPlayers) {
|
||||||
PlayerLM = Null;
|
PlayerLM = Null;
|
||||||
while (PlayerLM == Null) {
|
while (PlayerLM == Null) {
|
||||||
if (LandmarkIndex > Landmarks.count - 1 ) {
|
if (LandmarkIndex > Landmarks.count - 1 ) {
|
||||||
@ -288,16 +293,16 @@ if (!MapIsCompatible) {
|
|||||||
Race::Start(Player, PlayerLM , StartTime);
|
Race::Start(Player, PlayerLM , StartTime);
|
||||||
AccountIdsOfPlayers.add(Player.User.WebServicesUserId);
|
AccountIdsOfPlayers.add(Player.User.WebServicesUserId);
|
||||||
MalusQueue[Player.User.WebServicesUserId] = GetNewMalus(C_Malus_Reset);
|
MalusQueue[Player.User.WebServicesUserId] = GetNewMalus(C_Malus_Reset);
|
||||||
}
|
|
||||||
|
|
||||||
Net_NBPlayers = AccountIdsOfPlayers.count;
|
|
||||||
|
|
||||||
UpdateCustomRanking(Null, -1);
|
|
||||||
StateMgr::ForcePlayersStates([StateMgr::C_State_Playing]);
|
|
||||||
CarRank::Update(CarRank::C_SortCriteria_BestRace);
|
|
||||||
Race::EnableIntroDuringMatch(False);
|
|
||||||
UIManager.UIAll.SendChat("$<$ff3$> Stay the most time on the structure. $<$ff9GL HF!$>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Net_NBPlayers = AccountIdsOfPlayers.count;
|
||||||
|
|
||||||
|
UpdateCustomRanking(Null, -1);
|
||||||
|
StateMgr::ForcePlayersStates([StateMgr::C_State_Playing]);
|
||||||
|
CarRank::Update(CarRank::C_SortCriteria_BestRace);
|
||||||
|
Race::EnableIntroDuringMatch(False);
|
||||||
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user