public static Vector3Payload FromVector3(Vector3 v) { var item = new Vector3Payload(); item.x = v.x; item.y = v.y; item.z = v.z; return(item); }
public static PlayerPayload FromPlayerConnection(PlayerConnection connection) { var payload = new PlayerPayload(); PlayerDetail playerDetail; if (PlayerInfoManager.Instance.GetPlayer(connection.SteamId, out playerDetail)) { payload.playerName = playerDetail.PlayerName; payload.ping = playerDetail.PingMs; payload.score = playerDetail.Score; payload.playTime = PlayerInfoManager.Instance.GetPlayTime(playerDetail.StartPlayTime); } payload.location = Vector3Payload.FromVector3(connection.Brain.ParentHuman.transform.position); payload.steamName = connection.SteamName; payload.steamId = connection.SteamId.ToString(); return(payload); }
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); }