Пример #1
0
    public void Initialize()
    {
        root = this.transform.parent.parent.GetComponent <SelectSequenceScreen>();

        section = root.sections.Find("LetsRoll").GetComponent <RectTransform>();

        // title red bar
        titleContainer = section.Find("TitleContainer").GetComponent <RectTransform>();

        // subtitle
        subTitleText = section.Find("SubTitleText").GetComponent <RectTransform>();

        // race track banner
        raceTrackPanel      = section.Find("RaceTrackPanel").GetComponent <RectTransform>();
        raceTrackBanner     = section.Find("RaceTrackPanel").Find("RaceTrackBanner").GetComponent <RectTransform>();
        raceTrackBannerGlow = section.Find("RaceTrackPanel").Find("RaceTrackBannerGlow").GetComponent <RectTransform>();
        trackRecordCircle   = section.Find("RaceTrackPanel").Find("TrackRecordCircle").GetComponent <RectTransform>();
        trackRecordText     = trackRecordCircle.Find("TrackRecordText").GetComponent <RectTransform>();

        // main header image
        billboardImage    = section.Find("BillboardContainer").GetComponent <Image>();
        selectedTireImage = section.Find("SelectedTire").GetComponent <Image>();

        PrepareDraw();
    }
Пример #2
0
    public void Initialize()
    {
        root = this.transform.parent.parent.GetComponent <SelectSequenceScreen>();

        custPref = root.sections.Find("CustomerPreferences").GetComponent <RectTransform>();

        // title red bar
        titleContainer = custPref.Find("TitleContainer").GetComponent <RectTransform>();

        // title, subtitle and icon
        titleText    = custPref.Find("TitleText").GetComponent <RectTransform>();
        subTitleText = custPref.Find("SubTitleText").GetComponent <RectTransform>();
        icon         = custPref.Find("Icon").GetComponent <RectTransform>();

        // set list options
        optionsContainer = custPref.Find("OptionsContainer").GetComponent <RectTransform>();

        // iterate options and cache
        optionList = new RectTransform[3];
        for (int i = 0; i < optionList.Length; i++)
        {
            optionList[i] = optionsContainer.Find("OptionItemPanel_0" + (i + 1)).GetComponent <RectTransform>();
        }

        PrepareDraw();
    }
    public int currentIndex = 0;        // Tire Option Index

    public void Initialize()
    {
        root = this.transform.parent.parent.GetComponent <SelectSequenceScreen>();

        tireSelect = root.sections.Find("TireSelect").GetComponent <RectTransform>();

        // main header image
        billboardContainer = tireSelect.Find("BillboardContainer").GetComponent <RectTransform>();

        // hide cust pref button
        customerPrefBtn = tireSelect.Find("CustomerPrefBtnContainer").Find("CustomerPrefButton").GetComponent <RectTransform>();
        customerPrefBtn.GetComponent <Image>().alphaHitTestMinimumThreshold = 1f;    // hit area, ignores transparent pixels
        customerPrefBtn.GetComponent <Image>().raycastTarget = false;

        // question bar and text
        tireQuestionBar  = tireSelect.Find("QuestionContainer").GetComponent <RectTransform>();
        tireQuestionText = tireSelect.Find("QuestionText").GetComponent <RectTransform>();

        // hide loader
        sectionLoaderLabel = tireSelect.Find("LoadingTiresLabel").GetComponent <RectTransform>();

        // get and hide options
        RectTransform options = tireSelect.Find("Options").GetComponent <RectTransform>();

        optionList     = new RectTransform[4];
        optionDataList = new TireOptionData[4];

        // tire option indexes
        var optionIndexes = new List <int>(Enumerable.Range(0, 4));

        // generate random array
        if (PersistentModel.Instance.RandomizeTireOptions)
        {
            optionIndexes.ShuffleCrypto();
        }

        // Debug.Log("LENGTH: " + optionIndexes.Count);

        // iterate options and cache
        for (int i = 0; i < optionList.Length; i++)
        {
            // Debug.Log("Random Index: " + optionIndexes[i]);

            TireOptionData item = new TireOptionData()
            {
                index     = optionIndexes[i],
                correct   = PersistentModel.Instance.IsChallengeOptionCorrect(optionIndexes[i]),
                transform = options.Find("Option_" + (i + 1)).GetComponent <RectTransform>()
            };

            optionDataList[i] = item;
            optionList[i]     = options.Find("Option_" + (i + 1)).GetComponent <RectTransform>();
        }

        PrepareDraw(false);
    }