예제 #1
0
        public void InviteToSquad(FriendInviteToSquadEvent e, FriendUserNode friend, [JoinAll] SelfUserNode selfUser, [JoinBySquad] Optional <SquadNode> squad, [JoinAll] SingleNode <Dialogs60Component> dialogs, [JoinAll] Optional <SingleNode <WindowsSpaceComponent> > screens, [JoinAll] SingleNode <FriendsComponent> friends)
        {
            List <Animator> animators = new List <Animator>();

            if (screens.IsPresent())
            {
                animators = screens.Get().component.Animators;
            }
            if (friend.userRank.Rank < 4)
            {
                dialogs.component.Get <CantInviteFriendIntoSquadDialogComponent>().Show(friend.userUid.Uid, animators);
            }
            else if (friend.Entity.HasComponent <MatchMakingUserComponent>())
            {
                dialogs.component.Get <CantInviteFriendIntoSquadDialogComponent>().Show(friend.userUid.Uid, animators);
            }
            else
            {
                if (friend.Entity.HasComponent <InvitedToSquadUserComponent>())
                {
                    friend.Entity.RemoveComponent <InvitedToSquadUserComponent>();
                }
                friends.component.InSquadInvitations[friend.userGroup.Key] = DateTime.Now;
                friend.Entity.AddComponent <InvitedToSquadUserComponent>();
                this.Invite(friend, squad, selfUser);
            }
        }
예제 #2
0
 public void PutReputationToEnter(UpdateTopLeagueInfoEvent e, SelfUserNode user, [JoinAll] ScreenNode screen, [JoinAll] TopLeagueNode topLeague, [JoinAll] ResultsNode results)
 {
     if (!results.battleResults.ResultForClient.Spectator && screen.battleResultsAwardsScreen.CanShowLeagueProgress())
     {
         screen.battleResultsAwardsScreen.leagueResultUI.PutReputationToEnter(topLeague.Entity.Id, e.LastPlaceReputation);
     }
 }
예제 #3
0
        public void ShowCheckResult(PromoCodeCheckResultEvent e, SelfUserNode selfUser, [JoinAll] InputFieldNode inputField, [JoinAll] SingleNode <PromoCodesScreenLocalizationComponent> promoCodesScreen)
        {
            string str = inputField.inputField.Input.Trim();

            base.Log.InfoFormat("ShowCheckResult {0}", e.Result);
            if (str.StartsWith(LINK_PREFIX))
            {
                base.Log.InfoFormat("ShowCheckResult IsLink {0}", str);
                inputField.esm.Esm.ChangeState <InputFieldStates.ValidState>();
                inputField.interactivityPrerequisiteESM.Esm.ChangeState <InteractivityPrerequisiteStates.AcceptableState>();
            }
            else
            {
                inputField.inputField.ErrorMessage = string.IsNullOrEmpty(str) ? string.Empty : promoCodesScreen.component.InputStateTexts[e.Result.ToString()].ToString();
                if (e.Code.Equals(str, StringComparison.OrdinalIgnoreCase))
                {
                    if (e.Result == PromoCodeCheckResult.VALID)
                    {
                        inputField.esm.Esm.ChangeState <InputFieldStates.ValidState>();
                        inputField.interactivityPrerequisiteESM.Esm.ChangeState <InteractivityPrerequisiteStates.AcceptableState>();
                    }
                    else
                    {
                        inputField.esm.Esm.ChangeState <InputFieldStates.InvalidState>();
                        inputField.interactivityPrerequisiteESM.Esm.ChangeState <InteractivityPrerequisiteStates.NotAcceptableState>();
                    }
                }
            }
        }
예제 #4
0
 public void CheckItem(ItemInMarketRequestEvent e, Node any, [JoinAll] SelfUserNode selfUserNode, [JoinAll, Combine] MarketItemNode item)
 {
     if (!selfUserNode.purchasedItemList.Contains(item.Entity.Id))
     {
         e.marketItems.Add(item.Entity.Id, item.descriptionItem.Name);
     }
 }
예제 #5
0
        private void Invite(FriendUserNode friend, Optional <SquadNode> squad, SelfUserNode selfUser)
        {
            InviteToSquadEvent eventInstance = new InviteToSquadEvent();

            eventInstance.InvitedUsersIds = new long[] { friend.Entity.Id };
            base.NewEvent(eventInstance).Attach(selfUser).Schedule();
        }
