Ejemplo n.º 1
0
 public Rooted(uint _uid, Entity _affected)
     : base(_uid, _affected)
 {
     name = "Rooted";
     description = "You can not move.";
     icon = "status_stun";
 }
Ejemplo n.º 2
0
 public void AddParticleSystem(Entity ent, string systemName)
 {
     ParticleSettings settings = IoCManager.Resolve<IResourceManager>().GetParticles(systemName);
     if (settings != null)
     {
         //Add it.
     }
 }
Ejemplo 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;
 }
Ejemplo 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);
        }
Ejemplo 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;
     } 
 }
Ejemplo n.º 6
0
 public void SendDropEntity(Entity ent)
 {
     Owner.SendComponentNetworkMessage(this, NetDeliveryMethod.ReliableOrdered,
                                       ComponentMessageType.DropEntityInHand, ent.Uid);
 }
Ejemplo n.º 7
0
 public void SendInventoryRemove(Entity ent)
 {
     Owner.SendComponentNetworkMessage(this, NetDeliveryMethod.ReliableUnordered,
                                       ComponentMessageType.InventoryRemove, ent.Uid);
 }
Ejemplo n.º 8
0
 public bool ContainsEntity(Entity entity)
 {
     return ContainedEntities.Contains(entity);
 }
Ejemplo 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();
        }
Ejemplo n.º 10
0
        public override void OnAdd(Entity owner)
        {
            base.OnAdd(owner);

            _light.SetState(LightState.Off);
        }