Example #1
0
 private void UpdateOnChanged(RoomBehavior util)
 {
     if (Changed != null)
     {
         Changed(util);
     }
 }
Example #2
0
        public bool UndesignateRoomBehavior(RoomBehavior roomBehavior)
        {
            // Just uninstalling.
            if (RoomBehaviors == null)
            {
                return(false);
            }

            RoomBehaviors.Remove(roomBehavior.Type);

            return(true);
        }
Example #3
0
        /// <summary>
        /// Deconstructs the room behavior.
        /// </summary>
        public void Deconstruct(RoomBehavior roomBehavior)
        {
            // We call lua to decostruct
            EventActions.Trigger("OnUninstall", this);
            Room.UndesignateRoomBehavior(roomBehavior);

            if (Removed != null)
            {
                Removed(this);
            }

            // At this point, no DATA structures should be pointing to us, so we
            // should get garbage-collected.
        }
Example #4
0
        /// <summary>
        /// Copy Constructor -- don't call this directly, unless we never
        /// do ANY sub-classing. Instead use Clone(), which is more virtual.
        /// </summary>
        /// <param name="other"><see cref="RoomBehavior"/> being cloned.</param>
        private RoomBehavior(RoomBehavior other)
        {
            Type = other.Type;
            Name = other.Name;
            typeTags = new HashSet<string>(other.typeTags);
            description = other.description;

            Parameters = new Parameter(other.Parameters);

            if (other.EventActions != null)
            {
                EventActions = other.EventActions.Clone();
            }

            if (other.contextMenuLuaActions != null)
            {
                contextMenuLuaActions = new List<ContextMenuLuaAction>(other.contextMenuLuaActions);
            }

            if (other.funcRoomValidation != null)
            {
                funcRoomValidation = (Func<Room, bool>)other.funcRoomValidation.Clone();
            }

            if (other.requiredNestedObject != null)
            {
                requiredNestedObject = new List<NestedObjectRequirement>(other.requiredNestedObject);
            }

            if (other.ControlledNestedObject != null) 
            {
                ControlledNestedObject = new Dictionary<string, List<NestedObject>>(other.ControlledNestedObject);
            }

            LocalizationCode = other.LocalizationCode;
            UnlocalizedDescription = other.UnlocalizedDescription;
        }
Example #5
0
        public bool DesignateRoomBehavior(RoomBehavior objInstance)
        {
            if (objInstance == null)
            {
                return(false);
            }

            if (RoomBehaviors.ContainsKey(objInstance.Type))
            {
                return(false);
            }

            if (objInstance.IsValidRoom(this) == false)
            {
                Debug.ULogErrorChannel("Tile", "Trying to assign a RoomBehavior to a room that isn't valid!");
                return(false);
            }

            objInstance.Control(this);

            RoomBehaviors.Add(objInstance.Type, objInstance);

            return(true);
        }