예제 #6
0
 public void ShowReputation(ScreenNode screen, ResultsNode results, SelfUserNode user)
 {
     if (!screen.battleResultsAwardsScreen.CanShowLeagueProgress())
     {
         screen.battleResultsAwardsScreen.HideLeagueProgress();
     }
     else
     {
         screen.battleResultsAwardsScreen.ShowLeagueProgress();
         LeagueResultUI                leagueResultUI  = screen.battleResultsAwardsScreen.leagueResultUI;
         BattleResultForClient         resultForClient = results.battleResults.ResultForClient;
         PersonalBattleResultForClient personalResult  = resultForClient.PersonalResult;
         Entity prevLeague      = personalResult.PrevLeague;
         Entity league          = personalResult.League;
         double reputation      = personalResult.Reputation;
         double reputationDelta = personalResult.ReputationDelta;
         bool   topLeague       = league.HasComponent <TopLeagueComponent>();
         int    leaguePlace     = personalResult.LeaguePlace;
         bool   unfairMatching  = resultForClient.FindUserResultByUserId(user.Entity.Id).UnfairMatching;
         if (!ReferenceEquals(prevLeague, league))
         {
             leagueResultUI.SetPreviousLeague(prevLeague);
         }
         leagueResultUI.SetCurrentLeague(league, reputation, (long)leaguePlace, topLeague, reputationDelta, unfairMatching);
         leagueResultUI.DealWithReputationChange();
         if (!ReferenceEquals(prevLeague, league))
         {
             leagueResultUI.ShowNewLeague();
         }
     }
 }
예제 #7
0
 public void MarkSelf(NodeAddedEvent e, [Combine] UserGroupNode userGroup, [Context, JoinByUser] SelfUserNode selfUser)
 {
     if (!userGroup.Entity.HasComponent<SelfComponent>())
     {
         userGroup.Entity.AddComponent<SelfComponent>();
     }
 }
예제 #8
0
 private void ShowTooltipInLobby(LobbyInteractableUserButtonNode userButton, SelfUserNode selfUser, LobbyNode lobby)
 {
     if (!userButton.lobbyUserListItem.Empty)
     {
         long id = userButton.lobbyUserListItem.userEntity.Id;
         this.RequestTooltipDisplay(id, userButton.userInteractionsButton.tooltipPrefab, selfUser.Entity, InteractionSource.LOBBY, lobby.Entity.Id);
     }
 }
        public void ShowUserRankRestrictionIndicator(UpdateRankEvent e, SelfUserNode selfUser, [JoinAll, Combine] MarketItemWithUserRankRestrictionNode item)
        {
            CheckMarketItemRestrictionsEvent eventInstance = new CheckMarketItemRestrictionsEvent();

            base.ScheduleEvent(eventInstance, item);
            if (!eventInstance.RestrictedByRank)
            {
                item.userRankRestrictionBadgeGUI.SendMessageUpwards("OnItemEnabled", SendMessageOptions.DontRequireReceiver);
                item.userRankRestrictionBadgeGUI.gameObject.SetActive(false);
            }
        }
예제 #10
0
 public void LoadedUser(BattleInfoForLabelLoadedEvent e, SelfUserNode selfUser, [JoinAll] ICollection <UserLabelStateNode> userLabels)
 {
     foreach (UserLabelStateNode node in userLabels)
     {
         long key = node.battleGroup.Key;
         if (key.Equals(e.BattleId))
         {
             string battleMode = e.BattleMode;
             node.userLabelState.SetBattleDescription(battleMode, e.Map.GetComponent <DescriptionItemComponent>().Name);
         }
     }
 }
 public void CompleteBuyUIDChange(CompleteBuyUIDChangeEvent e, SelfUserNode userNode, [JoinAll] ScreenNode screen, [JoinAll] SingleNode <ChangeNicknameButtonComponent> changeNicknameButton, [JoinAll] SingleNode <Dialogs60Component> dialogs, [JoinAll] Optional <SingleNode <UserProfileUI> > profileUI)
 {
     dialogs.component.Get <NicknameChangeDialog>().Hide();
     if (e.Success)
     {
         screen.profileAccountSectionUI.UserNickname = userNode.userUid.Uid;
         if (profileUI.IsPresent())
         {
             profileUI.Get().component.UpdateNickname();
         }
     }
 }
