Skip to content

Commit

Permalink
Add extra localized message
Browse files Browse the repository at this point in the history
Bugfix menu scaling
  • Loading branch information
virtuaCode committed Feb 4, 2021
1 parent 791e89a commit f5f5dac
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 39 deletions.
47 changes: 17 additions & 30 deletions Classes/MapVote.uc
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ function PlayerJoin(PlayerController Player) {
$ Player.PlayerReplicationInfo.PlayerName $ ", "
$ Player.GetPlayerNetworkAddress(), 'MapVote');
AddMapVoteReplicationInfo(Player);

BroadcastInfo(0);
}
//------------------------------------------------------------------------------------------------
function AddMapVoteReplicationInfo(PlayerController Player) {
Expand Down Expand Up @@ -459,7 +461,7 @@ function SubmitMapVote(int MapIndex, Actor Voter) {
// else
//BroadcastMessage(PlayerController(Voter).PlayerReplicationInfo.PlayerName $ " voted for " $ mid(MapName,1), true);

BroadcastMessage(class 'VoteMsg', MapIndex, PlayerController(Voter).PlayerReplicationInfo, none);
BroadcastMessage(class 'MapVoteMsg', MapIndex, PlayerController(Voter).PlayerReplicationInfo, none);

TallyVotes(false);
}
Expand Down Expand Up @@ -513,7 +515,7 @@ function TallyVotes(bool bForceMapSwitch) {

if (!Level.Game.bGameEnded && !bMidGameVote && (float(PlayersThatVoted) / float(Level.Game.NumPlayers)) * 100 >= MidGameVotePercent) // Mid game vote initiated
{
BroadcastText("Mid-Game Map Voting has been initiated !!!!");
BroadcastInfo(1);
bMidGameVote = true;
// Start voting count-down timer
TimeLeft = VoteTimeLimit;
Expand Down Expand Up @@ -643,7 +645,7 @@ function TallyVotes(bool bForceMapSwitch) {
log("!!SERVER RESTART!! Address: "
$ ServerAddress[LastAddressIndex], 'MapVote');

BroadcastText("Vote ended! Upcoming map: " $ MapList[topmap].Title);
BroadcastMapResult(topmap);



Expand Down Expand Up @@ -721,7 +723,7 @@ event timer() {
log("!!SERVER RESTART!! Address: "
$ ServerAddress[LastAddressIndex], 'MapVote');

BroadcastText("Vote ended! Upcoming map: " $ MapList[mapnum].Title);
BroadcastMapResult(mapnum);


settimer2(5, false); // Five seconds should be enough for the second server to be started
Expand All @@ -743,7 +745,7 @@ event timer() {
if (bHandleEndGame) {
AllGoToGameEnded();
OpenAllVoteWindows();
BroadcastEndGameCountDown(TimeLeft);
BroadcastCountDown(TimeLeft);
} else
BroadcastCountDown(TimeLeft);
}
Expand All @@ -755,18 +757,13 @@ event timer() {
{
log("___CountDown "
$ TimeLeft, 'MapVote');
if (bHandleEndGame)
BroadcastEndGameCountDown(TimeLeft);
else
BroadcastCountDown(TimeLeft);
BroadcastCountDown(TimeLeft);
}

if (TimeLeft < 11 && TimeLeft > 0) // play announcer voice Count Down
{
if (bHandleEndGame)
BroadcastEndGameCountDown(TimeLeft);
else
BroadcastCountDown(TimeLeft);

BroadcastCountDown(TimeLeft);
}

if (TimeLeft % 20 == 0 && TimeLeft > 0) {
Expand Down Expand Up @@ -899,25 +896,15 @@ function BroadcastText(string strMsg) {
}
//------------------------------------------------------------------------------------------------
function BroadcastCountDown(int Switch) {
local Controller C;
local PlayerController P;
For(C = Level.ControllerList; C != None; C = C.NextController) {
P = PlayerController(C);
if (P != None)
P.ReceiveLocalizedMessage(class 'MapVoteCountDownMsg', Switch);
}
BroadcastMessage(class 'MapVoteCountDownMsg', Switch);
}
//------------------------------------------------------------------------------------------------
function BroadcastEndGameCountDown(int Switch) {
local Controller C;
local PlayerController P;
For(C = Level.ControllerList; C != None; C = C.NextController) {
P = PlayerController(C);
if (P != None)
P.ReceiveLocalizedMessage(class 'MapVoteCountDownMsg', Switch);
}
function BroadcastInfo(int Switch) {
BroadcastMessage(class 'MapVoteInfoMsg', Switch);
}
//------------------------------------------------------------------------------------------------
function BroadcastMapResult(int Switch) {
BroadcastMessage(class 'MapVoteResultMsg', Switch);
}
//------------------------------------------------------------------------------------------------
Expand Down
33 changes: 33 additions & 0 deletions Classes/MapVoteInfoMsg.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
class MapVoteInfoMsg extends LocalMessage;

var config string InfoMessage;
var config string MidGameVoteMessage;

static function string GetString(
optional int Switch,
optional PlayerReplicationInfo RelatedPRI_1,
optional PlayerReplicationInfo RelatedPRI_2,
optional Object OptionalObject
)
{
switch(Switch) {
case 0:
return Default.InfoMessage;
break;
case 1:
return Default.MidGameVoteMessage;
break;

}
return "";
}

defaultproperties
{
InfoMessage="INFO: Press F5 to open the Map Vote Menu"
MidGameVoteMessage="Mid-Game Voting has been started! Press F5 to vote for your map!"
bIsSpecial=False
bIsUnique=True
Lifetime=10
DrawColor=(B=0,G=255,R=255,A=255)
}
8 changes: 4 additions & 4 deletions Classes/MapVoteInteraction.uc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function bool KeyEvent( out EInputKey Key, out EInputAction Action, FLOAT Delta
}
//------------------------------------------------------------------------------------------------
function OpenVoteWindow() {
local XIIIRootWindow myRoot; // XIIIRootWindow
local XIIIRootWindowPlus myRoot; // XIIIRootWindow
local PlayerController PlayerOwner;

if(ViewportOwner != none)
Expand All @@ -45,9 +45,9 @@ function OpenVoteWindow() {


myRoot = XIIIRootWindowPlus(ViewportOwner.LocalInteractions[0]);

myRoot.CloseAll(true);
myRoot.bIamInMulti = false;
myRoot.gotostate('');
//myRoot.CloseAll(true);
myRoot.bIamInMulti = true;
myRoot.gotostate('UWindows');
myRoot.OpenMenuWithClass(class'XIIIMapVote.XIIIMenuMapVote', True);
MVWindow = XIIIMenuMapVote(GUIController(ViewportOwner.LocalInteractions[0]).TopPage());
Expand Down
2 changes: 1 addition & 1 deletion Classes/VoteMsg.uc → Classes/MapVoteMsg.uc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class VoteMsg extends LocalMessage;
class MapVoteMsg extends LocalMessage;

static function string GetString(
optional int Switch,
Expand Down
2 changes: 1 addition & 1 deletion Classes/MapVoteReplicationInfo.uc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ simulated event PostNetBeginPlay ()
MVInteraction = MapVoteInteraction(PlayerOwner.Player.InteractionMaster.AddInteraction("XIIIMapVote.MapVoteInteraction",PlayerOwner.Player));
}
MVInteraction.MVRI = self;
PlayerController(MyOwner).ClientMessage("Info: Press F5 to open the MapVote menu.");

}
else
log("___PlayerOwner.Player == none",'MapVote');
Expand Down
22 changes: 22 additions & 0 deletions Classes/MapVoteResultMsg.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class MapVoteResultMsg extends LocalMessage;

var config string ResultMessage;

static function string GetString(
optional int Switch,
optional PlayerReplicationInfo RelatedPRI_1,
optional PlayerReplicationInfo RelatedPRI_2,
optional Object OptionalObject
)
{
return Default.ResultMessage $ MapVoteReplicationInfo(OptionalObject).MapList[Switch].Title;
}

defaultproperties
{
ResultMessage="Vote ended! Upcoming map: "
bIsSpecial=False
bIsUnique=True
Lifetime=10
DrawColor=(B=0,G=255,R=255,A=255)
}
15 changes: 12 additions & 3 deletions Classes/XIIIMenuMapVote.uc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Created()
// LOCAL class<GameInfo> GameClass;
LOCAL bool bCanKick, bShowQuitButton;

Super.Created();
Super(XIIIWindowPlus).Created();

// init values
BoxWidth = 200;
Expand Down Expand Up @@ -101,6 +101,14 @@ function Created()

GotoState('STA_ResetInputs');
}
//------------------------------------------------------------------------------------------------
function DisplayHelpBar(Canvas C) {
myRoot.bIamInMulti = True;
Super(XIIIWindowPlus).DisplayHelpBar(C);
myRoot.bIamInMulti = False;
}


//------------------------------------------------------------------------------------------------
function BeforePaint(Canvas C, float X, float Y)
{
Expand All @@ -119,7 +127,7 @@ function Paint(Canvas C, float X, float Y)

local int i;

Super.Paint(C,X,Y);
Super(XIIIWindowPlus).Paint(C,X,Y);

/*if ( GetPlayerOwner().Level.Game==none || GetPlayerOwner().Level.NetMode != 0 || GetPlayerOwner().Level.Game.NumPlayers == 1 )
C.DrawMsgboxBackground(false, BackgroundPosX*fRatioX, BackgroundPosY*fScaleTo*fRatioY, 10, 10, BackgroundWidth*fRatioX, BackgroundHeight*fScaleTo*fRatioY);
Expand Down Expand Up @@ -271,7 +279,7 @@ function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
function ShowWindow()
{

Super.ShowWindow();
Super(XIIIWindowPlus).ShowWindow();

bShowBCK = true;
bShowSEL = true;
Expand Down Expand Up @@ -306,5 +314,6 @@ defaultproperties
bRequire640x480=False
bAllowedAsLast=True
bDisplayBar=True
bCenterInGame=False
}

0 comments on commit f5f5dac

Please sign in to comment.