Ejemplo n.º 1
0
        public MainPage()
        {
            this.InitializeComponent();

            this.navigationHelper            = new NavigationHelper(this);
            this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
            this.navigationHelper.SaveState += this.NavigationHelper_SaveState;

            this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Required;

            // Set the data context to the friendsData global variable
            AppServices.friendsData._page      = this;
            AppServices.friendsData.myUsername = AppServices.localUsername;
            DataContext          = AppServices.friendsData;
            AppServices.mainPage = this;

            WarpClient.initialize(AppServices.apiKey, AppServices.secretKey);
            WarpClient.setRecoveryAllowance(AppServices.appWarpRecoveryTime);
            AppServices.warpClient = WarpClient.GetInstance();

            AppServices.warpClient.AddConnectionRequestListener(AppServices.connListenObj);
            AppServices.warpClient.AddNotificationListener(AppServices.notificationListnerObj);
            AppServices.warpClient.AddUpdateRequestListener(AppServices.updateListenerObj);

            // Connect to Appwarp and update our online friends in the callback
            AppServices.appWarpConnectMode = appWarpConnectModes.sendAllUpdates;
            WarpClient.GetInstance().Connect(AppServices.localUsername);
        }
Ejemplo n.º 2
0
    void Start()
    {
        //bind all events

        //to connect with usa server
        //WarpClient.initialize(apiKey_us,secretKey_us);

        //to connect with Japan server
        //WarpClient.initialize(apiKey,secretKey);

        //to connect to appwarps2 server on my pc
        WarpClient.initialize(apiKey_s2, address, port);
        //WarpClient.initialize (apiKey, secretKey);

        WarpClient.setRecoveryAllowance(0);          //max recovery time set
        WarpClient.GetInstance().AddConnectionRequestListener(listen);
        WarpClient.GetInstance().AddChatRequestListener(listen);
        WarpClient.GetInstance().AddLobbyRequestListener(listen);
        WarpClient.GetInstance().AddNotificationListener(listen);
        WarpClient.GetInstance().AddRoomRequestListener(listen);
        WarpClient.GetInstance().AddUpdateRequestListener(listen);
        WarpClient.GetInstance().AddZoneRequestListener(listen);

        //connect
        UserName = UserName + UnityEngine.Random.Range(1, 1000).ToString();
        WarpClient.GetInstance().Connect(UserName, "");
    }
Ejemplo n.º 3
0
//	private string authData = "";

    void Awake()
    {
        Debug.Log("GameController");
        try {
            WarpClient.initialize(Constants.APP_KEY, Constants.HOST_NAME, Constants.PORT_NO);
            WarpClient.setRecoveryAllowance(Constants.RECCOVERY_ALLOWANCE_TIME);
            theClient = WarpClient.GetInstance();
        } catch (UnityException ex) {
            Utils.showToastAlert(Constants.ALERT_INIT_EXEC + " " + ex.Message);
        }
    }
Ejemplo n.º 4
0
        public JoinPage()
        {
            InitializeComponent();

            // Initialize the SDK with your applications credentials that you received
            // after creating the app from http://apphq.shephertz.com
            WarpClient.initialize(GlobalContext.API_KEY, GlobalContext.SECRET_KEY);
            WarpClient.setRecoveryAllowance(60);
            // Keep a reference of the SDK singleton handy for later use.
            GlobalContext.warpClient = WarpClient.GetInstance();
        }
Ejemplo n.º 5
0
        public void ConnectToGameServer()
        {
            WarpClient.initialize(Secret.GameServerAPIKey, Secret.GameServerAPIPassword);
            WarpClient.setRecoveryAllowance(60);
            MyGame = WarpClient.GetInstance();

            GameConListener         = new ConnectionListener(this);
            GameZoneRequestListener = new ZoneRequestListener(this);
            MyGame.AddConnectionRequestListener(GameConListener);
            MyGame.AddZoneRequestListener(GameZoneRequestListener);

            MyGame.Connect(QuizmasterName);
            MyGame.SetGeo("EU");
        }