예제 #12
0
 public void Init(NodeAddedEvent e, SelfUserNode selfUser)
 {
     base.CreateEntity("MandatoryAssetsFirstLoading").AddComponent <MandatoryAssetsFirstLoadingComponent>();
     foreach (string str in GetMandatoryAssetGUIDsFromConfig(selfUser.Entity.Id))
     {
         AssetReferenceComponent component = new AssetReferenceComponent(new AssetReference(str));
         Entity entity2 = base.CreateEntity("Loader " + str);
         entity2.AddComponent(component);
         entity2.AddComponent <PreloadComponent>();
         entity2.AddComponent(new AssetRequestComponent(100));
     }
 }
예제 #13
0
 public void CompleteBuyUIDChange(CompleteBuyUIDChangeEvent e, SelfUserNode userNode, [JoinAll] ActiveChangeUIDScreenNode activeChangeUIDScreenNode, [JoinByScreen] XButtonNode buttonNode, [JoinByScreen] LoginInputFieldValidStateNode inputField)
 {
     if (e.Success)
     {
         base.ScheduleEvent <UIDChangedEvent>(userNode);
         base.ScheduleEvent <ShowScreenLeftEvent <MainScreenComponent> >(userNode);
     }
     else
     {
         inputField.inputField.Input = string.Empty;
         buttonNode.confirmButton.FlipFront();
     }
 }
예제 #14
0
        private void CheckForDeserterDesc(SelfUserNode selfUser)
        {
            int needGoodBattles = selfUser.battleLeaveCounter.NeedGoodBattles;

            if (needGoodBattles > 0)
            {
                MainScreenComponent.Instance.ShowDeserterDesc(needGoodBattles, true);
            }
            else
            {
                MainScreenComponent.Instance.HideDeserterDesc();
            }
        }
예제 #15
0
 public void LoadedUser(BattleInfoForLabelLoadedEvent e, SelfUserNode selfUser, [JoinAll] ICollection <EmptyBattleLabelNode> battleLabels)
 {
     foreach (EmptyBattleLabelNode node in battleLabels)
     {
         long battleId = node.battleLabel.BattleId;
         if (battleId.Equals(e.BattleId))
         {
             BattleInfoForLabelComponent component = new BattleInfoForLabelComponent {
                 BattleMode = e.BattleMode
             };
             node.Entity.AddComponent(component);
             e.Map.GetComponent <MapGroupComponent>().Attach(node.Entity);
         }
     }
 }
예제 #16
0
 protected void InitConsole(SelfUserNode selfUser)
 {
     this.user = selfUser.Entity;
     if (Object.FindObjectOfType <SmartConsole>() == null)
     {
         Object.Instantiate <GameObject>(Object.FindObjectOfType <SmartConsoleActivator>().SmartConsole);
         SmartConsole.RegisterCommand("changeEnergy", "changeEnergy -10", "change user energy", new SmartConsole.ConsoleCommandFunction(this.ChangeEnergy));
         SmartConsole.RegisterCommand("incScore", "increaseScore RED", "Increases score of a team", new SmartConsole.ConsoleCommandFunction(this.IncreaseScore));
         SmartConsole.RegisterCommand("finish", "finish", "Finish current battle", new SmartConsole.ConsoleCommandFunction(this.FinishBattle));
         SmartConsole.RegisterCommand("banUser", "banUser User1 CHEATING DAY", "Bans user chat for REASON for TYPE. Possible reasons: FLOOD, FOUL, SEX, POLITICS... Possible type: NONE, WARN, MINUTE, HOUR, DAY...", new SmartConsole.ConsoleCommandFunction(this.BanUser));
         SmartConsole.RegisterCommand("unbanUser", "unbanUser User1", "Unbans user chat", new SmartConsole.ConsoleCommandFunction(this.UnbanUser));
         SmartConsole.RegisterCommand("addScore", "addScore 100", "Add user score", new SmartConsole.ConsoleCommandFunction(this.AddScore));
         SmartConsole.RegisterCommand("addKills", "addKills 10", "Add kills to user", new SmartConsole.ConsoleCommandFunction(this.AddKills));
         SmartConsole.RegisterCommand("giveBattleQuest", "giveBattleQuest tutorial/supply", "give battle quest to user", new SmartConsole.ConsoleCommandFunction(this.GiveBattleQuest));
         SmartConsole.RegisterCommand("changeReputation", "changeReputation -10", "change reputation", new SmartConsole.ConsoleCommandFunction(this.ChangeReputation));
     }
 }
