Rewarded ads, question popups and few fixes
This commit is contained in:
@@ -14,6 +14,7 @@ public class ChestButton : MonoBehaviour
|
||||
public float minLuck = 0;
|
||||
public float maxLuck = 100;
|
||||
public Button btnInfo;
|
||||
public Button adButton;
|
||||
[TextArea]
|
||||
public string infoTxt;
|
||||
|
||||
@@ -21,17 +22,26 @@ public class ChestButton : MonoBehaviour
|
||||
{
|
||||
btnInfo.onClick.AddListener(OnClickedInfo);
|
||||
|
||||
if(!IsSpecial)GetComponent<Button>().onClick.AddListener(OnClick);
|
||||
if(!IsSpecial){GetComponent<Button>().onClick.AddListener(OnClick);adButton.onClick.AddListener(OnAdClicked);}
|
||||
}
|
||||
|
||||
void OnClickedInfo()
|
||||
{
|
||||
MessageDialog.instance.ShowDialog(ChestName, $"This chest will drop following items.\n\n{getItemsProbability()}");
|
||||
MessageDialog.instance.ShowMessage(ChestName, $"This chest will drop following items.\n\n{getItemsProbability()}");
|
||||
}
|
||||
|
||||
void OnClick(){
|
||||
MessageDialog.instance.ShowQuestion("Are you sure?", $"Are you sure to purchase {ChestName} for {Price} Gems?", Buy,null);
|
||||
}
|
||||
|
||||
void OnAdClicked(){
|
||||
Debug.Log("Showing ad");
|
||||
AdsManager.instance.ShowRewarded(Buy);
|
||||
}
|
||||
|
||||
void Buy(){
|
||||
if(DBmanager.Gems < Price){
|
||||
MessageDialog.instance.ShowDialog("Failed","Insufficient Gems to complete the Purchase!");
|
||||
MessageDialog.instance.ShowMessage("Failed","Insufficient Gems to complete the Purchase!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class GoldPackButton : MonoBehaviour
|
||||
public int Price;
|
||||
void Start()
|
||||
{
|
||||
GetComponent<Button>().onClick.AddListener(()=>{GameManager.instance.BuyGold(this);});
|
||||
GetComponent<Button>().onClick.AddListener(OnClicked);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -22,6 +22,14 @@ public class GoldPackButton : MonoBehaviour
|
||||
|
||||
}
|
||||
|
||||
void OnClicked(){
|
||||
MessageDialog.instance.ShowQuestion("Are you sure?", $"Are you sure to purchase {Amount} Gold for {Price} Gems?", Buy,null);
|
||||
}
|
||||
|
||||
void Buy(){
|
||||
GameManager.instance.BuyGold(this);
|
||||
}
|
||||
|
||||
void OnValidate() {
|
||||
if(!autoReadFromText){return;}
|
||||
if(txtAmount!=null){
|
||||
|
||||
@@ -62,8 +62,15 @@ public class SpecialChest : MonoBehaviour
|
||||
|
||||
void OnClicked(){
|
||||
// gameObject.SetActive(false);
|
||||
//AdsManager.instance.ShowRewarded(Buy);
|
||||
// Buy();
|
||||
MessageDialog.instance.ShowQuestion("Are you sure?", $"Are you sure to purchase This special offer for {chestButton.Price} Gems?", Buy,null);
|
||||
|
||||
}
|
||||
|
||||
void Buy(){
|
||||
if(DBmanager.Gems < chestButton.Price){
|
||||
MessageDialog.instance.ShowDialog("Failed","Insufficient Gems to complete the Purchase!");
|
||||
MessageDialog.instance.ShowMessage("Failed","Insufficient Gems to complete the Purchase!");
|
||||
return;
|
||||
}
|
||||
DBmanager.SetGems(DBmanager.Gems - chestButton.Price);
|
||||
|
||||
Reference in New Issue
Block a user