Ejemplo n.º 6
0
 public MainPage()
 {
     UIDispatcher.Initialize();
     this.InitializeComponent();
     //MasterClient.initialize("192.168.1.78", 12349);
     //WarpClient.initialize("0a338a1f-4521-4acf-9", "192.168.1.17");
     WarpClient.initialize(CloudApiKey, SecretApiKey);
     WarpClient.GetInstance().AddConnectionRequestListener(new ConnectionListen(tblResponse));
     WarpClient.GetInstance().AddNotificationListener(new NotificationListener(tblNotification));
     WarpClient.GetInstance().AddZoneRequestListener(new ZoneListener(tblResponse));
     WarpClient.GetInstance().AddRoomRequestListener(new RoomListener(tblResponse));
     WarpClient.GetInstance().AddUpdateRequestListener(new UpdateListener(tblResponse));
     WarpClient.GetInstance().AddLobbyRequestListener(new LobbyListener(tblResponse));
     WarpClient.GetInstance().AddTurnBasedRoomRequestListener(new TurnRoomListener(tblResponse));
     WarpClient.setRecoveryAllowance(60);
     //MasterClient.GetInstance().AddMasterRequestListener(new MasterListener(tblMessage));
 }
Ejemplo n.º 7
0
        public void Connection()
        {
            string player_name = GameUser.CurrentUser.ID;

            // Debug.Log ("player_name " + player_name);
            WarpClient.initialize(appKey, ipAddress, port);
            WarpClient.setRecoveryAllowance(120);
            listen = GetComponent <Roulette_ListnerClass> ();
            WarpClient.GetInstance().AddConnectionRequestListener(listen);
            WarpClient.GetInstance().AddChatRequestListener(listen);
            WarpClient.GetInstance().AddLobbyRequestListener(listen);
            WarpClient.GetInstance().AddNotificationListener(listen);
            WarpClient.GetInstance().AddRoomRequestListener(listen);
            WarpClient.GetInstance().AddUpdateRequestListener(listen);
            WarpClient.GetInstance().AddZoneRequestListener(listen);
            WarpClient.GetInstance().Connect(player_name, "");
        }
Ejemplo n.º 8
0
// External methods
    public static void initialize()
    {
        WarpClient.initialize(apiKey, secretKey);
        WarpClient.setRecoveryAllowance(RECOVERY_TIME_SECS);
        WarpClient.GetInstance().AddConnectionRequestListener(listen);
        WarpClient.GetInstance().AddChatRequestListener(listen);
        WarpClient.GetInstance().AddNotificationListener(listen);
        WarpClient.GetInstance().AddRoomRequestListener(listen);
        WarpClient.GetInstance().AddZoneRequestListener(listen);
        MonoBehaviour.DontDestroyOnLoad(WarpClient.GetInstance());
        evenNumberedMoveSent     = true;
        evenNumberedMoveReceived = true;

        sessionName = System.DateTime.Now.Ticks.ToString();
        // Returns connection result in connectionStatusEvent
        WarpClient.GetInstance().Connect(sessionName);
    }
    void Start()
    {
        WarpClient.initialize(apiKey, secretKey /*, "54.246.103.117"*/);
        listen = GetComponent <Listener>();
        WarpClient.GetInstance().AddConnectionRequestListener(listen);
        WarpClient.GetInstance().AddChatRequestListener(listen);
        WarpClient.GetInstance().AddLobbyRequestListener(listen);
        WarpClient.GetInstance().AddNotificationListener(listen);
        WarpClient.GetInstance().AddRoomRequestListener(listen);
        WarpClient.GetInstance().AddUpdateRequestListener(listen);
        WarpClient.GetInstance().AddZoneRequestListener(listen);

        WarpClient.setRecoveryAllowance(60);
        // join with a unique name (current time stamp)
        username = System.DateTime.UtcNow.Ticks.ToString();

        //EditorApplication.playmodeStateChanged += OnEditorStateChanged;
    }