예제 #17
0
        public void SendChangeScreenEvent(ChangeScreenLogEvent e, Node any, [JoinAll] SelfUserNode user)
        {
            string nextScreen = this.SplitCamelCase(e.NextScreen.ToString());

            if (lastScreenName != nextScreen)
            {
                double duration = 0.0;
                if (!string.IsNullOrEmpty(lastScreenName))
                {
                    TimeSpan span = DateTime.Now.Subtract(lastScreenEnterDateTime);
                    duration = Math.Truncate((double)((span.TotalSeconds + (((float)span.Milliseconds) / 1000f)) * 100.0)) / 100.0;
                }
                ChangeScreenEvent eventInstance = new ChangeScreenEvent(lastScreenName, nextScreen, duration);
                lastScreenName          = nextScreen;
                lastScreenEnterDateTime = DateTime.Now;
                base.ScheduleEvent(eventInstance, user);
            }
        }
예제 #18
0
        private void ShowInviteDialog(SelfUserNode user, long engineId, string userUid, long fromUserId, DialogsNode dialogs)
        {
            InviteToSquadDialogComponent window = dialogs.dialogs60.Get <InviteToSquadDialogComponent>();

            if (!this.CanShowInviteWindow(window))
            {
                RejectInviteToSquadEvent eventInstance = new RejectInviteToSquadEvent {
                    FromUserId = fromUserId,
                    EngineId   = engineId
                };
                base.ScheduleEvent(eventInstance, user);
            }
            else
            {
                InviteToSquadDialogComponent component = dialogs.dialogs60.Get <NotificationsStackContainerComponent>().CreateNotification(window.gameObject).GetComponent <InviteToSquadDialogComponent>();
                component.FromUserId = fromUserId;
                component.EngineId   = engineId;
                component.Show(userUid, false, true);
            }
        }
