Example #1
0
    public void Clicked()
    {
        InventoryFrame.GetComponent <InventoryDrawer>().GrowPlace = SelectButton;
        InventoryFrame.GetComponent <InventoryDrawer>().SetPurpose(PurposeOfDrawing.AddToLab);
        InventoryFrame.gameObject.SetActive(true);
        if (SceneManager.GetActiveScene().buildIndex != 4 &&
            SecondButton.GetComponent <LabButton>().NowSelected != null)
        {
            InventoryFrame.Redraw(filter_RussianName: SecondButton.GetComponent <LabButton>().NowSelected.NameInRussian);
        }

        var scenario = GameObject.FindGameObjectWithTag("TutorialHandler")?.GetComponent <Scenario>();

        // тутор для выбора семечка 2
        if (QSReader.Create("TutorialState").Exists("Tutorial_HybridPanelSecond_Played"))
        {
            scenario?.Tutorial_ChooseItemToCrossSecond();
        }

        // тутор для выбора семечка 1
        if (QSReader.Create("TutorialState").Exists("Tutorial_HybridPanel_Played"))
        {
            scenario?.Tutorial_ChooseItemToCrossFirst();
        }
    }
    [SerializeField] GameObject[] RewatchButtons; // кнопки просмотра начальных роликов

    public void ClearAll()
    {
        PlayerPrefs.DeleteAll();

        var quickSavePath = Path.Combine(QuickSaveGlobalSettings.StorageLocation, "QuickSave");

        if (Directory.Exists(quickSavePath))
        {
            Directory.Delete(quickSavePath, true);
        }

        ClearPlayerStats();

        PlayerPrefs.Save();

        ClearExhibition();

        if (Inventory != null)
        {
            Inventory.Awake();
        }
        if (InventoryFrame != null)
        {
            InventoryFrame.Redraw();
        }
    }
    /// <summary>
    /// Продаёт семечко.
    /// </summary>
    public void Sell()
    {
        if (!int.TryParse(ItemObject.name, out var index))
        {
            return;
        }

        var seed = targetInventory.Elements[index];

        targetInventory.AddMoney(seed.Price);
        targetInventory.ChangeReputation(seed.Gabitus);
        targetInventory.RemoveItem(index);
        inventoryDrawer.Redraw();

        Statistics.UpdateSoldSeeds(seed.Name);

        parentGameObject.SetActive(false);
    }