Exemple #1
0
    public void NotEnoughGoldPrompt(Transform t, UnityAction onComplete = null)
    {
        getSoundManager().playError();
        Notification n = GameObject.Instantiate(notificationPrefab, t, false).GetComponent <Notification>();

        if (n == null)
        {
            return;
        }
        n.YesNoPrompt(LanguageSupport.NotEnoughGold(), () =>
        {
            Transform shop = Instantiate(Resources.Load <GameObject>("miscPrefabs/CoinShop"), t, false).transform;
            Button exit    = null;
            if (onComplete != null)
            {
                exit = shop.GetChild(0).Find("exit").GetComponent <Button>();
                exit.onClick.AddListener(onComplete);
            }
            if (exit != null && t != transform)
            {
                GetComponent <Canvas>().enabled = true;
                transform.GetChild(0).gameObject.SetActive(false);
                exit.onClick.AddListener(() => transform.GetChild(0).gameObject.SetActive(true));
            }
        }, onComplete, "Buy Gold");
        n.RewardBackground();
    }