Esempio n. 1
0
    public virtual void InitGameverses()
    {
#if ENABLE_FEATURE_NETWORKING
        gameversesGameObject = gameObject.AddComponent <GameversesGameObject>();
        networking           = gameversesGameObject.gameNetworking;
#endif
    }
        public void ResetAction(Button button)
        {
            Exit();

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

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

            gamePieces.ResetPieces();
            GameNetworking.Sync(CupboardApp.Networker);
        }
Esempio n. 3
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);
            }
        }
Esempio n. 4
0
        private void _keyListener_KeyUp(object sender, KeyboardKeyEventArgs e)
        {
            if (Warnings.NullOrDisposed(Scene))
            {
                return;
            }
            var keeper = Scene.FindComponent <SelectionKeeper>();

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

            if (keeper.Selection == null)
            {
                return;
            }

            var vel = 0;

            if (e.Key == Key.Right)
            {
                vel = 1;
            }

            else if (e.Key == Key.Left)
            {
                vel = -1;
            }

            if (vel != 0)
            {
                var angle = GetAngle(keeper.Selection);
                angle += MathF.DegToRad(Increment) * vel;

                GameNetworking.SendSpin(CupboardApp.Networker, angle, keeper.Selection.Name);

                SetAngle(keeper.Selection, angle);
            }
        }
Esempio n. 5
0
 public virtual void InitGameverses()
 {
     gameversesGameObject = gameObject.AddComponent <GameversesGameObject>();
     networking           = gameversesGameObject.gameNetworking;
 }
Esempio n. 6
0
 private static void Networker_DataRecieved(object sender, DataRecievedEventArgs e)
 {
     GameNetworking.ParseIncomingData(CupboardApp.Networker, e);
 }