import { ConnectPage } from "ConnectPage.slint"; import { StartPage } from "StartPage.slint"; import { GamePage, OtherPlayer, HandCard, CardColor, GameDirection } from "GamePage.slint"; enum PageType { ConnectPage, StartPage, GamePage } export component MainWindow inherits Window { in property active-page: PageType.ConnectPage; // ConnectPage in property is-connecting; // StartPage in property is-ready; in property is-restart; // GamePage in property <[OtherPlayer]> other-players; in property current-player-name; in property current-player-card-count; in property current-player-has-uno; in property is-current-player-turn; in property <[HandCard]> hand-cards; in property discard-top-card; in property game-direction; in property current-color; callback request-connect(string, string, string); callback request-start; callback request-play-card(int, CardColor); callback request-draw-card; callback request-uno; width: 1920px; height: 1080px; title: "UNO!"; if root.active-page == PageType.ConnectPage: connect-page := ConnectPage { is-connecting: root.is-connecting; request-connect(server-address, server-port, player-name) => { root.request-connect(server-address, server-port, player-name); } } if root.active-page == PageType.StartPage: start-page := StartPage { is-ready: root.is-ready; is-restart: root.is-restart; request-start => { root.request-start(); } } if root.active-page == PageType.GamePage: game-page := GamePage { other-players: root.other-players; current-player-name: root.current-player-name; current-player-card-count: root.current-player-card-count; current-player-has-uno: root.current-player-has-uno; is-current-player-turn: root.is-current-player-turn; hand-cards: root.hand-cards; discard-top-card: root.discard-top-card; game-direction: root.game-direction; current-color: root.current-color; request-play-card(index, card-color) => { root.request-play-card(index, card-color); } request-draw-card => { root.request-draw-card(); } request-uno => { root.request-uno(); } } }