Ejemplo n.º 10
0
        public void Connection()
        {
            // Debug.Log ("working "+UserController.getInstance.ID);
            string player_name = UserController.getInstance.ID;

            WarpClient.initialize(appKey, ipAddress, port);
            WarpClient.setRecoveryAllowance(120);
            newConnection = true;
            listen        = GetComponent <Listener>();
            WarpClient.GetInstance().AddConnectionRequestListener(listen);
            WarpClient.GetInstance().AddChatRequestListener(listen);
            WarpClient.GetInstance().AddLobbyRequestListener(listen);
            WarpClient.GetInstance().AddNotificationListener(listen);
            WarpClient.GetInstance().AddRoomRequestListener(listen);
            WarpClient.GetInstance().AddUpdateRequestListener(listen);
            WarpClient.GetInstance().AddZoneRequestListener(listen);
            WarpClient.GetInstance().Connect(player_name, "");
        }
Ejemplo n.º 11
0
        public void Connection()
        {
            string player_name = PlayerPrefs.GetString(PlayerDetails.ConnectionId);

            Debug.Log("player_name " + player_name);
            //player_name = "Ram";
            WarpClient.initialize(appKey, ipAddress, port);
            WarpClient.setRecoveryAllowance(100);
            listen = new Roulette_ListnerClass();
            WarpClient.GetInstance().AddConnectionRequestListener(listen);
            WarpClient.GetInstance().AddChatRequestListener(listen);
            WarpClient.GetInstance().AddLobbyRequestListener(listen);
            WarpClient.GetInstance().AddNotificationListener(listen);
            WarpClient.GetInstance().AddRoomRequestListener(listen);
            WarpClient.GetInstance().AddUpdateRequestListener(listen);
            WarpClient.GetInstance().AddZoneRequestListener(listen);
            WarpClient.GetInstance().Connect(player_name, "");
        }
Ejemplo n.º 12
0
        public void Connection()
        {
            loadingGameScreen.SetActive(true);
            appwarp.ServerMessage = "Connecting with server";
            Debug.Log("Player Name " + PlayerPrefs.GetString(GetPlayerDetailsTags.PLAYER_ID));
            string player_name = PlayerPrefs.GetString(GetPlayerDetailsTags.PLAYER_ID);

            WarpClient.initialize(appKey, ipAddress, port);
            WarpClient.setRecoveryAllowance(120);
            //listen = new Listener();
            WarpClient.GetInstance().AddConnectionRequestListener(this);
            WarpClient.GetInstance().AddChatRequestListener(this);
            WarpClient.GetInstance().AddLobbyRequestListener(this);
            WarpClient.GetInstance().AddNotificationListener(this);
            WarpClient.GetInstance().AddRoomRequestListener(this);
            WarpClient.GetInstance().AddUpdateRequestListener(this);
            WarpClient.GetInstance().AddZoneRequestListener(this);
            WarpClient.GetInstance().Connect(player_name, "");
        }
    public void Connection()
    {
        try {
            // Debug.Log ("Check for new connection");

            WarpClient.initialize(appKey, ipAddress, port);
            WarpClient.setRecoveryAllowance(100);
            listen = GetComponent <ListenerTeenPatti> ();
            WarpClient.GetInstance().AddConnectionRequestListener(listen);
            WarpClient.GetInstance().AddChatRequestListener(listen);
            WarpClient.GetInstance().AddLobbyRequestListener(listen);
            WarpClient.GetInstance().AddNotificationListener(listen);
            WarpClient.GetInstance().AddRoomRequestListener(listen);
            WarpClient.GetInstance().AddUpdateRequestListener(listen);
            WarpClient.GetInstance().AddZoneRequestListener(listen);
            WarpClient.GetInstance().Connect(GameUser.CurrentUser.ID, "");
            //WarpClient.GetInstance ().Connect (GameControllerTeenPatti.Player_ID, "");
        } catch (System.Exception ex) {
            // Debug.Log ("Connection Exception " + ex.Message);
        }
    }
Ejemplo n.º 14
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);
    }
