Esempio n. 1
0
        private WMapMarker PrepareMarker()
        {
            if (!int.TryParse(_textBoxX.Text, out var x))
            {
                return(null);
            }
            if (!int.TryParse(_textBoxY.Text, out var y))
            {
                return(null);
            }

            // Validate User Enter Data
            if (x > _mapMaxX || x < MAP_MIN_CORD)
            {
                return(null);
            }

            if (y > _mapMaxY || y < MAP_MIN_CORD)
            {
                return(null);
            }

            var markerName = _markerName.Text;

            if (string.IsNullOrEmpty(markerName))
            {
                return(null);
            }

            if (markerName.Contains(","))
            {
                markerName = markerName.Replace(",", "");
            }

            var mapIdx = World.MapIndex;
            var color  = _colors[_colorsCombo.SelectedIndex];
            var icon   = _iconsCombo == null ? string.Empty : _icons[_iconsCombo.SelectedIndex];

            var marker = new WMapMarker
            {
                Name      = markerName,
                X         = x,
                Y         = y,
                MapId     = mapIdx,
                ColorName = color,
                Color     = GetColor(color),
            };

            if (!_markerIcons.TryGetValue(icon, out var iconTexture))
            {
                return(marker);
            }

            marker.MarkerIcon     = iconTexture;
            marker.MarkerIconName = icon;

            return(marker);
        }
            public MakerManagerControl(WMapMarker marker, int y, int idx, bool isEditable)
            {
                CanMove = true;

                _idx        = idx;
                _marker     = marker;
                _y          = y;
                _isEditable = isEditable;

                DrawData();
            }