예제 #1
0
        private void UpdateBonusElementView(DailyBonusCycleComponent dailyBonusCycleComponent, DailyBonusScreenSystem.UserDailyBonusNode userDailyBonusNode, int zoneIndex, DailyBonusData[] dailyBonuses)
        {
            List <long> receivedRewards = userDailyBonusNode.userDailyBonusReceivedRewards.ReceivedRewards;
            int         num             = dailyBonusCycleComponent.Zones[zoneIndex];

            for (int i = 0; i < dailyBonuses.Length; i++)
            {
                if (i > num)
                {
                    this.bonusElements[i].UpdateView(dailyBonuses[i], BonusElementState.INACCESSIBLE);
                }
                else if (receivedRewards.Contains(dailyBonuses[i].Code))
                {
                    this.bonusElements[i].UpdateView(dailyBonuses[i], BonusElementState.TAKEN);
                }
                else
                {
                    this.bonusElements[i].UpdateView(dailyBonuses[i], BonusElementState.ACCESSIBLE);
                    this.bonusElements[i].transform.SetAsLastSibling();
                }
            }
            if (this.selectedBonusElement != null)
            {
                this.selectedBonusElement = null;
                this.onSelectedBonusElementChanged(this.selectedBonusElement);
            }
        }
예제 #2
0
        private void CreateBonusElements(DailyBonusCycleComponent dailyBonusCycleComponent, DailyBonusScreenSystem.UserDailyBonusNode userDailyBonusNode)
        {
            int num = 0;

            int[] zones       = dailyBonusCycleComponent.Zones;
            int   cycleNumber = (int)userDailyBonusNode.userDailyBonusCycle.CycleNumber;
            int   index       = 0;

            while (index < zones.Length)
            {
                Random.InitState(cycleNumber);
                int num4 = num;
                while (true)
                {
                    if (num4 > zones[index])
                    {
                        num = zones[index] + 1;
                        index++;
                        break;
                    }
                    GameObject obj2 = Instantiate <GameObject>(this.bonusElementPrefab);
                    obj2.transform.SetParent(base.transform, false);
                    MapViewBonusElement component = obj2.GetComponent <MapViewBonusElement>();
                    component.ZoneIndex = index;
                    this.bonusElements.Add(component);
                    component.OnValueChanged(new Action <MapViewBonusElement, bool>(this.OnBonusElementToggleValueChanged));
                    component.SetToggleGroup(base.GetComponent <ToggleGroup>());
                    num4++;
                }
            }
        }
예제 #3
0
        public void OnBonusElementToggleValueChanged(MapViewBonusElement bonusElement, bool isChecked)
        {
            ToggleGroup component = base.GetComponent <ToggleGroup>();

            if (!isChecked)
            {
                if (!component.AnyTogglesOn())
                {
                    this.selectedBonusElement = null;
                    this.onSelectedBonusElementChanged(this.selectedBonusElement);
                }
            }
            else
            {
                this.selectedBonusElement = bonusElement;
                this.onSelectedBonusElementChanged(this.selectedBonusElement);
                foreach (Toggle toggle in component.ActiveToggles())
                {
                    if (toggle != this.selectedBonusElement.Toggle)
                    {
                        toggle.isOn = false;
                    }
                }
                if (isChecked)
                {
                    UISoundEffectController.UITransformRoot.GetComponent <DailyBonusScreenSoundsRoot>().dailyBonusSoundsBehaviour.PlayClick();
                }
            }
        }
예제 #4
0
        private void UpdateTakeBonusButtonInteractable(MapViewBonusElement bonusElement)
        {
            this.takeContainerButton.gameObject.SetActive(true);
            this.takeBonusButton.gameObject.SetActive(true);
            bool flag = bonusElement != null;

            this.takeBonusButton.interactable     = flag;
            this.takeContainerButton.interactable = flag;
            if (!ReferenceEquals(this.GetCompleteUntakenDetailTargetItem(this.userDailyBonusNode, this.dailyBonusConfigNode), null))
            {
                this.takeContainerButton.gameObject.SetActive(false);
                this.takeBonusButton.gameObject.SetActive(false);
                this.takeDetailTarget.interactable = true;
            }
            else if (!flag)
            {
                this.takeContainerButton.gameObject.SetActive(false);
            }
            else
            {
                bool flag3 = bonusElement.dailyBonusData.DailyBonusType == DailyBonusType.CONTAINER;
                this.takeContainerButton.gameObject.SetActive(flag3);
                this.takeBonusButton.gameObject.SetActive(!flag3);
            }
        }
예제 #5
0
        public void ViewBonus(MapViewBonusElement element)
        {
            this.currentBonusElement = element;
            this.currentView.GetComponent <AnimationEventListener>().SetHideHandler(delegate {
                if (this.currentBonusElement == null)
                {
                    this.ShowView(this.text.gameObject);
                }
                else
                {
                    DailyBonusType dailyBonusType = this.currentBonusElement.dailyBonusData.DailyBonusType;
                    switch (dailyBonusType)
                    {
                    case DailyBonusType.NONE:
                        throw new ArgumentException("Unexpected DailyBonusType.NONE ");

                    case DailyBonusType.CRY:
                        this.ShowView(this.cryBonusView.gameObject);
                        this.cryBonusView.UpdateView(this.currentBonusElement.dailyBonusData.CryAmount);
                        break;

                    case DailyBonusType.XCRY:
                        this.ShowView(this.xCryBonusView.gameObject);
                        this.xCryBonusView.UpdateView(this.currentBonusElement.dailyBonusData.XcryAmount);
                        break;

                    case DailyBonusType.ENERGY:
                        this.ShowView(this.energyBonusView.gameObject);
                        this.energyBonusView.UpdateView(this.currentBonusElement.dailyBonusData.EnergyAmount);
                        break;

                    case DailyBonusType.CONTAINER:
                        this.ShowView(this.containerBonusView.gameObject);
                        this.containerBonusView.UpdateView(this.currentBonusElement.dailyBonusData.ContainerReward);
                        break;

                    default:
                        if (dailyBonusType == DailyBonusType.DETAIL)
                        {
                            this.ShowView(this.detailBonusView.gameObject);
                            this.detailBonusView.UpdateView(this.currentBonusElement.dailyBonusData.DetailReward);
                        }
                        break;
                    }
                }
            });
            this.HideCurrentView();
        }