public PavlovServerController(SshServerSerivce service, UserService userService, PavlovServerService pavlovServerService, ServerBansService serverBansService, ServerSelectedMapService serverSelectedMapService, MapsService mapsService, SshServerSerivce sshServerSerivce, ServerSelectedWhitelistService whitelistService, SteamIdentityStatsServerService steamIdentityStatsServerService, ServerSelectedModsService serverSelectedModsService, SteamIdentityService steamIdentityService, UserManager <LiteDbUser> userManager, IToastifyService notyfService) { _notifyService = notyfService; _service = service; _userservice = userService; _pavlovServerService = pavlovServerService; _serverSelectedMapService = serverSelectedMapService; _serverBansService = serverBansService; _steamIdentityStatsServerService = steamIdentityStatsServerService; _mapsService = mapsService; _whitelistService = whitelistService; _steamIdentityService = steamIdentityService; _sshServerSerivce = sshServerSerivce; _serverSelectedModsService = serverSelectedModsService; UserManager = userManager; }
/// <summary> /// Use <see cref="MapsService"/> to load geometry. /// </summary> private void Start() { // Get required MapsService component on this GameObject. MapsService mapsService = GetComponent <MapsService>(); // Set real-world location to load. mapsService.InitFloatingOrigin(LatLng); // Configure Map Styling. GameObjectOptions options = new GameObjectOptions(); options.RegionStyle = RegionStyleSettings.Apply(options.RegionStyle); options.SegmentStyle = RoadStyleSettings.Apply(options.SegmentStyle); options.AreaWaterStyle = WaterStyleSettings.Apply(options.AreaWaterStyle); options.ExtrudedStructureStyle = ExtrudedStructureStyleSettings.Apply(options.ExtrudedStructureStyle); options.ModeledStructureStyle = ModeledStructureStyleSettings.Apply(options.ModeledStructureStyle); // Load map with default options. Bounds bounds = new Bounds(Vector3.zero, Vector3.one * LoadRange); mapsService.LoadMap(bounds, options); }
/// <summary> /// Get <see cref="MapsService"/> and use it to load geometry. /// </summary> private void Start() { // Get required Maps Service component on this GameObject. MapsService mapsService = GetComponent <MapsService>(); // Set location to load. mapsService.InitFloatingOrigin(LatLng); // Create a roads style that defines a material for roads and for borders of roads. The specific // border material used is chosen to look just a little darker than the material of the ground // plane (helping the roads to visually blend into the surrounding ground). SegmentStyle roadsStyle = new SegmentStyle.Builder { Material = Roads, BorderMaterial = RoadEdges, Width = 7.0f, BorderWidth = 1.0f }.Build(); // Get default style options. GameObjectOptions renderingStyles = ExampleDefaults.DefaultGameObjectOptions; // Replace default roads style with new, just created roads style. renderingStyles.SegmentStyle = roadsStyle; // Load map with desired options. mapsService.LoadMap(ExampleDefaults.DefaultBounds, renderingStyles); }
/// <summary> /// Get <see cref="MapsService"/> and use it to load geometry, searching for the given Place Id /// in all extruded buildings. /// </summary> private void Start() { // Make sure a Place Id has been given. if (string.IsNullOrEmpty(PlaceId)) { // Note: 'name' and 'GetType()' just give the name of the GameObject this script is on, and // the name of this script respectively. Debug.LogErrorFormat("No Place Id defined for {0}.{1}, which needs a Place Id to operate!", name, GetType()); return; } // Get required Maps Service component on this GameObject. MapsService mapsService = GetComponent <MapsService>(); // Set location to load. mapsService.InitFloatingOrigin(LatLng); // Sign up to event that will be called after each extruded building is created, so can check // the Place Id of this building and adjust its height if required. mapsService.Events.ExtrudedStructureEvents.DidCreate.AddListener(CheckGeometry); // Load map with default options. mapsService.LoadMap(ExampleDefaults.DefaultBounds, ExampleDefaults.DefaultGameObjectOptions); }
public MapServiceTests() { services = new ServicesBuilder(); _mocker = new AutoMocker(); services.Build(_mocker); _mapsService = _mocker.CreateInstance <MapsService>(); }
public void Init(SecretsService secretsService, MapsService mapsService, Canvas worldCanvas, DiContainer container) { this.secretsService = secretsService; this.mapsService = mapsService; this.worldCanvas = worldCanvas; _container = container; }
/// <summary> /// Use <see cref="MapsService"/> to load geometry, displaying error icon in the center of any /// area that failed to load. /// </summary> private void Start() { // Get required Dynamic Maps Service component on this GameObject. MapsService = GetComponent <DynamicMapsService>().MapsService; MapsService.Events.MapEvents.LoadError.AddListener(OnMapLoadError); MapsService.Events.MapEvents.Progress.AddListener(OnMapLoadProgress); }
protected override void Awake() { base.Awake(); _mapsService = FindObjectOfType <MapsService>(); _animator = GetComponent <Animator>(); _button = GetComponent <Button>(); }
void Awake() { // Subscribe to intersection and segment events. MapsService mapsService = GetComponent <MapsService>(); mapsService.Events.IntersectionEvents.WillCreate.AddListener(OnWillCreateIntersection); mapsService.Events.SegmentEvents.WillCreate.AddListener(OnWillCreateSegment); }
protected void Awake() { Service = GetComponent <MapsService>(); Service.ApiKey = LocalEnvironments.APIKey; // この辺はStartメソッドでやらないと駄目らしい。 //Service.InitFloatingOrigin(new LatLng(Lat, Lng)); //Service.LoadMap(DefaultBounds, DefaultGameObjectOptions); }
public ViewportService(MapsService mapsService, PanAndZoom cameraControl, DynamicMapsUpdater mapsUpdater, SignalBus signalBus) { this.mapsService = mapsService; this.cameraControl = cameraControl; this.mapsUpdater = mapsUpdater; _signalBus = signalBus; movedObjects = new List <GameObject>(); }
public async void StartObservingGame(string token, string roomId) { bool isMyTurn = await MapsService.IsMyTurn(token, roomId); if (isMyTurn != PlayerState) { PlayerState = isMyTurn; } }
public MapsServiceTests() { var externalHttpRequests = new Mock <IExternalHttpRequests>(); var googleMapsOptions = Options.Create(new GoogleMapsOptions { ApiKey = string.Empty }); _mapsService = new MapsService(externalHttpRequests.Object, googleMapsOptions); }
void Awake() { TrafficSystem = GetComponent <TrafficSystem>(); // Subscribe to segment and road lattice events. MapsService mapsService = GetComponent <MapsService>(); mapsService.Events.SegmentEvents.DidCreate.AddListener(OnSegmentCreated); mapsService.Events.RoadLatticeEvents.DidModify.AddListener(OnRoadLatticeModified); }
public ServerSelectedMapServiceTests() { services = new ServicesBuilder(); _mocker = new AutoMocker(); services.Build(_mocker); _serverSelectedMapService = _mocker.CreateInstance <ServerSelectedMapService>(); _sshServerSerivce = _mocker.CreateInstance <SshServerSerivce>(); _pavlovServerService = _mocker.CreateInstance <PavlovServerService>(); _mapsService = _mocker.CreateInstance <MapsService>(); }
private void Start() { PlayableLocationsService = gameObject.AddComponent <PlayableLocationsService>(); MapsService.EnableVerboseLogging(true); ReportBadPointExample(); ReportImpressions(); }
/// <summary> /// Triggered when a valid location info is returned from the Unity Input locations service. /// </summary> /// <param name="locationInfo">Location Info</param> private void OnLocationServicesEvalComplete(LocationInfo locationInfo) { if (HasGPSLocation) // aka we were able to get a valid GPS location { LatLng = new LatLng(locationInfo.latitude, locationInfo.longitude); MapsService.MoveFloatingOrigin(LatLng); Avatar.transform.position = MapsService.Coords.FromLatLngToVector3(LatLng); } base.LoadMap(); }
/// <summary> /// Get the required <see cref="DynamicMapsService"/> on this <see cref="GameObject"/>, waiting /// until is has initialized before loading a 300km circle around the center of Korea at zoom /// level 6. /// </summary> private void Awake() { DynamicMapsService dynamicMapsService = GetComponent <DynamicMapsService>(); dynamicMapsService.OnMapLoadStarted.AddListener(() => { MapsService mapsService = dynamicMapsService.MapsService; mapsService.MakeMapLoadRegion() .AddCircle(mapsService.Coords.FromLatLngToVector3(KoreaCenter), 300000) .Load(dynamicMapsService.RenderingStyles, 6); }); }
public SshServerController(SshServerSerivce service, UserService userService, ServerSelectedMapService serverSelectedMapService, MapsService mapsService, PavlovServerService pavlovServerService, IConfiguration configuration) { _service = service; _userservice = userService; _serverSelectedMapService = serverSelectedMapService; _mapsService = mapsService; _pavlovServerService = pavlovServerService; _configuration = configuration; }
/// <summary> /// Use <see cref="MapsService"/> to load geometry. /// </summary> private void Start() { // Get required Maps Service component on this GameObject. MapsService mapsService = GetComponent <MapsService>(); // Set real-world location to load. mapsService.InitFloatingOrigin(LatLng); // Load map with default options. mapsService.LoadMap(Bounds, ExampleDefaults.DefaultGameObjectOptions); }
public PublicViewListsController(PavlovServerPlayerHistoryService pavlovServerPlayerHistoryService, UserService userService, PavlovServerService pavlovServerService, PublicViewListsService publicViewListsService, MatchService matchService, MapsService mapsService) { _pavlovServerPlayerHistoryService = pavlovServerPlayerHistoryService; _userService = userService; _pavlovServerService = pavlovServerService; _publicViewListsService = publicViewListsService; _matchService = matchService; _mapsService = mapsService; }
/// <summary> /// Use <see cref="MapsService"/> to load geometry. /// </summary> private void Start() { // Get required Maps Service component on this GameObject. MapsService mapsService = GetComponent <MapsService>(); // Set real-world location to load. mapsService.InitFloatingOrigin(LatLng); mapsService.Events.SegmentEvents.WillCreate.AddListener(WillCreateHandler); // Load map with default options. mapsService.LoadMap(ExampleDefaults.DefaultBounds, ExampleDefaults.DefaultGameObjectOptions); }
/// <summary> /// Follow player's real-world location, as derived from the device's GPS signal. /// </summary> private IEnumerator Follow() { // If location is allowed by the user, start the location service and compass, otherwise abort // the coroutine. #if PLATFORM_IOS // The location permissions request in IOS does not seem to get invoked until it is called for // in the code. It happens at runtime so if the code is not trying to access the location // right away, it will not pop up the permissions dialog. Input.location.Start(); #endif while (!Input.location.isEnabledByUser) { Debug.Log("Waiting for location services to become enabled.."); yield return(new WaitForSeconds(1f)); } Debug.Log("Location services is enabled."); #if !PLATFORM_IOS Input.location.Start(); #endif Input.compass.enabled = true; // Wait for the location service to start. while (true) { if (Input.location.status == LocationServiceStatus.Initializing) { // Starting, just wait. yield return(new WaitForSeconds(1f)); } else if (Input.location.status == LocationServiceStatus.Failed) { // Failed, abort the coroutine. Debug.LogError("Location Services failed to start."); yield break; } else if (Input.location.status == LocationServiceStatus.Running) { // Started, continue the coroutine. break; } } // Get the MapsService component and load it at the device location. PreviousLocation = new LatLng(Input.location.lastData.latitude, Input.location.lastData.longitude); MapsService = GetComponent <MapsService>(); MapsService.InitFloatingOrigin(PreviousLocation); MapsService.LoadMap(ExampleDefaults.DefaultBounds, ExampleDefaults.DefaultGameObjectOptions); }
private void Awake() { if (!tag.Equals("MainCamera")) { Destroy(this); } _mapsService = FindObjectOfType <MapsService>(); _floatingOrigin = CameraPositionOnGroundPlane; _objectsToRecenter = new List <GameObject> { gameObject }; }
public MapsController( ILogger <HomeController> logger, PointsService pointsService, DistancesService distanceService, MapsService mapService, UserManager <ApplicationUser> userManager) { _logger = logger; _pointsService = pointsService; _distanceService = distanceService; _mapService = mapService; _userManager = userManager; }
/// <summary> /// Use <see cref="MapsService"/> to load geometry. /// </summary> private void Start() { // Get required MapsService component on this GameObject. MapsService mapsService = GetComponent <MapsService>(); // Set real-world location to load. mapsService.InitFloatingOrigin(LatLng); // Register a listener to be notified when the map is loaded. mapsService.Events.MapEvents.Loaded.AddListener(OnLoaded); // Load map with default options. mapsService.LoadMap(ExampleDefaults.DefaultBounds, ExampleDefaults.DefaultGameObjectOptions); }
/// <summary> /// Use <see cref="MapsService"/> to load geometry, setting the widths of all roads by their /// type. /// </summary> private void Awake() { // Get the required Maps Service on this GameObject. MapsService mapsService = GetComponent <MapsService>(); // Sign up to event called whenever an error occurs. Note that this event must be set now // during Awake, so that when Dynamic Maps Service starts loading the map during Start, this // event will be triggered on any error. mapsService.Events.MapEvents.LoadError.AddListener(args => { // Check for the most common errors, showing specific error message in these cases. switch (args.DetailedErrorCode) { case MapLoadErrorArgs.DetailedErrorEnum.NetworkError: // Handle errors caused by a lack of internet connectivity (or other network problems). if (Application.internetReachability == NetworkReachability.NotReachable) { Debug.LogError("The Maps SDK for Unity must have internet access in order to run."); } else { Debug.LogErrorFormat( "The Maps SDK for Unity was not able to get a HTTP response after " + "{0} attempts.\nThis suggests an issue with the network, or with the " + "online Semantic Tile API, or that the request exceeded its deadline " + "(consider using MapLoadErrorArgs.TimeoutSeconds).\n{1}", args.Attempts, string.IsNullOrEmpty(args.Message) ? string.Concat("Specific error message received: ", args.Message) : "No error message received."); } return; // Handle errors caused by the specific version of the Maps SDK for Unity being used. case MapLoadErrorArgs.DetailedErrorEnum.UnsupportedClientVersion: Debug.LogError( "The specific version of the Maps SDK for Unity being used is no longer " + "supported (possibly in combination with the specific API key used)."); return; } // For all other types of errors, just show the given error message, as this should describe // the specific nature of the problem. Debug.LogError(args.Message); // Note that the Maps SDK for Unity will automatically retry failed attempts, unless // args.Retry is specifically set to false during this callback. }); }
/// <summary> /// Setup <see cref="MapsService"/>. Give buildings mesh colliders and make them explodeable. /// </summary> private void MapsServiceSetup() { MapsService = GetComponent <MapsService>(); MapsService.Events.ExtrudedStructureEvents.DidCreate.AddListener(args => { // Assign every building a mesh collider, so player and bullets can collide with them. MeshFilter meshFilter = args.GameObject.GetComponent <MeshFilter>(); MeshCollider collider = args.GameObject.AddComponent <MeshCollider>(); collider.sharedMesh = meshFilter.sharedMesh; // Assign every building a building exploder. BuildingExploder exploder = args.GameObject.AddComponent <BuildingExploder>(); exploder.ChunkMaterial = BuildingChunkMaterial; }); }
/// <summary> /// Configures the map. /// </summary> private void Start() { MapsService mapsService = GetComponent <MapsService>(); mapsService.InitFloatingOrigin(LoadingCenter); Material adminAreaMaterial = BaseMapMaterialUtils.CreateUniformColoredMaterial(AdminAreaColor); // Configure the map to only show prefectures and texture them with a solid color. mapsService.Events.RegionEvents.WillCreate.AddListener(args => { if (args.MapFeature.Metadata.Usage == RegionMetadata.UsageType.AdministrativeArea1) { RegionStyle.Builder style = args.Style.AsBuilder(); style.FillMaterial = adminAreaMaterial; args.Style = style.Build(); } else { args.Cancel = true; } }); // When a prefecture GameObject is created, create an extruded outline for it. Material borderMaterial = null; mapsService.Events.RegionEvents.DidCreate.AddListener(args => { if (borderMaterial == null) { // Set up the border material based on the prefecture material, but change the render queue // so that it renders on top. borderMaterial = new Material(args.GameObject.GetComponent <Renderer>().material); borderMaterial.color = BorderColor; borderMaterial.renderQueue++; } Extruder.AddAreaExternalOutline(args.GameObject, borderMaterial, args.MapFeature.Shape, BorderWidth); }); // Don't display water. mapsService.Events.AreaWaterEvents.WillCreate.AddListener(args => { args.Cancel = true; }); // Load the map around Japan. mapsService.MakeMapLoadRegion() .AddCircle(mapsService.Coords.FromLatLngToVector3(LoadingCenter), 2000000) // 2,000 km. .Load(ExampleDefaults.DefaultGameObjectOptions, 5); // Zoom level 5. }
/// <summary> /// Use <see cref="MapsService"/> to load geometry, setting the widths of all roads by their type. /// </summary> private void Awake() { // Get the required Maps Service on this GameObject. MapsService mapsService = GetComponent <MapsService>(); // Sign up to event called whenever an error occurs. Note that this event must be set now during // Awake, so that when Dynamic Maps Service starts loading the map during Start, this event will // be triggered on any error. mapsService.Events.MapEvents.LoadError.AddListener(args => { // Check for the most common errors, showing specific error message in these cases. switch (args.DetailedErrorCode) { case MapLoadErrorArgs.DetailedErrorEnum.NetworkError: // Debug.LogError("This demo version only works with offline data"); // DONT LOG NETWORK ERRORS. Musk lite shouldn't have access to the internet. // Handle errors caused by a lack of internet connectivity (or other network problems). // if (Application.internetReachability == NetworkReachability.NotReachable) { // Debug.LogError("The Maps Unity SDK must have internet access in order to run."); // } else { // Debug.LogErrorFormat("The Maps Unity SDK was not able to get a HTTP response after {0} " // + "attempts.\nThis suggests an issue with the network, or with the online Vector " // + "Tile API, or that the request exceeded its deadline (consider using " // + "MapLoadErrorArgs.TimeoutSeconds).\n{1}", // args.Attempts, string.IsNullOrEmpty(args.Message) // ? string.Concat("Specific error message received: ", args.Message) // : "No error message received."); // } return; // Handle errors caused by the specific version of the Maps Unity SDK being used. case MapLoadErrorArgs.DetailedErrorEnum.UnsupportedClientVersion: string url = "https://cloud.google.com/maps-platform/gaming/"; Debug.LogError( "This demo has expired. " + "Please visit " + url + " for more information."); // Debug.LogError("The specific version of the Maps Unity SDK being used is no longer " // + "supported (possibly in combination with the specific API key used)."); return; } // For all other types of errors, just show the given error message, as this should describe // the specific nature of the problem. Debug.LogError(args.DetailedErrorCode + ": " + args.Message); // Note that the Maps Unity SDK will automatically retry failed attempts, unless args.Retry // is specifically set to false during this callback. }); }