public ViewModelFactionMembersListControl(bool sortByRole) { this.sortByRole = sortByRole; this.privateState = Faction.GetPrivateState(FactionSystem.ClientCurrentFaction); this.privateState.OfficerRoleTitleBinding.ClientAnyModification += this.OfficerRoleTitleBindingAnyModificationHandler; this.membersList = this.privateState.Members; this.RebuildMembersList(); // uncomment to test the long list /*for (var i = 0; i < 120; i++) * { * var accessRights = (i % 10) switch * { * 4 => FactionMemberAccessRights.Officer, * _ => FactionMemberAccessRights.Member * }; * * MembersList.Add(new FactionMemberViewEntry( * new FactionMemberEntry("user" + i.ToString("000"), accessRights))); * }*/ this.SortMembersList(); this.membersList.ClientElementInserted += this.MembersListElementInsertedHandler; this.membersList.ClientElementRemoved += this.MembersListElementRemovedHandler; OnlinePlayersSystem.ClientPlayerAddedOrRemoved += this.OnlinePlayersSystemOnClientPlayerAddedOrRemovedHandler; }
public ViewModelFactionDiplomacyManagementControl() { FactionSystem.ClientCurrentFactionMemberAddedOrRemoved += this.ClientCurrentFactionMemberAddedOrRemovedHandler; this.factionPrivateState = Faction.GetPrivateState(FactionSystem.ClientCurrentFaction); this.factionPrivateState.AccessRightsBinding.ClientAnyModification += this.AccessRightsAnyModificationHandler; }
public ViewModelFactionAdmin(FactionPrivateState factionPrivateState) { this.CommandEditFactionDescriptionPrivate = new ActionCommand( () => this.ExecuteCommandEditFactionDescription(isPrivateDescription: true)); this.CommandEditFactionDescriptionPublic = new ActionCommand( () => this.ExecuteCommandEditFactionDescription(isPrivateDescription: false)); this.factionPrivateState = factionPrivateState; this.factionPrivateState.ClientSubscribe( _ => _.DescriptionPrivate, () => this.NotifyPropertyChanged(nameof(this.DescriptionPrivate)), subscriptionOwner: this); this.factionPrivateState.ClientSubscribe( _ => _.DescriptionPublic, () => this.NotifyPropertyChanged(nameof(this.DescriptionPublic)), subscriptionOwner: this); }
public ViewModelWindowFaction() { var faction = FactionSystem.ClientCurrentFaction; this.factionPublicState = Faction.GetPublicState(faction); this.factionPrivateState = Faction.GetPrivateState(faction); FactionSystem.ClientCurrentFactionMemberAddedOrRemoved += this.ClientCurrentFactionMemberAddedOrRemovedHandler; FactionConstants.ClientFactionMembersMaxChanged += this.FactionMembersMaxNumberChangedHandler; RateFactionUpgradeCostPerLevel.ClientValueChanged += this.FactionUpgradeCostsChangedHandler; FactionSystem.ClientCurrentFactionReceivedApplications.CollectionChanged += this.ReceivedApplicationsCollectionChangedHandler; this.factionPrivateState.IncomingFactionAllianceRequests.ClientAnyModification += this.IncomingFactionAllianceRequestsOnClientAnyModification; this.factionPrivateState.AccessRightsBinding.ClientAnyModification += this.AccessRightsAnyModificationHandler; ClientLandClaimAreaManager.AreaAdded += this.LandClaimAreaAddedOrRemovedHandler; ClientLandClaimAreaManager.AreaRemoved += this.LandClaimAreaAddedOrRemovedHandler; this.factionPublicState.ClientSubscribe( _ => _.ClanTag, () => this.NotifyPropertyChanged(nameof(this.ClanTag)), subscriptionOwner: this); this.factionPublicState.ClientSubscribe( _ => _.Emblem, () => this.NotifyPropertyChanged(nameof(this.Emblem)), subscriptionOwner: this); this.factionPublicState.ClientSubscribe( _ => _.LeaderName, () => this.NotifyPropertyChanged(nameof(this.LeaderName)), subscriptionOwner: this); this.factionPublicState.ClientSubscribe( _ => _.PlayersNumberCurrent, () => this.NotifyPropertyChanged(nameof(this.MembersNumberCurrent)), subscriptionOwner: this); this.factionPublicState.ClientSubscribe( _ => _.PlayersNumberCurrent, () => this.NotifyPropertyChanged(nameof(this.MembersNumberText)), subscriptionOwner: this); this.factionPublicState.ClientSubscribe( _ => _.Level, () => { this.NotifyPropertyChanged(nameof(this.FactionLevel)); this.NotifyPropertyChanged(nameof(this.IsFactionMaxLevelReached)); this.NotifyPropertyChanged(nameof(this.FactionLevelUpgradeCostLearningPoints)); this.NotifyPropertyChanged(nameof(this.FactionLevelUpgradeNextLevelInfoText)); }, subscriptionOwner: this); this.factionPublicState.ClientSubscribe( _ => _.IsAcceptingApplications, () => this.NotifyPropertyChanged(nameof(this.IsAcceptingApplications)), subscriptionOwner: this); this.factionPublicState.ClientSubscribe( _ => _.TotalScore, () => { this.NotifyPropertyChanged(nameof(this.TotalScore)); this.NotifyPropertyChanged(nameof(this.TotalScoreString)); }, subscriptionOwner: this); this.factionPublicState.ClientSubscribe( _ => _.LeaderboardRank, () => this.NotifyPropertyChanged(nameof(this.LeaderboardRank)), subscriptionOwner: this); this.factionPrivateState.ClientSubscribe( _ => _.DescriptionPrivate, () => this.NotifyPropertyChanged(nameof(this.DescriptionPrivate)), subscriptionOwner: this); this.factionPrivateState.ClientSubscribe( _ => _.DescriptionPublic, () => this.NotifyPropertyChanged(nameof(this.DescriptionPublic)), subscriptionOwner: this); this.factionPrivateState.ClientSubscribe( _ => _.AccumulatedLearningPointsForUpgrade, () => this.NotifyPropertyChanged(nameof(this.FactionAccumulatedLearningPointsForUpgrade)), subscriptionOwner: this); this.ViewModelFactionAdmin = new ViewModelFactionAdmin(this.factionPrivateState); this.Refresh(); ClientTimersSystem.AddAction(2, () => { if (!this.IsDisposed) { // a workaround for the notification icon in HUDButtonsBar this.NotifyPropertyChanged(nameof(this.ReceivedApplicationsCount)); } }); }