Beispiel #1
0
        public void SetSelfEnergy(UpdateSelfUserEnergyEvent e, SelfUserInSquadNode user, [JoinByUser] EnergyItemNode energy, SelfUserInSquadNode user1, [JoinByLeague] LeagueNode league, [JoinAll] UserEnergyBarNode screen)
        {
            UserGiftEnergyEvent eventInstance = new UserGiftEnergyEvent();

            base.ScheduleEvent(eventInstance, user);
            screen.userEnergyBarUi.SetEnergyLevel((energy.userItemCounter.Count - this.GetPayed(user)) + eventInstance.totalGift, league.leagueEnergyConfig.Capacity);
        }
Beispiel #2
0
        private void UpdateEnergyCell(UserInSquadNode user, [JoinByUser] UserEnergyCellNode userCell, [JoinByUser] EnergyItemNode energy, [JoinByLeague] LeagueNode league)
        {
            UserGiftEnergyEvent eventInstance = new UserGiftEnergyEvent();

            base.ScheduleEvent(eventInstance, user);
            userCell.userEnergyCellUi.Setup(user.userUid.Uid, energy.userItemCounter.Count + eventInstance.totalGift, league.leagueEnergyConfig.Cost);
            userCell.userEnergyCellUi.SetGiftValue(eventInstance.totalGift, eventInstance.uids);
        }
Beispiel #3
0
        public void InitUser(NodeAddedEvent e, UserEnergyCellNode userEnergyCell, [JoinByUser] UserInSquadNode user, [JoinByLeague] LeagueNode league, UserEnergyCellNode userEnergyCell1, [JoinByUser] Optional <EnergyItemNode> energy)
        {
            UserGiftEnergyEvent eventInstance = new UserGiftEnergyEvent();

            base.ScheduleEvent(eventInstance, user);
            userEnergyCell.userEnergyCellUi.Setup(user.userUid.Uid, !energy.IsPresent() ? 0L : (energy.Get().userItemCounter.Count + eventInstance.totalGift), league.leagueEnergyConfig.Cost);
            userEnergyCell.userEnergyCellUi.SetGiftValue(eventInstance.totalGift, eventInstance.uids);
        }
Beispiel #4
0
        public void GetSquadCurrentEnergy(SquadCurrentEnergy e, UserInSquadNode userInSquad, [JoinBySquad, Combine] UserInSquadNode user, [JoinByUser] EnergyItemNode userEnergy, [JoinByUser] UserInSquadNode user1, [JoinByLeague] LeagueNode league)
        {
            UserGiftEnergyEvent eventInstance = new UserGiftEnergyEvent();

            base.ScheduleEvent(eventInstance, user);
            long num = (long)Mathf.Min((float)league.leagueEnergyConfig.Cost, (float)(userEnergy.userItemCounter.Count + eventInstance.totalGift));

            e.CurrentEnergy += num;
        }
Beispiel #5
0
 public void GetUserGiftEnergy(UserGiftEnergyEvent e, UserInSquadNode user, [JoinBySquad] ICollection <UserInSquadNode> users)
 {
     foreach (UserInSquadNode node in users)
     {
         if (!ReferenceEquals(node, user))
         {
             Dictionary <long, long> energyPayments = node.battleEntrancePayer.EnergyPayments;
             foreach (long num in energyPayments.Keys)
             {
                 if (num == user.Entity.Id)
                 {
                     e.uids.Add(node.userUid.Uid);
                     e.totalGift += energyPayments[num];
                 }
             }
         }
     }
 }
Beispiel #6
0
        public void UpdateSquadTeleportInfo(UpdateTeleportInfoEvent e, Node any, [JoinAll] SelfUserInSquadNode selfUserInSquad, [JoinAll] SingleNode <ShareEnergyScreenComponent> shareEnergyDialog, [JoinAll] UserEnergyBarNode userEnergyBar, [JoinAll] Optional <EnergyPreviewCellNode> previewCell, [JoinByUser] Optional <EnergyItemNode> previewUserEnergy, [JoinByUser] Optional <UserInSquadNode> previewUserInSquad, [JoinByLeague] Optional <LeagueNode> previewUserLeague)
        {
            SquadTeleportPriceEvent eventInstance = new SquadTeleportPriceEvent();

            base.ScheduleEvent(eventInstance, selfUserInSquad);
            SelfExcessEnergyEvent event3 = new SelfExcessEnergyEvent();

            base.ScheduleEvent(event3, selfUserInSquad);
            SquadCurrentEnergy energy = new SquadCurrentEnergy();

            base.ScheduleEvent(energy, selfUserInSquad);
            shareEnergyDialog.component.TeleportPriceProgressBar.Progress = ((float)energy.CurrentEnergy) / ((float)eventInstance.TeleportPrice);
            base.ScheduleEvent <UpdateSelfUserEnergyEvent>(selfUserInSquad);
            long num = 0L;

            if (previewCell.IsPresent())
            {
                bool flag = previewUserInSquad.Get().Entity.HasComponent <SelfUserComponent>();
                UserGiftEnergyEvent event4 = new UserGiftEnergyEvent();
                base.ScheduleEvent(event4, previewUserInSquad.Get());
                num = (previewUserLeague.Get().leagueEnergyConfig.Cost - previewUserEnergy.Get().userItemCounter.Count) - event4.totalGift;
                if (num <= 0L)
                {
                    previewCell.Get().userEnergyCellUi.HideShareButton();
                }
                else if (flag || (event3.ExcessEnergy <= 0L))
                {
                    previewCell.Get().userEnergyCellUi.SetShareEnergyText(num, true);
                    userEnergyBar.userEnergyBarUi.ShowAdditionalEnergyLevel(num);
                    shareEnergyDialog.component.TeleportPriceProgressBar.AdditionalProgress = ((float)num) / ((float)eventInstance.TeleportPrice);
                }
                else
                {
                    long num2 = (long)Mathf.Min((float)event3.ExcessEnergy, (float)num);
                    previewCell.Get().userEnergyCellUi.SetShareEnergyText(num2, false);
                    userEnergyBar.userEnergyBarUi.SetSharedEnergyLevel(num2);
                    shareEnergyDialog.component.TeleportPriceProgressBar.AdditionalProgress = ((float)num2) / ((float)eventInstance.TeleportPrice);
                }
            }
        }