Ejemplo n.º 1
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);
                }
            }
        }
Ejemplo n.º 2
0
 public void GetSquadTeleportPrice(SquadTeleportPriceEvent e, UserInSquadNode userInSquad, [JoinBySquad, Combine] UserInSquadNode user, [JoinByLeague] LeagueNode league)
 {
     e.TeleportPrice += league.leagueEnergyConfig.Cost;
 }