예제 #1
0
        private static bool SharedIsOwnedAreaUnderRaid(ILogicObject area)
        {
            var areaPrivateState = area.GetPrivateState <LandClaimAreaPrivateState>();

            if (!areaPrivateState.LastRaidTime.HasValue)
            {
                return(false);
            }

            var time = Api.IsClient
                           ? Client.CurrentGame.ServerFrameTimeRounded
                           : Server.Game.FrameTime;

            var timeSinceRaid = time - areaPrivateState.LastRaidTime.Value;

            return(timeSinceRaid < RaidCooldownDurationSeconds);
        }
예제 #2
0
            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();
            }