Exemplo n.º 1
0
 public static void WriteStationContactProperties(StationContact contact, StationContactPayload payload)
 {
     contact.Angle           = Vector3Payload.ToVector3(payload.angle);
     contact.ContactName     = payload.contactName;
     contact.ContactType     = payload.contactType;
     contact.Lifetime        = payload.lifetime;
     contact.EndLifetime     = payload.endLifetime;
     contact.InitialLifeTime = payload.initialLifeTime;
     // TODO: Deserialize inventory data.
     //contact.TraderInventoryDict = payload.traderInventoryDict;
     //contact.SerializedTraderInventory = payload.serializedTraderInventory;
 }
Exemplo n.º 2
0
        public static StationContactPayload FromStationContact(StationContact contact)
        {
            var payload = new StationContactPayload
            {
                angle                   = Vector3Payload.FromVector3(contact.Angle),
                contactName             = contact.ContactName,
                contactType             = contact.ContactType,
                lifetime                = contact.Lifetime,
                endLifetime             = contact.EndLifetime,
                initialLifeTime         = contact.InitialLifeTime,
                contactID               = contact.ContactID,
                humanTradingSteamID     = contact.HumanTradingSteamID,
                currentlyTrading        = contact.CurrentlyTrading,
                connectedPadReferenceId = contact.ConnectedPad?.ReferenceId.ToString(),
                tradeInventory          = contact.TraderInventoryDict.Select(
                    item => new { Key = item.Key, Value = TradingItemPayload.FromTradingItemDat(item.Value) }
                    ).ToDictionary(item => item.Key, item => item.Value)
            };

            return(payload);
        }