public void TimeChecks()
    {
        for (int i = 0; i < Data.Grands.Count; i++)
        {
            Data.Grands[i].CheckTime(System.DateTime.Now);
        }

        if (Data.FundsHourly.Claim(() =>
        {
            if (FundsAlert == null)
            {
                FundsAlert = new RewardCon("INCOMING FUNDS", "", new int [] { 0, Data.Grands.Count * funds_per_hour, 0 });
            }
            else
            {
                FundsAlert.Funds += Data.Grands.Count * funds_per_hour;
            }
        }))
        {
            ;
        }

        if (Data.RepLast != WorldRes.Rep.Level)
        {
            RepAlert = new RewardCon(WorldRes.VillageName + " Rep Up!", "Lvl. " + WorldRes.Rep.Level,
                                     new int [] { 0, WorldRes.Rep.Level * 50, 1 + WorldRes.Rep.Level / 5 });
            Data.RepLast = WorldRes.Rep.Level;
        }

        Data.TimeLast = System.DateTime.Now;
    }
    public IEnumerator ShowAlerts()
    {
        List <FIRL> notices = new List <FIRL>();

        for (int i = 0; i < Rewards.Count; i++)
        {
            notices.Add(UI.RewardAlert(Rewards[i]));
        }

        for (int i = 0; i < Alerts.Count; i++)
        {
            notices.Add(UI.ShowGrandAlert(Alerts[i], i));
        }

        yield return(StartCoroutine(UI.GoThroughAlerts(notices)));

        Alerts.Clear();

        RepAlert   = null;
        FundsAlert = null;
    }
Exemple #3
0
    public FIRL RewardAlert(RewardCon r)
    {
        FIRL alert = Instantiate(Prefabs.GetObject("govletter") as GameObject).GetComponent <FIRL>();

        alert.SetParent(GameManager.Data.WorldObjects);
        alert.Init(-1, GameManager.Data.WorldObjects);

        alert.Text[0].text = r.Title;
        alert.Text[1].text = "";
        alert.Text[2].text = r.Description;

        if (r.Rep > 0)
        {
            alert.AddAction(TouchAction.Destroy, () =>
            {
                StartCoroutine(ResourceAlert(GameManager.WorldRes.Rep, r.Rep));
            });
            alert.Text[1].text += "+" + r.Rep + " REP\n";
        }
        if (r.Funds > 0)
        {
            alert.AddAction(TouchAction.Destroy, () =>
            {
                StartCoroutine(ResourceAlert(GameManager.WorldRes.Funds, r.Funds));
            });
            alert.Text[1].text += "+" + r.Funds + " FUNDS\n";
        }
        if (r.Meds > 0)
        {
            alert.AddAction(TouchAction.Destroy, () =>
            {
                StartCoroutine(ResourceAlert(GameManager.WorldRes.Meds, r.Meds));
            });
            alert.Text[1].text += "+" + r.Meds + " MEDS\n";
        }

        return(alert);
    }