public ViewModelWindowLandClaim( IStaticWorldObject landClaimWorldObject, ILogicObject area) { this.landClaimWorldObject = landClaimWorldObject; this.privateState = LandClaimArea.GetPrivateState(area); var protoLandClaim = (IProtoObjectLandClaim)landClaimWorldObject.ProtoStaticWorldObject; var canEditOwners = protoLandClaim .SharedCanEditOwners(landClaimWorldObject, ClientCurrentCharacterHelper.Character); this.ViewModelOwnersEditor = new ViewModelWorldObjectOwnersEditor( this.privateState.LandOwners, callbackServerSetOwnersList: ownersList => LandClaimSystem.ClientSetAreaOwners( area, ownersList), title: AccessListTitle + ":", emptyListMessage: AccessListEmpty, canEditOwners: canEditOwners, // exclude founder name ownersListFilter: name => name != this.FounderName, maxOwnersListLength: LandClaimSystemConstants.SharedLandClaimOwnersMax, displayedOwnersNumberAdjustment: -1); this.protoObjectLandClaim = (IProtoObjectLandClaim)this.landClaimWorldObject.ProtoStaticWorldObject; var upgrade = this.protoObjectLandClaim.ConfigUpgrade.Entries.FirstOrDefault(); if (upgrade is not null) { this.ViewModelStructureUpgrade = new ViewModelStructureUpgrade(upgrade); this.ViewModelProtoLandClaimInfoUpgrade = new ViewModelProtoLandClaimInfo( (IProtoObjectLandClaim)upgrade.ProtoStructure); } var objectPublicState = landClaimWorldObject.GetPublicState <ObjectLandClaimPublicState>(); objectPublicState.ClientSubscribe( _ => _.LandClaimAreaObject, _ => this.RefreshSafeStorageAndPowerGrid(), this); this.RefreshSafeStorageAndPowerGrid(); this.ViewModelProtoLandClaimInfoCurrent = new ViewModelProtoLandClaimInfo(this.protoObjectLandClaim); ItemsContainerLandClaimSafeStorage.ClientSafeItemsSlotsCapacityChanged += this.SafeItemsSlotsCapacityChangedHandler; this.RequestDecayInfoTextAsync(); this.ViewModelShieldProtectionControl = new ViewModelShieldProtectionControl( LandClaimSystem.SharedGetLandClaimAreasGroup(area)); }
public ViewModelWindowLandClaim( IStaticWorldObject landClaimWorldObject, ILogicObject area) { this.landClaimWorldObject = landClaimWorldObject; this.privateState = LandClaimArea.GetPrivateState(area); var protoStructureWithOwnersList = ((IProtoObjectWithOwnersList)landClaimWorldObject.ProtoStaticWorldObject); var canEditOwners = protoStructureWithOwnersList .SharedCanEditOwners(landClaimWorldObject, ClientCurrentCharacterHelper.Character); this.ViewModelOwnersEditor = new ViewModelWorldObjectOwnersEditor( this.privateState.LandOwners, callbackServerSetOwnersList: ownersList => LandClaimSystem.ClientSetAreaOwners( area, ownersList), title: AccessListTitle + ":", emptyListMessage: AccessListEmpty, canEditOwners: canEditOwners, // exclude founder name ownersListFilter: name => name != this.FounderName); this.protoObjectLandClaim = (IProtoObjectLandClaim)this.landClaimWorldObject.ProtoStaticWorldObject; var upgrade = this.protoObjectLandClaim.ConfigUpgrade.Entries.FirstOrDefault(); if (upgrade != null) { this.ViewModelStructureUpgrade = new ViewModelStructureUpgrade(upgrade); this.ViewModelProtoLandClaimInfoUpgrade = new ViewModelProtoLandClaimInfo( (IProtoObjectLandClaim)upgrade.ProtoStructure); } this.ViewModelItemsContainerExchange = new ViewModelItemsContainerExchange( landClaimWorldObject.GetPrivateState <ObjectLandClaimPrivateState>().ItemsContainer, callbackTakeAllItemsSuccess: () => { }) { IsContainerTitleVisible = false }; this.ViewModelProtoLandClaimInfoCurrent = new ViewModelProtoLandClaimInfo(this.protoObjectLandClaim); }
public LandClaimMapData(ILogicObject area, WorldMapController worldMapController) { this.area = area; this.areaPrivateState = area.GetPrivateState <LandClaimAreaPrivateState>(); this.worldMapController = worldMapController; this.stateSubscriptionStorage = new StateSubscriptionStorage(); // add land claim mark control to map this.markControl = new WorldMapMarkLandClaim(); var canvasPosition = this.GetAreaCanvasPosition(); Canvas.SetLeft(this.markControl, canvasPosition.X); Canvas.SetTop(this.markControl, canvasPosition.Y); Panel.SetZIndex(this.markControl, 12); worldMapController.AddControl(this.markControl); this.areaPrivateState.ClientSubscribe( o => o.LastRaidTime, this.RefreshRaidedState, this.stateSubscriptionStorage); this.RefreshRaidedState(); }