コード例 #1
0
ファイル: CropForm.cpp プロジェクト: CoCoTeam/TizenGameHub
void
CropForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId,
		const Tizen::Base::String& operationId,
		const Tizen::App::AppCtrlResult appControlResult,
		const Tizen::Base::Collection::IMap* pResultList)
{
	if (appId.Equals(L"tizen.filemanager", true) && operationId.Equals(L"http://tizen.org/appcontrol/operation/pick", true))
	{
		AppCtrlResult selectResult = appControlResult;
		if (selectResult == APP_CTRL_RESULT_SUCCEEDED)
		{
			//Get the file name
			result r ;
			String filename;
			String* pFilePath ;
			pFilePath = (String*)(Tizen::Base::String*)pResultList->GetValue(String(L"path"));
			LoadImage(pFilePath);
		}
		else
		{
			result r;
			Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
			Form *pForm = (Form*)pFrame->GetControl(MAIN_FORM_NAME, false);
			if(pForm)
			{
				r = pFrame->SetCurrentForm(*pForm);
				pForm->Draw();
				pForm->Show();
				pFrame->RemoveControl(*this);
			}
		}
	}
}
コード例 #2
0
ファイル: Chatting.cpp プロジェクト: JunminLee/Winwin
void Chatting::OnPushServiceRegistered(RequestId reqId,
		const Tizen::Base::String& registrationId, result r,
		const Tizen::Base::String& errorCode,
		const Tizen::Base::String& errorMsg) {
	if (r == E_SUCCESS) {
		// The registrationId may change in some cases.
		// If the registrationId changes, the application should send the registrationId to the application server.
		AppLog("####### Push registration is successful. #######");

		AppLog(
				"####### registrationId = %S #######", registrationId.GetPointer());

		if (registrationId.Equals(regIdList[0])) {

			resultRegId =
					"04a1a6b9f06851233d3392efe419021613dbcec57ba833da007a5fe87ba59d5963eb0f943802ab188b06014c3fc034fcb70e";
		} else {

			resultRegId =
					"04a173e35ebec95baab94ae8d77a84a76903911ea65dcf67cf2570b9649bef4c8e3f0710ae2f5f2b6969c6b8b119de9c78f7";
		}
	} else {
		AppLog(
				"####### Push registration is failed with result[%s]. #######", GetErrorMessage(r));
	}
}
コード例 #3
0
void GHPlayerListItemEventListener::OnListViewItemStateChanged
(Tizen::Ui::Controls::ListView &listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
{
	if (status == Tizen::Ui::Controls::LIST_ITEM_STATUS_SELECTED) {
		if(index < list.GetCount())
		{
			Tizen::Base::String playerId = ((GHPlayer*)(list.GetAt(index)))->getId();

			Tizen::Base::Collection::ArrayList* pList = new (std::nothrow)Tizen::Base::Collection::ArrayList;
			AppAssert(pList);
			pList->Construct();
			pList->Add( playerId );	// playerId

			// Scene 이동
			SceneManager* pSceneManager = SceneManager::GetInstance();
			SceneId sceneId = (playerId.Equals(GHSharedAuthData::getSharedInstance().getPlayerId()) ? SCENE_PLAYER : SCENE_PLAYERFRIEND);
			pSceneManager->GoForward(ForwardSceneTransition(sceneId, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
		}
	}
}
コード例 #4
0
void GHPlayerController::OnTransactionReadyToRead(Tizen::Base::String apiCode, Tizen::Base::String statusCode, Tizen::Web::Json::IJsonValue* data)
{
	AppLogDebug("[DEBUG] apiCode : %S", apiCode.GetPointer() );
	AppLogDebug("[DEBUG] statusCode : %S", statusCode.GetPointer());

	if(pProgressPopup->IsVisible()) {
		pProgressPopup->SetShowState(false);
	}
	if(apiCode.Equals(PLAYER_LOGIN)) {
		// 정상적으로 결과를 반환했을 때
		if(statusCode != "0") {

			// Save AppRegistry Data(Email, Password)----------
			appReg.put(appReg.email, playerEmail);
			appReg.put(appReg.pwd, playerPwd);
			//------------------------------------------------

			GHSharedAuthData & sharedInstance = GHSharedAuthData::getSharedInstance();
			sharedInstance.setPlayerId(statusCode);

			if(this->currentListener != null) this->currentListener->loginPlayerFinished(statusCode);
		}
		else { // 에러가 발생했을 때
		}


	}
	else if(apiCode.Equals(PLAYER_PLAYERDATA)) {	// PLAYER_PLAYERDATA
			GHPlayer *player;

			// 정상적으로 결과를 반환했을 때
			if(statusCode == "1") {

				JsonObject *pJsonOject 	= static_cast<JsonObject*>(data);

				AppLogDebug("---------------------------2-----------------------");

				String* pkeyId		= new String(L"player_id");
				String* pkeyEmail 	= new String(L"email");
				String* pkeyName 	= new String(L"name");
				String* pkeyImgUrl 	= new String(L"img_url");
				String* pkeyIsFriend= new String(L"is_friend");

				String  sId 		= getStringByKey(pJsonOject, pkeyId);
				String  sEmail 		= getStringByKey(pJsonOject, pkeyEmail);
				String  sName		= getStringByKey(pJsonOject, pkeyName);
				String  sImgUrl 	= getStringByKey(pJsonOject, pkeyImgUrl);
				bool  	bIsFriend 	= getBoolByKey(pJsonOject, pkeyIsFriend);

				AppLogDebug("--------------------------------------------------");

				player = new GHPlayer(sId, sEmail, sName, sImgUrl);
				player->setIsFriend(bIsFriend);

				// KEY NAME DELETE
				delete pkeyId;		delete pkeyEmail;
				delete pkeyName;	delete pkeyImgUrl;
				delete pkeyIsFriend;

			}
			else { // 에러가 발생했을 때
				player = null;
			}

			if(this->currentListener != null) this->currentListener->loadPlayerDataFinished(player);
	}
	else if(apiCode.Equals(PLAYER_GAMELIST))
	{
		ArrayList *gameList;

		// 정상적으로 결과를 반환했을 때
		if(statusCode == "1") {
			JsonArray* 	pJsonArray 	= static_cast<JsonArray*>(data);
			int 		arrNum 		= pJsonArray->GetCount();
			gameList = new ArrayList();

			// KEY NAME
			String* pKeyGameId 		= new String(L"game_id");
			String* pKeyGameTitle	= new String(L"title");
			String* pkeyGameImgUrl	= new String(L"img_url");
			String* pKeyGameDesc	= new String(L"description");

			AppLogDebug("[DEBUG] arrNum : %d", arrNum );

			for(int i=0; i<arrNum; i++) {
				JsonObject *pJsonOject 	= getJsonObjectByIndex(pJsonArray, i);

				// 데이터 파싱
				String  sGameId			= getStringByKey(pJsonOject, pKeyGameId);
				String  sGameTitle		= getStringByKey(pJsonOject, pKeyGameTitle);
				String  sGameImgUrl 	= getStringByKey(pJsonOject, pkeyGameImgUrl);
				String  sGameDesc	 	= getStringByKey(pJsonOject, pKeyGameDesc);

				// 리스트에 추가
				gameList->Add( new GHGame(sGameId, "", sGameTitle, sGameDesc, sGameImgUrl, 0, 0, 0, false, false) );
			}

			// KEY NAME DELETE
			delete pKeyGameId;		delete pKeyGameTitle;	 delete pkeyGameImgUrl;
		}
		else { // 에러가 발생했을 때
			gameList = null;
		}

		if(this->currentListener != null) this->currentListener->loadPlayerGamesFinished(gameList);


	}
	else if(apiCode.Equals(PLAYER_SEARCHFRIEND))
	{
		ArrayList *friendList;

		if(statusCode == "1") {
			JsonObject *pJsonOject 	= static_cast<JsonObject*>(data);
			friendList = new ArrayList();

			// KEY NAME
			String* pKeyPlayerId	= new String(L"player_id");
			String* pKeyPlayerEmail	= new String(L"email");
			String* pkeyPlayerName	= new String(L"name");
			String* pkeyPlayerImgUrl= new String(L"img_url");

			// 데이터 파싱
			String  sPlayerId		= getStringByKey(pJsonOject, pKeyPlayerId);
			String  sPlayerEmail	= getStringByKey(pJsonOject, pKeyPlayerEmail);
			String  sPlayerName		= getStringByKey(pJsonOject, pkeyPlayerName);
			String  sPlayerImgUrl 	= getStringByKey(pJsonOject, pkeyPlayerImgUrl);

			// 리스트에 추가
			friendList->Add( new GHPlayer(sPlayerId, sPlayerEmail, sPlayerName, sPlayerImgUrl) );

			// KEY NAME DELETE
			delete pKeyPlayerId;		delete pKeyPlayerEmail;
			delete pkeyPlayerName;		delete pkeyPlayerImgUrl;
		}
		else { // 에러가 발생했을 때
			friendList = null;
		}

		if(this->currentListener != null) this->currentListener->searchFriendFinished(friendList);
	}
	else if(apiCode.Equals(PLAYER_ADDFRIEND))
	{
		if(this->currentListener != null) this->currentListener->addFriendFinished(statusCode);
	}
	else if(apiCode.Equals(PLAYER_LOADFRIENDS))	// 친구 목록 불러오기
	{
		ArrayList *friendList;

		if(statusCode == "1") {
				JsonArray* 	pJsonArray 	= static_cast<JsonArray*>(data);
				int 		arrNum 		= pJsonArray->GetCount();
			friendList = new ArrayList();

			// KEY NAME
				String* pKeyPlayer		= new String(L"player_id");
				String* pKeyPlayerName	= new String(L"name");
				String* pkeyPlayerImgUrl= new String(L"img_url");

				AppLogDebug("[DEBUG] arrNum : %d", arrNum );

				for(int i=0; i<arrNum; i++) {
					JsonObject *pJsonOject 	= getJsonObjectByIndex(pJsonArray, i);

					// 데이터 파싱
					String  sPlayerId		= getStringByKey(pJsonOject, pKeyPlayer);
					String  sPlayerName		= getStringByKey(pJsonOject, pKeyPlayerName);
					String  sPlayerImgUrl 	= getStringByKey(pJsonOject, pkeyPlayerImgUrl);

					// 리스트에 추가
					friendList->Add( new GHPlayer(sPlayerId, sPlayerName, sPlayerImgUrl) );
				}

				// KEY NAME DELETE
				delete pKeyPlayer;		delete pKeyPlayerName;	 delete pkeyPlayerImgUrl;
		}
		else { // 에러가 발생했을 때
			friendList = null;
		}

		if(this->currentListener != null) this->currentListener->loadPlayerFriendsFinished(friendList);

	}
	else //PLAYER_LOGIN ,PLAYER_GAMEJOIN
	{
//		if(this->currentListener != null) this->currentListener->doPlayerFinished(statusCode);
	}
}