public InfoGeometry(IGeometry geometry, StyleSpecification styleSpecification, MapCore map, EnhancedMapLayer layer)
     : base(geometry, styleSpecification, map, layer)
 {
     //must have at least one EnhancedMapPoint to show label and launch balloon.
     foreach (var mapObject in mapObjects)
     {
         if (mapObject is EnhancedMapPoint)
         {
             var mapPoint = (EnhancedMapPoint)mapObject;
             if (mainPoint == null)
             {
                 mainPoint = mapPoint;
             }
             mapPoint.Balloon += (o, e) => Balloon(this, new BalloonEventArgs { LayerID = layer.ID, ItemID = ItemID });
         }
     }
     if (mainPoint == null)
     {
         //TODO: create one, invisible at centre of first object
         var point = geometry.Centroid;
         mainPoint = createPoint(point, layer);
         mainPoint.Balloon += (o, e) => Balloon(this, new BalloonEventArgs { LayerID = layer.ID, ItemID = ItemID });
     }
     Selected += InfoGeometry_Selected;
 }
Beispiel #2
0
 public Map()
 {
     _mapCore = new MapCore(this);
     Configure();
     MapFunctions.Add(new MapFunctionZoom (this));
     OnSizeChanged (this, new EventArgs());
 }
 public BaseGeometry(IGeometry geometry, StyleSpecification styleSpecification, MapCore map, EnhancedMapLayer layer)
 {
     Geometry = geometry;
     StyleSpecification = styleSpecification;
     mapInstance = map;
     mapLayer = layer;
     mapObjects = new ObservableCollection<Control>();
     if (mapLayer != null)
     {
         createGeometry(mapLayer, Geometry);
     }
 }
