예제 #1
0
        //-----------------------------------------------------------------------------
        // Description
        //-----------------------------------------------------------------------------

        public void ResetDescription()
        {
            ISlotItem item = currentSlotGroup.CurrentSlot.SlotItem;

            description  = FormatCodes.FormatString(item != null ? item.Name : "");
            textPosition = 0;
            textTimer    = 0;
            textStart    = 0;
            if (!description.IsEmpty)
            {
                if (description.Length % 2 == 1)
                {
                    description.Add(' ');
                }

                if (description.Length == 16)
                {
                    description.Add(' ');
                    textStart = 0;
                }
                else
                {
                    for (int i = (8 - description.Length / 2); i > 0; i--)
                    {
                        description.Add(' ');
                    }
                    textStart = (16 - description.Length) * 8;
                }

                description.AddRange(FormatCodes.FormatString(item.Description));
            }
        }
예제 #2
0
 //-----------------------------------------------------------------------------
 // Constructor
 //-----------------------------------------------------------------------------
 public Slot(SlotGroup group, Point2I position, int width)
 {
     this.group			= group;
     this.position		= position;
     this.width			= width;
     this.connections	= new ISlotConnection[4];
     this.item			= null;
     this.disabled		= false;
 }
예제 #3
0
파일: Slot.cs 프로젝트: radtek/ZeldaOracle
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------

        public Slot(SlotGroup group, Point2I position, int width)
        {
            this.group       = group;
            this.position    = position;
            this.width       = width;
            this.connections = new ISlotConnection[4];
            this.item        = null;
            this.disabled    = false;
        }
예제 #4
0
파일: Ship.cs 프로젝트: sTsUA/TestTask
        /// <summary>
        /// Ставим предмет в слот
        /// </summary>
        public bool TrySetItemToSlot(ISlotItem slotItem)
        {
            for (int i = 0; i < _slots.Length; i++)
            {
                if (_slots[i].TryPutItem(slotItem))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #5
0
        //-----------------------------------------------------------------------------
        // Slots
        //-----------------------------------------------------------------------------

        public Slot GetSlotWithItem(ISlotItem item)
        {
            for (int i = 0; i < slotGroups.Count; i++)
            {
                for (int j = 0; j < slotGroups[i].NumSlots; j++)
                {
                    if (slotGroups[i].GetSlotAt(j).SlotItem == item)
                    {
                        return(slotGroups[i].GetSlotAt(j));
                    }
                }
            }
            return(null);
        }
예제 #6
0
 //-----------------------------------------------------------------------------
 // Items
 //-----------------------------------------------------------------------------
 // Sets the item for the slot.
 public void SetItem(ISlotItem item)
 {
     this.item = item;
 }
예제 #7
0
파일: Slot.cs 프로젝트: kitfka/AlleyCat
 public virtual bool AllowedFor(ISlotItem context) => !AllowedCondition.Exists(c => !c.Matches(context));
예제 #8
0
        public virtual bool AllowedFor(ISlotItem context)
        {
            Ensure.Any.IsNotNull(context, nameof(context));

            return(_allowedFor == null || _allowedFor.Matches(context));
        }
예제 #9
0
파일: Slot.cs 프로젝트: radtek/ZeldaOracle
        //-----------------------------------------------------------------------------
        // Items
        //-----------------------------------------------------------------------------

        // Sets the item for the slot.
        public void SetItem(ISlotItem item)
        {
            this.item = item;
        }
예제 #10
0
 //-----------------------------------------------------------------------------
 // Slots
 //-----------------------------------------------------------------------------
 public Slot GetSlotWithItem(ISlotItem item)
 {
     for (int i = 0; i < slotGroups.Count; i++) {
         for (int j = 0; j < slotGroups[i].NumSlots; j++) {
             if (slotGroups[i].GetSlotAt(j).SlotItem == item) {
                 return slotGroups[i].GetSlotAt(j);
             }
         }
     }
     return null;
 }