예제 #19
0
        public void ShowTooltip(UserNode user, SelfUserNode selfUser, SquadTeammateInteractionButtonComponent squadTeammateInteractionButton, FriendsComponent friends)
        {
            SquadTeammateInteractionTooltipContentData data;
            SquadTeammateInteractionTooltipContentData data2;
            bool flag2 = selfUser.Entity.HasComponent <SquadLeaderComponent>();
            bool flag3 = user.Entity.HasComponent <AcceptedFriendComponent>();
            bool flag4 = selfUser.Entity.HasComponent <MatchMakingUserComponent>();
            bool flag5 = friends.OutgoingFriendsIds.Contains(user.Entity.Id);

            if (user.Entity.HasComponent <SelfUserComponent>())
            {
                if (flag4)
                {
                    return;
                }
                data2 = new SquadTeammateInteractionTooltipContentData {
                    teammateEntity       = user.Entity,
                    ShowLeaveSquadButton = true
                };
                data = data2;
            }
            else
            {
                data2 = new SquadTeammateInteractionTooltipContentData {
                    teammateEntity              = user.Entity,
                    ShowProfileButton           = true,
                    ShowLeaveSquadButton        = false,
                    ShowRemoveFromSquadButton   = !flag4,
                    ActiveRemoveFromSquadButton = flag2,
                    ShowGiveLeaderButton        = !flag4,
                    ActiveGiveLeaderButton      = flag2,
                    ShowAddFriendButton         = !flag3 && !flag5,
                    ShowFriendRequestSentButton = !flag3 && flag5
                };
                data = data2;
            }
            TooltipController.Instance.ShowTooltip(Input.mousePosition, data, squadTeammateInteractionButton.tooltipPrefab, false);
        }
        public void FillMVPScreen(NodeAddedEvent e, SingleNode <MVPScreenUIComponent> screen, SingleNode <BattleResultsComponent> battleResults, [JoinAll] ModuleUpgradeConfigNode moduleUpgradeConfig, [JoinAll] SelfUserNode user)
        {
            screen.component.SetModuleConfig(moduleUpgradeConfig.moduleUpgradablePowerConfig);
            UserResult mvp         = this.FindMostValuablePlayer(battleResults.component.ResultForClient);
            bool       mvpIsPlayer = false;

            if (!battleResults.component.ResultForClient.Spectator)
            {
                UserResult result2 = battleResults.component.ResultForClient.FindUserResultByUserId(user.Entity.Id);
                mvpIsPlayer = mvp.UserId == result2.UserId;
            }
            screen.component.SetResults(mvp, battleResults.component.ResultForClient, mvpIsPlayer);
        }
 public void DelayShowBackgroundAndLoadHangar(NodeAddedEvent e, SingleNode <RoundRestartingStateComponent> round, [Mandatory, JoinAll] SelfUserNode user)
 {
     base.NewEvent <GoBackFromBattleWithResultsEvent>().Attach(user).ScheduleDelayed(4f);
     base.NewEvent <LoadHangarEvent>().Attach(user).ScheduleDelayed(3.5f);
 }
 public void CreateResultsEntity(BattleResultForClientEvent e, SelfUserNode user, [JoinAll] ICollection <SingleNode <BattleResultsComponent> > otherResults)
 {
     this.UpdateResultEntity(e.UserResultForClient, otherResults);
 }
        public void BuildSelfTank(BuildSelfPlayerTankEvent e, Node any, [JoinAll] SelfUserNode user, [JoinAll] SingleNode <BattleResultsComponent> battleResults, [JoinAll] SingleNode <BattleResultCommonUIComponent> screen)
        {
            UserResult mvp = battleResults.component.ResultForClient.FindUserResultByUserId(user.Entity.Id);

            this.BuildTank(mvp, false, screen.component.tankPreviewImage2);
        }
        public void ScreenInit(NodeAddedEvent e, SingleNode <BattleResultCommonUIComponent> battleResultScreenUI, [JoinAll] SelfUserNode selfUserNode, [JoinAll] SingleNode <BattleResultsComponent> results)
        {
            BattleResultForClient resultForClient = results.component.ResultForClient;

            if (resultForClient.Spectator)
            {
                battleResultScreenUI.component.ShowScreen(resultForClient.Custom, true, false, false, false);
            }
            else
            {
                bool flag  = resultForClient.PersonalResult.MaxEnergySource == EnergySource.MVP_BONUS;
                bool flag2 = (resultForClient.PersonalResult.MaxEnergySource == EnergySource.UNFAIR_MM) || (resultForClient.PersonalResult.MaxEnergySource == EnergySource.DISBALANCE_BONUS);
                GetBattleTypeEvent eventInstance = new GetBattleTypeEvent {
                    WithCashback = flag || flag2
                };
                base.ScheduleEvent(eventInstance, battleResultScreenUI);
                bool tutor = (selfUserNode.userStatistics.Statistics["ALL_BATTLES_PARTICIPATED"] <= 4L) || (eventInstance.BattleType == BattleResultsAwardsScreenComponent.BattleTypes.Tutorial);
                battleResultScreenUI.component.ShowScreen(resultForClient.Custom, false, tutor, selfUserNode.Entity.HasComponent <SquadGroupComponent>(), true);
            }
        }
