144 lines
4.9 KiB
Plaintext
144 lines
4.9 KiB
Plaintext
import {
|
|
Palette,
|
|
StandardButton,
|
|
LineEdit,
|
|
HorizontalBox,
|
|
VerticalBox,
|
|
Button,
|
|
ComboBox,
|
|
ScrollView,
|
|
} from "std-widgets.slint";
|
|
import { NetplayData } from "netplay_page.slint";
|
|
import { SettingsData } from "settings_page.slint";
|
|
import { Page } from "page.slint";
|
|
|
|
export component NetplayCreate inherits Page {
|
|
title: @tr("Netplay: Create Session");
|
|
callback select_rom(string);
|
|
callback create_session(string, string, string, string, string, string, bool, bool);
|
|
callback select_netplay_state;
|
|
callback close;
|
|
|
|
VerticalBox {
|
|
alignment: start;
|
|
HorizontalBox {
|
|
alignment: center;
|
|
VerticalBox {
|
|
alignment: start;
|
|
horizontal-stretch: 0;
|
|
HorizontalBox {
|
|
VerticalBox {
|
|
Text {
|
|
text: @tr("Session Name:");
|
|
}
|
|
|
|
LineEdit {
|
|
placeholder-text: @tr("Enter session name");
|
|
text: NetplayData.session_name;
|
|
edited(text) => {
|
|
NetplayData.session_name = text;
|
|
}
|
|
}
|
|
}
|
|
|
|
VerticalBox {
|
|
Text {
|
|
text: @tr("Password (Optional):");
|
|
}
|
|
|
|
LineEdit {
|
|
placeholder-text: @tr("Enter session password");
|
|
text: NetplayData.password;
|
|
edited(text) => {
|
|
NetplayData.password = text;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
VerticalBox {
|
|
Text {
|
|
text: @tr("Player Name:");
|
|
}
|
|
|
|
LineEdit {
|
|
placeholder-text: @tr("Enter player name");
|
|
text: NetplayData.player_name;
|
|
edited(text) => {
|
|
NetplayData.player_name = text;
|
|
}
|
|
}
|
|
}
|
|
|
|
HorizontalBox {
|
|
alignment: center;
|
|
if NetplayData.game_name == "": Button {
|
|
text: @tr("Select ROM");
|
|
clicked => {
|
|
select_rom(SettingsData.rom_dir);
|
|
}
|
|
}
|
|
if NetplayData.game_name != "": Button {
|
|
text: NetplayData.game_name;
|
|
clicked => {
|
|
select_rom(SettingsData.rom_dir);
|
|
}
|
|
}
|
|
}
|
|
|
|
Rectangle { }
|
|
|
|
if NetplayData.game_cheats != "": Text {
|
|
text: @tr("This game has cheats enabled. Cheats will be synchronized with other players.");
|
|
horizontal-alignment: center;
|
|
wrap: word-wrap;
|
|
}
|
|
Rectangle { }
|
|
|
|
HorizontalBox {
|
|
alignment: center;
|
|
Button {
|
|
text: @tr("Create Session");
|
|
enabled: NetplayData.session_name != "" && NetplayData.player_name != "" && NetplayData.game_name != "" && !NetplayData.pending_session;
|
|
clicked => {
|
|
NetplayData.pending_session = true;
|
|
create_session(
|
|
NetplayData.session_name,
|
|
NetplayData.player_name,
|
|
NetplayData.game_name,
|
|
NetplayData.game_hash,
|
|
NetplayData.game_cheats,
|
|
NetplayData.password,
|
|
SettingsData.overclock_n64_cpu,
|
|
SettingsData.disable_expansion_pak);
|
|
}
|
|
}
|
|
|
|
Button {
|
|
text: @tr("Resume Session…");
|
|
enabled: !NetplayData.pending_session;
|
|
clicked => {
|
|
select_netplay_state();
|
|
}
|
|
}
|
|
|
|
if NetplayData.state_path != "" : Text {
|
|
text: @tr("Resume session: peers will sync to the saved state when they join.");
|
|
horizontal-alignment: center;
|
|
wrap: word-wrap;
|
|
}
|
|
|
|
Button {
|
|
text: @tr("Cancel");
|
|
clicked => {
|
|
close();
|
|
}
|
|
}
|
|
}
|
|
|
|
Rectangle { }
|
|
}
|
|
}
|
|
}
|
|
}
|