public Customer(Guid id, object character, CollectionGroup <T> inventories, CurrencyCollectionGroup <ICurrency> currencies) { ID = id; this.character = character; this.inventories = inventories; this.currencies = currencies; }
// public CollectionGroup<IItemInstance> serverItemCollectionGroup { get; set; } // public CollectionGroup<IEquippableItemInstance, IEquipmentCollection<IEquippableItemInstance>> serverEquipmentCollectionGroup { get; set; } // public CurrencyCollectionGroup<ICurrency> serverCurrencyCollectionGroup { get; set; } public UNetInventoryPlayer() { logger = new UnityLogger("[UNet][player] "); itemCollectionGroup = new CollectionGroup <IItemInstance>(); equipmentCollectionGroup = new CollectionGroup <IEquippableItemInstance, IEquipmentCollection <IEquippableItemInstance> >(); currencyCollectionGroup = new CurrencyCollectionGroup <ICurrency>(); }
protected virtual void DrawCurrencyCollections(InventoryPlayer t, CurrencyCollectionGroup <ICurrency> g) { using (new VerticalLayoutBlock("box")) { GUILayout.Label(new GUIContent("Currencies"), UnityEditor.EditorStyles.boldLabel); foreach (var collection in g.collections) { DrawCollection(collection.collection, collection.priority.GetGeneralPriority()); } } }
public void Setup() { UnityEngine.Assertions.Assert.raiseExceptions = true; _col1 = new CurrencyCollection(); _col2 = new CurrencyCollection(); _group = new CurrencyCollectionGroup <ICurrency>(new CurrencyCollectionGroup <ICurrency> .Slot[] { new CurrencyCollectionGroup <ICurrency> .Slot(_col1, new CurrencyCollectionPriority <ICurrency>()), new CurrencyCollectionGroup <ICurrency> .Slot(_col2, new CurrencyCollectionPriority <ICurrency>(60, 60, 60)), }); _gold = new Currency(Guid.NewGuid(), "Gold", "GOLD", 2, 999d); _silver = new Currency(Guid.NewGuid(), "Silver", "Silver", 2, 999d); }
public override void OnEnter() { var customerWrapper = ScriptableObject.CreateInstance <ItemVendorCustomerWrapper>(); var character = (Character)characterObject.Value; var inventories = character.GetComponent <IInventoryCollectionOwner>()?.itemCollectionGroup; var currencyCollections = character.GetComponent <ICurrencyCollectionOwner>()?.currencyCollectionGroup; if (inventories == null) { inventories = new CollectionGroup <IItemInstance>(); LogWarning(nameof(IInventoryCollectionOwner) + " not found on character. Using empty group."); } if (currencyCollections == null) { currencyCollections = new CurrencyCollectionGroup <ICurrency>(); LogWarning(nameof(ICurrencyCollectionOwner) + " not found on character. Using empty group."); } customerWrapper.customer = new Customer <IItemInstance>(System.Guid.Parse(customerGuid.Value), character, inventories, currencyCollections); customerResult = customerWrapper; Finish(); }