// ------------------------------------------- /* * OnUIEvent */ private void OnUIEvent(string _nameEvent, params object[] _list) { if (_nameEvent == EVENT_IAP_CONFIRMATION) { bool success = (bool)_list[0]; string iapID = (string)_list[1]; if (MenusScreenController.Instance.DebugIAPs) { Debug.Log("EVENT_IAP_CONFIRMATION::success[" + success + "]::iapID[" + iapID + "]"); } if ((iapID.IndexOf(IAP_ENERGY_PACK_1) != -1) || (iapID.IndexOf(IAP_ENERGY_PACK_2) != -1) || (iapID.IndexOf(IAP_ENERGY_PACK_3) != -1) || (iapID.IndexOf(IAP_ENERGY_PACK_4) != -1)) { if (success) { int rentValue = int.Parse(iapID.Substring(iapID.Length - 1, 1)); UIEventController.Instance.DispatchUIEvent(UsersController.EVENT_USER_IAP_CALL_PURCHASE_RENT_PROVIDER, success, rentValue, m_currentCodeTransaction); } else { UIEventController.Instance.DispatchUIEvent(UsersController.EVENT_USER_IAP_CALL_PURCHASE_RENT_PROVIDER, success); } } else { if (iapID.IndexOf(IAP_POST_OFFER_NO_WAIT) != -1) { UIEventController.Instance.DispatchUIEvent(UsersController.EVENT_USER_IAP_CALL_PURCHASE_POST_OFFER, success, m_currentCodeTransaction); } else { if (iapID.IndexOf(IAP_CREATE_NEW_REQUEST) != -1) { UIEventController.Instance.DispatchUIEvent(UsersController.EVENT_USER_IAP_CALL_PURCHASE_NEW_REQUEST, success, m_currentCodeTransaction); } else { if (!success) { UIEventController.Instance.DispatchUIEvent(ScreenController.EVENT_FORCE_DESTRUCTION_POPUP); string title = LanguageController.Instance.GetText("message.error"); string description = LanguageController.Instance.GetText("message.iap.failure.any.operation"); MenusScreenController.Instance.CreateNewInformationScreen(ScreenInformationView.SCREEN_INFORMATION, UIScreenTypePreviousAction.KEEP_CURRENT_SCREEN, title, description, null, ""); } } } } } if (_nameEvent == EVENT_IAP_CALL_PURCHASE_RENT_PROVIDER) { m_currentEventIAP = EVENT_IAP_CALL_PURCHASE_RENT_PROVIDER; m_currentIdProduct = (string)_list[0]; m_currentCodeTransaction = Utilities.RandomCodeGeneration(UsersController.Instance.CurrentUser.Id.ToString()); string codeGeneratedInitial = RJEncryptor.EncryptStringWithKey(m_currentCodeTransaction, MenusScreenController.KYRJEncryption); CommsHTTPConstants.IAPRegisterCode(UsersController.Instance.CurrentUser.Id, UsersController.Instance.CurrentUser.Password, codeGeneratedInitial); } if (_nameEvent == EVENT_IAP_CALL_PURCHASE_POST_OFFER_NO_WAIT) { m_currentEventIAP = EVENT_IAP_CALL_PURCHASE_POST_OFFER_NO_WAIT; m_currentCodeTransaction = Utilities.RandomCodeGeneration(UsersController.Instance.CurrentUser.Id.ToString()); CommsHTTPConstants.IAPRegisterCode(UsersController.Instance.CurrentUser.Id, UsersController.Instance.CurrentUser.Password, RJEncryptor.EncryptStringWithKey(m_currentCodeTransaction, MenusScreenController.KYRJEncryption)); } if (_nameEvent == EVENT_IAP_CALL_PURCHASE_CREATE_NEW_REQUEST) { m_currentEventIAP = EVENT_IAP_CALL_PURCHASE_CREATE_NEW_REQUEST; m_currentCodeTransaction = Utilities.RandomCodeGeneration(UsersController.Instance.CurrentUser.Id.ToString()); CommsHTTPConstants.IAPRegisterCode(UsersController.Instance.CurrentUser.Id, UsersController.Instance.CurrentUser.Password, RJEncryptor.EncryptStringWithKey(m_currentCodeTransaction, MenusScreenController.KYRJEncryption)); } if (_nameEvent == EVENT_IAP_CODE_CONFIRMATION) { if ((bool)_list[0]) { string codeDecrypted = RJEncryptor.DecryptStringWithKey((string)_list[1], MenusScreenController.KYRJEncryption); if (codeDecrypted == m_currentCodeTransaction) { m_currentCodeTransaction = (string)_list[1]; if (m_currentEventIAP == EVENT_IAP_CALL_PURCHASE_RENT_PROVIDER) { if (m_currentIdProduct.Length > 0) { BuyProductID(m_currentIdProduct); } } if (m_currentEventIAP == EVENT_IAP_CALL_PURCHASE_POST_OFFER_NO_WAIT) { BuyProductID(IAP_POST_OFFER_NO_WAIT); } if (m_currentEventIAP == EVENT_IAP_CALL_PURCHASE_CREATE_NEW_REQUEST) { BuyProductID(IAP_CREATE_NEW_REQUEST); } m_currentEventIAP = ""; m_currentIdProduct = ""; } } } }