Esempio n. 1
0
 public Rooted(uint _uid, Entity _affected)
     : base(_uid, _affected)
 {
     name = "Rooted";
     description = "You can not move.";
     icon = "status_stun";
 }
Esempio n. 2
0
 public void AddParticleSystem(Entity ent, string systemName)
 {
     ParticleSettings settings = IoCManager.Resolve<IResourceManager>().GetParticles(systemName);
     if (settings != null)
     {
         //Add it.
     }
 }
Esempio n. 3
0
 public ExampleEffect(uint _uid, Entity _affected)
     //Do not add more parameters to the constructors or bad things happen.
     : base(_uid, _affected)
 {
     name = "Example Effect";
     description = "This is an example...";
     icon = "status_example";
     isDebuff = false;
 }
Esempio n. 4
0
        public ContextMenu(Entity entity, Vector2D creationPos, IResourceManager resourceManager,
                           IUserInterfaceManager userInterfaceManager, bool showExamine = true)
        {
            _owningEntity = entity;
            _resourceManager = resourceManager;
            _userInterfaceManager = userInterfaceManager;

            var entries = new List<ContextMenuEntry>();
            var replies = new List<ComponentReplyMessage>();

            entity.SendMessage(this, ComponentMessageType.ContextGetEntries, replies);

            if (replies.Any())
                entries =
                    (List<ContextMenuEntry>)
                    replies.First(x => x.MessageType == ComponentMessageType.ContextGetEntries).ParamsList[0];

            if (showExamine)
            {
                var examineButton =
                    new ContextMenuButton(
                        new ContextMenuEntry
                            {ComponentMessage = "examine", EntryName = "Examine", IconName = "context_eye"}, _buttonSize,
                        _resourceManager);
                examineButton.Selected += ContextSelected;
                _buttons.Add(examineButton);
                examineButton.Update(0);
            }

            var sVarButton =
                new ContextMenuButton(
                    new ContextMenuEntry {ComponentMessage = "svars", EntryName = "SVars", IconName = "context_eye"},
                    _buttonSize, _resourceManager);
            sVarButton.Selected += ContextSelected;
            _buttons.Add(sVarButton);
            sVarButton.Update(0);

            foreach (ContextMenuEntry entry in entries)
            {
                var newButton = new ContextMenuButton(entry, _buttonSize, _resourceManager);
                newButton.Selected += ContextSelected;
                _buttons.Add(newButton);
                newButton.Update(0);
            }

            float currY = creationPos.Y;
            foreach (ContextMenuButton button in _buttons)
            {
                button.Position = new Point((int) creationPos.X, (int) currY);
                currY += _buttonSize.Y;
            }
            ClientArea = new Rectangle((int) creationPos.X, (int) creationPos.Y, (int) _buttonSize.X,
                                       _buttons.Count()*(int) _buttonSize.Y);
        }
Esempio n. 5
0
 private void SetNewState(ItemComponentState state)
 {
     if(state.Holder != null && (Holder == null || Holder.Uid != state.Holder))
     {
         Holder = Owner.EntityManager.GetEntity((int)state.Holder);
         HoldingHand = state.InventoryLocation;
     }
     if(Holder != null && state.Holder == null)
     {
         Holder = null;
         HoldingHand = state.InventoryLocation;
     } 
 }
Esempio n. 6
0
 public void SendDropEntity(Entity ent)
 {
     Owner.SendComponentNetworkMessage(this, NetDeliveryMethod.ReliableOrdered,
                                       ComponentMessageType.DropEntityInHand, ent.Uid);
 }
Esempio n. 7
0
 public void SendInventoryRemove(Entity ent)
 {
     Owner.SendComponentNetworkMessage(this, NetDeliveryMethod.ReliableUnordered,
                                       ComponentMessageType.InventoryRemove, ent.Uid);
 }
Esempio n. 8
0
 public bool ContainsEntity(Entity entity)
 {
     return ContainedEntities.Contains(entity);
 }
Esempio n. 9
0
        public override void Dispose()
        {
            foreach (ContextMenuButton button in _buttons)
                button.Dispose();

            _buttons.Clear();
            _owningEntity = null;

            _userInterfaceManager.RemoveFocus();
            _userInterfaceManager.RemoveComponent(this);

            base.Dispose();
        }
Esempio n. 10
0
        public override void OnAdd(Entity owner)
        {
            base.OnAdd(owner);

            _light.SetState(LightState.Off);
        }