Exemplo n.º 1
0
        public void ResetAction(Button button)
        {
            Exit();

            var gamePieces = Scene.Current.FindComponent <GamePieces>();

            if (Warnings.NullOrDisposed(gamePieces))
            {
                return;
            }

            gamePieces.ResetPieces();
            GameNetworking.Sync(CupboardApp.Networker);
        }
Exemplo n.º 2
0
        private static void Networker_Joined(object sender, ServerJoinedEventArgs e)
        {
            if (CupboardApp.Networker.Hosting)
            {
                OldContext.ShowNotification("Success", $"{e.RemoteEndPoint.Address}:{e.RemoteEndPoint.Port} has joined.", duration: 3);
                GameNetworking.Sync(CupboardApp.Networker);
            }
            else
            {
                OldContext.ShowNotification("Success", $"Joined server {e.RemoteEndPoint.Address}:{e.RemoteEndPoint.Port}", duration: 3);

                var joinButton = Scene.Current.FindComponents <Button>().Where(x => x.Command == "Cancel").FirstOrDefault();
                joinButton.Command = "Join";

                Scene.SwitchTo(_gameScene);
            }
        }