예제 #25
0
 public void NotificationBadgeInit(NodeAddedEvent e, [Combine] SingleNode <ModulesNotificationBadgeComponent> modulesNotificationBadge, SelfUserNode selfUser, SelectedPresetNode selectedPreset, [JoinAll] ICollection <MarketModuleNode> marketModules)
 {
예제 #26
0
        public void InputChangedWithDelay(InputPausedEvent e, InputFieldNode inputField, [JoinAll] SelfUserNode selfUser)
        {
            string str = inputField.inputField.Input.Trim();

            if (!string.IsNullOrEmpty(str))
            {
                inputField.esm.Esm.ChangeState <InputFieldStates.AwaitState>();
                inputField.interactivityPrerequisiteESM.Esm.ChangeState <InteractivityPrerequisiteStates.NotAcceptableState>();
                base.Log.InfoFormat("InputChangedWithDelay {0}", str);
                CheckPromoCodeEvent eventInstance = new CheckPromoCodeEvent {
                    Code = str
                };
                base.ScheduleEvent(eventInstance, selfUser);
            }
        }
예제 #27
0
 public void InputChanged(InputFieldValueChangedEvent e, InputFieldNode inputField, [JoinAll] SelfUserNode selfUser)
 {
     inputField.esm.Esm.ChangeState <InputFieldStates.AwaitState>();
     inputField.interactivityPrerequisiteESM.Esm.ChangeState <InteractivityPrerequisiteStates.NotAcceptableState>();
     base.Log.InfoFormat("InputChanged", new object[0]);
 }
예제 #28
0
        public void ActivatePromoCode(ButtonClickEvent e, ActivateButtonNode button, [JoinByScreen] InputFieldNode inputField, [JoinAll] SelfUserNode selfUser)
        {
            string str = inputField.inputField.Input.Trim();

            if (str.StartsWith(LINK_PREFIX))
            {
                base.Log.InfoFormat("NavigateLink {0}", str);
                NavigateLinkEvent eventInstance = new NavigateLinkEvent {
                    Link = str.Substring(LINK_PREFIX.Length)
                };
                base.ScheduleEvent(eventInstance, button);
            }
            else
            {
                base.Log.InfoFormat("ActivatePromoCode {0}", str);
                ActivatePromoCodeEvent eventInstance = new ActivatePromoCodeEvent {
                    Code = str
                };
                base.ScheduleEvent(eventInstance, selfUser);
                button.buttonMapping.Button.interactable = false;
                inputField.inputField.Input = string.Empty;
            }
        }
예제 #29
0
 public void SetLeagueBorder(NodeAddedEvent e, SingleNode <SelfUserAvatarComponent> ui, [JoinAll] SelfUserNode user, [JoinByLeague] LeagueNode league)
 {
     ui.component.SetLeagueBorder(league.leagueConfig.LeagueIndex);
     ui.component.SetRank();
 }
        public void InitTeamScoreTables(NodeAddedEvent e, [Combine] TeamScoreTableNode scoreTable, BattleResultsNode battleResults, SingleNode <TeamBattleResultsScreenComponent> screen, [JoinAll] SelfUserNode selfUser, [JoinAll] SingleNode <FriendsComponent> friends)
        {
            BattleResultForClient resultForClient = battleResults.battleResults.ResultForClient;
            ScrollRect            component       = scoreTable.uiTeam.gameObject.GetComponent <ScrollRect>();
            Vector2 vector = new Vector2();

            component.content.anchoredPosition = vector;
            PlayerStatInfoUI         rowPrefab = scoreTable.battleResultsScoreTable.rowPrefab;
            ICollection <UserResult> is2       = null;
            TeamColor teamColor = scoreTable.uiTeam.TeamColor;

            if (teamColor == TeamColor.BLUE)
            {
                is2 = (resultForClient.Spectator || (resultForClient.PersonalResult.UserTeamColor == TeamColor.BLUE)) ? resultForClient.BlueUsers : resultForClient.RedUsers;
            }
            else if (teamColor == TeamColor.RED)
            {
                is2 = (resultForClient.Spectator || (resultForClient.PersonalResult.UserTeamColor == TeamColor.BLUE)) ? resultForClient.RedUsers : resultForClient.BlueUsers;
            }
            foreach (UserResult result in is2)
            {
                PlayerStatInfoUI oui2          = Object.Instantiate <PlayerStatInfoUI>(rowPrefab);
                bool             isSelf        = result.UserId == selfUser.userGroup.Key;
                bool             isFriend      = friends.component.AcceptedFriendsIds.Contains(result.UserId);
                bool             containerLeft = false;
                int  leagueIndex = result.League.GetComponent <LeagueConfigComponent>().LeagueIndex;
                bool isDm        = false;
                oui2.Init(leagueIndex, result.Uid, result.Kills, result.Deaths, result.KillAssists, result.ScoreWithoutPremium, !isSelf ? Color.white : scoreTable.scoreTableRowColor.selfRowColor, result.HullId, result.WeaponId, result.UserId, battleResults.battleResults.ResultForClient.BattleId, result.AvatarId, isSelf, isDm, isFriend, containerLeft, false);
                oui2.transform.SetParent(component.content, false);
            }
        }