Example #1
0
    // ====================== Métodos não fixos ou que podem deixar de existir ====================== //

    void UserInput()
    {
        ConsoleKeyInfo cki;

        // Prevent example from ending if CTL+C is pressed.
        Console.TreatControlCAsInput = true;

        Console.WriteLine("\nType h to Help.");
        Console.WriteLine("Press the Escape (Esc) key to quit: \n");

        do
        {
            cki = Console.ReadKey();

            string ch = cki.Key.ToString();

            if (ch == "A")
            {
                OnClickEventEnter?.Invoke(this, EventArgs.Empty);
                OnNotifyAchievement?.Invoke(app, new MyEventArs(MyEventArs.AmountOfClicks, app.totalAmountOfClicks));
            }
            else if (ch == "B")
            {
                BuyAHelper();
            }
            else if (ch == "H")
            {
                UiManager.Status();
            }
            else if (ch == "D1")
            {
                UiManager.ShowOptions();
            }
            else if (ch == "D2")
            {
                app.helperManager.DebugerHelpers();
            }
            else if (ch == "D3")
            {
                BuyAUpgrade();
            }
        } while (cki.Key != ConsoleKey.Escape);
    }
Example #2
0
    void OnItemBought(Helper helper)
    {
        if (app.resourceManager.Spend(helper.buyPrice))
        {
            OnNotifyAchievement?.Invoke(app.resourceManager, new MyEventArs(MyEventArs.SpendResource, helper.buyPrice)); // Spend Resource

            if (app.game != null)
            {
                app.game.helpers.Add(helper);
                helper.OnItemBought(); //adds +1 to quantity and recalculate buyPrice

                //UIManager.UpdateCoinsCount(resourceManager.coins, resourceManager.maxCoins); // to display updated info of coins spent
                UpdateCoinsCount();
                //UIManager.UpdateHelpersList(app.helperManager.helpers, app);

                OnNotifyAchievement?.Invoke(app, new MyEventArs(MyEventArs.BuyHelper, app.game.helpers.Count)); // buy Helper
            }
        }
    }