void Start()
    {
        speed = startSpeed;

        bufferedEnviroment.UpdatePooledObjects(6);
        bufferedEnviroment.UpdatePooledObjects(4);

        bufferedEnviroment[0].position = new Vector3(0, width, 0);
        bufferedEnviroment[1].position = new Vector3(0, 0, 0);
        bufferedEnviroment[2].position = new Vector3(0, -width, 0);
        bufferedEnviroment[3].position = new Vector3(0, -width * 2, 0);

        lastEnviroment = bufferedEnviroment[3];
    }
Ejemplo n.º 2
0
    private void SetInitialReferences()
    {
        rectTransform = GetComponent <RectTransform>();

        //Debug.Log("THIS SLIDER IS BAD", this);

        minSlider      = rectTransform.Find("Min Slider").GetComponent <RangeMinSlider>();
        maxSlider      = rectTransform.Find("Max Slider").GetComponent <RangeMaxSlider>();
        minSliderLabel = rectTransform.Find("FirstLabel").GetComponent <TextMeshProUGUI>();
        maxSliderLabel = rectTransform.Find("LastLabel").GetComponent <TextMeshProUGUI>();

        rangeTickLayoutGroup   = rectTransform.Find("RangeTicks").GetComponent <HorizontalLayoutGroup>();
        rangeTickRectTransform = rangeTickLayoutGroup.GetComponent <RectTransform>();
        rangeTickGameObject    = rangeTickLayoutGroup.gameObject;

        bufferedRangeTicks = new BufferedArray <BufferedRangeTick>(InstantiateRangeTickBuffer, BufferRangeTick);

        List <BufferedRangeTick> bufferedRangeTicksInChildren = new List <BufferedRangeTick>();

        foreach (Transform obj in rangeTickRectTransform)
        {
            bufferedRangeTicksInChildren.Add(new BufferedRangeTick(obj.gameObject));
        }

        bufferedRangeTicks.AddRange(bufferedRangeTicksInChildren);

        bufferedRangeTicks.bufferedCount = bufferedRangeTicksInChildren.Count;

        bufferedRangeTicks.UpdatePooledObjects(0);

        minSlider.label        = minSliderLabel;
        minSlider.numberFormat = "n" + 0; //DecimalPlaces;
        maxSlider.label        = maxSliderLabel;
        maxSlider.numberFormat = "n" + 0; //DecimalPlaces;
    }
    private IEnumerator Start()
    {
        bufferedDropdownElements = new BufferedArray <BufferedDropdownElement>(InstantiateBufferedDropdownElement, BufferDropdownElement);

        dropDownButton.onClick.AddListener(Animate);


        bufferedDropdownElements.UpdatePooledObjects(startingBuffer);
        bufferedDropdownElements.UpdatePooledObjects(0);

        canvas.overrideSorting = true;
        canvas.sortingOrder    = (int)rectTransform.position.y;

        isInitialized = true;


        yield return(new WaitForEndOfFrame());

        //OnRectTransformDimensionsChange();

        Invoke("UpdateSortingOrder", 1f);

        //if (enableScrollbar == true)
        //{
        //    itemList.padding.right = 25;
        //    scrollbar.SetActive(true);
        //}

        //else
        //{
        //    itemList.padding.right = 8;
        //    Destroy(scrollbar);
        //}

        //if (enableIcon == false)
        //{
        //    selectedImage.enabled = false;
        //}
    }
Ejemplo n.º 4
0
    private void UpdateTicks()
    {
        if (showTicks)
        {
            rangeTickGameObject.SetActive(true);
            int tickCount = maxValue - minValue;

            bufferedRangeTicks.UpdatePooledObjects((int)(tickCount / tickInterval));
        }
        else
        {
            rangeTickGameObject.SetActive(false);
        }
    }
    private void Awake()
    {
        bufferedAudioSources = new BufferedArray <BufferedAudioSource>(InstantiateBufferedAudioSource, BufferBufferedAudioSource);

        instance = this;

        mainCameraTransform = Camera.main.transform;

        backgroundMusicAudioSource = GameObject.Find("BackgroundMusicAudioSource").GetComponent <AudioSource>();

        buttonHighlightClip = _buttonHighlightClip;
        buttonClickClip     = _buttonClickClip;

        purchaseClip = _purchaseClip;
        winClip      = _winClip;
        loseClip     = _loseClip;

        mainMenuMusic = _mainMenuMusic;
        queueingMusic = _queueingMusic;
        gameMusic     = _gameMusic;

        bufferedAudioSources.UpdatePooledObjects(50);
        bufferedAudioSources.UpdatePooledObjects(0);
    }
    public void UpdateScaleBarElement()
    {
        bufferedTextObjects.UpdatePooledObjects(intervals + 1);

        //bufferedTextObjects[0].text.alignment = TextAlignmentOptions.MidlineLeft;
        bufferedTextObjects[0].text.text = maximumUnit.ToString() + " " + measurementUnit;

        //bufferedTextObjects[bufferedTextObjects.bufferedCount - 1].text.alignment = TextAlignmentOptions.MidlineRight;

        float interval = maximumUnit / intervals;

        for (int i = 1; i < bufferedTextObjects.bufferedCount - 1; i++)
        {
            bufferedTextObjects[i].text.text = (maximumUnit - (interval * i)).ToString();
        }

        bufferedImageObjects.UpdatePooledObjects(intervals + 2);

        float cornerWidth = (rect.width / (intervals + 1)) / 2.0f;

        bufferedImageObjects[0].layoutElement.minWidth       = cornerWidth;
        bufferedImageObjects[0].layoutElement.preferredWidth = cornerWidth;
        bufferedImageObjects[0].image.color = Color.clear;

        bufferedImageObjects[bufferedImageObjects.bufferedCount - 1].layoutElement.minWidth       = cornerWidth;
        bufferedImageObjects[bufferedImageObjects.bufferedCount - 1].layoutElement.preferredWidth = cornerWidth;
        bufferedImageObjects[bufferedImageObjects.bufferedCount - 1].image.color = Color.clear;

        for (int i = 1; i < bufferedImageObjects.bufferedCount - 1; i += 2)
        {
            bufferedImageObjects[i].layoutElement.minWidth       = 1.0f;
            bufferedImageObjects[i].layoutElement.preferredWidth = 100.0f;
            bufferedImageObjects[i].image.color = barPrimaryColor;
        }

        for (int i = 2; i < bufferedImageObjects.bufferedCount - 1; i += 2)
        {
            bufferedImageObjects[i].layoutElement.minWidth       = 1.0f;
            bufferedImageObjects[i].layoutElement.preferredWidth = 100.0f;
            bufferedImageObjects[i].image.color = barSecondaryColor;
        }
    }
 public void ClearDropdown()
 {
     bufferedDropdownElements.UpdatePooledObjects(0);
 }