mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
make everything use a better performant drop shadow instead, add pre game support, more clientside fixes
This commit is contained in:
parent
a817d0481b
commit
cc57591342
21 changed files with 683 additions and 122 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
package src;
|
package src;
|
||||||
|
|
||||||
|
import gui.MPPreGameDlg;
|
||||||
import src.Radar;
|
import src.Radar;
|
||||||
import rewind.InputRecorder;
|
import rewind.InputRecorder;
|
||||||
import net.NetPacket.ScoreboardPacket;
|
import net.NetPacket.ScoreboardPacket;
|
||||||
|
|
@ -550,6 +551,15 @@ class MarbleWorld extends Scheduler {
|
||||||
Net.serverInfo.state = "PLAYING";
|
Net.serverInfo.state = "PLAYING";
|
||||||
MasterServerClient.instance.sendServerInfo(Net.serverInfo); // notify the server of the playing state
|
MasterServerClient.instance.sendServerInfo(Net.serverInfo); // notify the server of the playing state
|
||||||
}
|
}
|
||||||
|
if (this.isMultiplayer) {
|
||||||
|
// Push the pre - game
|
||||||
|
showPreGame();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showPreGame() {
|
||||||
|
MarbleGame.canvas.pushDialog(new MPPreGameDlg());
|
||||||
|
this.setCursorLock(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addJoiningClient(cc:GameConnection, onAdded:() -> Void) {
|
public function addJoiningClient(cc:GameConnection, onAdded:() -> Void) {
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,15 @@ typedef GamepadSettings = {
|
||||||
var rewind:Array<String>;
|
var rewind:Array<String>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef ServerSettings = {
|
||||||
|
var name:String;
|
||||||
|
var description:String;
|
||||||
|
var maxPlayers:Int;
|
||||||
|
var password:String;
|
||||||
|
var forceSpectators:Bool;
|
||||||
|
var quickRespawn:Bool;
|
||||||
|
}
|
||||||
|
|
||||||
typedef PlayStatistics = {
|
typedef PlayStatistics = {
|
||||||
var oobs:Int;
|
var oobs:Int;
|
||||||
var respawns:Int;
|
var respawns:Int;
|
||||||
|
|
@ -189,6 +198,15 @@ class Settings {
|
||||||
totalTime: 0,
|
totalTime: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static var serverSettings:ServerSettings = {
|
||||||
|
name: "Multiplayer Server",
|
||||||
|
password: "",
|
||||||
|
maxPlayers: 8,
|
||||||
|
description: "My cool server",
|
||||||
|
forceSpectators: false,
|
||||||
|
quickRespawn: true
|
||||||
|
}
|
||||||
|
|
||||||
public static var levelStatistics:Map<String, PlayStatistics> = [];
|
public static var levelStatistics:Map<String, PlayStatistics> = [];
|
||||||
|
|
||||||
public static var highscoreName = "";
|
public static var highscoreName = "";
|
||||||
|
|
@ -244,6 +262,7 @@ class Settings {
|
||||||
touch: touchSettings,
|
touch: touchSettings,
|
||||||
gamepad: gamepadSettings,
|
gamepad: gamepadSettings,
|
||||||
stats: playStatistics,
|
stats: playStatistics,
|
||||||
|
server: serverSettings,
|
||||||
highscoreName: highscoreName,
|
highscoreName: highscoreName,
|
||||||
marbleIndex: optionsSettings.marbleIndex,
|
marbleIndex: optionsSettings.marbleIndex,
|
||||||
marbleSkin: optionsSettings.marbleSkin,
|
marbleSkin: optionsSettings.marbleSkin,
|
||||||
|
|
@ -379,6 +398,9 @@ class Settings {
|
||||||
levelStatistics.set(key, value);
|
levelStatistics.set(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (json.serverSettings != null) {
|
||||||
|
serverSettings = json.serverSettings;
|
||||||
|
}
|
||||||
#if js
|
#if js
|
||||||
if (optionsSettings.marbleIndex == null) {
|
if (optionsSettings.marbleIndex == null) {
|
||||||
optionsSettings.marbleIndex = 0;
|
optionsSettings.marbleIndex = 0;
|
||||||
|
|
|
||||||
|
|
@ -127,73 +127,133 @@ class EndGameGui extends GuiControl {
|
||||||
egResult.position = new Vector(313, 54);
|
egResult.position = new Vector(313, 54);
|
||||||
egResult.extent = new Vector(244, 69);
|
egResult.extent = new Vector(244, 69);
|
||||||
egResult.text.text = '<font face="DomCasual64" color="#FFFFFF"><p align="right">${Util.formatTime(timeState.gameplayClock)}</p></font>';
|
egResult.text.text = '<font face="DomCasual64" color="#FFFFFF"><p align="right">${Util.formatTime(timeState.gameplayClock)}</p></font>';
|
||||||
egResult.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0, 0.4, 1, true);
|
egResult.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
pg.addChild(egResult);
|
pg.addChild(egResult);
|
||||||
|
|
||||||
var egFirstLine = new GuiMLText(domcasual24, mlFontLoader);
|
var egFirstLine = new GuiMLText(domcasual24, mlFontLoader);
|
||||||
egFirstLine.position = new Vector(340, 150);
|
egFirstLine.position = new Vector(340, 150);
|
||||||
egFirstLine.extent = new Vector(210, 25);
|
egFirstLine.extent = new Vector(210, 25);
|
||||||
egFirstLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true);
|
egFirstLine.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0x777777
|
||||||
|
};
|
||||||
pg.addChild(egFirstLine);
|
pg.addChild(egFirstLine);
|
||||||
|
|
||||||
var egSecondLine = new GuiMLText(domcasual24, mlFontLoader);
|
var egSecondLine = new GuiMLText(domcasual24, mlFontLoader);
|
||||||
egSecondLine.position = new Vector(341, 178);
|
egSecondLine.position = new Vector(341, 178);
|
||||||
egSecondLine.extent = new Vector(209, 25);
|
egSecondLine.extent = new Vector(209, 25);
|
||||||
egSecondLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true);
|
egSecondLine.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0x777777
|
||||||
|
};
|
||||||
pg.addChild(egSecondLine);
|
pg.addChild(egSecondLine);
|
||||||
|
|
||||||
var egThirdLine = new GuiMLText(domcasual24, mlFontLoader);
|
var egThirdLine = new GuiMLText(domcasual24, mlFontLoader);
|
||||||
egThirdLine.position = new Vector(341, 206);
|
egThirdLine.position = new Vector(341, 206);
|
||||||
egThirdLine.extent = new Vector(209, 25);
|
egThirdLine.extent = new Vector(209, 25);
|
||||||
egThirdLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true);
|
egThirdLine.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0x777777
|
||||||
|
};
|
||||||
pg.addChild(egThirdLine);
|
pg.addChild(egThirdLine);
|
||||||
|
|
||||||
var egFourthLine = new GuiMLText(domcasual24, mlFontLoader);
|
var egFourthLine = new GuiMLText(domcasual24, mlFontLoader);
|
||||||
egFourthLine.position = new Vector(341, 234);
|
egFourthLine.position = new Vector(341, 234);
|
||||||
egFourthLine.extent = new Vector(209, 25);
|
egFourthLine.extent = new Vector(209, 25);
|
||||||
egFourthLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true);
|
egFourthLine.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0x777777
|
||||||
|
};
|
||||||
pg.addChild(egFourthLine);
|
pg.addChild(egFourthLine);
|
||||||
|
|
||||||
var egFifthLine = new GuiMLText(domcasual24, mlFontLoader);
|
var egFifthLine = new GuiMLText(domcasual24, mlFontLoader);
|
||||||
egFifthLine.position = new Vector(341, 262);
|
egFifthLine.position = new Vector(341, 262);
|
||||||
egFifthLine.extent = new Vector(209, 25);
|
egFifthLine.extent = new Vector(209, 25);
|
||||||
egFifthLine.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true);
|
egFifthLine.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0x777777
|
||||||
|
};
|
||||||
pg.addChild(egFifthLine);
|
pg.addChild(egFifthLine);
|
||||||
|
|
||||||
var egFirstLineScore = new GuiMLText(domcasual24, mlFontLoader);
|
var egFirstLineScore = new GuiMLText(domcasual24, mlFontLoader);
|
||||||
egFirstLineScore.position = new Vector(475, 150);
|
egFirstLineScore.position = new Vector(475, 150);
|
||||||
egFirstLineScore.extent = new Vector(210, 25);
|
egFirstLineScore.extent = new Vector(210, 25);
|
||||||
egFirstLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true);
|
egFirstLineScore.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0x777777
|
||||||
|
};
|
||||||
pg.addChild(egFirstLineScore);
|
pg.addChild(egFirstLineScore);
|
||||||
|
|
||||||
var egSecondLineScore = new GuiMLText(domcasual24, mlFontLoader);
|
var egSecondLineScore = new GuiMLText(domcasual24, mlFontLoader);
|
||||||
egSecondLineScore.position = new Vector(476, 178);
|
egSecondLineScore.position = new Vector(476, 178);
|
||||||
egSecondLineScore.extent = new Vector(209, 25);
|
egSecondLineScore.extent = new Vector(209, 25);
|
||||||
egSecondLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true);
|
egSecondLineScore.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0x777777
|
||||||
|
};
|
||||||
pg.addChild(egSecondLineScore);
|
pg.addChild(egSecondLineScore);
|
||||||
|
|
||||||
var egThirdLineScore = new GuiMLText(domcasual24, mlFontLoader);
|
var egThirdLineScore = new GuiMLText(domcasual24, mlFontLoader);
|
||||||
egThirdLineScore.position = new Vector(476, 206);
|
egThirdLineScore.position = new Vector(476, 206);
|
||||||
egThirdLineScore.extent = new Vector(209, 25);
|
egThirdLineScore.extent = new Vector(209, 25);
|
||||||
egThirdLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true);
|
egThirdLineScore.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0x777777
|
||||||
|
};
|
||||||
pg.addChild(egThirdLineScore);
|
pg.addChild(egThirdLineScore);
|
||||||
|
|
||||||
var egFourthLineScore = new GuiMLText(domcasual24, mlFontLoader);
|
var egFourthLineScore = new GuiMLText(domcasual24, mlFontLoader);
|
||||||
egFourthLineScore.position = new Vector(476, 234);
|
egFourthLineScore.position = new Vector(476, 234);
|
||||||
egFourthLineScore.extent = new Vector(209, 25);
|
egFourthLineScore.extent = new Vector(209, 25);
|
||||||
egFourthLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true);
|
egFourthLineScore.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0x777777
|
||||||
|
};
|
||||||
pg.addChild(egFourthLineScore);
|
pg.addChild(egFourthLineScore);
|
||||||
|
|
||||||
var egFifthLineScore = new GuiMLText(domcasual24, mlFontLoader);
|
var egFifthLineScore = new GuiMLText(domcasual24, mlFontLoader);
|
||||||
egFifthLineScore.position = new Vector(476, 262);
|
egFifthLineScore.position = new Vector(476, 262);
|
||||||
egFifthLineScore.extent = new Vector(209, 25);
|
egFifthLineScore.extent = new Vector(209, 25);
|
||||||
egFifthLineScore.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true);
|
egFifthLineScore.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0x777777
|
||||||
|
};
|
||||||
pg.addChild(egFifthLineScore);
|
pg.addChild(egFifthLineScore);
|
||||||
|
|
||||||
var egTitleText = new GuiMLText(expo50, mlFontLoader);
|
var egTitleText = new GuiMLText(expo50, mlFontLoader);
|
||||||
egTitleText.text.textColor = 0xffff00;
|
egTitleText.text.textColor = 0xffff00;
|
||||||
egTitleText.text.text = '<font color="#FFFFFF" face="DomCasual64">Your Time:</font>';
|
egTitleText.text.text = '<font color="#FFFFFF" face="DomCasual64">Your Time:</font>';
|
||||||
egTitleText.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0, 0.4, 1, true);
|
egTitleText.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
egTitleText.position = new Vector(34, 54);
|
egTitleText.position = new Vector(34, 54);
|
||||||
egTitleText.extent = new Vector(247, 69);
|
egTitleText.extent = new Vector(247, 69);
|
||||||
pg.addChild(egTitleText);
|
pg.addChild(egTitleText);
|
||||||
|
|
@ -202,7 +262,12 @@ class EndGameGui extends GuiControl {
|
||||||
egTopThreeText.position = new Vector(341, 114);
|
egTopThreeText.position = new Vector(341, 114);
|
||||||
egTopThreeText.extent = new Vector(209, 34);
|
egTopThreeText.extent = new Vector(209, 34);
|
||||||
egTopThreeText.text.text = '<font face="DomCasual32" color="#FFFFFF">Top 5 Times:</font>'; // Make toggleable 3-5
|
egTopThreeText.text.text = '<font face="DomCasual32" color="#FFFFFF">Top 5 Times:</font>'; // Make toggleable 3-5
|
||||||
egTopThreeText.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0, 0.4, 1, true);
|
egTopThreeText.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
pg.addChild(egTopThreeText);
|
pg.addChild(egTopThreeText);
|
||||||
|
|
||||||
var text = '<font color="#FFFFFF" face="DomCasual32"><p align="center">';
|
var text = '<font color="#FFFFFF" face="DomCasual32"><p align="center">';
|
||||||
|
|
@ -228,7 +293,12 @@ class EndGameGui extends GuiControl {
|
||||||
var finishMessage = new GuiMLText(expo32, mlFontLoader);
|
var finishMessage = new GuiMLText(expo32, mlFontLoader);
|
||||||
finishMessage.text.textColor = 0x00ff00;
|
finishMessage.text.textColor = 0x00ff00;
|
||||||
finishMessage.text.text = text;
|
finishMessage.text.text = text;
|
||||||
finishMessage.text.filter = new DropShadow(1, 0.785, 0, 1, 0, 0.4, 1, true);
|
finishMessage.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
// finishMessage.justify = Center;
|
// finishMessage.justify = Center;
|
||||||
finishMessage.position = new Vector(25, 120);
|
finishMessage.position = new Vector(25, 120);
|
||||||
finishMessage.extent = new Vector(293, 211);
|
finishMessage.extent = new Vector(293, 211);
|
||||||
|
|
@ -274,7 +344,12 @@ class EndGameGui extends GuiControl {
|
||||||
leftColumn.text.lineSpacing = 5;
|
leftColumn.text.lineSpacing = 5;
|
||||||
leftColumn.text.textColor = 0xFFFFFF;
|
leftColumn.text.textColor = 0xFFFFFF;
|
||||||
leftColumn.text.text = 'Par Time:<br/>${mission.game == "gold" || mission.game.toLowerCase() == "ultra" ? '<font color="#FFCC00">Gold Time:</font>' : '<font color="#CCCCCC">Platinum Time:</font>'}<br/>${mission.ultimateTime != 0 ? '<font color="#FFDD22">Ultimate Time:</font><br/>' : ''}<font face="Arial14"><br/></font><font color="#FFFFFF" face="DomCasual24">Time Passed:<br/>Clock Bonuses:</font>';
|
leftColumn.text.text = 'Par Time:<br/>${mission.game == "gold" || mission.game.toLowerCase() == "ultra" ? '<font color="#FFCC00">Gold Time:</font>' : '<font color="#CCCCCC">Platinum Time:</font>'}<br/>${mission.ultimateTime != 0 ? '<font color="#FFDD22">Ultimate Time:</font><br/>' : ''}<font face="Arial14"><br/></font><font color="#FFFFFF" face="DomCasual24">Time Passed:<br/>Clock Bonuses:</font>';
|
||||||
leftColumn.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true);
|
leftColumn.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0x777777
|
||||||
|
};
|
||||||
leftColumn.position = new Vector(25, 165);
|
leftColumn.position = new Vector(25, 165);
|
||||||
leftColumn.extent = new Vector(293, 211);
|
leftColumn.extent = new Vector(293, 211);
|
||||||
pg.addChild(leftColumn);
|
pg.addChild(leftColumn);
|
||||||
|
|
@ -286,7 +361,12 @@ class EndGameGui extends GuiControl {
|
||||||
rightColumn.text.lineSpacing = 5;
|
rightColumn.text.lineSpacing = 5;
|
||||||
rightColumn.text.textColor = 0xFFFFFF;
|
rightColumn.text.textColor = 0xFFFFFF;
|
||||||
rightColumn.text.text = '${Util.formatTime(mission.qualifyTime == Math.POSITIVE_INFINITY ? 5999.999 : mission.qualifyTime)}<br/><font color="${mission.game == "gold" || mission.game.toLowerCase() == "ultra" ? '#FFCC00' : '#CCCCCC'}">${Util.formatTime(mission.goldTime)}</font><br/>${mission.ultimateTime != 0 ? '<font color="#FFDD22">${Util.formatTime(mission.ultimateTime)}</font><br/>' : ''}<font face="Arial14"><br/></font><font color="#FFFFFF" face="DomCasual24">${Util.formatTime(elapsedTime)}<br/>${Util.formatTime(bonusTime)}</font>';
|
rightColumn.text.text = '${Util.formatTime(mission.qualifyTime == Math.POSITIVE_INFINITY ? 5999.999 : mission.qualifyTime)}<br/><font color="${mission.game == "gold" || mission.game.toLowerCase() == "ultra" ? '#FFCC00' : '#CCCCCC'}">${Util.formatTime(mission.goldTime)}</font><br/>${mission.ultimateTime != 0 ? '<font color="#FFDD22">${Util.formatTime(mission.ultimateTime)}</font><br/>' : ''}<font face="Arial14"><br/></font><font color="#FFFFFF" face="DomCasual24">${Util.formatTime(elapsedTime)}<br/>${Util.formatTime(bonusTime)}</font>';
|
||||||
rightColumn.text.filter = new DropShadow(1.414, 0.785, 0xffffff, 1, 0, 0.4, 1, true);
|
rightColumn.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0x777777
|
||||||
|
};
|
||||||
rightColumn.position = new Vector(235, 165);
|
rightColumn.position = new Vector(235, 165);
|
||||||
rightColumn.extent = new Vector(293, 211);
|
rightColumn.extent = new Vector(293, 211);
|
||||||
pg.addChild(rightColumn);
|
pg.addChild(rightColumn);
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,12 @@ class EnterNameDlg extends GuiControl {
|
||||||
|
|
||||||
var enterNameText = new GuiMLText(domcasual32, mlFontLoader);
|
var enterNameText = new GuiMLText(domcasual32, mlFontLoader);
|
||||||
enterNameText.text.textColor = 0xFFFFFF;
|
enterNameText.text.textColor = 0xFFFFFF;
|
||||||
enterNameText.text.filter = new DropShadow(1.414, 0.785, 0x7777777F, 1, 0, 0.4, 1, true);
|
enterNameText.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
enterNameText.position = new Vector(37, 23);
|
enterNameText.position = new Vector(37, 23);
|
||||||
enterNameText.extent = new Vector(345, 85);
|
enterNameText.extent = new Vector(345, 85);
|
||||||
// enterNameText.justify = Center;
|
// enterNameText.justify = Center;
|
||||||
|
|
|
||||||
|
|
@ -95,15 +95,11 @@ class JoinServerGui extends GuiImage {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var maxPlayers = 8;
|
|
||||||
var privateSlots = 0;
|
|
||||||
var privateGame = false;
|
|
||||||
|
|
||||||
var hostBtn = new GuiButton(loadButtonImages("data/ui/mp/join/host"));
|
var hostBtn = new GuiButton(loadButtonImages("data/ui/mp/join/host"));
|
||||||
hostBtn.position = new Vector(521, 379);
|
hostBtn.position = new Vector(521, 379);
|
||||||
hostBtn.extent = new Vector(93, 45);
|
hostBtn.extent = new Vector(93, 45);
|
||||||
hostBtn.pressedAction = (e) -> {
|
hostBtn.pressedAction = (e) -> {
|
||||||
Net.hostServer('${Settings.highscoreName}\'s Server', maxPlayers, privateSlots, privateGame, () -> {
|
Net.hostServer(Settings.serverSettings.name, Settings.serverSettings.description, Settings.serverSettings.maxPlayers, "", () -> {
|
||||||
MarbleGame.canvas.setContent(new MPPlayMissionGui(true));
|
MarbleGame.canvas.setContent(new MPPlayMissionGui(true));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -134,7 +130,7 @@ class JoinServerGui extends GuiImage {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}, 15000);
|
}, 15000);
|
||||||
Net.joinServer(ourServerList[curSelection].name, false, () -> {
|
Net.joinServer(ourServerList[curSelection].name, "", () -> {
|
||||||
failed = false;
|
failed = false;
|
||||||
Net.remoteServerInfo = ourServerList[curSelection];
|
Net.remoteServerInfo = ourServerList[curSelection];
|
||||||
});
|
});
|
||||||
|
|
@ -168,7 +164,12 @@ class JoinServerGui extends GuiImage {
|
||||||
titleText.extent = new Vector(647, 30);
|
titleText.extent = new Vector(647, 30);
|
||||||
titleText.justify = Center;
|
titleText.justify = Center;
|
||||||
titleText.text.text = "Join Server";
|
titleText.text.text = "Join Server";
|
||||||
titleText.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0, 0.4, 1, true);
|
titleText.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
titleText.text.textColor = 0xFFFFFF;
|
titleText.text.textColor = 0xFFFFFF;
|
||||||
window.addChild(titleText);
|
window.addChild(titleText);
|
||||||
|
|
||||||
|
|
@ -177,7 +178,12 @@ class JoinServerGui extends GuiImage {
|
||||||
serverInfoHeader.extent = new Vector(210, 166);
|
serverInfoHeader.extent = new Vector(210, 166);
|
||||||
serverInfoHeader.justify = Center;
|
serverInfoHeader.justify = Center;
|
||||||
serverInfoHeader.text.text = "Select a Server";
|
serverInfoHeader.text.text = "Select a Server";
|
||||||
serverInfoHeader.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0, 0.4, 1, true);
|
serverInfoHeader.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
serverInfoHeader.text.textColor = 0xFFFFFF;
|
serverInfoHeader.text.textColor = 0xFFFFFF;
|
||||||
window.addChild(serverInfoHeader);
|
window.addChild(serverInfoHeader);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,12 @@ class JukeboxDlg extends GuiImage {
|
||||||
var songTitle = new GuiMLText(markerFelt24, null);
|
var songTitle = new GuiMLText(markerFelt24, null);
|
||||||
songTitle.position = new Vector(61, 262);
|
songTitle.position = new Vector(61, 262);
|
||||||
songTitle.extent = new Vector(416, 22);
|
songTitle.extent = new Vector(416, 22);
|
||||||
songTitle.text.filter = new DropShadow(1.414, 0.785, 0x0000007F, 1, 0, 0.4, 1, true);
|
songTitle.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
songTitle.text.textColor = 0xFFFFFF;
|
songTitle.text.textColor = 0xFFFFFF;
|
||||||
songTitle.text.text = '<p align="center">Title: ${songList[selectedIdx]}</p>';
|
songTitle.text.text = '<p align="center">Title: ${songList[selectedIdx]}</p>';
|
||||||
this.addChild(songTitle);
|
this.addChild(songTitle);
|
||||||
|
|
@ -58,7 +63,12 @@ class JukeboxDlg extends GuiImage {
|
||||||
var songStatus = new GuiMLText(markerFelt24, null);
|
var songStatus = new GuiMLText(markerFelt24, null);
|
||||||
songStatus.position = new Vector(56, 283);
|
songStatus.position = new Vector(56, 283);
|
||||||
songStatus.extent = new Vector(421, 22);
|
songStatus.extent = new Vector(421, 22);
|
||||||
songStatus.text.filter = new DropShadow(1.414, 0.785, 0x0000007F, 1, 0, 0.4, 1, true);
|
songStatus.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
songStatus.text.textColor = 0xFFFFFF;
|
songStatus.text.textColor = 0xFFFFFF;
|
||||||
songStatus.text.text = '<p align="center">${playing ? "Playing" : "Stopped"}</p>';
|
songStatus.text.text = '<p align="center">${playing ? "Playing" : "Stopped"}</p>';
|
||||||
this.addChild(songStatus);
|
this.addChild(songStatus);
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,13 @@ class MPExitGameDlg extends GuiControl {
|
||||||
this.extent = new Vector(640, 480);
|
this.extent = new Vector(640, 480);
|
||||||
|
|
||||||
function loadButtonImages(path:String) {
|
function loadButtonImages(path:String) {
|
||||||
|
var normal = ResourceLoader.getResource('${path}_n.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||||
|
var hover = ResourceLoader.getResource('${path}_h.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||||
|
var pressed = ResourceLoader.getResource('${path}_d.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||||
|
return [normal, hover, pressed];
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadButtonImagesExt(path:String) {
|
||||||
var normal = ResourceLoader.getResource('${path}_n.png', ResourceLoader.getImage, this.imageResources).toTile();
|
var normal = ResourceLoader.getResource('${path}_n.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||||
var hover = ResourceLoader.getResource('${path}_h.png', ResourceLoader.getImage, this.imageResources).toTile();
|
var hover = ResourceLoader.getResource('${path}_h.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||||
var pressed = ResourceLoader.getResource('${path}_d.png', ResourceLoader.getImage, this.imageResources).toTile();
|
var pressed = ResourceLoader.getResource('${path}_d.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||||
|
|
@ -32,7 +39,7 @@ class MPExitGameDlg extends GuiControl {
|
||||||
dialogImg.extent = new Vector(347, 250);
|
dialogImg.extent = new Vector(347, 250);
|
||||||
this.addChild(dialogImg);
|
this.addChild(dialogImg);
|
||||||
|
|
||||||
var partialRestart = new GuiButton(loadButtonImages("data/ui/mp/exit/partial"));
|
var partialRestart = new GuiButton(loadButtonImagesExt("data/ui/mp/exit/partial"));
|
||||||
partialRestart.position = new Vector(133, 80);
|
partialRestart.position = new Vector(133, 80);
|
||||||
partialRestart.extent = new Vector(94, 45);
|
partialRestart.extent = new Vector(94, 45);
|
||||||
partialRestart.vertSizing = Top;
|
partialRestart.vertSizing = Top;
|
||||||
|
|
@ -55,7 +62,7 @@ class MPExitGameDlg extends GuiControl {
|
||||||
resumeBtn.pressedAction = (e) -> resumeFunc();
|
resumeBtn.pressedAction = (e) -> resumeFunc();
|
||||||
dialogImg.addChild(resumeBtn);
|
dialogImg.addChild(resumeBtn);
|
||||||
|
|
||||||
var serverSettingsBtn = new GuiButton(loadButtonImages("data/ui/mp/play/settings"));
|
var serverSettingsBtn = new GuiButton(loadButtonImagesExt("data/ui/mp/play/settings"));
|
||||||
serverSettingsBtn.position = new Vector(195, 184);
|
serverSettingsBtn.position = new Vector(195, 184);
|
||||||
serverSettingsBtn.extent = new Vector(45, 45);
|
serverSettingsBtn.extent = new Vector(45, 45);
|
||||||
serverSettingsBtn.vertSizing = Top;
|
serverSettingsBtn.vertSizing = Top;
|
||||||
|
|
@ -67,7 +74,7 @@ class MPExitGameDlg extends GuiControl {
|
||||||
serverSettingsBtn.disabled = true;
|
serverSettingsBtn.disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var kickBtn = new GuiButton(loadButtonImages("data/ui/mp/play/kick"));
|
var kickBtn = new GuiButton(loadButtonImagesExt("data/ui/mp/play/kick"));
|
||||||
kickBtn.position = new Vector(108, 184);
|
kickBtn.position = new Vector(108, 184);
|
||||||
kickBtn.extent = new Vector(45, 45);
|
kickBtn.extent = new Vector(45, 45);
|
||||||
kickBtn.vertSizing = Top;
|
kickBtn.vertSizing = Top;
|
||||||
|
|
@ -82,7 +89,7 @@ class MPExitGameDlg extends GuiControl {
|
||||||
quickspawnBtn.vertSizing = Top;
|
quickspawnBtn.vertSizing = Top;
|
||||||
dialogImg.addChild(quickspawnBtn);
|
dialogImg.addChild(quickspawnBtn);
|
||||||
|
|
||||||
var completeRestart = new GuiButton(loadButtonImages("data/ui/mp/exit/complete"));
|
var completeRestart = new GuiButton(loadButtonImagesExt("data/ui/mp/exit/complete"));
|
||||||
completeRestart.position = new Vector(224, 80);
|
completeRestart.position = new Vector(224, 80);
|
||||||
completeRestart.extent = new Vector(104, 45);
|
completeRestart.extent = new Vector(104, 45);
|
||||||
completeRestart.vertSizing = Top;
|
completeRestart.vertSizing = Top;
|
||||||
|
|
@ -102,7 +109,12 @@ class MPExitGameDlg extends GuiControl {
|
||||||
exitTitle.extent = new Vector(331, 30);
|
exitTitle.extent = new Vector(331, 30);
|
||||||
exitTitle.justify = Center;
|
exitTitle.justify = Center;
|
||||||
exitTitle.text.text = "Ingame Options";
|
exitTitle.text.text = "Ingame Options";
|
||||||
exitTitle.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
exitTitle.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
dialogImg.addChild(exitTitle);
|
dialogImg.addChild(exitTitle);
|
||||||
|
|
||||||
var restartTitle = new GuiText(markerFelt32);
|
var restartTitle = new GuiText(markerFelt32);
|
||||||
|
|
@ -110,7 +122,12 @@ class MPExitGameDlg extends GuiControl {
|
||||||
restartTitle.extent = new Vector(114, 14);
|
restartTitle.extent = new Vector(114, 14);
|
||||||
restartTitle.justify = Center;
|
restartTitle.justify = Center;
|
||||||
restartTitle.text.text = "Restart:";
|
restartTitle.text.text = "Restart:";
|
||||||
restartTitle.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
restartTitle.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
dialogImg.addChild(restartTitle);
|
dialogImg.addChild(restartTitle);
|
||||||
|
|
||||||
var jukeboxButton = new GuiButton(loadButtonImages("data/ui/jukebox/jb_pausemenu"));
|
var jukeboxButton = new GuiButton(loadButtonImages("data/ui/jukebox/jb_pausemenu"));
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,12 @@ class MPMarbleSelectGui extends GuiImage {
|
||||||
|
|
||||||
var titleText = new GuiMLText(markerFelt28, null);
|
var titleText = new GuiMLText(markerFelt28, null);
|
||||||
titleText.text.textColor = 0xFFFFFF;
|
titleText.text.textColor = 0xFFFFFF;
|
||||||
titleText.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0x0000007F, 0.4, 1, true);
|
titleText.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
titleText.horizSizing = Center;
|
titleText.horizSizing = Center;
|
||||||
titleText.vertSizing = Bottom;
|
titleText.vertSizing = Bottom;
|
||||||
titleText.position = new Vector(140, 67);
|
titleText.position = new Vector(140, 67);
|
||||||
|
|
@ -78,7 +83,12 @@ class MPMarbleSelectGui extends GuiImage {
|
||||||
|
|
||||||
var marbleText = new GuiMLText(markerFelt24, null);
|
var marbleText = new GuiMLText(markerFelt24, null);
|
||||||
marbleText.text.textColor = 0xFFFFFF;
|
marbleText.text.textColor = 0xFFFFFF;
|
||||||
marbleText.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0x0000007F, 0.4, 1, true);
|
marbleText.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
marbleText.horizSizing = Center;
|
marbleText.horizSizing = Center;
|
||||||
marbleText.vertSizing = Bottom;
|
marbleText.vertSizing = Bottom;
|
||||||
marbleText.position = new Vector(86, 243);
|
marbleText.position = new Vector(86, 243);
|
||||||
|
|
|
||||||
|
|
@ -158,19 +158,22 @@ class MPPlayMissionGui extends GuiImage {
|
||||||
searchBtn.pressedAction = (e) -> {
|
searchBtn.pressedAction = (e) -> {
|
||||||
MarbleGame.canvas.pushDialog(new MPSearchGui(false));
|
MarbleGame.canvas.pushDialog(new MPSearchGui(false));
|
||||||
}
|
}
|
||||||
|
if (Net.isHost)
|
||||||
window.addChild(searchBtn);
|
window.addChild(searchBtn);
|
||||||
|
|
||||||
var kickBtn = new GuiButton(loadButtonImages("data/ui/mp/play/kick"));
|
var kickBtn = new GuiButton(loadButtonImages("data/ui/mp/play/kick"));
|
||||||
kickBtn.position = new Vector(304, 514);
|
kickBtn.position = new Vector(304, 514);
|
||||||
kickBtn.extent = new Vector(44, 44);
|
kickBtn.extent = new Vector(44, 44);
|
||||||
|
if (Net.isHost)
|
||||||
window.addChild(kickBtn);
|
window.addChild(kickBtn);
|
||||||
|
|
||||||
var serverSettingsBtn = new GuiButton(loadButtonImages("data/ui/mp/play/settings"));
|
var serverSettingsBtn = new GuiButton(loadButtonImagesExt("data/ui/mp/play/settings"));
|
||||||
serverSettingsBtn.position = new Vector(157, 514);
|
serverSettingsBtn.position = new Vector(157, 514);
|
||||||
serverSettingsBtn.extent = new Vector(44, 44);
|
serverSettingsBtn.extent = new Vector(44, 44);
|
||||||
serverSettingsBtn.pressedAction = (e) -> {
|
serverSettingsBtn.pressedAction = (e) -> {
|
||||||
MarbleGame.canvas.pushDialog(new MPServerDlg());
|
MarbleGame.canvas.pushDialog(new MPServerDlg());
|
||||||
}
|
}
|
||||||
|
if (Net.isHost)
|
||||||
window.addChild(serverSettingsBtn);
|
window.addChild(serverSettingsBtn);
|
||||||
|
|
||||||
var marbleSelectBtn = new GuiButton(loadButtonImages("data/ui/mp/play/marble"));
|
var marbleSelectBtn = new GuiButton(loadButtonImages("data/ui/mp/play/marble"));
|
||||||
|
|
@ -213,6 +216,8 @@ class MPPlayMissionGui extends GuiImage {
|
||||||
difficultySelector.pressedAction = (e) -> {
|
difficultySelector.pressedAction = (e) -> {
|
||||||
MarbleGame.canvas.pushDialog(difficultyPopover);
|
MarbleGame.canvas.pushDialog(difficultyPopover);
|
||||||
};
|
};
|
||||||
|
else
|
||||||
|
difficultySelector.disabled = true;
|
||||||
window.addChild(difficultySelector);
|
window.addChild(difficultySelector);
|
||||||
|
|
||||||
var difficultyCloseButton = new GuiButton(loadButtonImages("data/ui/mp/play/difficultymenu"));
|
var difficultyCloseButton = new GuiButton(loadButtonImages("data/ui/mp/play/difficultymenu"));
|
||||||
|
|
@ -305,14 +310,24 @@ class MPPlayMissionGui extends GuiImage {
|
||||||
var pmDesc = new GuiMLText(markerFelt18, mlFontLoader);
|
var pmDesc = new GuiMLText(markerFelt18, mlFontLoader);
|
||||||
pmDesc.position = new Vector(0, 0);
|
pmDesc.position = new Vector(0, 0);
|
||||||
pmDesc.extent = new Vector(427, 99);
|
pmDesc.extent = new Vector(427, 99);
|
||||||
pmDesc.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
pmDesc.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
pmDesc.text.lineSpacing = -1;
|
pmDesc.text.lineSpacing = -1;
|
||||||
pmDescContainer.addChild(pmDesc);
|
pmDescContainer.addChild(pmDesc);
|
||||||
|
|
||||||
var parTime = new GuiMLText(markerFelt18, mlFontLoader);
|
var parTime = new GuiMLText(markerFelt18, mlFontLoader);
|
||||||
parTime.position = new Vector(43, 190);
|
parTime.position = new Vector(43, 190);
|
||||||
parTime.extent = new Vector(416, 44);
|
parTime.extent = new Vector(416, 44);
|
||||||
parTime.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
parTime.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
parTime.text.lineSpacing = -1;
|
parTime.text.lineSpacing = -1;
|
||||||
window.addChild(parTime);
|
window.addChild(parTime);
|
||||||
|
|
||||||
|
|
@ -341,7 +356,12 @@ class MPPlayMissionGui extends GuiImage {
|
||||||
playerListTitle.text.text = "Players";
|
playerListTitle.text.text = "Players";
|
||||||
playerListTitle.text.textColor = 0xBDCFE4;
|
playerListTitle.text.textColor = 0xBDCFE4;
|
||||||
playerListTitle.justify = Center;
|
playerListTitle.justify = Center;
|
||||||
playerListTitle.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
playerListTitle.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
playersBox.addChild(playerListTitle);
|
playersBox.addChild(playerListTitle);
|
||||||
|
|
||||||
this.addChild(window);
|
this.addChild(window);
|
||||||
|
|
|
||||||
200
src/gui/MPPreGameDlg.hx
Normal file
200
src/gui/MPPreGameDlg.hx
Normal file
|
|
@ -0,0 +1,200 @@
|
||||||
|
package gui;
|
||||||
|
|
||||||
|
import h2d.filter.DropShadow;
|
||||||
|
import net.Net;
|
||||||
|
import src.MarbleGame;
|
||||||
|
import hxd.res.BitmapFont;
|
||||||
|
import h3d.Vector;
|
||||||
|
import src.ResourceLoader;
|
||||||
|
import src.Settings;
|
||||||
|
|
||||||
|
class MPPreGameDlg extends GuiControl {
|
||||||
|
public function new() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.horizSizing = Width;
|
||||||
|
this.vertSizing = Height;
|
||||||
|
this.position = new Vector();
|
||||||
|
this.extent = new Vector(640, 480);
|
||||||
|
|
||||||
|
function loadButtonImages(path:String) {
|
||||||
|
var normal = ResourceLoader.getResource('${path}_n.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||||
|
var hover = ResourceLoader.getResource('${path}_h.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||||
|
var pressed = ResourceLoader.getResource('${path}_d.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||||
|
return [normal, hover, pressed];
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadButtonImagesExt(path:String) {
|
||||||
|
var normal = ResourceLoader.getResource('${path}_n.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||||
|
var hover = ResourceLoader.getResource('${path}_h.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||||
|
var pressed = ResourceLoader.getResource('${path}_d.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||||
|
var disabled = ResourceLoader.getResource('${path}_i.png', ResourceLoader.getImage, this.imageResources).toTile();
|
||||||
|
return [normal, hover, pressed, disabled];
|
||||||
|
}
|
||||||
|
|
||||||
|
var markerFelt32fontdata = ResourceLoader.getFileEntry("data/font/MarkerFelt.fnt");
|
||||||
|
var markerFelt32b = new BitmapFont(markerFelt32fontdata.entry);
|
||||||
|
@:privateAccess markerFelt32b.loader = ResourceLoader.loader;
|
||||||
|
var markerFelt32 = markerFelt32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel);
|
||||||
|
var markerFelt24 = markerFelt32b.toSdfFont(cast 20 * Settings.uiScale, MultiChannel);
|
||||||
|
var markerFelt20 = markerFelt32b.toSdfFont(cast 18.5 * Settings.uiScale, MultiChannel);
|
||||||
|
var markerFelt18 = markerFelt32b.toSdfFont(cast 17 * Settings.uiScale, MultiChannel);
|
||||||
|
var markerFelt26 = markerFelt32b.toSdfFont(cast 22 * Settings.uiScale, MultiChannel);
|
||||||
|
|
||||||
|
var dialogImg = new GuiImage(ResourceLoader.getResource("data/ui/mp/pre/window.png", ResourceLoader.getImage, this.imageResources).toTile());
|
||||||
|
dialogImg.horizSizing = Center;
|
||||||
|
dialogImg.vertSizing = Center;
|
||||||
|
dialogImg.position = new Vector(0, 0);
|
||||||
|
dialogImg.extent = new Vector(640, 480);
|
||||||
|
this.addChild(dialogImg);
|
||||||
|
|
||||||
|
var leaveBtn = new GuiButton(loadButtonImages("/data/ui/mp/pre/leave"));
|
||||||
|
leaveBtn.horizSizing = Left;
|
||||||
|
leaveBtn.vertSizing = Top;
|
||||||
|
leaveBtn.position = new Vector(499, 388);
|
||||||
|
leaveBtn.extent = new Vector(94, 45);
|
||||||
|
dialogImg.addChild(leaveBtn);
|
||||||
|
|
||||||
|
var playBtn = new GuiButton(loadButtonImages("/data/ui/mp/pre/play"));
|
||||||
|
playBtn.horizSizing = Right;
|
||||||
|
playBtn.vertSizing = Top;
|
||||||
|
playBtn.position = new Vector(406, 388);
|
||||||
|
playBtn.extent = new Vector(94, 45);
|
||||||
|
playBtn.buttonType = Toggle;
|
||||||
|
dialogImg.addChild(playBtn);
|
||||||
|
|
||||||
|
var readyBtn = new GuiButton(loadButtonImages("/data/ui/mp/pre/ready"));
|
||||||
|
readyBtn.horizSizing = Right;
|
||||||
|
readyBtn.vertSizing = Top;
|
||||||
|
readyBtn.position = new Vector(53, 394);
|
||||||
|
readyBtn.extent = new Vector(133, 33);
|
||||||
|
readyBtn.buttonType = Toggle;
|
||||||
|
dialogImg.addChild(readyBtn);
|
||||||
|
|
||||||
|
var kickBtn = new GuiButton(loadButtonImages("/data/ui/mp/play/kick"));
|
||||||
|
kickBtn.horizSizing = Right;
|
||||||
|
kickBtn.vertSizing = Bottom;
|
||||||
|
kickBtn.position = new Vector(360, 388);
|
||||||
|
kickBtn.extent = new Vector(45, 45);
|
||||||
|
if (Net.isHost)
|
||||||
|
dialogImg.addChild(kickBtn);
|
||||||
|
|
||||||
|
var spectateBtn = new GuiButton(loadButtonImages("/data/ui/mp/pre/spectate"));
|
||||||
|
spectateBtn.horizSizing = Right;
|
||||||
|
spectateBtn.vertSizing = Top;
|
||||||
|
spectateBtn.position = new Vector(190, 394);
|
||||||
|
spectateBtn.extent = new Vector(127, 33);
|
||||||
|
dialogImg.addChild(spectateBtn);
|
||||||
|
|
||||||
|
var serverTitle = new GuiText(markerFelt24);
|
||||||
|
serverTitle.text.textColor = 0xFFFFFF;
|
||||||
|
serverTitle.position = new Vector(60, 59);
|
||||||
|
serverTitle.extent = new Vector(525, 30);
|
||||||
|
serverTitle.text.text = Net.isHost ? Settings.serverSettings.name : Net.connectedServerInfo.name;
|
||||||
|
serverTitle.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
|
serverTitle.justify = Center;
|
||||||
|
dialogImg.addChild(serverTitle);
|
||||||
|
|
||||||
|
var serverDesc = new GuiText(markerFelt24);
|
||||||
|
serverDesc.text.textColor = 0xFFFFFF;
|
||||||
|
serverDesc.position = new Vector(60, 92);
|
||||||
|
serverDesc.extent = new Vector(525, 66);
|
||||||
|
serverDesc.text.text = Net.isHost ? Settings.serverSettings.description : Net.connectedServerInfo.description;
|
||||||
|
serverDesc.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
|
serverDesc.justify = Center;
|
||||||
|
dialogImg.addChild(serverDesc);
|
||||||
|
|
||||||
|
var levelName = new GuiText(markerFelt24);
|
||||||
|
levelName.text.textColor = 0xFFFFFF;
|
||||||
|
levelName.position = new Vector(60, 158);
|
||||||
|
levelName.extent = new Vector(525, 22);
|
||||||
|
levelName.text.text = MarbleGame.instance.world.mission.title;
|
||||||
|
levelName.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
|
dialogImg.addChild(levelName);
|
||||||
|
|
||||||
|
var levelDesc = new GuiText(markerFelt18);
|
||||||
|
levelDesc.text.textColor = 0xFFFFFF;
|
||||||
|
levelDesc.position = new Vector(60, 185);
|
||||||
|
levelDesc.extent = new Vector(516, 63);
|
||||||
|
levelDesc.text.text = MarbleGame.instance.world.mission.description;
|
||||||
|
levelDesc.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
|
dialogImg.addChild(levelDesc);
|
||||||
|
|
||||||
|
var playerTitle = new GuiText(markerFelt18);
|
||||||
|
playerTitle.text.textColor = 0xDDDDEE;
|
||||||
|
playerTitle.position = new Vector(60, 263);
|
||||||
|
playerTitle.extent = new Vector(525, 14);
|
||||||
|
playerTitle.text.text = "Player Status";
|
||||||
|
playerTitle.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
|
dialogImg.addChild(playerTitle);
|
||||||
|
|
||||||
|
var playerListContainer = new GuiScrollCtrl(ResourceLoader.getResource("data/ui/common/philscroll.png", ResourceLoader.getImage, this.imageResources)
|
||||||
|
.toTile());
|
||||||
|
playerListContainer.position = new Vector(57, 286);
|
||||||
|
playerListContainer.extent = new Vector(525, 99);
|
||||||
|
playerListContainer.childrenHandleScroll = true;
|
||||||
|
// playerList.maxScrollY = 394 * Settings.uiScale;
|
||||||
|
dialogImg.addChild(playerListContainer);
|
||||||
|
|
||||||
|
var playerListLeftShadow = new GuiTextListCtrl(markerFelt18, [
|
||||||
|
Settings.highscoreName,
|
||||||
|
Settings.highscoreName,
|
||||||
|
Settings.highscoreName,
|
||||||
|
Settings.highscoreName,
|
||||||
|
Settings.highscoreName,
|
||||||
|
Settings.highscoreName,
|
||||||
|
Settings.highscoreName,
|
||||||
|
Settings.highscoreName
|
||||||
|
], 0);
|
||||||
|
playerListLeftShadow.horizSizing = Width;
|
||||||
|
playerListLeftShadow.position = new Vector(0, 0);
|
||||||
|
playerListLeftShadow.extent = new Vector(525, 99);
|
||||||
|
playerListLeftShadow.scrollable = true;
|
||||||
|
playerListLeftShadow.textYOffset = -6;
|
||||||
|
playerListContainer.addChild(playerListLeftShadow);
|
||||||
|
|
||||||
|
var playerListLeft = new GuiTextListCtrl(markerFelt18, [
|
||||||
|
Settings.highscoreName,
|
||||||
|
Settings.highscoreName,
|
||||||
|
Settings.highscoreName,
|
||||||
|
Settings.highscoreName,
|
||||||
|
Settings.highscoreName,
|
||||||
|
Settings.highscoreName,
|
||||||
|
Settings.highscoreName,
|
||||||
|
Settings.highscoreName
|
||||||
|
], 0xFFFFFF);
|
||||||
|
playerListLeft.horizSizing = Width;
|
||||||
|
playerListLeft.position = new Vector(-1, -1);
|
||||||
|
playerListLeft.extent = new Vector(525, 99);
|
||||||
|
playerListLeft.scrollable = true;
|
||||||
|
playerListLeft.textYOffset = -6;
|
||||||
|
playerListContainer.addChild(playerListLeft);
|
||||||
|
|
||||||
|
playerListContainer.setScrollMax(playerListLeft.calculateFullHeight());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package gui;
|
package gui;
|
||||||
|
|
||||||
|
import net.MasterServerClient;
|
||||||
|
import net.Net;
|
||||||
import h2d.filter.DropShadow;
|
import h2d.filter.DropShadow;
|
||||||
import src.Marbleland;
|
import src.Marbleland;
|
||||||
import h2d.Tile;
|
import h2d.Tile;
|
||||||
|
|
@ -10,6 +12,7 @@ import h3d.Vector;
|
||||||
import src.ResourceLoader;
|
import src.ResourceLoader;
|
||||||
import src.Settings;
|
import src.Settings;
|
||||||
import src.MissionList;
|
import src.MissionList;
|
||||||
|
import net.NetCommands;
|
||||||
|
|
||||||
class MPServerDlg extends GuiImage {
|
class MPServerDlg extends GuiImage {
|
||||||
public function new() {
|
public function new() {
|
||||||
|
|
@ -57,7 +60,12 @@ class MPServerDlg extends GuiImage {
|
||||||
var title = new GuiText(markerFelt32);
|
var title = new GuiText(markerFelt32);
|
||||||
title.text.text = "Server Settings";
|
title.text.text = "Server Settings";
|
||||||
title.text.textColor = 0xFFFFFF;
|
title.text.textColor = 0xFFFFFF;
|
||||||
title.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
title.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
title.justify = Center;
|
title.justify = Center;
|
||||||
title.position = new Vector(11, 21);
|
title.position = new Vector(11, 21);
|
||||||
title.extent = new Vector(418, 14);
|
title.extent = new Vector(418, 14);
|
||||||
|
|
@ -80,6 +88,33 @@ class MPServerDlg extends GuiImage {
|
||||||
// showPasswords.extent = new Vector(31, 31);
|
// showPasswords.extent = new Vector(31, 31);
|
||||||
// this.addChild(showPasswords);
|
// this.addChild(showPasswords);
|
||||||
|
|
||||||
|
// State variables
|
||||||
|
var curServerName = Settings.serverSettings.name;
|
||||||
|
var curServerPassword = Settings.serverSettings.password;
|
||||||
|
var curServerDescription = Settings.serverSettings.description;
|
||||||
|
var curServerMaxPlayers = Settings.serverSettings.maxPlayers;
|
||||||
|
var curServerForceSpectators = Settings.serverSettings.forceSpectators;
|
||||||
|
var curServerQuickRespawn = Settings.serverSettings.quickRespawn;
|
||||||
|
|
||||||
|
saveBtn.pressedAction = (e) -> {
|
||||||
|
Settings.serverSettings.name = curServerName;
|
||||||
|
Settings.serverSettings.password = curServerPassword;
|
||||||
|
Settings.serverSettings.description = curServerDescription;
|
||||||
|
Settings.serverSettings.maxPlayers = curServerMaxPlayers;
|
||||||
|
Settings.serverSettings.forceSpectators = curServerForceSpectators;
|
||||||
|
Settings.serverSettings.quickRespawn = curServerQuickRespawn;
|
||||||
|
if (Net.isHost) {
|
||||||
|
Net.serverInfo.name = curServerName;
|
||||||
|
Net.serverInfo.description = curServerDescription;
|
||||||
|
Net.serverInfo.maxPlayers = curServerMaxPlayers;
|
||||||
|
Net.serverInfo.password = curServerPassword;
|
||||||
|
MasterServerClient.instance.sendServerInfo(Net.serverInfo); // Update data on master server
|
||||||
|
NetCommands.sendServerSettings(Settings.serverSettings.name, Settings.serverSettings.description, Settings.serverSettings.quickRespawn,
|
||||||
|
Settings.serverSettings.forceSpectators);
|
||||||
|
}
|
||||||
|
MarbleGame.canvas.popDialog(this);
|
||||||
|
}
|
||||||
|
|
||||||
var serverSettingsContainer = new GuiControl();
|
var serverSettingsContainer = new GuiControl();
|
||||||
serverSettingsContainer.vertSizing = Height;
|
serverSettingsContainer.vertSizing = Height;
|
||||||
serverSettingsContainer.horizSizing = Left;
|
serverSettingsContainer.horizSizing = Left;
|
||||||
|
|
@ -90,7 +125,12 @@ class MPServerDlg extends GuiImage {
|
||||||
var serverName = new GuiText(markerFelt18);
|
var serverName = new GuiText(markerFelt18);
|
||||||
serverName.text.text = "Server Name:";
|
serverName.text.text = "Server Name:";
|
||||||
serverName.text.textColor = 0xFFFFFF;
|
serverName.text.textColor = 0xFFFFFF;
|
||||||
serverName.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
serverName.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
serverName.position = new Vector(0, 0);
|
serverName.position = new Vector(0, 0);
|
||||||
serverName.extent = new Vector(206, 14);
|
serverName.extent = new Vector(206, 14);
|
||||||
serverSettingsContainer.addChild(serverName);
|
serverSettingsContainer.addChild(serverName);
|
||||||
|
|
@ -104,14 +144,29 @@ class MPServerDlg extends GuiImage {
|
||||||
var serverNameEdit = new GuiTextInput(markerFelt18);
|
var serverNameEdit = new GuiTextInput(markerFelt18);
|
||||||
serverNameEdit.position = new Vector(3, 3);
|
serverNameEdit.position = new Vector(3, 3);
|
||||||
serverNameEdit.extent = new Vector(291, 29);
|
serverNameEdit.extent = new Vector(291, 29);
|
||||||
serverNameEdit.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
serverNameEdit.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
serverNameEdit.horizSizing = Left;
|
serverNameEdit.horizSizing = Left;
|
||||||
|
serverNameEdit.text.textColor = 0;
|
||||||
|
serverNameEdit.text.text = curServerName;
|
||||||
|
serverNameEdit.onTextChange = (t) -> {
|
||||||
|
curServerName = t;
|
||||||
|
}
|
||||||
serverNameEditBg.addChild(serverNameEdit);
|
serverNameEditBg.addChild(serverNameEdit);
|
||||||
|
|
||||||
var password = new GuiText(markerFelt18);
|
var password = new GuiText(markerFelt18);
|
||||||
password.text.text = "Password:";
|
password.text.text = "Password:";
|
||||||
password.text.textColor = 0xFFFFFF;
|
password.text.textColor = 0xFFFFFF;
|
||||||
password.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
password.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
password.position = new Vector(0, 39);
|
password.position = new Vector(0, 39);
|
||||||
password.extent = new Vector(206, 14);
|
password.extent = new Vector(206, 14);
|
||||||
serverSettingsContainer.addChild(password);
|
serverSettingsContainer.addChild(password);
|
||||||
|
|
@ -125,14 +180,29 @@ class MPServerDlg extends GuiImage {
|
||||||
var passwordEdit = new GuiTextInput(markerFelt18);
|
var passwordEdit = new GuiTextInput(markerFelt18);
|
||||||
passwordEdit.position = new Vector(3, 3);
|
passwordEdit.position = new Vector(3, 3);
|
||||||
passwordEdit.extent = new Vector(291, 29);
|
passwordEdit.extent = new Vector(291, 29);
|
||||||
passwordEdit.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
passwordEdit.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
passwordEdit.horizSizing = Left;
|
passwordEdit.horizSizing = Left;
|
||||||
|
passwordEdit.text.textColor = 0;
|
||||||
|
passwordEdit.text.text = curServerPassword;
|
||||||
|
passwordEdit.onTextChange = (t) -> {
|
||||||
|
curServerPassword = t;
|
||||||
|
}
|
||||||
passwordEditBg.addChild(passwordEdit);
|
passwordEditBg.addChild(passwordEdit);
|
||||||
|
|
||||||
var serverDescTitle = new GuiText(markerFelt18);
|
var serverDescTitle = new GuiText(markerFelt18);
|
||||||
serverDescTitle.text.text = "Server Info:";
|
serverDescTitle.text.text = "Server Info:";
|
||||||
serverDescTitle.text.textColor = 0xFFFFFF;
|
serverDescTitle.text.textColor = 0xFFFFFF;
|
||||||
serverDescTitle.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
serverDescTitle.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
serverDescTitle.position = new Vector(0, 39 * 2);
|
serverDescTitle.position = new Vector(0, 39 * 2);
|
||||||
serverDescTitle.extent = new Vector(206, 14);
|
serverDescTitle.extent = new Vector(206, 14);
|
||||||
serverSettingsContainer.addChild(serverDescTitle);
|
serverSettingsContainer.addChild(serverDescTitle);
|
||||||
|
|
@ -146,14 +216,29 @@ class MPServerDlg extends GuiImage {
|
||||||
var serverDescEdit = new GuiTextInput(markerFelt18);
|
var serverDescEdit = new GuiTextInput(markerFelt18);
|
||||||
serverDescEdit.position = new Vector(3, 3);
|
serverDescEdit.position = new Vector(3, 3);
|
||||||
serverDescEdit.extent = new Vector(291 + 93, 29);
|
serverDescEdit.extent = new Vector(291 + 93, 29);
|
||||||
serverDescEdit.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
serverDescEdit.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
serverDescEdit.horizSizing = Left;
|
serverDescEdit.horizSizing = Left;
|
||||||
|
serverDescEdit.text.textColor = 0;
|
||||||
|
serverDescEdit.text.text = curServerDescription;
|
||||||
|
serverDescEdit.onTextChange = (t) -> {
|
||||||
|
curServerDescription = t;
|
||||||
|
}
|
||||||
serverDescEditBg.addChild(serverDescEdit);
|
serverDescEditBg.addChild(serverDescEdit);
|
||||||
|
|
||||||
var maxPlayers = new GuiText(markerFelt18);
|
var maxPlayers = new GuiText(markerFelt18);
|
||||||
maxPlayers.text.text = "Max Players: 8";
|
maxPlayers.text.text = "Max Players: " + curServerMaxPlayers;
|
||||||
maxPlayers.text.textColor = 0xFFFFFF;
|
maxPlayers.text.textColor = 0xFFFFFF;
|
||||||
maxPlayers.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
maxPlayers.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
maxPlayers.position = new Vector(0, 39 * 4);
|
maxPlayers.position = new Vector(0, 39 * 4);
|
||||||
maxPlayers.extent = new Vector(206, 14);
|
maxPlayers.extent = new Vector(206, 14);
|
||||||
serverSettingsContainer.addChild(maxPlayers);
|
serverSettingsContainer.addChild(maxPlayers);
|
||||||
|
|
@ -161,19 +246,30 @@ class MPServerDlg extends GuiImage {
|
||||||
var playerMinus = new GuiButton(loadButtonImages("data/ui/mp/settings/minus"));
|
var playerMinus = new GuiButton(loadButtonImages("data/ui/mp/settings/minus"));
|
||||||
playerMinus.position = new Vector(331, 9 + 29 * 5);
|
playerMinus.position = new Vector(331, 9 + 29 * 5);
|
||||||
playerMinus.extent = new Vector(31, 31);
|
playerMinus.extent = new Vector(31, 31);
|
||||||
playerMinus.pressedAction = (sender) -> {};
|
playerMinus.pressedAction = (sender) -> {
|
||||||
|
curServerMaxPlayers = Std.int(Math.max(1, curServerMaxPlayers - 1));
|
||||||
|
maxPlayers.text.text = "Max Players: " + curServerMaxPlayers;
|
||||||
|
};
|
||||||
serverSettingsContainer.addChild(playerMinus);
|
serverSettingsContainer.addChild(playerMinus);
|
||||||
|
|
||||||
var playerPlus = new GuiButton(loadButtonImages("data/ui/mp/settings/plus"));
|
var playerPlus = new GuiButton(loadButtonImages("data/ui/mp/settings/plus"));
|
||||||
playerPlus.position = new Vector(359, 9 + 29 * 5);
|
playerPlus.position = new Vector(359, 9 + 29 * 5);
|
||||||
playerPlus.extent = new Vector(31, 31);
|
playerPlus.extent = new Vector(31, 31);
|
||||||
playerPlus.pressedAction = (sender) -> {};
|
playerPlus.pressedAction = (sender) -> {
|
||||||
|
Settings.serverSettings.maxPlayers = Std.int(Math.min(8, Settings.serverSettings.maxPlayers + 1));
|
||||||
|
maxPlayers.text.text = "Max Players: " + Settings.serverSettings.maxPlayers;
|
||||||
|
};
|
||||||
serverSettingsContainer.addChild(playerPlus);
|
serverSettingsContainer.addChild(playerPlus);
|
||||||
|
|
||||||
var forceSpectators = new GuiText(markerFelt18);
|
var forceSpectators = new GuiText(markerFelt18);
|
||||||
forceSpectators.text.text = "Force Spectators:";
|
forceSpectators.text.text = "Force Spectators:";
|
||||||
forceSpectators.text.textColor = 0xFFFFFF;
|
forceSpectators.text.textColor = 0xFFFFFF;
|
||||||
forceSpectators.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
forceSpectators.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
forceSpectators.position = new Vector(0, 39 * 5);
|
forceSpectators.position = new Vector(0, 39 * 5);
|
||||||
forceSpectators.extent = new Vector(206, 14);
|
forceSpectators.extent = new Vector(206, 14);
|
||||||
serverSettingsContainer.addChild(forceSpectators);
|
serverSettingsContainer.addChild(forceSpectators);
|
||||||
|
|
@ -182,13 +278,21 @@ class MPServerDlg extends GuiImage {
|
||||||
forceSpectatorsChk.position = new Vector(359, 9 * 2 + 29 * 6 + 2);
|
forceSpectatorsChk.position = new Vector(359, 9 * 2 + 29 * 6 + 2);
|
||||||
forceSpectatorsChk.extent = new Vector(31, 31);
|
forceSpectatorsChk.extent = new Vector(31, 31);
|
||||||
forceSpectatorsChk.buttonType = Toggle;
|
forceSpectatorsChk.buttonType = Toggle;
|
||||||
forceSpectatorsChk.pressedAction = (sender) -> {};
|
forceSpectatorsChk.pressed = curServerForceSpectators;
|
||||||
|
forceSpectatorsChk.pressedAction = (sender) -> {
|
||||||
|
curServerForceSpectators = !curServerForceSpectators;
|
||||||
|
};
|
||||||
serverSettingsContainer.addChild(forceSpectatorsChk);
|
serverSettingsContainer.addChild(forceSpectatorsChk);
|
||||||
|
|
||||||
var quickRespawn = new GuiText(markerFelt18);
|
var quickRespawn = new GuiText(markerFelt18);
|
||||||
quickRespawn.text.text = "Allow Quick Respawn:";
|
quickRespawn.text.text = "Allow Quick Respawn:";
|
||||||
quickRespawn.text.textColor = 0xFFFFFF;
|
quickRespawn.text.textColor = 0xFFFFFF;
|
||||||
quickRespawn.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
quickRespawn.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
quickRespawn.position = new Vector(0, 39 * 6);
|
quickRespawn.position = new Vector(0, 39 * 6);
|
||||||
quickRespawn.extent = new Vector(206, 14);
|
quickRespawn.extent = new Vector(206, 14);
|
||||||
serverSettingsContainer.addChild(quickRespawn);
|
serverSettingsContainer.addChild(quickRespawn);
|
||||||
|
|
@ -197,7 +301,10 @@ class MPServerDlg extends GuiImage {
|
||||||
quickRespawnChk.position = new Vector(359, 9 * 3 + 29 * 7 + 4);
|
quickRespawnChk.position = new Vector(359, 9 * 3 + 29 * 7 + 4);
|
||||||
quickRespawnChk.extent = new Vector(31, 31);
|
quickRespawnChk.extent = new Vector(31, 31);
|
||||||
quickRespawnChk.buttonType = Toggle;
|
quickRespawnChk.buttonType = Toggle;
|
||||||
quickRespawnChk.pressedAction = (sender) -> {};
|
quickRespawnChk.pressed = curServerQuickRespawn;
|
||||||
|
quickRespawnChk.pressedAction = (sender) -> {
|
||||||
|
curServerQuickRespawn = !curServerQuickRespawn;
|
||||||
|
};
|
||||||
serverSettingsContainer.addChild(quickRespawnChk);
|
serverSettingsContainer.addChild(quickRespawnChk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,12 @@ class MainMenuGui extends GuiImage {
|
||||||
versionText.position = new Vector(502, 61);
|
versionText.position = new Vector(502, 61);
|
||||||
versionText.extent = new Vector(97, 72);
|
versionText.extent = new Vector(97, 72);
|
||||||
versionText.text.text = "<p align=\"center\">1.5.4</p>";
|
versionText.text.text = "<p align=\"center\">1.5.4</p>";
|
||||||
versionText.text.filter = new DropShadow(1.414, 0.785, 0x3333337F, 1, 0, 0.7, 1, true);
|
versionText.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
this.addChild(versionText);
|
this.addChild(versionText);
|
||||||
|
|
||||||
var kofi = new GuiButton(loadButtonImages("data/ui/kofi1"));
|
var kofi = new GuiButton(loadButtonImages("data/ui/kofi1"));
|
||||||
|
|
|
||||||
|
|
@ -553,7 +553,12 @@ class MarbleSelectGui extends GuiImage {
|
||||||
|
|
||||||
var titleText = new GuiMLText(markerFelt28, null);
|
var titleText = new GuiMLText(markerFelt28, null);
|
||||||
titleText.text.textColor = 0xFFFFFF;
|
titleText.text.textColor = 0xFFFFFF;
|
||||||
titleText.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0x0000007F, 0.4, 1, true);
|
titleText.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
titleText.horizSizing = Center;
|
titleText.horizSizing = Center;
|
||||||
titleText.vertSizing = Bottom;
|
titleText.vertSizing = Bottom;
|
||||||
titleText.position = new Vector(140, 67);
|
titleText.position = new Vector(140, 67);
|
||||||
|
|
@ -563,7 +568,12 @@ class MarbleSelectGui extends GuiImage {
|
||||||
|
|
||||||
var marbleText = new GuiMLText(markerFelt24, null);
|
var marbleText = new GuiMLText(markerFelt24, null);
|
||||||
marbleText.text.textColor = 0xFFFFFF;
|
marbleText.text.textColor = 0xFFFFFF;
|
||||||
marbleText.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0x0000007F, 0.4, 1, true);
|
marbleText.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
marbleText.horizSizing = Center;
|
marbleText.horizSizing = Center;
|
||||||
marbleText.vertSizing = Bottom;
|
marbleText.vertSizing = Bottom;
|
||||||
marbleText.position = new Vector(86, 243);
|
marbleText.position = new Vector(86, 243);
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,12 @@ class OptionsDlg extends GuiImage {
|
||||||
textObj.extent = new Vector(212, 14);
|
textObj.extent = new Vector(212, 14);
|
||||||
textObj.text.text = text;
|
textObj.text.text = text;
|
||||||
textObj.text.textColor = 0xFFFFFF;
|
textObj.text.textColor = 0xFFFFFF;
|
||||||
textObj.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
textObj.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
parent.addChild(textObj);
|
parent.addChild(textObj);
|
||||||
|
|
||||||
var optDropdownImg = new GuiImage(ResourceLoader.getResource('data/ui/options/dropdown-${size}.png', ResourceLoader.getImage, this.imageResources)
|
var optDropdownImg = new GuiImage(ResourceLoader.getResource('data/ui/options/dropdown-${size}.png', ResourceLoader.getImage, this.imageResources)
|
||||||
|
|
@ -220,7 +225,12 @@ class OptionsDlg extends GuiImage {
|
||||||
textObj.extent = new Vector(212, 14);
|
textObj.extent = new Vector(212, 14);
|
||||||
textObj.text.text = text;
|
textObj.text.text = text;
|
||||||
textObj.text.textColor = 0xFFFFFF;
|
textObj.text.textColor = 0xFFFFFF;
|
||||||
textObj.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
textObj.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
parent.addChild(textObj);
|
parent.addChild(textObj);
|
||||||
|
|
||||||
var sliderBar = new GuiImage(ResourceLoader.getResource("data/ui/options/bar.png", ResourceLoader.getImage, this.imageResources).toTile());
|
var sliderBar = new GuiImage(ResourceLoader.getResource("data/ui/options/bar.png", ResourceLoader.getImage, this.imageResources).toTile());
|
||||||
|
|
@ -399,7 +409,12 @@ class OptionsDlg extends GuiImage {
|
||||||
textObj.extent = new Vector(212, 14);
|
textObj.extent = new Vector(212, 14);
|
||||||
textObj.text.text = text;
|
textObj.text.text = text;
|
||||||
textObj.text.textColor = 0xFFFFFF;
|
textObj.text.textColor = 0xFFFFFF;
|
||||||
textObj.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
textObj.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
parent.addChild(textObj);
|
parent.addChild(textObj);
|
||||||
|
|
||||||
var remapBtn = new GuiButtonText(loadButtonImages("data/ui/options/bind"), markerFelt24);
|
var remapBtn = new GuiButtonText(loadButtonImages("data/ui/options/bind"), markerFelt24);
|
||||||
|
|
@ -444,7 +459,12 @@ class OptionsDlg extends GuiImage {
|
||||||
textObj.extent = new Vector(212, 14);
|
textObj.extent = new Vector(212, 14);
|
||||||
textObj.text.text = "Touch Controls";
|
textObj.text.text = "Touch Controls";
|
||||||
textObj.text.textColor = 0xFFFFFF;
|
textObj.text.textColor = 0xFFFFFF;
|
||||||
textObj.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
textObj.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
hotkeysPanel.addChild(textObj);
|
hotkeysPanel.addChild(textObj);
|
||||||
|
|
||||||
var remapBtn = new GuiButtonText(loadButtonImages("data/ui/options/bind"), markerFelt24);
|
var remapBtn = new GuiButtonText(loadButtonImages("data/ui/options/bind"), markerFelt24);
|
||||||
|
|
|
||||||
|
|
@ -887,7 +887,12 @@ class PlayGui {
|
||||||
middleMsg.text.text = text;
|
middleMsg.text.text = text;
|
||||||
middleMsg.justify = Center;
|
middleMsg.justify = Center;
|
||||||
middleMsg.text.textColor = color;
|
middleMsg.text.textColor = color;
|
||||||
middleMsg.text.filter = new h2d.filter.DropShadow(1.414, 0.785, 0x000000F, 1, 0, 0.4, 1, true);
|
middleMsg.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
}; // new h2d.filter.DropShadow(1.414, 0.785, 0x000000F, 1, 0, 0.4, 1, true);
|
||||||
this.playGuiCtrl.addChild(middleMsg);
|
this.playGuiCtrl.addChild(middleMsg);
|
||||||
middleMsg.render(scene2d);
|
middleMsg.render(scene2d);
|
||||||
middleMsg.text.y -= (25 / playGuiCtrl.extent.y) * scene2d.height;
|
middleMsg.text.y -= (25 / playGuiCtrl.extent.y) * scene2d.height;
|
||||||
|
|
|
||||||
|
|
@ -892,8 +892,12 @@ class PlayMissionGui extends GuiImage {
|
||||||
setScoreHover = (isHover) -> {
|
setScoreHover = (isHover) -> {
|
||||||
var currentMission = currentList[currentSelection];
|
var currentMission = currentList[currentSelection];
|
||||||
|
|
||||||
pmScoreText.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
pmScoreText.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
var scoreTextTime = "";
|
var scoreTextTime = "";
|
||||||
var scoreData = Settings.getScores(currentMission.path);
|
var scoreData = Settings.getScores(currentMission.path);
|
||||||
if (scoreData.length == 0) {
|
if (scoreData.length == 0) {
|
||||||
|
|
@ -982,10 +986,20 @@ class PlayMissionGui extends GuiImage {
|
||||||
currentSelection = -1;
|
currentSelection = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmDescription.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
pmDescription.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
pmDescription.text.lineSpacing = -1;
|
pmDescription.text.lineSpacing = -1;
|
||||||
|
|
||||||
pmDescriptionRight.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
pmDescriptionRight.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
pmDescriptionRight.text.lineSpacing = -1;
|
pmDescriptionRight.text.lineSpacing = -1;
|
||||||
|
|
||||||
var descText = '<font color="#FDFEFE" face="MarkerFelt26"><p align="center">#${currentList.indexOf(currentMission) + 1}: ${currentMission.title}</p></font>';
|
var descText = '<font color="#FDFEFE" face="MarkerFelt26"><p align="center">#${currentList.indexOf(currentMission) + 1}: ${currentMission.title}</p></font>';
|
||||||
|
|
@ -1025,8 +1039,18 @@ class PlayMissionGui extends GuiImage {
|
||||||
}
|
}
|
||||||
pmDescription.text.text = descText;
|
pmDescription.text.text = descText;
|
||||||
|
|
||||||
pmParText.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
pmParText.text.dropShadow = {
|
||||||
pmParTextRight.text.filter = new DropShadow(1.414, 0.785, 0x0000000F, 1, 0, 0.4, 1, true);
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
|
pmParTextRight.text.dropShadow = {
|
||||||
|
dx: 1,
|
||||||
|
dy: 1,
|
||||||
|
alpha: 0.5,
|
||||||
|
color: 0
|
||||||
|
};
|
||||||
if (this.scoreShowing) {
|
if (this.scoreShowing) {
|
||||||
if (currentMission.game == "platinum") {
|
if (currentMission.game == "platinum") {
|
||||||
pmParText.text.text = '<font color="#FFE3E3" face="MarkerFelt20">Platinum: <font color="#CCCCCC">${Util.formatTime(currentMission.goldTime)}</font></font>';
|
pmParText.text.text = '<font color="#FFE3E3" face="MarkerFelt20">Platinum: <font color="#CCCCCC">${Util.formatTime(currentMission.goldTime)}</font></font>';
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,6 @@ abstract class GameConnection {
|
||||||
var lobbyReady:Bool;
|
var lobbyReady:Bool;
|
||||||
var platform:NetPlatform;
|
var platform:NetPlatform;
|
||||||
var marbleId:Int;
|
var marbleId:Int;
|
||||||
var isPrivate:Bool;
|
|
||||||
|
|
||||||
function new(id:Int) {
|
function new(id:Int) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,19 @@ import src.Console;
|
||||||
|
|
||||||
typedef RemoteServerInfo = {
|
typedef RemoteServerInfo = {
|
||||||
name:String,
|
name:String,
|
||||||
|
description:String,
|
||||||
players:Int,
|
players:Int,
|
||||||
maxPlayers:Int,
|
maxPlayers:Int,
|
||||||
platform:Int,
|
platform:Int,
|
||||||
version:String
|
version:String,
|
||||||
|
passworded:Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
class MasterServerClient {
|
class MasterServerClient {
|
||||||
#if js
|
#if js
|
||||||
static var serverIp = "wss://mbomaster.randomityguy.me:8443";
|
static var serverIp = "wss://mbomaster.randomityguy.me:8443";
|
||||||
#else
|
#else
|
||||||
static var serverIp = "ws://89.58.58.191:8080";
|
static var serverIp = "ws://89.58.58.191:8084";
|
||||||
#end
|
#end
|
||||||
public static var instance:MasterServerClient;
|
public static var instance:MasterServerClient;
|
||||||
|
|
||||||
|
|
@ -208,32 +210,24 @@ class MasterServerClient {
|
||||||
queueMessage(Json.stringify({
|
queueMessage(Json.stringify({
|
||||||
type: "serverInfo",
|
type: "serverInfo",
|
||||||
name: serverInfo.name,
|
name: serverInfo.name,
|
||||||
|
description: serverInfo.description,
|
||||||
players: serverInfo.players,
|
players: serverInfo.players,
|
||||||
maxPlayers: serverInfo.maxPlayers,
|
maxPlayers: serverInfo.maxPlayers,
|
||||||
privateSlots: serverInfo.privateSlots,
|
password: serverInfo.password,
|
||||||
privateServer: serverInfo.privateServer,
|
|
||||||
inviteCode: serverInfo.inviteCode,
|
|
||||||
state: serverInfo.state,
|
state: serverInfo.state,
|
||||||
platform: serverInfo.platform,
|
platform: serverInfo.platform,
|
||||||
version: "MBP" // MarbleGame.currentVersion
|
version: "MBP" // MarbleGame.currentVersion
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendConnectToServer(serverName:String, sdp:String, isInvite:Bool = false) {
|
public function sendConnectToServer(serverName:String, sdp:String, password:String) {
|
||||||
if (!isInvite) {
|
|
||||||
queueMessage(Json.stringify({
|
queueMessage(Json.stringify({
|
||||||
type: "connect",
|
type: "connect",
|
||||||
serverName: serverName,
|
serverName: serverName,
|
||||||
sdp: sdp
|
|
||||||
}));
|
|
||||||
} else {
|
|
||||||
queueMessage(Json.stringify({
|
|
||||||
type: "connectInvite",
|
|
||||||
sdp: sdp,
|
sdp: sdp,
|
||||||
inviteCode: serverName
|
password: password
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function getServerList(serverListCb:Array<RemoteServerInfo>->Void) {
|
public function getServerList(serverListCb:Array<RemoteServerInfo>->Void) {
|
||||||
this.serverListCb = serverListCb;
|
this.serverListCb = serverListCb;
|
||||||
|
|
@ -269,20 +263,13 @@ class MasterServerClient {
|
||||||
}));
|
}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var pubSlotsAvail = Net.serverInfo.maxPlayers - Net.serverInfo.privateSlots;
|
|
||||||
var privSlotsAvail = Net.serverInfo.privateSlots;
|
|
||||||
|
|
||||||
var pubCount = 1; // Self
|
var pubCount = 1; // Self
|
||||||
var privCount = 0;
|
|
||||||
for (cid => cc in Net.clientIdMap) {
|
for (cid => cc in Net.clientIdMap) {
|
||||||
if (cc.isPrivate) {
|
|
||||||
privCount++;
|
|
||||||
} else {
|
|
||||||
pubCount++;
|
pubCount++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!joiningPrivate && pubCount >= pubSlotsAvail) {
|
if (!joiningPrivate && pubCount >= Net.serverInfo.maxPlayers) {
|
||||||
queueMessage(Json.stringify({
|
queueMessage(Json.stringify({
|
||||||
type: "connectFailed",
|
type: "connectFailed",
|
||||||
success: false,
|
success: false,
|
||||||
|
|
@ -291,11 +278,7 @@ class MasterServerClient {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (joiningPrivate && privCount >= privSlotsAvail) {
|
Net.addClientFromSdp(conts.sdp, (sdpReply) -> {
|
||||||
joiningPrivate = false; // Join publicly
|
|
||||||
}
|
|
||||||
|
|
||||||
Net.addClientFromSdp(conts.sdp, joiningPrivate, (sdpReply) -> {
|
|
||||||
queueMessage(Json.stringify({
|
queueMessage(Json.stringify({
|
||||||
success: true,
|
success: true,
|
||||||
type: "connectResponse",
|
type: "connectResponse",
|
||||||
|
|
|
||||||
|
|
@ -40,26 +40,33 @@ enum abstract NetPacketType(Int) from Int to Int {
|
||||||
@:publicFields
|
@:publicFields
|
||||||
class ServerInfo {
|
class ServerInfo {
|
||||||
var name:String;
|
var name:String;
|
||||||
|
var description:String;
|
||||||
var players:Int;
|
var players:Int;
|
||||||
var maxPlayers:Int;
|
var maxPlayers:Int;
|
||||||
var privateSlots:Int;
|
var password:String;
|
||||||
var privateServer:Bool;
|
|
||||||
var inviteCode:Int;
|
|
||||||
var state:String;
|
var state:String;
|
||||||
var platform:NetPlatform;
|
var platform:NetPlatform;
|
||||||
|
|
||||||
public function new(name:String, players:Int, maxPlayers:Int, privateSlots:Int, privateServer:Bool, inviteCode:Int, state:String, platform:NetPlatform) {
|
public function new(name:String, description:String, players:Int, maxPlayers:Int, password:String, state:String, platform:NetPlatform) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
this.players = players;
|
this.players = players;
|
||||||
this.maxPlayers = maxPlayers;
|
this.maxPlayers = maxPlayers;
|
||||||
this.privateSlots = privateSlots;
|
this.password = password;
|
||||||
this.privateServer = privateServer;
|
|
||||||
this.inviteCode = inviteCode;
|
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@:publicFields
|
||||||
|
@:structInit
|
||||||
|
class ConnectedServerInfo {
|
||||||
|
var name:String;
|
||||||
|
var description:String;
|
||||||
|
var quickRespawn:Bool;
|
||||||
|
var forceSpectator:Bool;
|
||||||
|
}
|
||||||
|
|
||||||
class Net {
|
class Net {
|
||||||
static var client:RTCPeerConnection;
|
static var client:RTCPeerConnection;
|
||||||
static var clientDatachannel:RTCDataChannel;
|
static var clientDatachannel:RTCDataChannel;
|
||||||
|
|
@ -81,13 +88,14 @@ class Net {
|
||||||
public static var clientConnection:ClientConnection;
|
public static var clientConnection:ClientConnection;
|
||||||
public static var serverInfo:ServerInfo;
|
public static var serverInfo:ServerInfo;
|
||||||
public static var remoteServerInfo:RemoteServerInfo;
|
public static var remoteServerInfo:RemoteServerInfo;
|
||||||
|
public static var connectedServerInfo:ConnectedServerInfo;
|
||||||
|
|
||||||
static var stunServers = ["stun:stun.l.google.com:19302"];
|
static var stunServers = ["stun:stun.l.google.com:19302"];
|
||||||
|
|
||||||
public static var turnServer:String = "";
|
public static var turnServer:String = "";
|
||||||
|
|
||||||
public static function hostServer(name:String, maxPlayers:Int, privateSlots:Int, privateServer:Bool, onHosted:() -> Void) {
|
public static function hostServer(name:String, description:String, maxPlayers:Int, password:String, onHosted:() -> Void) {
|
||||||
serverInfo = new ServerInfo(name, 1, maxPlayers, privateSlots, privateServer, Std.int(999999 * Math.random()), "LOBBY", getPlatform());
|
serverInfo = new ServerInfo(name, description, 1, maxPlayers, password, "LOBBY", getPlatform());
|
||||||
MasterServerClient.connectToMasterServer(() -> {
|
MasterServerClient.connectToMasterServer(() -> {
|
||||||
isHost = true;
|
isHost = true;
|
||||||
isClient = false;
|
isClient = false;
|
||||||
|
|
@ -98,14 +106,14 @@ class Net {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addClientFromSdp(sdpString:String, privateJoin:Bool, onFinishSdp:String->Void) {
|
public static function addClientFromSdp(sdpString:String, onFinishSdp:String->Void) {
|
||||||
var peer = new RTCPeerConnection(stunServers, "0.0.0.0");
|
var peer = new RTCPeerConnection(stunServers, "0.0.0.0");
|
||||||
var sdpObj = Json.parse(sdpString);
|
var sdpObj = Json.parse(sdpString);
|
||||||
peer.setRemoteDescription(sdpObj.sdp, sdpObj.type);
|
peer.setRemoteDescription(sdpObj.sdp, sdpObj.type);
|
||||||
addClient(peer, privateJoin, onFinishSdp);
|
addClient(peer, onFinishSdp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function addClient(peer:RTCPeerConnection, privateJoin:Bool, onFinishSdp:String->Void) {
|
static function addClient(peer:RTCPeerConnection, onFinishSdp:String->Void) {
|
||||||
var candidates = [];
|
var candidates = [];
|
||||||
peer.onLocalCandidate = (c) -> {
|
peer.onLocalCandidate = (c) -> {
|
||||||
Console.log('Local candidate: ' + c);
|
Console.log('Local candidate: ' + c);
|
||||||
|
|
@ -173,7 +181,7 @@ class Net {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (reliable != null && unreliable != null)
|
if (reliable != null && unreliable != null)
|
||||||
onClientConnect(peer, reliable, unreliable, privateJoin);
|
onClientConnect(peer, reliable, unreliable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -182,7 +190,7 @@ class Net {
|
||||||
clientIdMap[id] = ghost;
|
clientIdMap[id] = ghost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function joinServer(serverName:String, isInvite:Bool, connectedCb:() -> Void) {
|
public static function joinServer(serverName:String, password:String, connectedCb:() -> Void) {
|
||||||
MasterServerClient.connectToMasterServer(() -> {
|
MasterServerClient.connectToMasterServer(() -> {
|
||||||
client = new RTCPeerConnection(stunServers, "0.0.0.0");
|
client = new RTCPeerConnection(stunServers, "0.0.0.0");
|
||||||
var candidates = [];
|
var candidates = [];
|
||||||
|
|
@ -250,7 +258,7 @@ class Net {
|
||||||
MasterServerClient.instance.sendConnectToServer(serverName, Json.stringify({
|
MasterServerClient.instance.sendConnectToServer(serverName, Json.stringify({
|
||||||
sdp: sdpObj,
|
sdp: sdpObj,
|
||||||
type: "offer"
|
type: "offer"
|
||||||
}), isInvite);
|
}), password);
|
||||||
}
|
}
|
||||||
|
|
||||||
client.onGatheringStateChange = (s) -> {
|
client.onGatheringStateChange = (s) -> {
|
||||||
|
|
@ -355,6 +363,7 @@ class Net {
|
||||||
Net.clientConnection = null;
|
Net.clientConnection = null;
|
||||||
Net.serverInfo = null;
|
Net.serverInfo = null;
|
||||||
Net.remoteServerInfo = null;
|
Net.remoteServerInfo = null;
|
||||||
|
Net.connectedServerInfo = null;
|
||||||
Net.lobbyHostReady = false;
|
Net.lobbyHostReady = false;
|
||||||
Net.lobbyClientReady = false;
|
Net.lobbyClientReady = false;
|
||||||
Net.hostReady = false;
|
Net.hostReady = false;
|
||||||
|
|
@ -375,6 +384,7 @@ class Net {
|
||||||
MasterServerClient.disconnectFromMasterServer();
|
MasterServerClient.disconnectFromMasterServer();
|
||||||
Net.serverInfo = null;
|
Net.serverInfo = null;
|
||||||
Net.remoteServerInfo = null;
|
Net.remoteServerInfo = null;
|
||||||
|
Net.connectedServerInfo = null;
|
||||||
Net.lobbyHostReady = false;
|
Net.lobbyHostReady = false;
|
||||||
Net.lobbyClientReady = false;
|
Net.lobbyClientReady = false;
|
||||||
Net.hostReady = false;
|
Net.hostReady = false;
|
||||||
|
|
@ -444,7 +454,7 @@ class Net {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function onClientConnect(c:RTCPeerConnection, dc:RTCDataChannel, dcu:RTCDataChannel, joiningPrivate:Bool) {
|
static function onClientConnect(c:RTCPeerConnection, dc:RTCDataChannel, dcu:RTCDataChannel) {
|
||||||
if (!Net.isMP) {
|
if (!Net.isMP) {
|
||||||
c.close();
|
c.close();
|
||||||
return;
|
return;
|
||||||
|
|
@ -456,7 +466,6 @@ class Net {
|
||||||
}
|
}
|
||||||
var cc = new ClientConnection(clientId, c, dc, dcu);
|
var cc = new ClientConnection(clientId, c, dc, dcu);
|
||||||
clients.set(c, cc);
|
clients.set(c, cc);
|
||||||
cc.isPrivate = joiningPrivate;
|
|
||||||
clientIdMap[clientId] = clients[c];
|
clientIdMap[clientId] = clients[c];
|
||||||
cc.lastRecvTime = Console.time(); // So it doesnt get timed out
|
cc.lastRecvTime = Console.time(); // So it doesnt get timed out
|
||||||
|
|
||||||
|
|
@ -569,6 +578,8 @@ class Net {
|
||||||
// if (MultiplayerLevelSelectGui.custSelected) {
|
// if (MultiplayerLevelSelectGui.custSelected) {
|
||||||
// NetCommands.setLobbyCustLevelNameClient(conn, MultiplayerLevelSelectGui.custPath);
|
// NetCommands.setLobbyCustLevelNameClient(conn, MultiplayerLevelSelectGui.custPath);
|
||||||
// } else {
|
// } else {
|
||||||
|
NetCommands.sendServerSettingsClient(conn, Settings.serverSettings.name, Settings.serverSettings.description, Settings.serverSettings.quickRespawn,
|
||||||
|
Settings.serverSettings.forceSpectators);
|
||||||
NetCommands.setLobbyLevelIndexClient(conn, MPPlayMissionGui.currentCategoryStatic, MPPlayMissionGui.currentSelectionStatic);
|
NetCommands.setLobbyLevelIndexClient(conn, MPPlayMissionGui.currentCategoryStatic, MPPlayMissionGui.currentSelectionStatic);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -326,6 +326,15 @@ class NetCommands {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@:rpc(server) public static function sendServerSettings(name:String, desc:String, quickRespawn:Bool, forceSpectator:Bool) {
|
||||||
|
Net.connectedServerInfo = {
|
||||||
|
name: name,
|
||||||
|
description: desc,
|
||||||
|
quickRespawn: quickRespawn,
|
||||||
|
forceSpectator: forceSpectator
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// @:rpc(client) public static function sendChatMessage(msg:String) {
|
// @:rpc(client) public static function sendChatMessage(msg:String) {
|
||||||
// if (Net.isHost) {
|
// if (Net.isHost) {
|
||||||
// sendServerChatMessage(msg);
|
// sendServerChatMessage(msg);
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,14 @@ class RPCMacro {
|
||||||
serializeFns.push(macro stream.writeInt32($i{argName}));
|
serializeFns.push(macro stream.writeInt32($i{argName}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TPath({
|
||||||
|
name: 'Bool'
|
||||||
|
}): {
|
||||||
|
deserializeFns.push(macro var $argName = stream.readFlag());
|
||||||
|
callExprs.push(macro $i{argName});
|
||||||
|
serializeFns.push(macro stream.writeFlag($i{argName}));
|
||||||
|
}
|
||||||
|
|
||||||
case TPath({
|
case TPath({
|
||||||
name: 'Float'
|
name: 'Float'
|
||||||
}): {
|
}): {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue