예제 #1
0
//	public void onFacebookProfileRetreived(boolean success) {
//		//		Log.d("onFacebookProfileRetreived", ""+success);
//		if(progressDialog!=null){
//			progressDialog.dismiss();
//			progressDialog = null;
//		}
//		if(success){
//			// do success logic
//			Log.d("UserContext.AccessToken", UserContext.AccessToken);
//			Log.d("UserContext.MyUserName", UserContext.MyUserName);
//			try {
//				JSONObject data = new JSONObject();
//				data.put("token", UserContext.AccessToken);
//				loginToAppWarp(UserContext.MyUserName, data.toString());
//			} catch (Exception e) {
//				Utils.showToastAlert("onFacebookProfileRetreived"+ " " + e.toString());
//			}
//		}
//	}

    private void loginToAppWarp(string name, string authData)
    {
        Debug.Log("loginToAppWarp: " + name);
        theClient.Connect(name, authData);
        progressDialog.show("connecting to appwarp...");
        progressDialog.setCancelable(true);
    }
예제 #2
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);
    }
예제 #3
0
    public void ConnectedToServer()
    {
        if (string.IsNullOrEmpty(m_strPlayerName))
        {
            m_strPlayerName = "JohnDoe_";
            Debug.LogError("[WarpNetworkManager] Playername is empty: Settings Default Name: JohnDoe");
        }
        m_strPlayerName = m_strPlayerName + "_";
        m_strPlayerName = string.Concat(m_strPlayerName, System.DateTime.UtcNow.Ticks.ToString());
        Debug.Log("[WarpNetworkManager] Connecting to server: PLAYERNAME: " + m_strPlayerName);


        m_warpClient.Connect(m_strPlayerName);
    }
예제 #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            WarpClient.initialize(Constants.apiKey, Constants.secretKey);
            App42API.Initialize(Constants.apiKey, Constants.secretKey);

            w = WarpClient.GetInstance();
            w.AddConnectionRequestListener(this);

            Button   button = FindViewById <Button>(Resource.Id.myButton);
            EditText et     = FindViewById <EditText>(Resource.Id.editText1);

            button.Click += delegate
            {
                w.Connect(et.Text);
            };
        }