init commit
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class MainMenu : Control {
|
||||
Options _Options;
|
||||
Reference _Reference;
|
||||
|
||||
public override void _Ready() {
|
||||
_Reference = GetNode<Reference>("/root/Reference");
|
||||
_Options = GetNode<Options>( "/root/Options" );
|
||||
_Reference.MainMenu = this;
|
||||
}
|
||||
|
||||
void _on_settings_button_down() {
|
||||
_Reference.SettingsFrame.ToggleSettingsVisibility();
|
||||
}
|
||||
|
||||
public async void _on_join_game_pressed() {
|
||||
SettingsFile sf = _Options._SettingsFile;
|
||||
GameSettings gs = sf.Game;
|
||||
string userN = gs.UserName;
|
||||
string passW = gs.SessionToken;
|
||||
(bool, Account) User = await _Reference.MistoxNet.TrySession( userN, passW );
|
||||
if( User.Item1 ) {
|
||||
_Reference.Lighting.Environment.SsrEnabled = sf.Display.ScreenSpaceReflections;
|
||||
_Reference.Lighting.Environment.SsaoEnabled = sf.Display.ScreenSpaceAmbiantOcclusion;
|
||||
_Reference.Lighting.Environment.SdfgiEnabled = sf.Display.GlobalIllumination;
|
||||
_Reference.GameHandler.Visible = true;
|
||||
_Reference.GameUI.Visible = true;
|
||||
Visible = false;
|
||||
_Options.Host = GetNode<TextEdit>("Host").Text;
|
||||
_Reference.GameHandler.StartClient();
|
||||
this.Visible = false;
|
||||
_Reference.PreGame.Visible = true;
|
||||
|
||||
} else {
|
||||
_Reference.Alert.PerformAlert( "Login failed" );
|
||||
_Reference.SessionHandler.GetParent<Control>().Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void _on_start_server_pressed(){
|
||||
_Reference.GameHandler.StartServer();
|
||||
_Reference.MainMenu.Visible = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user