示例#1
0
        public Item Equip(Item equippable, EquipmentSlot slot)
        {
            if (equippable.SlotKind != slot.Kind || !Slots.Contains(slot))
            {
                return(null);
            }

            Item previousItem = null;

            if (SlotsInUse.Contains(slot))
            {
                previousItem = _equipped[slot];
            }


            _equipped[slot] = equippable;
            SlotsInUse.Add(slot);

            OnEquipped?.Invoke(slot, equippable);

            if (previousItem != null)
            {
                OnUnequipped?.Invoke(slot, previousItem);
            }

            return(previousItem);
        }
示例#2
0
 public bool IsSellable(Slot s)
 {
     return(s != null &&
            Slots.Contains(s) &&
            s.Product != null &&
            _totalAmount >= s.Product.Price &&
            s.Quantity > 0);
 }
        public void Removeinterval(int Start, int End)
        {
            for (int i = Start; i <= End; i++)
            {
                Slots[i] = false;
            }

            if (Slots.Contains(true))
            {
                isFreeDay = false;
            }
            else
            {
                isFreeDay = true;
            }
            GetNoHours();
        }
示例#4
0
 //印出棋盤
 public void Print()
 {
     for (var y = 1; y <= GRID_SIZE; y++)
     {
         for (var x = 1; x <= GRID_SIZE; x++)
         {
             var pos = x * DIG_SHIFT + y;
             if (QueenPositions.Contains(pos))
             {
                 Console.ForegroundColor = ConsoleColor.Red;
             }
             else
             {
                 Console.ForegroundColor =
                     Slots.Contains(pos) ? ConsoleColor.White : ConsoleColor.Yellow;
             }
             Console.Write("█ ");
         }
         Console.WriteLine();
     }
     Console.ResetColor();
 }
        public List <Hollow> Generate(ulong seed)
        {
            var  hollows       = new List <Hollow>();
            uint startingFrame = Functions.initialPIDRNGBW2(seed);

            uint[] rngArray = FillRNGArray(startingFrame, seed);

            for (uint i = 0; i <= MaxAdvances; ++i)
            {
                uint offset = i;
                for (ushort h = 0; h < OpenHollows; ++h)
                {
                    // hollow check
                    if (Functions.RNGRange(rngArray[offset++], 100) >= 5)
                    {
                        continue;
                    }
                    Hollow hollow = GenerateHollow(rngArray, offset);
                    // if it's not what we're searching for skip it, null = show all
                    if (Hollows != null && !Hollows.Contains(h))
                    {
                        continue;
                    }
                    if ((Slots != null && !Slots.Contains(hollow.Slot)) ||
                        (SubSlots != null && !SubSlots.Contains(hollow.SubSlot)))
                    {
                        continue;
                    }
                    // gender filter goes here
                    switch (GenderRatio)
                    {
                    case 60:
                        if (hollow.Female60 != Gender)
                        {
                            continue;
                        }
                        break;

                    case 30:
                        if (hollow.Female30 != Gender)
                        {
                            continue;
                        }
                        break;

                    case 10:
                        if (hollow.Female10 != Gender)
                        {
                            continue;
                        }
                        break;

                    case 5:
                        if (hollow.Female5 != Gender)
                        {
                            continue;
                        }
                        break;
                    }

                    hollow.Seed          = seed;
                    hollow.StartingFrame = startingFrame;
                    hollow.Frame         = startingFrame + i;
                    hollow.HollowNumber  = h;
                    hollows.Add(hollow);
                }
            }

            return(hollows);
        }