Esempio n. 1
0
        public override void AddComponent(IComponent c)
        {
            base.AddComponent(c);
            ServerCharacterComponent com = c as ServerCharacterComponent;

            if (com != null)
            {
                Stats.UpdateWithValues(com.AddedStats);

                if (com.AddedProperties != null)
                {
                    // initial copy of properties
                    Properties.UpdateWithValues(com.AddedProperties);

                    // be notified of future updates. Two-way binding
                    com.AddedProperties.SubscribeToChangeNotifications(this);
                    Properties.SubscribeToChangeNotifications(com);
                }

                if (com.AddedStats != null)
                {
                    // initial copy of properties
                    Stats.UpdateWithValues(com.AddedStats);

                    // be notified of future updates. Two-way binding.
                    com.AddedStats.SubscribeToChangeNotifications(this);
                    Stats.SubscribeToChangeNotifications(com);
                }
            }
        }
Esempio n. 2
0
        protected virtual void OnGamePropertiesUpdate(INetworkConnection con, PacketGamePropertiesUpdateNotification msg)
        {
            if (msg.PropertyBagId == Properties.ID)
            {
                if (msg.Remove)
                {
                    Properties.RemoveProperties(msg.Properties);
                }
                else
                {
                    Properties.UpdateWithValues(msg.Properties);
                }
            }

            Log.LogMsg(">>> Game Properties Updated: " + msg.Properties.Length.ToString());
        }