コード例 #1
0
    /// <summary>
    /// Показывает информацию о росте.
    /// </summary>
    private void ShowInfoContainer()
    {
        if (infoBlocker == null)
        {
            SpawnBlocker();
        }

        if (startCointainerPlace == null)
        {
            startCointainerPlace = transform;
        }

        infoContainer.transform.SetParent(transform.parent.parent, true);
        infoContainer.transform.SetAsLastSibling();
        infoContainer.SetActive(true);

        infoContainerOpenedTimes = 1;
        infoBlocker.SetActive(true);

        if (optionsMenu == null)
        {
            var canvas = GameObject.FindGameObjectWithTag("Canvas");
            optionsMenu = Instantiate(optionsMenuPrefab, canvas.transform, false);
        }

        optionsMenu.СancelAction  = () => CancelPlant();
        optionsMenu.SpeedUpAction = () => SpeedUpSeed();
    }
コード例 #2
0
    void Start()
    {
        Instance = this;

        m_qualityLevel = QualitySettings.GetQualityLevel();
        m_fullscreen   = Screen.fullScreen;
        m_framerateSlider.m_unlimited = -1;
        m_qualityDropdown.value       = m_qualityLevel;

        PopulateResolutions();
    }
コード例 #3
0
    void Start()
    {
        Instance = this;

        m_extruders    = new List <Extruder>();
        m_lights       = new List <GameLight>();
        m_qualityLevel = QualitySettings.GetQualityLevel();
        m_fullscreen   = Screen.fullScreen;
        m_framerateSlider.m_unlimited = -1;
        m_qualityDropdown.value       = m_qualityLevel;

        PopulateResolutions(false);
        CheckForResolutionIssues();
        m_resolutionDropdown.RefreshShownValue();

        PopulateLanguages();
        m_languageDropdown.RefreshShownValue();
    }
コード例 #4
0
    /// <summary>
    /// Organizes plants on patch.
    /// </summary>
    private void Start()
    {
        _inventory ??= GameObject.Find("DataKeeper").GetComponent <Inventory>();

        if (PlayerPrefs.GetInt(Patch.name + "occupied") == 1)
        {
            isOccupied  = true;
            timerNeeded = true;
        }
        else
        {
            isOccupied           = false;
            timerBGImage.enabled = false;
            return;
        }

        growingSeed = ScriptableObject.CreateInstance <Seed>();
        growingSeed.SetValues(PlayerPrefs.GetString(Patch.name + "grows"));
        SetSeedSpeed(growingSeed);

        var oldDate    = DateTime.Parse(PlayerPrefs.GetString(Patch.name + "timeStart"));
        var timePassed = (DateTime.Now.Ticks - oldDate.Ticks) / 10000000;

        time = PlayerPrefs.GetInt(Patch.name + "time") - timePassed * _timeSpeedBooster;

        var seedsCount = PlayerPrefs.GetInt(Patch.name + "seedsCount");

        for (var i = 0; i < seedsCount; i++)
        {
            var seed = ScriptableObject.CreateInstance <Seed>();
            seed.SetValues(PlayerPrefs.GetString(Patch.name + "grown" + i));
            grownSeeds.Add(seed);
        }

        lastPatchGrowth = null;
        infoBlocker     = null;
        optionsMenu     = null;

        if (time <= 0)
        {
            EndGrowthCycle();
        }
    }
コード例 #5
0
    /// <summary>
    /// Скрывает информацию о росте.
    /// </summary>
    private void HideInfoContainer()
    {
        if (startCointainerPlace != null)
        {
            infoContainer.transform.SetParent(startCointainerPlace, true);
        }

        infoContainer.SetActive(false);

        if (lastPatchGrowth != this)
        {
            return;
        }

        Destroy(infoBlocker);
        infoBlocker = null;

        Destroy(optionsMenu?.gameObject);
        optionsMenu = null;
    }
コード例 #6
0
    /// <summary>
    /// Закрывает активную информацию о росте.
    /// </summary>
    public void CloseActiveInfoContainer(bool resetOpenedTimes = true)
    {
        HideInfoContainer();

        Destroy(infoBlocker);
        infoBlocker = null;

        Destroy(optionsMenu?.gameObject);
        optionsMenu = null;

        if (lastPatchGrowth == null)
        {
            return;
        }

        if (resetOpenedTimes)
        {
            lastPatchGrowth.infoContainerOpenedTimes = 0;
        }

        lastPatchGrowth.infoContainer.SetActive(false);
        lastPatchGrowth.infoContainer.transform.SetParent(lastPatchGrowth.startCointainerPlace, true);
    }