/// <summary>
        /// This method should be called only by LandClaimSystem.
        /// </summary>
        internal static void AddArea(ILogicObject area)
        {
            if (StateSubscriptionStorages.ContainsKey(area))
            {
                return;
            }

            // register for group change event
            var stateSubscriptionStorage = new StateSubscriptionStorage();

            StateSubscriptionStorages[area] = stateSubscriptionStorage;

            var areaPublicState = LandClaimArea.GetPublicState(area);

            areaPublicState.ClientSubscribe(
                o => o.LandClaimAreasGroup,
                newValue =>
            {
                //Api.Logger.Dev($"Received LandClaimAreasGroup changed: {newValue} for {area}");
                OnAreaModified(area);
            },
                stateSubscriptionStorage);

            // register area
            RendererManagerGraceAreas.RegisterArea(area);

            var renderer = LandClaimSystem.ClientIsOwnedArea(area)
                               ? RendererManagerOwnedByPlayer
                               : RendererManagerNotOwnedByPlayer;

            renderer.RegisterArea(area);

            AreaAdded?.Invoke(area);
        }
Beispiel #2
0
        private static void AddArea(ILogicObject area)
        {
            RendererGraceAreas.AddRenderer(area);
            var renderer = LandClaimSystem.ClientIsOwnedArea(area)
                               ? RendererAreasOwnedByPlayer
                               : RendererAreasNotOwnedByPlayer;

            renderer.AddRenderer(area);

            AreaAdded?.Invoke(area);
        }