/// <summary> /// Initialize the weightedButtonGroupDatas. Can be done only once per session. /// </summary> public void Initialize() { if (!isInitialized) { weightedButtonGroupDatas = new WeightedRandomizer <ButtonGroupData>(); foreach (ButtonGroupData _buttonGroupData in buttonGroupDatas) { if (_buttonGroupData == null) { continue; } #if VOODOO_SAUCE if (_buttonGroupData.buttonGroupVisualPrefab != null && _buttonGroupData.buttonGroupVisualPrefab.specialButton != null) { Voodoo.Sauce.Components.NoAdsButton noAdsButton = _buttonGroupData.buttonGroupVisualPrefab.specialButton.GetComponent <Voodoo.Sauce.Components.NoAdsButton>(); if (noAdsButton == null || !VoodooSauce.IsPremium()) { weightedButtonGroupDatas.AddElement(_buttonGroupData, _buttonGroupData.weight); } } else { weightedButtonGroupDatas.AddElement(_buttonGroupData, _buttonGroupData.weight); } #else weightedButtonGroupDatas.AddElement(_buttonGroupData, _buttonGroupData.weight); #endif isInitialized = true; } } }