예제 #1
0
        private void Start()
        {
            PUN2Vendor <IItemInstance> _vendor = null;

            if (PhotonNetwork.LocalPlayer.IsMasterClient)
            {
                collection = PUN2CollectionUtility.CreateServerVendorItemCollection(Math.Max(this._itemDefs.Length, this._slotCount), _vendorCollectionName, _vendorCollectionGuid.guid, this.photonView);
                foreach (var itemDef in _itemDefs)
                {
                    if (itemDef == null)
                    {
                        continue;
                    }

                    var inst = ItemFactory.CreateInstance(itemDef, Guid.NewGuid());
                    var prod = new VendorProduct <IItemInstance>(inst, itemDef.buyPrice, itemDef.sellPrice);
                    collection.Add(prod);
                }

                _vendor = new PUN2Vendor <IItemInstance>(_vendorGuid.guid, _vendorCollectionName, _vendorCollectionGuid.guid, _config, this.photonView, collection, new InfiniteCurrencyCollection()); // TODO: Make currency customizable

                //if (PhotonNetwork.LocalPlayer.IsMasterClient)
                ServerVendorRegistry.itemVendors.Register(_vendorGuid.guid, _vendor);
            }

            // Create on new vendor here for "client" purposes. This way, changing one vendor ('client' or 'server') doesn't affect the other.
            _vendor = new PUN2Vendor <IItemInstance>(_vendorGuid.guid, _vendorCollectionName, _vendorCollectionGuid.guid, _config, this.photonView, collection, new InfiniteCurrencyCollection()); // TODO: Make currency customizable
            VendorRegistry.itemVendors.Register(_vendorGuid.guid, _vendor);
        }
예제 #2
0
//        [ServerCallback]
        private void Start()
        {
            if (isServer)
            {
                collection = UNetCollectionUtility.CreateServerVendorItemCollection(10, _vendorCollectionName, _vendorCollectionGuid.guid, _identity);
                foreach (var itemDef in _itemDefs)
                {
                    if (itemDef == null)
                    {
                        continue;
                    }

                    var inst = ItemFactory.CreateInstance(itemDef, Guid.NewGuid());
                    var prod = new VendorProduct <IItemInstance>(inst, itemDef.buyPrice, itemDef.sellPrice);
                    collection.Add(prod);
                }
            }

            _vendor = new UNetVendor <IItemInstance>(_vendorGuid.guid, _vendorCollectionName, _vendorCollectionGuid.guid, _identity, collection, new InfiniteCurrencyCollection()); // TODO: Make currency customizable

            if (isServer)
            {
                ServerVendorRegistry.itemVendors.Register(_vendorGuid.guid, _vendor);
            }

            if (isClient)
            {
                VendorRegistry.itemVendors.Register(_vendorGuid.guid, _vendor);
            }
        }
예제 #3
0
        public object Clone()
        {
            var prod = new VendorProduct <T>((T)item.Clone(), buyPrice, sellPrice);

//            prod.collectionEntry = collectionEntry;

            return(prod);
//            return MemberwiseClone();
        }
예제 #4
0
 public bool Equals(VendorProduct <T> other)
 {
     return(Equals((IVendorProduct <T>)other));
 }