Beispiel #1
0
    void MultiPlayerInit()
    {
        apiKey    = "58271c1a56f7b42d7a979d66e372b409ca81dabd1d1ea25c599dd1b7fd3a780b";
        secretKey = "9c38fcd3b67e65bb94a4c109ea0c2d50f0fd5f28d0bae2c66d6d8298898ac86f";
        roomIndex = 0;
        roomId    = "";

        if (listen == null)
        {
            listen = new Listener();
        }

        WarpClient.initialize(apiKey, secretKey);
        serverConnection = WarpClient.GetInstance();
        serverConnection.AddConnectionRequestListener(listen);
        serverConnection.AddChatRequestListener(listen);
        serverConnection.AddUpdateRequestListener(listen);
        serverConnection.AddLobbyRequestListener(listen);
        serverConnection.AddNotificationListener(listen);
        serverConnection.AddRoomRequestListener(listen);
        serverConnection.AddZoneRequestListener(listen);
        serverConnection.AddTurnBasedRoomRequestListener(listen);



        matchRoomData = new Dictionary <string, object>();
        matchRoomData.Add("Password", "Shenkar");

        serverConnection.Connect(DefinedVariables.userName);
    }
Beispiel #2
0
        public GamePage()
        {
            InitializeComponent();
            this.SupportedOrientations = SupportedPageOrientation.Landscape;

            Balls_mas = new Ball[maxUsers];// ініціал масиву шарів
            Ws.InitWorld();
            // initial word dates винести в клас
            //_world = new World(new Vector2(0, 0));
            //ConvertUnits.SetDisplayUnitToSimUnitRatio(64f);
            //width = ConvertUnits.ToSimUnits(800);
            //height = ConvertUnits.ToSimUnits(480);
            //

            WarpClient game = WarpClient.GetInstance();

            game.AddNotificationListener(new GameNotificationListener(this));



            // Get the content manager from the application
            contentManager = (Application.Current as App).Content;

            // Create a timer for this page
            timer = new GameTimer();
            timer.UpdateInterval = TimeSpan.FromTicks(333333);
            timer.Update        += OnUpdate;
            timer.Draw          += OnDraw;
        }
 void Start()
 {
     Debug.Log("MULTIPLAYER ENGINE");
     roomId      = Constants.ROOM_ID;
     CARD_STATUS = Constants.BLIND;
     GAME_STATUS = Constants.STOPPED;
     theClient.AddConnectionRequestListener(this);
     theClient.AddRoomRequestListener(this);
     theClient.AddTurnBasedRoomRequestListener(this);
     theClient.AddNotificationListener(this);
     progressDialog.show("Waiting to start game");
     progressDialog.setCancelable(true);
 }
Beispiel #4
0
        public RoomPage()
        {
            InitializeComponent();
            WarpClient game = WarpClient.GetInstance();

            //підключив то шо треба для кімнати і чату
            game.AddLobbyRequestListener(new LobbyReqListen(this));
            game.AddNotificationListener(new NotificationListener(this));
            game.AddRoomRequestListener(new RoomPageListener(this));
            //підписуюся на кімнату та лобі
            //WarpClient.GetInstance().JoinRoom(UserDates._RoomId);
            WarpClient.GetInstance().SubscribeRoom(UserDates._RoomId);
            WarpClient.GetInstance().JoinLobby();
            WarpClient.GetInstance().SubscribeLobby();
            WarpClient.GetInstance().JoinRoom(UserDates._RoomId);
            //Thread.Sleep(500);

            WarpClient.GetInstance().GetLiveRoomInfo(UserDates._RoomId);
        }
Beispiel #5
0
    //Api refernce: http://appwarp.shephertz.com/game-development-center/csharp-api-reference/
    //Callbacks: http://appwarp.shephertz.com/game-development-center/windows-game-developers-home/windows-client-listener/#connectionrequestlistener
    // Start is called before the first frame update
    private void Start()
    {
        WarpClient.initialize("9a8f11688a5028bd91cee478f992c94a69bfbdfbf5fe661b498a922603c5cd2a", "073e537d85b820a19b211ac9714d432726b83537f85037b3631e358d31c384b8");
        WarpClient.setRecoveryAllowance(5);
        m_warpClient = WarpClient.GetInstance();

        //Registering to connection callbacks
        m_warpClient.AddConnectionRequestListener(m_warpListener);
        //Registering to Chat callbacks
        m_warpClient.AddChatRequestListener(m_warpListener);
        //Registering to Update Request callbacks
        m_warpClient.AddUpdateRequestListener(m_warpListener);
        //Registering to Lobby callbacks
        m_warpClient.AddLobbyRequestListener(m_warpListener);
        //Registering to Notifier callbacks
        m_warpClient.AddNotificationListener(m_warpListener);
        //Registering to Room/Subscribe callbacks
        m_warpClient.AddRoomRequestListener(m_warpListener);
        //Registering to Zone callbacks
        m_warpClient.AddZoneRequestListener(m_warpListener);
        //Registering to Turn Based callbacks
        m_warpClient.AddTurnBasedRoomRequestListener(m_warpListener);
    }