示例#1
0
        private static LocationStateEntity ToEntity(ILocationState location, string cmdrName, string version)
        {
            return(new LocationStateEntity
            {
                CommanderName = cmdrName,
                GameVersion = version,
                TimeStamp = location.TimeStamp,

                StarSystem_Name = location.StarSystem?.Name,
                StarSystem_Coords_X = location.StarSystem?.Coords[0] ?? 0,
                StarSystem_Coords_Y = location.StarSystem?.Coords[1] ?? 0,
                StarSystem_Coords_Z = location.StarSystem?.Coords[2] ?? 0,

                Body_Name = location.Body?.Name,
                Body_Type = location.Body?.Type,
                Body_Docked = location.Body?.Docked,

                SurfaceLocation_Landed = location.SurfaceLocation?.Landed,
                SurfaceLocation_Latitude = location.SurfaceLocation?.Latitude,
                SurfaceLocation_Longitude = location.SurfaceLocation?.Longitude,

                Station_Name = location.Station?.Name,
                Station_Type = location.Station?.Type,

                SignalSource_Threat = location.SignalSource?.Threat,
                SignalSource_Type_Symbol = location.SignalSource?.Type.Symbol,
                SignalSource_Type_Text = location.SignalSource?.Type.Text
            });
        }
    public void ChangeState(string stateName)
    {
        if (this.CurrentState.Name == stateName)
        {
            return;
        }

        var newState = this.Locations.Find(l => l.Name == stateName);

        this.CurrentState = newState;
    }