Beispiel #4
0
        public Core()
        {
            Offline = true;
            user = UserInfo.GetYou();
            userList = new UserList();

            monsterList = new MonsterList();
            monsterUserList = new MonsterList();
            userList = new UserList();
            areaList = new AreaList();
            //garden = new Garden.Garden();
            mapCore = new MapCore(user);
            Shop = new Shop();
        }
        public bool FieldHasData()
        {
            MapCore mapCore = this.GetMapCore();

            if (mapCore != null && mapCore.IsDesignMode())
            {
                if (this.Collection == mapCore.GroupFields)
                {
                    foreach (Group group in mapCore.Groups)
                    {
                        if (group[this.Name] != null)
                        {
                            return(true);
                        }
                    }
                }
                else if (this.Collection == mapCore.ShapeFields)
                {
                    foreach (Shape shape in mapCore.Shapes)
                    {
                        if (shape[this.Name] != null)
                        {
                            return(true);
                        }
                    }
                }
                else if (this.Collection == mapCore.PathFields)
                {
                    foreach (Path path in mapCore.Paths)
                    {
                        if (path[this.Name] != null)
                        {
                            return(true);
                        }
                    }
                }
                else if (this.Collection == mapCore.SymbolFields)
                {
                    foreach (Symbol symbol in mapCore.Symbols)
                    {
                        if (symbol[this.Name] != null)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
 public void Simplify(MapCore map, double resolution)
 {
     if (resolution <= 0.0)
     {
         return;
     }
     foreach (Shape shape in map.Shapes)
     {
         Simplify(shape, resolution);
     }
     foreach (Path path in map.Paths)
     {
         Simplify(path, resolution);
     }
 }
        public override bool IsVisible()
        {
            MapCore mapCore = base.GetMapCore();
            bool    result  = true;

            if (mapCore != null && this.DockedInsideViewport)
            {
                result = mapCore.Viewport.Visible;
            }
            if (base.IsVisible())
            {
                return(result);
            }
            return(false);
        }
        public PointF GetCenterPointInContentPixels(MapGraphics g)
        {
            MapCore mapCore = this.GetMapCore();

            if (mapCore == null)
            {
                return(PointF.Empty);
            }
            MapPoint centralPoint = this.CentralPoint;

            centralPoint.X += this.CentralPointOffset.X;
            centralPoint.Y += this.CentralPointOffset.Y;
            PointF relative = mapCore.GeographicToPercents(centralPoint).ToPointF();

            return(g.GetAbsolutePoint(relative));
        }
Beispiel #9
0
 internal void InternalZoomLevelChanged()
 {
     try
     {
         internalZoomChange = true;
         MapCore mapCore = GetMapCore();
         if (mapCore != null && mapCore.Viewport != null && !fixThumbPoition)
         {
             mapCore.Viewport.Zoom = (float)GetZoomLevelFromPointerPosition(Pointer.Value);
         }
     }
     finally
     {
         internalZoomChange = false;
     }
 }
 public void InternalZoomLevelChanged()
 {
     try
     {
         this.internalZoomChange = true;
         MapCore mapCore = base.GetMapCore();
         if (mapCore != null && mapCore.Viewport != null && !this.fixThumbPoition)
         {
             mapCore.Viewport.Zoom = (float)this.GetZoomLevelFromPointerPosition(this.Pointer.Value);
         }
     }
     finally
     {
         this.internalZoomChange = false;
     }
 }
        public EnhancedMapPoint(Location location, MapCore map)
        {
            Offset            = new Point(0, 0);
            ClusteredElements = new List <IClusterable>();
            ProjectedPoints   = new Dictionary <int, Point>();
            projectionWorker.WorkerSupportsCancellation = true;
            projectionWorker.DoWork             += projectionWorkerDoWork;
            projectionWorker.RunWorkerCompleted += projectionWorkerOnCompleted;

            mapInstance     = map;
            Location        = location;
            DefaultStyleKey = typeof(EnhancedMapPoint);

            MouseLeftButtonDown += EnhancedMapPoint_MouseLeftButtonDown;
            MouseLeave          += EnhancedMapPoint_MouseLeave;
            MouseEnter          += EnhancedMapPoint_MouseEnter;
        }
        public EnhancedMapLayer(MapCore map)
        {
            mapLayerObjects    = new List <MapLayerObject>();
            layerDataToProcess = new List <VectorLayerData>();
            mapLayerGeometries = new List <BaseGeometry>();
            MapInstance        = map;

            onMapMovementWorker.WorkerSupportsCancellation = true;
            onMapMovementWorker.DoWork             += OnMapMovementWorkerOnDoWork;
            onMapMovementWorker.RunWorkerCompleted += OnMapMovementWorkerOnRunWorkerCompleted;

            Loaded += EnhancedMapLayer_Loaded;

            dataAddedWorker.WorkerSupportsCancellation = true;
            dataAddedWorker.DoWork             += dataAddedWorker_DoWork;
            dataAddedWorker.RunWorkerCompleted += dataAddedWorker_RunWorkerCompleted;
        }
        public EnhancedMapPoint(Location location, MapCore map)
        {
            Offset = new Point(0, 0);
            ClusteredElements = new List<IClusterable>();
            ProjectedPoints = new Dictionary<int, Point>();
            projectionWorker.WorkerSupportsCancellation = true;
            projectionWorker.DoWork += projectionWorkerDoWork;
            projectionWorker.RunWorkerCompleted += projectionWorkerOnCompleted;

            mapInstance = map;
            Location = location;
            DefaultStyleKey = typeof(EnhancedMapPoint);

            MouseLeftButtonDown += EnhancedMapPoint_MouseLeftButtonDown;
            MouseLeave += EnhancedMapPoint_MouseLeave;
            MouseEnter += EnhancedMapPoint_MouseEnter;
        }
        public EnhancedMapLayer(MapCore map)
        {
            mapLayerObjects = new List<MapLayerObject>();
            layerDataToProcess = new List<VectorLayerData>();
            mapLayerGeometries = new List<BaseGeometry>();
            MapInstance = map;

            onMapMovementWorker.WorkerSupportsCancellation = true;
            onMapMovementWorker.DoWork += OnMapMovementWorkerOnDoWork;
            onMapMovementWorker.RunWorkerCompleted += OnMapMovementWorkerOnRunWorkerCompleted;

            Loaded += EnhancedMapLayer_Loaded;

            dataAddedWorker.WorkerSupportsCancellation = true;
            dataAddedWorker.DoWork += dataAddedWorker_DoWork;
            dataAddedWorker.RunWorkerCompleted += dataAddedWorker_RunWorkerCompleted;
        }
Beispiel #15
0
        public void SetLocationInPixels(PointF location)
        {
            MapCore mapCore = GetMapCore();

            if (mapCore != null)
            {
                if (LocationUnit == CoordinateUnit.Pixel)
                {
                    Location = new MapLocation(this, location.X, location.Y);
                    return;
                }
                float num = 100f * location.X / (float)(mapCore.Width - 1);
                num = ((!float.IsNaN(num)) ? num : 0f);
                float num2 = 100f * location.Y / (float)(mapCore.Height - 1);
                num2     = ((!float.IsNaN(num2)) ? num2 : 0f);
                Location = new MapLocation(this, num, num2);
            }
        }
Beispiel #16
0
        public void SetSizeInPixels(SizeF size)
        {
            MapCore mapCore = GetMapCore();

            if (mapCore != null)
            {
                if (SizeUnit == CoordinateUnit.Pixel)
                {
                    Size = new MapSize(this, size.Width, size.Height);
                    return;
                }
                float num = 100f * size.Width / (float)mapCore.Width;
                num = ((!float.IsNaN(num) && !float.IsInfinity(num)) ? num : 0f);
                float num2 = 100f * size.Height / (float)mapCore.Height;
                num2 = ((!float.IsNaN(num2) && !float.IsInfinity(num2)) ? num2 : 0f);
                Size = new MapSize(this, num, num2);
            }
        }
Beispiel #17
0
        internal ZoomPanel(CommonElements common)
            : base(common)
        {
            Name    = "ZoomPanel";
            scale   = new LinearScale(this);
            pointer = new LinearPointer(this);
            MapCore mapCore = GetMapCore();

            Scale.LabelStyle.Visible           = false;
            Scale.MajorTickMark.Visible        = false;
            Scale.MinorTickMark.Length         = 30f;
            Scale.MinorTickMark.Width          = 10f;
            Scale.MinorTickMark.EnableGradient = false;
            Scale.FillGradientType             = GradientType.None;
            Scale.FillHatchStyle = MapHatchStyle.None;
            Scale.ShadowOffset   = 0f;
            Scale.BorderWidth    = 1;
            Scale.Width          = 15f;
            Scale.Minimum        = 0.0;
            Scale.Maximum        = 100.00000000001;
            double tickMarksInterval = GetTickMarksInterval(TickCount);

            Scale.MinorTickMark.Interval = tickMarksInterval;
            Pointer.Placement            = Placement.Cross;
            if (mapCore != null && mapCore.Viewport != null)
            {
                Pointer.Position = mapCore.Viewport.Zoom;
            }
            Pointer.SnappingEnabled  = true;
            Pointer.SnappingInterval = tickMarksInterval;
            Pointer.FillGradientType = GradientType.None;
            Pointer.FillHatchStyle   = MapHatchStyle.None;
            Pointer.ShadowOffset     = 0f;
            if (mapCore != null && mapCore.Viewport != null)
            {
                ZoomLevel = mapCore.Viewport.Zoom;
            }
            zoomInButton  = new PanelButton(this, PanelButtonType.ZoomButton, PanelButtonStyle.RoundedRectangle, zoomButtonClickHandler);
            zoomOutButton = new PanelButton(this, PanelButtonType.ZoomOut, PanelButtonStyle.RoundedRectangle, zoomButtonClickHandler);
            ApplyStyle();
            ApplyColors();
        }
Beispiel #18
0
        public void SetSizeInPixels(SizeF size)
        {
            MapCore mapCore = this.GetMapCore();

            if (mapCore != null)
            {
                if (this.SizeUnit == CoordinateUnit.Pixel)
                {
                    this.Size = new MapSize(this, size.Width, size.Height);
                }
                else
                {
                    float num = (float)(100.0 * size.Width / (float)mapCore.Width);
                    num = (float)((!float.IsNaN(num) && !float.IsInfinity(num)) ? num : 0.0);
                    float num2 = (float)(100.0 * size.Height / (float)mapCore.Height);
                    num2      = (float)((!float.IsNaN(num2) && !float.IsInfinity(num2)) ? num2 : 0.0);
                    this.Size = new MapSize(this, num, num2);
                }
            }
        }
Beispiel #19
0
        public void SetLocationInPixels(PointF location)
        {
            MapCore mapCore = this.GetMapCore();

            if (mapCore != null)
            {
                if (this.LocationUnit == CoordinateUnit.Pixel)
                {
                    this.Location = new MapLocation(this, location.X, location.Y);
                }
                else
                {
                    float num = (float)(100.0 * location.X / (float)(mapCore.Width - 1));
                    num = (float)((!float.IsNaN(num)) ? num : 0.0);
                    float num2 = (float)(100.0 * location.Y / (float)(mapCore.Height - 1));
                    num2          = (float)((!float.IsNaN(num2)) ? num2 : 0.0);
                    this.Location = new MapLocation(this, num, num2);
                }
            }
        }
Beispiel #20
0
        internal List <ILayerElement> GetLayerElements()
        {
            List <ILayerElement> list = new List <ILayerElement>();

            if (Common != null && Common.MapCore != null)
            {
                MapCore mapCore = Common.MapCore;
                foreach (ILayerElement group in mapCore.Groups)
                {
                    if (group.Layer == Name)
                    {
                        list.Add(group);
                    }
                }
                foreach (ILayerElement shape in mapCore.Shapes)
                {
                    if (shape.Layer == Name)
                    {
                        list.Add(shape);
                    }
                }
                foreach (ILayerElement path in mapCore.Paths)
                {
                    if (path.Layer == Name)
                    {
                        list.Add(path);
                    }
                }
                {
                    foreach (ILayerElement symbol in mapCore.Symbols)
                    {
                        if (symbol.Layer == Name)
                        {
                            list.Add(symbol);
                        }
                    }
                    return(list);
                }
            }
            return(list);
        }
        public SelectGeometry(IGeometry geometry, StyleSpecification styleSpecification, MapCore map,
                              EnhancedMapLayer layer)
            : base(geometry, styleSpecification, map, layer)
        {
            //default is the inverse of the style colours + 50% larger icon.
            SelectedSpecification = styleSpecification.Clone();
            SelectedSpecification.IconScale = styleSpecification.IconScale * 1.5;
            SelectedSpecification.LineColour = Utilities.InvertColorFromHexString(styleSpecification.LineColour);
            SelectedSpecification.PolyFillColour = Utilities.InvertColorFromHexString(styleSpecification.PolyFillColour);

            foreach (Control mapObject in mapObjects)
            {
                mapObject.MouseLeftButtonDown += SelectGeometry_MouseLeftButtonDown;
                mapObject.MouseEnter += SelectGeometry_MouseEnter;
                mapObject.MouseLeave += SelectGeometry_MouseLeave;
            }

            mapObjects.CollectionChanged += mapObjects_CollectionChanged;

            EnableSelection = true;
        }
        public override void SizeLocationChanged(SizeLocationChangeInfo info)
        {
            base.SizeLocationChanged(info);
            switch (info)
            {
            case SizeLocationChangeInfo.Location:
                this.Location.Docked = this.AutoSize;
                break;

            case SizeLocationChangeInfo.Size:
                this.Size.AutoSize = this.AutoSize;
                break;
            }
            MapCore mapCore = base.GetMapCore();

            if (mapCore != null)
            {
                mapCore.InvalidateCachedPaths();
            }
            this.InvalidateAndLayout();
        }
Beispiel #23
0
        public PointF GetLocationInPixels()
        {
            PointF result = default(PointF);

            if (LocationUnit == CoordinateUnit.Pixel)
            {
                result.X = Location.X;
                result.Y = Location.Y;
            }
            else
            {
                MapCore mapCore = GetMapCore();
                if (mapCore == null)
                {
                    return(result);
                }
                result.X = (float)(mapCore.Width - 1) * Location.X / 100f;
                result.Y = (float)(mapCore.Height - 1) * Location.Y / 100f;
            }
            return(result);
        }
        public override MapCore Generate(int seed, CancellationToken?cancellationToken = null)
        {
            cancellationToken?.ThrowIfCancellationRequested();

            var map = new MapCore(Size, HeightLimit);

            foreach (var position in Enumerables.InRange2(Size))
            {
                float noiseValue       = noise.cellular2x2(0.05f * new float2(position.x, position.y)).x;
                float normalizedHeight = (noiseValue - 0.4f) / (1 - 0.4f);
                if (normalizedHeight >= 0)
                {
                    float height = 2 * ShiftedErf(normalizedHeight);
                    var   node   = new MapNode(MapNode.NodeType.Common, height);
                    map[position] = node;
                }

                cancellationToken?.ThrowIfCancellationRequested();
            }
            return(map);
        }
        internal override ArrayList GetSortedValues(Field field, object fromValue, object toValue)
        {
            MapCore mapCore = GetMapCore();

            if (mapCore == null)
            {
                return(null);
            }
            ArrayList arrayList = new ArrayList();

            foreach (Group group in mapCore.Groups)
            {
                object obj = group[field.Name];
                if (obj != null && IsValueInRange(field, obj, fromValue, toValue))
                {
                    arrayList.Add(obj);
                }
            }
            arrayList.Sort();
            return(arrayList);
        }
Beispiel #26
0
        public SizeF GetSizeInPixels()
        {
            SizeF result = default(SizeF);

            if (SizeUnit == CoordinateUnit.Pixel)
            {
                result.Width  = Size.Width;
                result.Height = Size.Height;
            }
            else
            {
                MapCore mapCore = GetMapCore();
                if (mapCore == null)
                {
                    return(result);
                }
                result.Width  = (float)mapCore.Width * Size.Width / 100f;
                result.Height = (float)mapCore.Height * Size.Height / 100f;
            }
            return(result);
        }
Beispiel #27
0
        public override void OnRemove()
        {
            base.OnRemove();
            MapCore mapCore = this.GetMapCore();

            if (mapCore != null)
            {
                foreach (Shape shape in mapCore.Shapes)
                {
                    if (shape.ParentGroup == this.Name)
                    {
                        shape.ParentGroup = "";
                    }
                }
                mapCore.InvalidateCachedPaths();
                mapCore.InvalidateRules();
                mapCore.InvalidateDataBinding();
                mapCore.InvalidateCachedBounds();
                mapCore.InvalidateGridSections();
            }
        }
Beispiel #28
0
    private void NotLoadingRelated()
    {
        // What we can do right away
        SceneGlobals.Refresh();
        SceneGlobals.main_canvas      = GameObject.Find("MainCanvas").GetComponent <Canvas>();
        SceneGlobals.map_canvas       = GameObject.Find("MapCanvas").GetComponent <Canvas>();
        SceneGlobals.permanent_canvas = GameObject.Find("PermanentCanvas").GetComponent <Canvas>();
        SceneGlobals.map_drawer       = Loader.EnsureComponent <MapDrawer>(gameObject);
        SceneGlobals.general          = this;

        uiscript             = Loader.EnsureComponent <GUIScript>(gameObject);
        map_core             = Loader.EnsureComponent <MapCore>(gameObject);
        SceneGlobals.console = console = SceneGlobals.permanent_canvas.GetComponentInChildren <ConsoleBehaviour>();
        console.Start_();
        console.ConsolePos = ConsolePosition.lower;

        // Configure the cameras
        ship_camera = GameObject.Find("ShipCamera").GetComponent <Camera>();
        if (ship_camera == null)
        {
            Debug.LogError("NO ShipCamera");
        }
        ship_camera.farClipPlane = 1e9f;
        Loader.EnsureComponent <CameraMovement>(ship_camera.gameObject);
        map_camera = GameObject.Find("MapCamera").GetComponent <Camera>();
        SceneGlobals.ship_camera = ship_camera;
        SceneGlobals.map_camera  = map_camera;

        // Initialize the audio source
        GameObject audiosource_object = new GameObject("Audio Source");

        audiosource_object.transform.SetParent(ship_camera.transform);
        Globals.audio = Loader.EnsureComponent <AudioManager>(audiosource_object);

        // Get the map view manager
        map_core.Start_();
        SceneGlobals.map_core = map_core;

        SceneGlobals.ui_script = uiscript;
    }
        internal void UpdateLegend()
        {
            MapCore mapCore = GetMapCore();

            if (mapCore == null)
            {
                return;
            }
            Field field = GetField();

            if (!(ShowInLegend != string.Empty) || !(ShowInLegend != "(none)"))
            {
                return;
            }
            Legend legend = (Legend)mapCore.Legends.GetByName(ShowInLegend);

            if (legend == null)
            {
                return;
            }
            foreach (CustomWidth customWidth in CustomWidths)
            {
                if (customWidth.VisibleInt)
                {
                    LegendItem legendItem = legend.Items.Add("");
                    legendItem.automaticallyAdded = true;
                    legendItem.PathWidth          = (int)Math.Round(customWidth.Width);
                    legendItem.ItemStyle          = LegendItemStyle.Path;
                    legendItem.Text           = GetLegendText(field, customWidth.FromValueInt, customWidth.ToValueInt);
                    legendItem.PathLineStyle  = base.LineStyleInLegend;
                    legendItem.BorderColor    = BorderColorInLegend;
                    legendItem.BorderWidth    = base.BorderWidthInLegend;
                    legendItem.Color          = ColorInLegend;
                    legendItem.SecondaryColor = SecondaryColorInLegend;
                    legendItem.GradientType   = GradientTypeInLegend;
                    legendItem.HatchStyle     = HatchStyleInLegend;
                }
            }
        }
Beispiel #30
0
        internal override void OnRemove()
        {
            base.OnRemove();
            MapCore mapCore = GetMapCore();

            if (mapCore == null)
            {
                return;
            }
            foreach (Shape shape in mapCore.Shapes)
            {
                if (shape.ParentGroup == Name)
                {
                    shape.ParentGroup = "";
                }
            }
            mapCore.InvalidateCachedPaths();
            mapCore.InvalidateRules();
            mapCore.InvalidateDataBinding();
            mapCore.InvalidateCachedBounds();
            mapCore.InvalidateGridSections();
        }
Beispiel #31
0
        internal void FieldDataFromBuffer()
        {
            if (string.IsNullOrEmpty(fieldDataBuffer))
            {
                return;
            }
            MapCore mapCore = GetMapCore();

            if (mapCore != null)
            {
                fields.Clear();
                string[] array = fieldDataBuffer.Split('&');
                for (int i = 0; i < array.Length; i++)
                {
                    string[] array2     = array[i].Split('=');
                    string   name       = XmlConvert.DecodeName(array2[0]);
                    string   fieldValue = XmlConvert.DecodeName(array2[1]);
                    ((Field)mapCore.GroupFields.GetByName(name))?.ParseValue(fieldValue, fields);
                }
                fieldDataBuffer = "";
            }
        }
Beispiel #32
0
        private string FieldDataToString()
        {
            string  text    = string.Empty;
            MapCore mapCore = GetMapCore();

            if (mapCore != null)
            {
                foreach (Field groupField in mapCore.GroupFields)
                {
                    if (!groupField.IsTemporary)
                    {
                        string text2 = groupField.FormatValue(fields[groupField.Name]);
                        if (!string.IsNullOrEmpty(text2))
                        {
                            text = text + XmlConvert.EncodeName(groupField.Name) + "=" + text2 + "&";
                        }
                    }
                }
                text = text.TrimEnd('&');
            }
            return(text);
        }
Beispiel #33
0
        public DesignDataSetSource(MapCore mapCore, object originalDataSource)
        {
            StringEnumerator enumerator = DataBindingHelper.GetDataSourceDataMembers(originalDataSource).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    string    current   = enumerator.Current;
                    DataTable dataTable = new DataTable(current)
                    {
                        Locale = CultureInfo.CurrentCulture
                    };
                    DataBindingHelper.InitDesignDataTable(originalDataSource, current, dataTable);
                    base.Tables.Add(dataTable);
                }
            }
            finally
            {
                (enumerator as IDisposable)?.Dispose();
            }
        }
Beispiel #34
0
        private void MapChanged(string from, string to)
        {
            MapType mapTo   = GetMapType(to);
            MapType mapFrom = GetMapType(from);

            if (mapTo == MapType.MainMenu)
            {
                MenuLoaded();
            }

            // rng started in middle of level, request to restart or menu
            if (mapFrom == MapType.Unknown && mapTo != MapType.MainMenu)
            {
                AccurateMapType = MapType.Unknown;
                LogStatus("[!] Level is already running,\nreturn to MainMenu or restart level!");
                return;
            }

            // entered a level, from menu
            if (mapFrom == MapType.MainMenu && mapTo != MapType.MainMenu)
            {
                LogStatus("Loading level/cutscene...");
            }
            AccurateMapType = mapTo;    // display temp map name

            // Entered Menu
            if (mapTo == MapType.MainMenu)
            {
                // reset currMap if any and hide rng button
                if (currentMap != null)
                {
                    currentMap = null;
                    main.ToggleRngControls(false);
                }
                LogStatus("Idle");
                return;
            }
        }
Beispiel #35
0
        static void Main(string[] args)
        {
            decimal db = 117.84002737023984M;

            //ElasticSearchClient.InsertEntityToES(new OuterRequest
            //{
            //    NickName="李金川",
            //    Uid=10000
            //});

            //var ct = Map.MapCore.LoadChinaCountryMap();


            var lon = 120.428758;
            var lat = 30.886504;

            lon = 118.146966;
            lat = 24.510565;
            var city = MapCore.Location(lon, lat);


            lon = 120.994825;
            lat = 31.360307;

            var area = MapCore.Location(lon, lat);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Restart();
            for (int i = 0; i < 1000000; i++)
            {
                //area = Map.MapCore.China.Position(new MapPoint(131.140361m, 44.222059m));
                MapCore.Location(131.140361, 44.222059);
            }
            sw.Stop();

            Console.WriteLine(sw.ElapsedMilliseconds);
            //Console.Read();
        }
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            ArrayList arrayList = new ArrayList();

            arrayList.Add("(none)");
            if (context != null && context.Instance != null)
            {
                object obj = null;
                obj = ((!(context.Instance is object[])) ? context.Instance : ((object[])context.Instance)[0]);
                if (obj is Symbol)
                {
                    MapCore mapCore = ((Symbol)obj).GetMapCore();
                    if (mapCore != null)
                    {
                        foreach (Shape shape in mapCore.Shapes)
                        {
                            arrayList.Add(shape.Name);
                        }
                    }
                }
            }
            return(new StandardValuesCollection(arrayList));
        }
Beispiel #37
0
        public void NewRNG(bool force = false)
        {
            if (currentMap == null)
            {
                return;
            }

            // Can not RNG?
            if (!Config.GetInstance().Gen_RngOnRestart)
            {
                currentMap = null;
                LogStatus("RNG disabled by user.");
                return;
            }

            // valid map but no rng?
            if (!currentMap.HasRng)
            {
                LogStatus("No RNG for this section, relax...");
                return;
            }


            if (currentMap != null && (Config.GetInstance().Gen_RngOnRestart || force))
            {
                Config.GetInstance().NewSeed();
                currentMap.RandomizeEnemies(game);
                if (currentMap.CPRequired)
                {
                    LogStatus("RNG Generated!\n Die or load cp to see changes.");
                }
                else
                {
                    main.LogStatus("Rng Loaded! Good luck!");
                }
            }
        }
 public EnhancedMapLayer GetELayerByID(string layerID, MapCore map)
 {
     return map.Children.OfType<EnhancedMapLayer>().FirstOrDefault(geomLayer => geomLayer.ID == layerID);
 }
 public MapLayer GetLayerByID(string layerName, MapCore map)
 {
     return map.Children.OfType<MapLayer>().FirstOrDefault(geomLayer => geomLayer.Name == layerName);
 }