| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- using System.Collections.Generic;
- namespace ScrapYard.API
- {
- public class ShopPlatform
- {
- public readonly ShopPlatformSpacingType Type;
- public readonly string Title;
- internal List<ShopPlatformEntry> Entries = new List<ShopPlatformEntry>();
- internal static List<ShopPlatform> ShopPlatforms = new List<ShopPlatform>();
- public static ShopPlatform DefaultObjects
- {
- get => ShopPlatforms[0];
- }
- public static ShopPlatform DefaultBlocks
- {
- get => ShopPlatforms[1];
- }
- public static ShopPlatform DefaultWalls
- {
- get => ShopPlatforms[2];
- }
- public ShopPlatform(string title, ShopPlatformSpacingType spacingType = ShopPlatformSpacingType.Normal)
- {
- this.Type = spacingType;
- this.Title = title;
- }
- public virtual ShopPlatform Register()
- {
- ShopPlatforms.Add(this);
- return this;
- }
- public ShopPlatformSpacingType GetShopPlatformSpacingType()
- {
- return Type;
- }
- public void AddShopPlatformEntry(ShopPlatformEntry row)
- {
- Entries.Add(row);
- }
- public void RemoveShopPlatformEntry(ShopPlatformEntry row)
- {
- Entries.Remove(row);
- }
- public ShopPlatformEntry[] GetShopPlatformEntries()
- {
- return Entries.ToArray();
- }
- public static ShopPlatform[] GetShopPlatforms()
- {
- return ShopPlatforms.ToArray();
- }
- internal int GetSpacesPerRow()
- {
- int spaces = 0;
- switch (Type)
- {
- case ShopPlatformSpacingType.Normal:
- spaces = 7;
- break;
- case ShopPlatformSpacingType.Near:
- spaces = 13;
- break;
- case ShopPlatformSpacingType.Far:
- spaces = 3;
- break;
- }
- return spaces;
- }
- internal int GetRowsNeeded()
- {
- return ((Entries.Count - 1) / GetSpacesPerRow()) + 1;
- }
- }
- public enum ShopPlatformSpacingType
- {
- Normal,
- Near,
- Far
- }
- }
|