public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 1: { m_House = reader.ReadItem() as BaseHouse; goto case 0; } case 0: { m_Description = reader.ReadString(); m_Marked = reader.ReadBool(); m_Target = reader.ReadPoint3D(); m_TargetMap = reader.ReadMap(); CalculateHue(); break; } } }
public LocationStruct(GenericReader reader) { int version = reader.ReadInt(); Map = reader.ReadMap(); Location = reader.ReadPoint3D(); Name = reader.ReadString(); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 3: case 2: { m_Level = reader.ReadInt(); goto case 1; } case 1: { m_TargetMap = reader.ReadMap(); break; } case 0: { m_TargetMap = Map.Felucca; break; } } if ( version < 2 ) m_Level = GetRandomLevel(); // if( version < 3 && m_TargetMap == Map.Tokuno ) // m_TargetMap = Map.Felucca; }
public JBrainNetwork(string id, double learningRate, double lambda, int hiddenLayers, int layerSize, Map map) { this.ID = id; FileInfo definition = new FileInfo(String.Format("JBrain_{0}.jbw", id)); if (definition.Exists) { Load(); } else { this.learningRate = learningRate; this.lambda = lambda; formerPrediction = 0; inputNeurons = map.Select(region => new InputNeuron(String.Format("ARMIES_{0}", region.ID))) .Concat(map.Select(region => new InputNeuron(String.Format("OWNER_{0}", region.ID)))).ToArray(); this.hiddenLayers = new Neuron[hiddenLayers][]; for (int i = 0; i < hiddenLayers; i++) { this.hiddenLayers[i] = Enumerable.Range(0, layerSize) .Select(j => new Neuron(String.Format("LAYER_{0}_HIDDEN_{1}", i, j), ((i > 0) ? this.hiddenLayers[i - 1] : inputNeurons))).ToArray(); } outputNeuron = new OutputNeuron("OUTPUT", ((hiddenLayers > 0) ? this.hiddenLayers.Last() : inputNeurons)); Save(); } }
public void Regenerate(bool rebuild = false) { float tStart = Time.realtimeSinceStartup; string path = levelDirectory + gameObject.name + ".asset"; if (!rebuild && Map.IsMap(path)) { map = Map.Read(path); } else { map = Map.Generate(new DepthFirstGenerator(width, height)); if (!Application.isPlaying) { map.SaveToFile(path); } } MeshFilter filter = GetComponent<MeshFilter>(); if (filter == null) gameObject.AddComponent<MeshFilter>(); ProceduralMesh pm = new ProceduralMesh(); pm.Generate(map); pm.Compile(); GetComponent<MeshCollider>().sharedMesh = pm.Mesh; filter.sharedMesh = pm.Mesh; float tEnd = Time.realtimeSinceStartup; float tTotal = tEnd - tStart; Debug.Log("Level Regenerate( Maze: " + rebuild + " ). Time: " + tTotal); }
public int GetMapHue( Map map ) { if ( map == Map.Felucca ) return 81; return 0; }
static Map LoadHeaderInternal( [NotNull] Stream stream ) { if( stream == null ) throw new ArgumentNullException( "stream" ); BinaryReader reader = new BinaryReader( stream ); // Read in the magic number if( reader.ReadUInt32() != Identifier ) { throw new MapFormatException(); } // Read in the map dimesions int width = reader.ReadInt16(); int length = reader.ReadInt16(); int height = reader.ReadInt16(); // ReSharper disable UseObjectOrCollectionInitializer Map map = new Map( null, width, length, height, false ); // ReSharper restore UseObjectOrCollectionInitializer // Read in the spawn location map.Spawn = new Position { X = reader.ReadInt16(), Y = reader.ReadInt16(), Z = reader.ReadInt16(), R = reader.ReadByte(), L = reader.ReadByte() }; return map; }
public static void SetHasBingLayers(Map o, bool value) { if (o == null) return; o.SetValue(HasBingLayersProperty, value); }
public static void FixMap(this PlayerMobile m, Map def, Point3D loc) { if (m == null || m.Deleted || def == null || def == Map.Internal || loc == Point3D.Zero) { return; } if (m.LogoutMap == null || m.LogoutMap == Map.Internal) { m.LogoutLocation = loc.ToPoint3D(); m.LogoutMap = def; } if (m.Map != null) { return; } if (IsOnline(m)) { m.MoveToWorld(loc, def); BaseCreature.TeleportPets(m, loc, def); } else { m.Location = loc; m.Internalize(); m.AutoStablePets(); } }
public void Effect( Point3D loc, Map map, bool checkMulti ) { if ( map == null || (!Core.AOS && Caster.Map != map) ) { Caster.SendLocalizedMessage( 1005570 ); // You can not gate to another facet. } else if ( !map.CanFit( loc.X, loc.Y, loc.Z, 16 ) ) { Caster.SendLocalizedMessage( 501942 ); // That location is blocked. } else if ( (checkMulti && SpellHelper.CheckMulti( loc, map )) ) { Caster.SendLocalizedMessage( 501942 ); // That location is blocked. } else if ( !SpellHelper.CheckTravel( Caster, loc, map, TravelType.Gate ) && Caster.AccessLevel == AccessLevel.Player ) { Caster.PlaySound( 0x5C ); } else if ( CheckSequence() ) { Caster.SendLocalizedMessage( 501024 ); // You open a magical gate to another location Effects.PlaySound( Caster.Location, Caster.Map, 0x20E ); InternalItem firstGate = new InternalItem( loc, map ); firstGate.MoveToWorld( Caster.Location, Caster.Map ); Effects.PlaySound( loc, map, 0x20E ); InternalItem secondGate = new InternalItem( Caster.Location, Caster.Map ); secondGate.MoveToWorld( loc, map ); } FinishSequence(); }
// RimWorld.AreaAllowedGUI public static void DoStockpileSelectors( Rect rect, ref Zone_Stockpile stockpile, Map map ) { // get all stockpiles List<Zone_Stockpile> allStockpiles = map.zoneManager.AllZones.OfType<Zone_Stockpile>().ToList(); // count + 1 for all stockpiles int areaCount = allStockpiles.Count + 1; // create colour swatch if ( textures == null || textures.Count != areaCount - 1 ) CreateTextures( allStockpiles ); float widthPerCell = rect.width / areaCount; Text.WordWrap = false; Text.Font = GameFont.Tiny; Rect nullAreaRect = new Rect( rect.x, rect.y, widthPerCell, rect.height ); DoZoneSelector( nullAreaRect, ref stockpile, null, BaseContent.GreyTex ); int areaIndex = 1; for( int j = 0; j < allStockpiles.Count; j++ ) { float xOffset = areaIndex * widthPerCell; Rect stockpileRect = new Rect( rect.x + xOffset, rect.y, widthPerCell, rect.height ); DoZoneSelector( stockpileRect, ref stockpile, allStockpiles[j], textures[j] ); areaIndex++; } Text.WordWrap = true; Text.Font = GameFont.Small; }
public TopicWorker(Factories.TopicFactory factory, Map map, Topic parentTopic, ITopicConnection connectionType) { _topic = factory.CreateTopic(map, parentTopic); _topicPointer = factory.CreateTopicPointer(connectionType); _topic.Pointer = _topicPointer; }
public void ShowMapWithPointLayerBasedOnFeatureDataTable() { var table = new FeatureDataTable(); table.Columns.Add("X", typeof(double)); table.Columns.Add("Y", typeof(double)); table.Columns.Add("Category", typeof(string)); DataRow row = table.NewRow(); table.Rows.Add(row); row.ItemArray = new object[] { 100000, 400000, "testCategory" }; row = table.NewRow(); table.Rows.Add(row); row.ItemArray = new object[] { 200000, 400000, "TestCategory" }; var dataTablePoint = new DataTablePoint(table, "Category", "X", "Y"); var vectorLayer = new VectorLayer("test", dataTablePoint); vectorLayer.Theme =ThemeFactory.CreateSingleFeatureTheme(vectorLayer.Style.GeometryType, Color.Blue, 10); var map = new Map { Name = "testmap" }; map.Layers.Add(vectorLayer); map.Center = new Coordinate(150000, 400000); map.Zoom = 200000; //map.ZoomToExtents(); //map.ZoomToBox(map.Envelope); MapTestHelper.Show(map); }
static Map LoadHeaderInternal( [NotNull] Stream stream ) { if( stream == null ) throw new ArgumentNullException( "stream" ); BinaryReader bs = new BinaryReader( stream ); // Read in the magic number if( bs.ReadByte() != 0xbe || bs.ReadByte() != 0xee || bs.ReadByte() != 0xef ) { throw new MapFormatException( "MinerCPP map header is incorrect." ); } // Read in the map dimesions // Saved in big endian for who-know-what reason. // XYZ(?) int width = IPAddress.NetworkToHostOrder( bs.ReadInt16() ); int height = IPAddress.NetworkToHostOrder( bs.ReadInt16() ); int length = IPAddress.NetworkToHostOrder( bs.ReadInt16() ); // ReSharper disable UseObjectOrCollectionInitializer Map map = new Map( null, width, length, height, false ); // ReSharper restore UseObjectOrCollectionInitializer // Read in the spawn location // XYZ(?) map.Spawn = new Position { X = IPAddress.NetworkToHostOrder( bs.ReadInt16() ), Z = IPAddress.NetworkToHostOrder( bs.ReadInt16() ), Y = IPAddress.NetworkToHostOrder( bs.ReadInt16() ), R = bs.ReadByte(), L = bs.ReadByte() }; // Skip over the block count, totally useless bs.ReadInt32(); return map; }
private bool UsingSelectedAttack; //Determines if an attack from a ship is being used for the turn (requires option 1) #endregion Fields #region Constructors /// <summary>Initializes a member of the advanced turn class. Used to define maps used and how extra turns are awarded for the turn sequence.</summary> /// <param name="Bonus">Determines if a turn is awarded for destroying a part of the opponent's ship.</param> /// <param name="Salvo">Determines if a turn is awarded for each of the players ships above one.</param> /// <param name="FriendlyMap">The player's map.</param /// <param name="EnemyMap">The opponent's map</param> public AdvancedTurn(bool Bonus, bool Salvo, Map FriendlyMap, Map EnemyMap) : base(Bonus, Salvo, FriendlyMap, EnemyMap) { SelectedOption = 0; SetSelectedIndex(); UsingSelectedAA = false; }
public MoleHideInfo( Point3D loc, Map map, Mobile user ) { m_Location = loc; m_Map = map; m_User = user; m_Count = 9; }
public HealthPickup(Screens.ScreenManager screenManager, Vector2 position, Map.Room parentRoom, Texture2D spriteSheet) : base(screenManager, position, parentRoom, spriteSheet) { Random rand = new Random(); if (rand.Next(0, 100) < 25) health = 2; if (health == 2) { sourceRect.X = 8 * 16; sourceRect.Y = 6 * 16; } else { sourceRect.X = 9 * 16; sourceRect.Y = 6 * 16; } sourceRect.Width = 16; sourceRect.Height = 16; collisionBox.x = (int)position.X; collisionBox.y = (int)position.Y; collisionBox.width = 32; collisionBox.height = 32; }
public static void Proc(ref Actor sActor, ref Actor dActor, ref Map.SkillArgs args) { byte level; ActorPC pc = (ActorPC)sActor; ActorEventHandlers.PC_EventHandler eh = (ActorEventHandlers.PC_EventHandler)pc.e; Tasks.PassiveSkillStatus ss; level = (byte)(args.skillID - baseID + 1); switch (SkillHandler.AddPassiveStatus(pc, "MentalPower", 3, out ss, new PassiveSkillStatus.DeactivateFunc(Deactivate))) { case PassiveStatusAddResult.WeaponMissMatch: if (ss != null) { BonusHandler.Instance.SkillAddAddition(pc, (uint)(baseID + ss.level - 1), true); } break; case PassiveStatusAddResult.Updated: BonusHandler.Instance.SkillAddAddition(pc, (uint)(baseID + ss.level - 1), true); BonusHandler.Instance.SkillAddAddition(pc, (uint)args.skillID, false); ss.level = level; break; case PassiveStatusAddResult.OK: ss.level = level; BonusHandler.Instance.SkillAddAddition(pc, (uint)args.skillID, false); break; } }
/// <summary> /// Initializes values and points on map /// </summary> public async void init() { key = await Map.GetSessionIdAsync(); _mapLayer = new MapLayer(); _map = Map; _map.Children.Add(_mapLayer); }
public static void RegisterMap( int mapIndex, int mapID, int fileIndex, int width, int height, int season, string name, MapRules rules ) { Map newMap = new Map( mapID, mapIndex, fileIndex, width, height, season, name, rules ); Map.Maps[mapIndex] = newMap; Map.AllMaps.Add( newMap ); }
private void AddPoint(Map controlMap, GeoCoordinate geo) { // With the new Map control: // Map -> MapLayer -> MapOverlay -> UIElements // - Add a MapLayer to the Map // - Add an MapOverlay to that layer // - We can add a single UIElement to that MapOverlay.Content MapLayer ml = new MapLayer(); MapOverlay mo = new MapOverlay(); // Add an Ellipse UI Ellipse r = new Ellipse(); r.Fill = new SolidColorBrush(Color.FromArgb(255, 240, 5, 5)); // the item is placed on the map at the top left corner so // in order to center it, we change the margin to a negative // margin equal to half the width and height r.Width = r.Height = 12; r.Margin = new Thickness(-6, -6, 0, 0); // Add the Ellipse to the Content mo.Content = r; // Set the GeoCoordinate of that content mo.GeoCoordinate = geo; // Add the MapOverlay to the MapLayer ml.Add(mo); // Add the MapLayer to the Map controlMap.Layers.Add(ml); }
public void Run(Action<string> emitError, Action<string> emitWarning, Map map) { /* first, check all the types implementing ISync */ foreach (var t in Game.modData.ObjectCreator.GetTypesImplementing<ISync>()) if (!HasAnySyncFields(t)) emitWarning("{0} has ISync but nothing marked with [Sync]".F(t.Name)); }
public FeatureLayerHelper(Map map, string name, FeatureLayer.QueryMode mode, bool visible) { this.FeatureLayer = (FeatureLayer)map.Layers.FirstOrDefault(layer => (layer is FeatureLayer) && ((FeatureLayer)layer).DisplayName.ToLower().Equals(name.ToLower())); if (this.FeatureLayer == null) { Log.Trace("Could not find layer with name '" + name + "'"); return; } this.FeatureLayer.Visible = visible; this.FeatureLayer.Mode = mode; this.FeatureLayer.AutoSave = false; this.Fields = QueryLayerFields(this.FeatureLayer); if (this.Fields == null) Log.Trace("Could not query layer fields '" + name + "'"); this.FeatureLayer.Initialized += FeatureLayer_Initialized; this.FeatureLayer.Initialize(); this.FeatureLayer.BeginSaveEdits += FeatureLayer_BeginSaveEdits; this.FeatureLayer.EndSaveEdits += FeatureLayer_EndSaveEdits; this.FeatureLayer.UpdateCompleted += FeatureLayer_UpdateCompleted; this.FeatureLayer.UpdateFailed += FeatureLayer_UpdateFailed; this.FeatureLayer.SaveEditsFailed += FeatureLayer_SaveEditsFailed; }
void Start() { // create the map singleton map = Map.Instance; // 9 rue Gentil, Lyon map.CenterWGS84 = new double[2] { 4.83527, 45.76487 }; map.UseLocation = true; map.InputsEnabled = true; // create a test layer TileLayer layer = map.CreateLayer<OSMTileLayer>("test tile layer"); layer.URLFormat = "http://a.tile.openstreetmap.org/{0}/{1}/{2}.png"; // create some test 2D markers GameObject go = Tile.CreateTileTemplate(); go.renderer.material.mainTexture = MarkerTexture; go.renderer.material.renderQueue = 4000; GameObject markerGO; markerGO = Instantiate(go) as GameObject; map.CreateMarker<Marker>("test marker - 9 rue Gentil, Lyon", new double[2] { 4.83527, 45.76487 }, markerGO); markerGO = Instantiate(go) as GameObject; map.CreateMarker<Marker>("test marker - 31 rue de la Bourse, Lyon", new double[2] { 4.83699, 45.76535 }, markerGO); markerGO = Instantiate(go) as GameObject; map.CreateMarker<Marker>("test marker - 1 place St Nizier, Lyon", new double[2] { 4.83295, 45.76468 }, markerGO); DestroyImmediate(go); }
public GargantuanMinion(Map.World world, PowerContext context, int GargID) : base(world, 122305, context.User, null) { Scale = 1f; //TODO: get a proper value for this. this.WalkSpeed *= 5; SetBrain(new MinionBrain(this)); (Brain as MinionBrain).AddPresetPower(30005); (Brain as MinionBrain).AddPresetPower(30001); (Brain as MinionBrain).AddPresetPower(30592); (Brain as MinionBrain).AddPresetPower(30550); Attributes[GameAttribute.Hitpoints_Max] = 5f; Attributes[GameAttribute.Hitpoints_Cur] = 5f; Attributes[GameAttribute.Attacks_Per_Second] = 1.0f; Attributes[GameAttribute.Damage_Weapon_Min, 0] = 5f; Attributes[GameAttribute.Damage_Weapon_Delta, 0] = 7f; Attributes[GameAttribute.Pet_Type] = 0x8; //Pet_Owner and Pet_Creator seems to be 0 (context.User as Player).InGameClient.SendMessage(new PetMessage() { Field0 = 0, Field1 = GargID, PetId = this.DynamicID, Field3 = 0x8, }); }
static void ProcessYaml(ModData modData, Map map, MiniYaml yaml, int engineDate, UpgradeAction processYaml) { if (yaml == null) return; if (yaml.Value != null) { var files = FieldLoader.GetValue<string[]>("value", yaml.Value); foreach (var filename in files) { var fileNodes = MiniYaml.FromStream(map.Open(filename), filename); processYaml(modData, engineDate, ref fileNodes, null, 0); // HACK: Obtain the writable save path using knowledge of the underlying filesystem workings var packagePath = filename; var package = map.Package; if (filename.Contains("|")) modData.DefaultFileSystem.TryGetPackageContaining(filename, out package, out packagePath); ((IReadWritePackage)package).Update(packagePath, Encoding.ASCII.GetBytes(fileNodes.WriteToString())); } } processYaml(modData, engineDate, ref yaml.Nodes, null, 1); }
public Form1() { _map = new MapAround.Mapping.Map(); InitializeComponent(); mapControl.Map = _map; }
public override void EnsureDefaults() { base.EnsureDefaults(); Location = DefLocation; Map = DefMap; }
public BreakableBlock(int x, int y, Sprite sprite, Map map) : base(x,y, sprite) { //this.Kill(); // Do not draw me this.collisionBlock = new CollisionBlock(x, y, sprite.Width, sprite.Height); map.ExtraCollisionBlocks.Add(collisionBlock); }
//This is the way we Listen for mob killing events. private bool OnKillListener(Map.World world, string group) { while (world.HasActorsInGroup(group)) { } return true; }
private async void SaveMapAsync(object sender, OnSaveMapEventArgs e) { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); // Get the current map Map myMap = _myMapView.Map; try { // Show the progress bar so the user knows work is happening _progressBar.Visibility = ViewStates.Visible; // Get information entered by the user for the new portal item properties string title = e.MapTitle; string description = e.MapDescription; string[] tags = e.Tags; // Apply the current extent as the map's initial extent myMap.InitialViewpoint = _myMapView.GetCurrentViewpoint(ViewpointType.BoundingGeometry); // Export the current map view for the item's thumbnail RuntimeImage thumbnailImg = await _myMapView.ExportImageAsync(); // See if the map has already been saved (has an associated portal item) if (myMap.Item == null) { // Call a function to save the map as a new portal item await SaveNewMapAsync(myMap, title, description, tags, thumbnailImg); // Report a successful save alertBuilder.SetTitle("Map saved"); alertBuilder.SetMessage("Saved '" + title + "' to ArcGIS Online!"); alertBuilder.Show(); } else { // This is not the initial save, call SaveAsync to save changes to the existing portal item await myMap.SaveAsync(); // Get the file stream from the new thumbnail image Stream imageStream = await thumbnailImg.GetEncodedBufferAsync(); // Update the item thumbnail ((PortalItem)myMap.Item).SetThumbnail(imageStream); await myMap.SaveAsync(); // Report update was successful alertBuilder.SetTitle("Updates saved"); alertBuilder.SetMessage("Saved changes to '" + myMap.Item.Title + "'"); alertBuilder.Show(); } } catch (Exception ex) { // Show the exception message alertBuilder.SetTitle("Unable to save map"); alertBuilder.SetMessage(ex.Message); alertBuilder.Show(); } finally { // Hide the progress bar _progressBar.Visibility = ViewStates.Invisible; } }
public CameraVisionCenter(Map map) : base(map) { }
public override void Update(Map map, (int, int) cords, List <Unit> area)
private async void Initialize() { // Get all the ColorRamp names from the PresetColorRampType Enumeration and put them // in an array of strings, then set the ComboBox.ItemSource to the array, and finally // select the first item in the ComboBox string[] myPresetColorRampTypes = System.Enum.GetNames(typeof(PresetColorRampType)); ColorRamps.ItemsSource = myPresetColorRampTypes; ColorRamps.SelectedIndex = 0; // Get all the SlopeType names from the SlopeType Enumeration and put them // in an array of strings, then set the ComboBox.ItemSource to the array, and finally // select the first item in the ComboBox string[] mySlopeTypes = System.Enum.GetNames(typeof(SlopeType)); SlopeTypes.ItemsSource = mySlopeTypes; SlopeTypes.SelectedIndex = 0; // Set the altitude slider min/max and initial value AltitudeSlider.Minimum = 0; AltitudeSlider.Maximum = 90; AltitudeSlider.Value = 45; // Set the azimuth slider min/max and initial value AzimuthSlider.Minimum = 0; AzimuthSlider.Maximum = 360; AzimuthSlider.Value = 180; // Load the raster file using a path on disk Raster myRasterImagery = new Raster(GetRasterPath_Imagery()); // Create the raster layer from the raster RasterLayer myRasterLayerImagery = new RasterLayer(myRasterImagery); // Create a new map using the raster layer as the base map Map myMap = new Map(new Basemap(myRasterLayerImagery)); try { // Wait for the layer to load - this enabled being able to obtain the extent information // of the raster layer await myRasterLayerImagery.LoadAsync(); // Create a new EnvelopeBuilder from the full extent of the raster layer EnvelopeBuilder myEnvelopBuilder = new EnvelopeBuilder(myRasterLayerImagery.FullExtent); // Zoom in the extent just a bit so that raster layer encompasses the entire viewable area of the map myEnvelopBuilder.Expand(0.75); // Set the viewpoint of the map to the EnvelopeBuilder's extent myMap.InitialViewpoint = new Viewpoint(myEnvelopBuilder.ToGeometry().Extent); // Add map to the map view MyMapView.Map = myMap; // Wait for the map to load await myMap.LoadAsync(); // Enable the 'Update Renderer' button now that the map has loaded UpdateRenderer.IsEnabled = true; } catch (Exception e) { await new MessageDialog2(e.ToString(), "Error").ShowAsync(); } }
public static void saveMap(Map map) { Debug.Log(DateTime.Now + " マップ\"" + map.mapname + "\"をセーブ中..."); aaa(map); Debug.Log(DateTime.Now + " マップをセーブしました"); }
// Use this for initialization void Start() { Map = new Map1(); }
public static void EventSink_Login(LoginEventArgs e) { Mobile from = e.Mobile; if (!IsStranded(from)) { return; } Map map = from.Map; Point2D[] list; if (map == Map.Felucca) { list = m_Felucca; } else if (map == Map.Trammel) { list = m_Trammel; } else if (map == Map.Ilshenar) { list = m_Ilshenar; } else if (map == Map.Tokuno) { list = m_Tokuno; } else { return; } Point2D p = Point2D.Zero; double pdist = double.MaxValue; for (int i = 0; i < list.Length; ++i) { double dist = from.GetDistanceToSqrt(list[i]); if (dist < pdist) { p = list[i]; pdist = dist; } } int x = p.X, y = p.Y; int z; bool canFit = false; z = map.GetAverageZ(x, y); canFit = map.CanSpawnMobile(x, y, z); for (int i = 1; !canFit && i <= 40; i += 2) { for (int xo = -1; !canFit && xo <= 1; ++xo) { for (int yo = -1; !canFit && yo <= 1; ++yo) { if (xo == 0 && yo == 0) { continue; } x = p.X + (xo * i); y = p.Y + (yo * i); z = map.GetAverageZ(x, y); canFit = map.CanSpawnMobile(x, y, z); } } } if (canFit) { from.Location = new Point3D(x, y, z); } }
private async void Initialize() { try { // Get the paths to resources used by the sample. string basemapTilePath = DataManager.GetDataFolder("567e14f3420d40c5a206e5c0284cf8fc", "streetmap_SD.tpk"); string networkGeodatabasePath = DataManager.GetDataFolder("567e14f3420d40c5a206e5c0284cf8fc", "sandiego.geodatabase"); // Create the tile cache representing the offline basemap. TileCache tiledBasemapCache = new TileCache(basemapTilePath); // Create a tiled layer to display the offline tiles. ArcGISTiledLayer offlineTiledLayer = new ArcGISTiledLayer(tiledBasemapCache); // Create a basemap based on the tile layer. Basemap offlineBasemap = new Basemap(offlineTiledLayer); // Create a new map with the offline basemap. Map theMap = new Map(offlineBasemap); // Set the initial viewpoint to show the routable area. theMap.InitialViewpoint = new Viewpoint(_routableArea); // Show the map in the map view. MyMapView.Map = theMap; // Create overlays for displaying the stops and the calculated route. _stopsOverlay = new GraphicsOverlay(); _routeOverlay = new GraphicsOverlay(); // Create a symbol and renderer for symbolizing the calculated route. SimpleLineSymbol routeSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.Blue, 2); _routeOverlay.Renderer = new SimpleRenderer(routeSymbol); // Add the stops and route overlays to the map. MyMapView.GraphicsOverlays.Add(_stopsOverlay); MyMapView.GraphicsOverlays.Add(_routeOverlay); // Create the route task, referring to the offline geodatabase with the street network. _offlineRouteTask = await RouteTask.CreateAsync(networkGeodatabasePath, "Streets_ND"); // Get the list of available travel modes. _availableTravelModes = _offlineRouteTask.RouteTaskInfo.TravelModes.ToList(); // Update the UI with the travel modes list. TravelModesCombo.ItemsSource = _availableTravelModes; TravelModesCombo.SelectedIndex = 0; // Create the default parameters. _offlineRouteParameters = await _offlineRouteTask.CreateDefaultParametersAsync(); // Display the extent of the road network on the map. DisplayBoundaryMarker(); // Now that the sample is ready, hook up the tapped and hover events. MyMapView.GeoViewTapped += MapView_Tapped; MyMapView.MouseMove += MapView_MouseMoved; TravelModesCombo.SelectionChanged += TravelMode_SelectionChanged; } catch (Exception e) { Debug.WriteLine(e); ShowMessage("Couldn't start sample", "There was a problem starting the sample. See debug output for details."); } }
public static bool IsSpace(this Map map) { return(map.terrainGrid.TerrainAt(IntVec3.Zero).defName == "HardVacuum"); }
protected override void OnTarget(Mobile from, object targeted) { IPoint3D p = targeted as IPoint3D; Map map = from.Map; if (p == null || map == null || m_Maker == null || m_Maker.Deleted) { return; } if (m_Maker.IsChildOf(from.Backpack)) { SpellHelper.GetSurfaceTop(ref p); BaseHouse house = null; Point3D loc = new Point3D(p); if (targeted is Item && !((Item)targeted).IsLockedDown && !((Item)targeted).IsSecure && !(targeted is AddonComponent)) { from.SendLocalizedMessage(1076191); // Statues can only be placed in houses. return; } else if (from.IsBodyMod) { from.SendLocalizedMessage(1073648); // You may only proceed while in your original state... return; } AddonFitResult result = CouldFit(loc, map, from, ref house); if (result == AddonFitResult.Valid) { CharacterStatue statue = new CharacterStatue(from, m_Type); CharacterStatuePlinth plinth = new CharacterStatuePlinth(statue); house.Addons.Add(plinth); if (m_Maker is IRewardItem) { statue.IsRewardItem = ((IRewardItem)m_Maker).IsRewardItem; } statue.Plinth = plinth; plinth.MoveToWorld(loc, map); statue.InvalidatePose(); /* * TODO: Previously the maker wasn't deleted until after statue * customization, leading to redeeding issues. Exact OSI behavior * needs looking into. */ m_Maker.Delete(); statue.Sculpt(from); from.CloseGump(typeof(CharacterStatueGump)); from.SendGump(new CharacterStatueGump(m_Maker, statue, from)); } else if (result == AddonFitResult.Blocked) { from.SendLocalizedMessage(500269); // You cannot build that there. } else if (result == AddonFitResult.NotInHouse) { from.SendLocalizedMessage(1076192); // Statues can only be placed in houses where you are the owner or co-owner. } else if (result == AddonFitResult.DoorTooClose) { from.SendLocalizedMessage(500271); // You cannot build near the door. } } else { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } }
public Mob(PlayerData opts, GameObject scene, Map map) : base(opts, scene, map) { this.type = EnumChange <Consts.EntityType> .EnumToString(Consts.EntityType.mob); }
public static SpaceAtmosphereMapComponent GetSpaceAtmosphereMapComponent(this Map map) { return(map.GetComponent <SpaceAtmosphereMapComponent>()); }
protected override bool TryCastShot() { bool result = false; bool arg_40_0; if (this.currentTarget != null && base.CasterPawn != null) { IntVec3 arg_29_0 = this.currentTarget.Cell; Vector3 vector = this.currentTarget.CenterVector3; arg_40_0 = this.currentTarget.Cell.IsValid; arg_41_0 = vector.InBounds(base.CasterPawn.Map); arg_42_0 = true; // vector.ToIntVec3().Standable(base.CasterPawn.Map); } else { arg_40_0 = false; } bool flag = arg_40_0; bool flag2 = arg_41_0; bool flag3 = arg_42_0; if (flag) { if (flag2 & flag3) { Pawn p = this.CasterPawn; Map map = this.CasterPawn.Map; IntVec3 cell = this.CasterPawn.Position; bool draftFlag = this.CasterPawn.Drafted; try { if (this.CasterPawn.IsColonist) { ModOptions.Constants.SetPawnInFlight(true); ThingSelectionUtility.SelectNextColonist(); this.CasterPawn.DeSpawn(); //p.SetPositionDirect(this.currentTarget.Cell); GenSpawn.Spawn(p, this.currentTarget.Cell, map); p.drafter.Drafted = draftFlag; if (base.CasterPawn.GetComp<CompAbilityUserMagic>().MagicData.MagicPowerSkill_Cantrips.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Cantrips_ver").level >= 1) { List<Pawn> eList = TM_Calc.FindPawnsNearTarget(p, 2, this.currentTarget.Cell, true); if(eList != null && eList.Count > 0) { for(int i = 0; i < eList.Count; i++) { Pawn e = eList[i]; TM_Action.DamageEntities(e, null, 5f, DamageDefOf.Stun, p); } } } CameraJumper.TryJumpAndSelect(p); ModOptions.Constants.SetPawnInFlight(false); } else { ModOptions.Constants.SetPawnInFlight(true); this.CasterPawn.DeSpawn(); GenSpawn.Spawn(p, this.currentTarget.Cell, map); ModOptions.Constants.SetPawnInFlight(false); } } catch { if(!this.CasterPawn.Spawned) { GenSpawn.Spawn(p, cell, map); Log.Message("Exception occured when trying to blink - recovered pawn at position ability was used from."); } } //this.Ability.PostAbilityAttempt(); //this.CasterPawn.SetPositionDirect(this.currentTarget.Cell); //base.CasterPawn.SetPositionDirect(this.currentTarget.Cell); //this.CasterPawn.pather.ResetToCurrentPosition(); result = true; } else { Messages.Message("InvalidTargetLocation".Translate(), MessageTypeDefOf.RejectInput); } } else { Log.Warning("failed to TryCastShot"); } this.burstShotsLeft = 0; //this.ability.TicksUntilCasting = (int)base.UseAbilityProps.SecondsToRecharge * 60; return result; }
public override void Render(Graphics g, Map map) { try { _shapeFile.Open(); var ds = new FeatureDataSet(); _shapeFile.ExecuteIntersectionQuery(map.Envelope, ds); var dt = ds.Tables[0]; foreach (FeatureDataRow fdr in dt.Rows) { if (fdr.Geometry.EnvelopeInternal.Intersects(map.Envelope)) { var file = fdr[_fieldName] as string; if (!Path.IsPathRooted(file)) { file = Path.Combine(Path.GetDirectoryName(_fileName), file); } if (file == null) { continue; } if (_logger.IsDebugEnabled) { _logger.Debug("Drawing " + file); } if (!_openDatasets.ContainsKey(file)) { OpenDataset(file); _openDatasets.Add(file, new CacheHolder() { Bands = Bands, Dataset = _gdalDataset, Envelope = _envelope, HistoBounds = HistoBounds, ImageSize = _imageSize, Projection = Projection }); } else { CacheHolder hld = _openDatasets[file]; Bands = hld.Bands; _gdalDataset = hld.Dataset; _envelope = hld.Envelope; HistoBounds = hld.HistoBounds; _imageSize = hld.ImageSize; Projection = hld.Projection; } base.Render(g, map); _envelope = null; _gdalDataset = null; } } } catch (Exception) { _shapeFile.Close(); } }
public TimeoutTeleporter(Point3D pointDest, Map mapDest, bool creatures) : base(pointDest, mapDest, creatures) { m_Teleporting = new Dictionary<Mobile, Timer>(); }
virtual public void setMap(Map map) { _map = map; }
/// <summary> /// Function to compute the required size for rendering the map decoration object /// <para>This is just the size of the decoration object, border settings are excluded</para> /// </summary> /// <param name="g">The graphics object</param> /// <param name="map">The map</param> /// <returns>The size of the map decoration</returns> protected override Size InternalSize(IGraphics g, Map map) { return(Size); }
public TimeoutTeleporter(Point3D pointDest, Map mapDest) : this(pointDest, mapDest, false) { }
public void SpawnFollowers(Mobile target) { Map map = this.Map; if (map == null) { return; } int followers = 0; foreach (Mobile m in this.GetMobilesInRange(10)) { if (m is EarthElemental || m is FireElemental || m is AirElemental || m is FireSteed || m is WaterElemental) { ++followers; } } if (this.Followers < 9) { this.PlaySound(0x218);////////// int newFollowers = Utility.RandomMinMax(1, 3); for (int i = 0; i < newFollowers; ++i) { BaseCreature follower; switch (Utility.Random(5)) { default: case 0: follower = new WaterElemental(); break; case 1: follower = new EarthElemental(); break; case 2: follower = new FireSteed(); break; case 3: follower = new FireElemental(); break; case 4: follower = new AirElemental(); break; } follower.Team = this.Team; bool validLocation = false; Point3D loc = this.Location; for (int j = 0; !validLocation && j < 9; ++j) { int x = this.X + Utility.Random(3) - 1; int y = this.Y + Utility.Random(3) - 1; int z = map.GetAverageZ(x, y); if (validLocation = map.CanFit(x, y, this.Z, 16, false, false)) { loc = new Point3D(x, y, this.Z); } else if (validLocation = map.CanFit(x, y, z, 16, false, false)) { loc = new Point3D(x, y, z); } } follower.MoveToWorld(loc, map); follower.Combatant = target; } } }
public FileNode Get(String FileName) { FileNode FileNode; return(Map.TryGetValue(FileName, out FileNode) ? FileNode : null); }
/// <summary> /// 检查指定点NPC当前是否可行走 /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public bool CanNPCWalk(int x, int y) { return Map.CanWalk(x, y) && GetNpcFromPosInMap(x, y) == null && !Context.PlayContext.PlayerCharacter.PosInMap.EqualsLocation(x, y); }
public void Insert(FileNode FileNode) { Set.Add(FileNode.FileName); Map.Add(FileNode.FileName, FileNode); TouchParent(FileNode); }
public override void SpawnSetup(Map map, bool respawningAfterLoad) { base.SpawnSetup(map, respawningAfterLoad); gasComp = GetComp <CompGasTrader>(); }
// SpawnSetup and checking power sources public override void SpawnSetup(Map map, bool respawningAfterLoad) { base.SpawnSetup(map, respawningAfterLoad); powerComp = base.GetComp<CompPowerTrader>(); flickableComp = base.GetComp<CompFlickable>(); }
private void Play_Executed(object sender, ExecutedRoutedEventArgs e) { e.Handled = true; Model.Map = Map.FromFile(Model.MapFile); }
public void GenerateMap() { currentMap = maps[mapIndex]; tileMap = new Transform[currentMap.mapSize.x, currentMap.mapSize.y]; System.Random prng = new System.Random(currentMap.seed); // generating coords allTileCoords = new List <Coord>(); for (int x = 0; x < currentMap.mapSize.x; x++) { for (int y = 0; y < currentMap.mapSize.y; y++) { allTileCoords.Add(new Coord(x, y)); } } shuffledTileCoords = new Queue <Coord>(Utility.ShuffleArray(allTileCoords.ToArray(), currentMap.seed)); // the previous tiles need to be deleted before generating new ones, hence string holderName = "Generator Map"; // the string which will store the name of the gameobject if (transform.Find(holderName)) { // using DestroyImmediate() because it needs to be called from the editor DestroyImmediate(transform.Find(holderName).gameObject); // destroy the gameobject associated with the holdername string } Transform mapHolder = new GameObject(holderName).transform; mapHolder.parent = transform; //parenting the new mapholder to the parent script // spawning tiles for (int x = 0; x < currentMap.mapSize.x; x++) { for (int y = 0; y < currentMap.mapSize.y; y++) { Vector3 tilePosition = CoordToPosition(x, y); // the tile or quad has to be rotated on the x axis by 90 degrees as it faces us Transform newTile = Instantiate(tilePrefab, tilePosition, Quaternion.Euler(Vector3.right * 90)) as Transform; newTile.localScale = Vector3.one * (1 - outlinePercent) * tileSize; newTile.parent = mapHolder; // parenting the new tile to the mapholder, hierarchy matters, I guess... tileMap[x, y] = newTile; } } // spawning obstacles bool[,] obstacleMap = new bool[(int)currentMap.mapSize.x, (int)currentMap.mapSize.y]; int obstacleCount = (int)(currentMap.mapSize.x * currentMap.mapSize.y * currentMap.obstaclePercent); int currentObstacleCount = 0; List <Coord> allOpenCoords = new List <Coord>(allTileCoords); for (int i = 0; i < obstacleCount; i++) { Coord randomCoord = getRandomCoord(); obstacleMap[randomCoord.x, randomCoord.y] = true; currentObstacleCount++; if (randomCoord != currentMap.mapCentre && MapIsFullyAccessible(obstacleMap, currentObstacleCount)) { float obstacleHeight = Mathf.Lerp(currentMap.minObstacleHeight, currentMap.maxObstacleHeight, (float)prng.NextDouble()); Vector3 obstaclePosition = CoordToPosition(randomCoord.x, randomCoord.y); Transform newObstacle = Instantiate(obstaclePrefab, obstaclePosition + Vector3.up * obstacleHeight / 2, Quaternion.identity) as Transform; newObstacle.parent = mapHolder; newObstacle.localScale = new Vector3(((1 - outlinePercent) * tileSize), obstacleHeight, ((1 - outlinePercent) * tileSize)); Renderer obstacleRenderer = newObstacle.GetComponent <Renderer>(); Material obstacleMaterial = new Material(obstacleRenderer.sharedMaterial); float colorPercent = randomCoord.y / (float)currentMap.mapSize.y; obstacleMaterial.color = Color.Lerp(currentMap.foregroundColor, currentMap.backgroundColor, colorPercent); obstacleRenderer.sharedMaterial = obstacleMaterial; allOpenCoords.Remove(randomCoord); } else { obstacleMap[randomCoord.x, randomCoord.y] = false; currentObstacleCount--; } } shuffledOpenTileCoords = new Queue <Coord>(Utility.ShuffleArray(allOpenCoords.ToArray(), currentMap.seed)); // creating a navmesh mask Transform maskLeft = Instantiate(navMeshMaskPrefab, Vector3.left * (currentMap.mapSize.x + maxMapSize.x) / 4f * tileSize, Quaternion.identity) as Transform; maskLeft.parent = mapHolder; maskLeft.localScale = new Vector3((maxMapSize.x - currentMap.mapSize.x) / 2f, 1, currentMap.mapSize.y) * tileSize; Transform maskRight = Instantiate(navMeshMaskPrefab, Vector3.right * (currentMap.mapSize.x + maxMapSize.x) / 4f * tileSize, Quaternion.identity) as Transform; maskRight.parent = mapHolder; maskRight.localScale = new Vector3((maxMapSize.x - currentMap.mapSize.x) / 2f, 1, currentMap.mapSize.y) * tileSize; Transform maskTop = Instantiate(navMeshMaskPrefab, Vector3.forward * (currentMap.mapSize.y + maxMapSize.y) / 4f * tileSize, Quaternion.identity) as Transform; maskTop.parent = mapHolder; maskTop.localScale = new Vector3(maxMapSize.x, 1, (maxMapSize.y - currentMap.mapSize.y) / 2f) * tileSize; Transform maskBot = Instantiate(navMeshMaskPrefab, Vector3.back * (currentMap.mapSize.y + maxMapSize.y) / 4f * tileSize, Quaternion.identity) as Transform; maskBot.parent = mapHolder; maskBot.localScale = new Vector3(maxMapSize.x, 1, (maxMapSize.y - currentMap.mapSize.y) / 2f) * tileSize; navmeshFloor.localScale = new Vector3(maxMapSize.x, maxMapSize.y) * tileSize; mapFloor.localScale = new Vector3(currentMap.mapSize.x * tileSize, currentMap.mapSize.y * tileSize); }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!Validate(attacker) || (Contexts != null && Contexts.Any(c => c.Attacker == attacker))) { return; } ClearCurrentAbility(attacker); Map map = attacker.Map; if (map == null) { return; } BaseWeapon weapon = attacker.Weapon as BaseWeapon; if (weapon == null) { return; } if (!CheckMana(attacker, true)) { return; } attacker.FixedEffect(0x3728, 10, 15); attacker.PlaySound(0x2A1); List <Mobile> list = SpellHelper.AcquireIndirectTargets(attacker, attacker, attacker.Map, 1) .OfType <Mobile>() .Where(m => attacker.InRange(m, weapon.MaxRange) && m != defender).ToList(); int count = list.Count; if (count > 0) { double bushido = attacker.Skills.Bushido.Value; int bonus = 0; if (bushido > 0) { bonus = (int)Math.Min(100, ((list.Count * bushido) * (list.Count * bushido)) / 3600); } var context = new WhirlwindAttackContext(attacker, list, bonus); AddContext(context); attacker.RevealingAction(); foreach (Mobile m in list) { attacker.SendLocalizedMessage(1060161); // The whirling attack strikes a target! m.SendLocalizedMessage(1060162); // You are struck by the whirling attack and take damage! weapon.OnHit(attacker, m); } RemoveContext(context); } ColUtility.Free(list); weapon.ProcessingMultipleHits = false; }
public virtual void DoEffect(Point3D loc, Map map) { Effects.SendLocationParticles(EffectItem.Create(loc, map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052); Effects.PlaySound(loc, map, 0x225); }
public void PlacementWarning_Callback( Mobile from, bool okay, object state ) { if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null ) return; PreviewHouse prevHouse = (PreviewHouse)state; if ( !okay ) { prevHouse.Delete(); return; } if ( prevHouse.Deleted ) { /* Too much time has passed and the test house you created has been deleted. * Please try again! */ from.SendGump( new NoticeGump( 1060637, 30720, 1060647, 32512, 320, 180, null, null ) ); return; } Point3D center = prevHouse.Location; Map map = prevHouse.Map; prevHouse.Delete(); ArrayList toMove; //Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z ); HousePlacementResult res = HousePlacement.Check( from, m_MultiID, center, out toMove, false ); switch ( res ) { case HousePlacementResult.Valid: { if ( from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse( from ) ) from.SendLocalizedMessage( 501271 ); // You already own a house, you may not place another! else if (from is PlayerMobile && ((PlayerMobile)from).Young) from.SendMessage("Young players may not place houses. You must renounce your young status first."); else { BaseHouse house = ConstructHouse( from ); if ( house == null ) return; house.Price = m_Cost; if ( from.AccessLevel >= AccessLevel.GameMaster ) from.SendMessage( "{0} gold would have been withdrawn from your bank if you were not a GM.", m_Cost.ToString() ); else { if ( Banker.Withdraw( from, m_Cost ) ) from.SendLocalizedMessage( 1060398, m_Cost.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box. else { house.RemoveKeys( from ); house.Delete(); from.SendLocalizedMessage( 1060646 ); // You do not have the funds available in your bank box to purchase this house. Try placing a smaller house, or adding gold or checks to your bank box. return; } } house.MoveToWorld( center, from.Map ); for ( int i = 0; i < toMove.Count; ++i ) { object o = toMove[i]; if ( o is Mobile ) ( (Mobile)o ).Location = house.BanLocation; else if ( o is Item ) ( (Item)o ).Location = house.BanLocation; } } break; } case HousePlacementResult.BadItem: case HousePlacementResult.BadLand: case HousePlacementResult.BadStatic: case HousePlacementResult.BadRegionHidden: case HousePlacementResult.NoSurface: { from.SendLocalizedMessage( 1043287 ); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain. break; } case HousePlacementResult.BadRegion: { from.SendLocalizedMessage( 501265 ); // Housing cannot be created in this area. break; } case HousePlacementResult.BadRegionTemp: { from.SendLocalizedMessage( 501270 ); //Lord British has decreed a 'no build' period, thus you cannot build this house at this time. break; } case HousePlacementResult.BadRegionRaffle: { from.SendLocalizedMessage( 1150493 ); // You must have a deed for this plot of land in order to build here. break; } case HousePlacementResult.InvalidCastleKeep: { from.SendLocalizedMessage( 1061122 ); // Castles and keeps cannot be created here. break; } } }
private async void Initialize() { // Create a map with a light gray canvas basemap. Map sampleMap = new Map(Basemap.CreateLightGrayCanvas()); // Assign the map to the MapView. MyMapView.Map = sampleMap; // Define the Url string for the US highways feature layer. string highwaysUrlString = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/1"; // Create a service feature table from the url to the US highways feature service. ServiceFeatureTable highwaysServiceFeatureTable = new ServiceFeatureTable(new System.Uri(highwaysUrlString)); // Create a feature layer from the service feature table. FeatureLayer highwaysFeatureLayer = new FeatureLayer(highwaysServiceFeatureTable); // Add the US highways feature layer to the operations layers collection of the map. sampleMap.OperationalLayers.Add(highwaysFeatureLayer); // Load the US highways feature layer - this way we can obtain it's extent. await highwaysFeatureLayer.LoadAsync(); // Zoom the map view to the extent of the US highways feature layer. await MyMapView.SetViewpointGeometryAsync(highwaysFeatureLayer.FullExtent); // Help regarding the Json syntax for defining the LabelDefinition.FromJson syntax can be found here: // https://developers.arcgis.com/web-map-specification/objects/labelingInfo/ // This particular JSON string will have the following characteristics: // (1) The 'labelExpressionInfo' defines that the label text displayed comes from the field 'rte_num1' in the // feature service and will be prefaced with an "I -". Example: "I - 10", "I - 15", "I - 95", etc. // (2) The 'labelPlacement' will be placed above and along the highway polyline segment. // (3) The 'where' clause restricts the labels to be displayed that has valid (non-empty) data. Empty data // for this service has a single blank space in the 'rte_num1' field. // (4) The 'symbol' for the labeled text will be blue with a yellow halo. string theJSON_String = @"{ ""labelExpressionInfo"":{""expression"":""'I - ' + $feature.rte_num1""}, ""labelPlacement"":""esriServerLinePlacementAboveAlong"", ""where"":""rte_num1 <> ' '"", ""symbol"": { ""angle"":0, ""backgroundColor"":[0,0,0,0], ""borderLineColor"":[0,0,0,0], ""borderLineSize"":0, ""color"":[0,0,255,255], ""font"": { ""decoration"":""none"", ""size"":15, ""style"":""normal"", ""weight"":""normal"" }, ""haloColor"":[255,255,0,255], ""haloSize"":1.5, ""horizontalAlignment"":""center"", ""kerning"":false, ""type"":""esriTS"", ""verticalAlignment"":""middle"", ""xoffset"":0, ""yoffset"":0 } }"; // Create a label definition from the JSON string. LabelDefinition highwaysLabelDefinition = LabelDefinition.FromJson(theJSON_String); // Add the label definition to the feature layer's label definition collection. highwaysFeatureLayer.LabelDefinitions.Add(highwaysLabelDefinition); // Enable the visibility of labels to be seen. highwaysFeatureLayer.LabelsEnabled = true; }