public void onDeleteRoomDone(com.shephertz.app42.gaming.multiplayer.client.events.RoomEvent roomEventObj)
 {
     if (roomEventObj.getData() != null)
     {
         Debug.WriteLine("onDeleteRoom " + roomEventObj.getData().getId() + " " + roomEventObj.getResult());
     }
 }
 public void onGetLiveUserInfoDone(com.shephertz.app42.gaming.multiplayer.client.events.LiveUserInfoEvent eventObj)
 {
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         // Join the room where the friend is playing
         GlobalContext.GameRoomId = eventObj.getLocationId();
         WarpClient.GetInstance().JoinRoom(GlobalContext.GameRoomId);
     }
 }
 public void onGetLiveUserInfoDone(com.shephertz.app42.gaming.multiplayer.client.events.LiveUserInfoEvent eventObj)
 {
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         // Join the room where the friend is playing
         GlobalContext.GameRoomId = eventObj.getLocationId();
         WarpClient.GetInstance().JoinRoom(GlobalContext.GameRoomId);
     }
     else
     {
         // remote user is either off line or has not joined any room yet. Create one and wait for him.
         GlobalContext.tableProperties["IsPrivateRoom"]="true";
         WarpClient.GetInstance().CreateTurnRoom("TurnBasedRoom", GlobalContext.localUsername, 2, GlobalContext.tableProperties,GlobalContext.turnTime);
     }
 }
Exemplo n.º 4
0
		// This will be called after the user presses Login on the LoginPage and a session has been established using the App42 cloud API's
		//	this then connects and creates a session with the AppWarp API's which will be used for initial chat establishment and update
		//	messages for things like online status and message types.
		public void onConnectDone(com.shephertz.app42.gaming.multiplayer.client.events.ConnectEvent eventObj)
		{
			byte result = eventObj.getResult();
			string errorMsg = string.Empty;

			// If the connection was successful check which mode the call was made in and do the desired operation
			if (result == WarpResponseResultCode.SUCCESS)
			{
				AppServices.operationSuccessful = true;

				if (AppServices.appWarpConnectMode == appWarpConnectModes.sendAllUpdates)
				{
					foreach (FriendsListEntry friend in AppServices.friendsData.friendsList)
					{
						if (friend.isOnline)
						{
							AppServices.appWarpLastSentToUsername = friend.username;
							if (friend.sessionEstablished)
								AppServices.warpClient.sendPrivateUpdate(friend.username, MessageBuilder.buildOnlineStatusUpdateBytes(true, friend.encryptionKey));
							else
								AppServices.warpClient.sendPrivateUpdate(friend.username, MessageBuilder.buildOnlineStatusUpdateBytes(true, AppServices.defaultEncryptionKey));
						}
					}
				}
				AppServices.appWarpConnectMode = appWarpConnectModes.justConnect;
				AppServices.appWarpLoggedIn = true;
				return;
			}
			else if (result == WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE)
			{
				AppServices.warpClient.RecoverConnection();
				return;
			}
			else if (result == WarpResponseResultCode.SUCCESS_RECOVERED)
			{
				return;
			}
			else if (result == WarpResponseResultCode.AUTH_ERROR)
			{
				errorMsg = "Connect Authentication Error: Attempting to connect without initializing the API keys.";
			}
			else if (result == WarpResponseResultCode.BAD_REQUEST)
			{
				errorMsg = "Bad Request: The entered username does not exist.";
			}
			else if (result == WarpResponseResultCode.CONNECTION_ERR)
			{
				errorMsg = "Network Connection Error: Please check your network connection and try again.";
			}
			else
			{
				errorMsg = "Unknown Error: Please check your network connection and the entered username and try again.";
			}

			AppServices.operationSuccessful = false;
			AppServices.errorMessage = errorMsg;
			AppServices.appWarpLoggedIn = true;
		}
Exemplo n.º 5
0
 public void onCreateRoomDone(com.shephertz.app42.gaming.multiplayer.client.events.RoomEvent eventObj)
 {
     UIDispatcher.Execute(delegate() { tblmessage.Text = "Create Room Result :" + eventObj.getResult(); });
 }
 public void onCreateRoomDone(com.shephertz.app42.gaming.multiplayer.client.events.RoomEvent eventObj)
 {
     status = "onCreateRoomDone "+eventObj.getResult();
     WarpClient.GetInstance().JoinRoom(eventObj.getData ().getId ());
     Context.isRoomCreator = true;
 }