public override void Shutdown() { Debug.Log("cafebazaar: request shutdown."); #if UNITY_ANDROID_CAFE BazaarIAB.unbindService(); #endif }
void Start() { BazaarIAB.init("MIHNMA0GCSqGSIb3DQEBAQUAA4G7ADCBtwKBrwCsKayLopsdltsho45vsaVhWeamm89xS62xwub2QU8DF9AOndmaLr3yP+lP53tdwNc5V4wVEyb6/EIZWMEZdWAYH2oNOhLNkK2MBSaQ0fHWnXnVTnAoJUnzVJxzCVPOpXAtOK5SVZiDMjlx3q16eYZe6y1ams6+mIcTDpCogHBeQlKT3jWzhTIdyGsz+d7MhwYa5rNU/CzRN09L70XNWctFdF0VCXZkCCFhIgszExUCAwEAAQ=="); BTN_close.onClick.AddListener(() => { BazaarIAB.unbindService(); Destroy(gameObject); }); BTN_buy_800.onClick.AddListener(() => { BazaarIAB.purchaseProduct("CH-V-C"); }); BTN_buy_1600.onClick.AddListener(() => { BazaarIAB.purchaseProduct("CH-V-C-1"); }); BTN_buy_38000.onClick.AddListener(() => { BazaarIAB.purchaseProduct("CH-V-C-2"); }); BTN_buy_72000.onClick.AddListener(() => { BazaarIAB.purchaseProduct("72000"); }); BTN_buy_120000.onClick.AddListener(() => { BazaarIAB.purchaseProduct("120000"); }); BTN_buy_205000.onClick.AddListener(() => { BazaarIAB.purchaseProduct("205000"); }); BTN_buy_233000.onClick.AddListener(() => { BazaarIAB.purchaseProduct("23300"); }); BTN_buy_280000.onClick.AddListener(() => { BazaarIAB.purchaseProduct("280000"); }); //event manager bazaar IABEventManager.purchaseFailedEvent += Event_faild; IABEventManager.purchaseSucceededEvent += Even_success; void Event_faild(string faild) { Instantiate(Raw_model_message_notifaction).GetComponent <Raw_model_massage_notifaction>().Change_value("Payment failed", $"{faild}", Raw_model_massage_notifaction.Type.ERRoR, Raw_model_massage_notifaction.Theme.Night); } void Even_success(BazaarPurchase success) { //control product switch (success.ProductId) { case "CH-V-C": { inject_coin_to_server(75); BazaarIAB.consumeProduct("CH-V-C"); Instantiate(Raw_model_message_notifaction).GetComponent <Raw_model_massage_notifaction>().Change_value("Payment Successful", "75 coins have been added to your account\n" + "Thank you for your purchase", Raw_model_massage_notifaction.Type.Success, Raw_model_massage_notifaction.Theme.Night); } break; case "CH-V-C-1": { inject_coin_to_server(150); BazaarIAB.consumeProduct("CH-V-C-1"); Instantiate(Raw_model_message_notifaction).GetComponent <Raw_model_massage_notifaction>().Change_value("Payment Successful", "800 coins have been added to your account\n" + "Thank you for your purchase", Raw_model_massage_notifaction.Type.Success, Raw_model_massage_notifaction.Theme.Night); } break; case "CH-V-C-2": { inject_coin_to_server(350); BazaarIAB.consumeProduct("CH-V-C-2"); Instantiate(Raw_model_message_notifaction).GetComponent <Raw_model_massage_notifaction>().Change_value("Payment Successful", "350 coins have been added to your account\n" + "Thank you for your purchase", Raw_model_massage_notifaction.Type.Success, Raw_model_massage_notifaction.Theme.Night); } break; case "72000": { inject_coin_to_server(1500); BazaarIAB.consumeProduct("72000"); Instantiate(Raw_model_message_notifaction).GetComponent <Raw_model_massage_notifaction>().Change_value("Payment Successful", "1500 coins have been added to your account\n" + "Thank you for your purchase", Raw_model_massage_notifaction.Type.Success, Raw_model_massage_notifaction.Theme.Night); } break; case "120000": { inject_coin_to_server(1550); BazaarIAB.consumeProduct("120000"); Instantiate(Raw_model_message_notifaction).GetComponent <Raw_model_massage_notifaction>().Change_value("Payment Successful", "1550 coins have been added to your account\n" + "Thank you for your purchase", Raw_model_massage_notifaction.Type.Success, Raw_model_massage_notifaction.Theme.Night); } break; case "205000": { inject_coin_to_server(2700); BazaarIAB.consumeProduct("205000"); Instantiate(Raw_model_message_notifaction).GetComponent <Raw_model_massage_notifaction>().Change_value("Payment Successful", "2700 coins have been added to your account\n" + "Thank you for your purchase", Raw_model_massage_notifaction.Type.Success, Raw_model_massage_notifaction.Theme.Night); } break; case "23300": { inject_coin_to_server(6000); BazaarIAB.consumeProduct("23300"); Instantiate(Raw_model_message_notifaction).GetComponent <Raw_model_massage_notifaction>().Change_value("Payment Successful", "6000 coins have been added to your account\n" + "Thank you for your purchase", Raw_model_massage_notifaction.Type.Success, Raw_model_massage_notifaction.Theme.Night); } break; case "280000": { inject_coin_to_server(10000); BazaarIAB.consumeProduct("280000"); Instantiate(Raw_model_message_notifaction).GetComponent <Raw_model_massage_notifaction>().Change_value("Payment Successful", "10000 coins have been added to your account\n" + "Thank you for your purchase", Raw_model_massage_notifaction.Type.Success, Raw_model_massage_notifaction.Theme.Night); } break; } //update coin panel shop Text_coin_panel_shop.text = PlayerPrefs.GetInt("Coin").ToString(); //add history to server Data_buy data_purchase = new Data_buy { developerid = success.DeveloperPayload, Orderid = success.OrderId, orginal_Json = success.OriginalJson, Purchasses_pakage = success.PackageName, Purchasses_productid = success.ProductId, Purchasses_state = success.PurchaseState.ToString(), Purchasses_time = success.PurchaseTime.ToString(), Purchasses_token = success.PurchaseToken, Signuture = success.Signature, Type = success.Type, }; Chilligames_SDK.API_Client.Add_purchasses_history(new Req_add_purchasses_history { _id = _id, data_purchass = ChilligamesJson.SerializeObject(data_purchase), Name_app = "Venomic" }, () => { }, err => { }); } }