Ejemplo n.º 15
0
        private async void Login()
        {
            // Since we are creating a new user no need to authenticate at this time
            AppServices.localUsername          = usernameBox.Text;
            AppServices.localUsernameEncrypted = encryptedUsername;
            AppServices.app42Authenticated     = true;

            if (AppServices.app42Authenticated)
            {
                AppServices.app42Authenticated = false;
            }

            if (AppServices.app42LoggedIn)
            {
                AppServices.app42LoggedIn = false;
                AppServices.sessionService.Invalidate(AppServices.localSessionId, new LogoutSessionCallback());
            }

            // Reset the operation status before starting the next operation
            this.StartAsyncOperations("Creating a session...");

            // Create a session for the local user
            if (AppServices.app42LoggedIn == false)
            {
                AppServices.sessionService.GetSession(AppServices.localUsernameEncrypted, true, new LoginSessionCallback());
            }

            // Wait for creating a session to complete
            await Task.Run(() =>
            {
                while (AppServices.app42LoggedIn == false)
                {
                    ;
                }
            });

            if (AppServices.operationSuccessful == false)
            {
                AppServices.app42LoggedIn = false;
                this.EndAsyncOperationsError();
                return;
            }

            //If we have not initialized the AppWarp API yet, we do that now.
            if (AppServices.appWarpLoggedIn)
            {
                AppServices.appWarpLoggedIn = false;
                AppServices.warpClient.Disconnect();
            }
            else
            {
                this.StartAsyncOperations("Logging in...");
                WarpClient.initialize(AppServices.apiKey, AppServices.secretKey);
                WarpClient.setRecoveryAllowance(AppServices.appWarpRecoveryTime);
                AppServices.warpClient = WarpClient.GetInstance();

                AppServices.warpClient.AddConnectionRequestListener(AppServices.connListenObj);
                AppServices.warpClient.AddNotificationListener(AppServices.notificationListnerObj);
                AppServices.warpClient.AddUpdateRequestListener(AppServices.updateListenerObj);
            }
            AppServices.warpClient.Connect(AppServices.localUsername);

            await Task.Run(() =>
            {
                while (AppServices.appWarpLoggedIn == false)
                {
                    ;
                }
            });

            // If the Connect failed, enable input and show an error message
            if (AppServices.operationSuccessful == false)
            {
                AppServices.appWarpLoggedIn = false;
                this.EndAsyncOperationsError();
                return;
            }

            // Since there are no friends or updates to send we just set these to true
            AppServices.app42LoadedFriends = true;
            AppServices.appWarpUpdateSent  = true;

            if (AppServices.app42LoadedRequests)
            {
                AppServices.app42LoadedRequests = false;
                AppServices.friendsData.friendRequests.Clear();
            }
            this.StartAsyncOperations("Loading friend requests...");
            AppServices.friendsData.GetFriendRequestsFromCloud();

            await Task.Run(() =>
            {
                while (AppServices.app42LoadedRequests == false)
                {
                    ;
                }
            });

            if (AppServices.operationSuccessful == false)
            {
                AppServices.app42LoadedRequests = false;
                this.EndAsyncOperationsError();
                return;
            }

            // Enabling this causes a small graphical glitch where the password box gets focus for a split second when transitioning
            //	to the next page so its better to just leave it off
            //this.EndAsyncOperationsSuccess();

            // If we reach this point then both authentication and creating a session were successful so we
            //	go to the next page
            this.Frame.Navigate(typeof(MainPage));
        }
Ejemplo n.º 16
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("On navigated to loading");
            timeout = 0;

            MediaElementData[0] = t1;
            MediaElementData[1] = t2;

            Global.MyAudio[0] = App.GlobalMediaElement0;
            Global.MyAudio[1] = App.GlobalMediaElement1;
            Global.MyAudio[2] = App.GlobalMediaElement2;
            Global.MyAudio[3] = App.GlobalMediaElement3;
            Global.MyAudio[4] = App.GlobalMediaElement4;

            Global.opponentUsername = "";
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ready.Text = Global.localUsername + " \nvs\n";
            });

            _dispatcherTimer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(1)
            };
            _dispatcherTimer.Tick += UpdateMediaData;
            _dispatcherTimer.Start();

            i = 0;
            k = 0;
            B(false);

            requestCallback = this;
            App42API.Initialize(Constants.API_KEY, Constants.SECRET_KEY);
            App42Log.SetDebug(true);

            ServiceAPI api = new ServiceAPI(Constants.API_KEY, Constants.SECRET_KEY);

            storage       = api.BuildStorageService();
            uploadService = api.BuildUploadService();

            System.Diagnostics.Debug.WriteLine("Before warp");

            WarpClient.initialize(Constants.API_KEY, Constants.SECRET_KEY);

            WarpClient.setRecoveryAllowance(60);

            Global.warpClient = WarpClient.GetInstance();


            //trivia
            if ((int)settings["trigger"] == 0)
            {
                TriviaTB.Text = Global.TriviaB[(new Random()).Next(Global.TriviaB.Length)];
            }
            else
            {
                TriviaTB.Text = Global.TriviaH[(new Random()).Next(Global.TriviaH.Length)];
            }

            Global.disconnectSuccess       = false;
            Global.deleteSuccess           = false;
            Global.conListenObj            = new ConnectionListener(this);
            Global.roomReqListenerObj      = new RoomReqListener(this);
            Global.zoneReqListenerObj      = new ZoneRequestListener(this);
            Global.notificationListenerObj = new NotificationListener(this);

            Global.warpClient.AddConnectionRequestListener(Global.conListenObj);
            Global.warpClient.AddRoomRequestListener(Global.roomReqListenerObj);
            Global.warpClient.AddNotificationListener(Global.notificationListenerObj);
            Global.warpClient.AddZoneRequestListener(Global.zoneReqListenerObj);

            Global.warpClient.Connect(Global.localUsername);

            System.Diagnostics.Debug.WriteLine("after warp");
        }
