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

            _buttons.Clear();
            _owningEntity = null;

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

            base.Dispose();
        }
예제 #10
0
        public override void OnAdd(Entity owner)
        {
            base.OnAdd(owner);

            _light.SetState(LightState.Off);
        }