Ejemplo n.º 17
0
    public void InitializeServer(POKER_GAME_TYPE gt)
    {
        string ip = "";

        if (UIManager.Instance.server == SERVER.LIVE)
        {
            ip = liveIPAddress;
        }
        else
        {
            ip = UIManager.Instance.server == SERVER.LOCAL_C ? localIPAddressC : localIPAddressR;
        }

        int port = 12346;

                #if UNITY_WEBGL
        port = 12347;
                #endif
        string appKey = "";
        Debug.Log(ip + " >> Port > " + port + " >> Game Type : " + gt);
        if (gt == POKER_GAME_TYPE.TABLE)
        {
            appKey = UIManager.Instance.server == SERVER.LIVE ? tableGameAppKey : localTableAppKey;
            Debug.Log("Table game selected............." + appKey + " >> ip : " + ip + " >> port : " + port);
            WarpClient.initialize(appKey, ip, port);
        }
        else if (gt == POKER_GAME_TYPE.TEXAS)
        {
            appKey = UIManager.Instance.server == SERVER.LIVE ? texassGameAppKey : localTexassAppKey;
            Debug.Log("Texas game selected............." + appKey + " >> ip : " + ip + " >> port : " + port);
            WarpClient.initialize(appKey, ip, port);
        }
        else
        {
            appKey = UIManager.Instance.server == SERVER.LIVE ? whoopassGameAppKey : localWAAppKey;
            Debug.Log("WHPoker game selected............." + appKey + " >> ip : " + ip + " >> port : " + port);
            WarpClient.initialize(appKey, ip, port);
        }

                #if UNITY_WEBGL
        WarpClient.GetInstance().enableSSL(true);
                #endif
        WarpClient.GetInstance().SetAppKey(appKey);

        WarpClient.setRecoveryAllowance(Constants.RECONNECTING_TIMEOUT);

        WarpClient.GetInstance().RemoveConnectionRequestListener(this);
        WarpClient.GetInstance().RemoveChatRequestListener(this);
        WarpClient.GetInstance().RemoveLobbyRequestListener(this);
        WarpClient.GetInstance().RemoveNotificationListener(this);
        WarpClient.GetInstance().RemoveRoomRequestListener(this);
        WarpClient.GetInstance().RemoveUpdateRequestListener(this);
        WarpClient.GetInstance().RemoveZoneRequestListener(this);
        WarpClient.GetInstance().RemoveTurnBasedRoomRequestListener(this);

        WarpClient.GetInstance().AddConnectionRequestListener(this);
        WarpClient.GetInstance().AddChatRequestListener(this);
        WarpClient.GetInstance().AddLobbyRequestListener(this);
        WarpClient.GetInstance().AddNotificationListener(this);
        WarpClient.GetInstance().AddRoomRequestListener(this);
        WarpClient.GetInstance().AddUpdateRequestListener(this);
        WarpClient.GetInstance().AddZoneRequestListener(this);
        WarpClient.GetInstance().AddTurnBasedRoomRequestListener(this);
    }