private void ClearPartialAnimation(PartialAnimation ActivePartialAnimation) { for (int L = 0; L < ActivePartialAnimation.ListAnimationLayer.Count; L++) { foreach (VisibleTimeline ActiveBitmap in ActivePartialAnimation.ListAnimationLayer[L].ListVisibleObject) { ActiveBitmap.OnDeathFrame(this); } foreach (MarkerTimeline ActiveMarker in ActivePartialAnimation.ListAnimationLayer[L].ListActiveMarker) { ActiveMarker.OnDeathFrame(this); } foreach (PolygonCutterTimeline ActivePolygonCutter in ActivePartialAnimation.ListAnimationLayer[L].ListPolygonCutter) { ActivePolygonCutter.OnDeathFrame(this); } ActivePartialAnimation.ListAnimationLayer[L].ResetAnimationLayer(); } ActivePartialAnimation.ActiveKeyFrame = ActivePartialAnimation.LoopStart; for (int F = 0; F < ActivePartialAnimation.ActiveKeyFrame; F++) { ActivePartialAnimation.UpdateKeyFrame(F); } }
protected virtual void OnLoopEnd() { CurrentQuote = ""; ListActiveSFX.Clear(); DicActiveAnimationObject.Clear(); for (int L = 0; L < ListAnimationLayer.Count; L++) { foreach (VisibleTimeline ActiveBitmap in ListAnimationLayer[L].ListVisibleObject) { ActiveBitmap.OnDeathFrame(this); } foreach (MarkerTimeline ActiveMarker in ListAnimationLayer[L].ListActiveMarker) { ActiveMarker.OnDeathFrame(this); } foreach (PolygonCutterTimeline ActivePolygonCutter in ListAnimationLayer[L].ListPolygonCutter) { ActivePolygonCutter.OnDeathFrame(this); } ListAnimationLayer[L].ResetAnimationLayer(); } ActiveKeyFrame = LoopStart; for (int F = 0; F <= ActiveKeyFrame; F++) { UpdateKeyFrame(F); } }
private void MapControlOnMouseRightButtonDown(object sender, MouseButtonEventArgs args) { var mapsPos = args.GetPosition(MapControl).ToMapsui(); var info = MapControl.GetMapInfo(mapsPos, 12); polyDraw = new ActiveMarker { id = GameState.Instance.marker.GenerateMarkerName(MarkerChannel.Global), channel = 0, color = "ColorBlack", type = "hd_dot", shape = "POLYLINE", text = "", size = "1,1", alpha = 1, dir = 0, brush = "Solid" }; polyDraw.pos.Clear(); polyDraw.pos.Add((float)info.WorldPosition.X); polyDraw.pos.Add((float)info.WorldPosition.Y); polyDraw.polyline.Add(new float[] { (float)info.WorldPosition.X, (float)info.WorldPosition.Y }); var markerProvider = MapMarkersLayer.DataSource as MapMarkerProvider; markerProvider?.AddMarker(polyDraw, false); MapMarkersLayer.DataHasChanged(); //MapControl.Refresh(ChangeType.Discrete); args.Handled = true; }
public AnimationClass SetAnimation(string NewAnimation) { if (CurrentAnimation == NewAnimation) { return(DicAnimation[NewAnimation]); } DicActiveAnimationObject.Clear(); AnimationClass NewAnimationClass; DicAnimation.TryGetValue(NewAnimation, out NewAnimationClass); if (NewAnimationClass == null) { NewAnimationClass = CreateAnimation(NewAnimation, false); DicAnimation.Add(NewAnimation, NewAnimationClass); } CurrentAnimation = NewAnimation; if (ListAnimationLayer != null) { for (int L = 0; L < ListAnimationLayer.Count; L++) { foreach (VisibleTimeline ActiveBitmap in ListAnimationLayer[L].ListVisibleObject) { ActiveBitmap.OnDeathFrame(this); } foreach (MarkerTimeline ActiveMarker in ListAnimationLayer[L].ListActiveMarker) { ActiveMarker.OnDeathFrame(this); } foreach (PolygonCutterTimeline ActivePolygonCutter in ListAnimationLayer[L].ListPolygonCutter) { ActivePolygonCutter.OnDeathFrame(this); } } } ListAnimationLayer = DicAnimation[CurrentAnimation].ListAnimationLayer; ActiveKeyFrame = 0; LoopStart = DicAnimation[CurrentAnimation].LoopStart; LoopEnd = DicAnimation[CurrentAnimation].LoopEnd; for (int L = 0; L < ListAnimationLayer.Count; L++) { ListAnimationLayer[L].ResetAnimationLayer(); } Init(); return(NewAnimationClass); }
private void MapControlOnTouchEnded(object sender, TouchedEventArgs e) { if (polyDraw == null) { return; } //MapMarkersLayer.Delayer.MillisecondsToWait = 500; GameState.Instance.marker.CreateMarker(polyDraw); var markerProvider = MapMarkersLayer.DataSource as MapMarkerProvider; markerProvider?.RemoveMarker(polyDraw.id); polyDraw = null; }
private void MapControlOnMouseRightButtonUp(object sender, MouseButtonEventArgs args) { if (polyDraw == null) { return; } //MapMarkersLayer.Delayer.MillisecondsToWait = 500; GameState.Instance.marker.CreateMarker(polyDraw); var markerProvider = MapMarkersLayer.DataSource as MapMarkerProvider; markerProvider?.RemoveMarker(polyDraw.id); polyDraw = null; }
public bool IsVisible(ActiveMarker marker) { if (marker.channel == -1) { return(true); } if (!_channelEnabled[marker.channel]) { return(false); } return(true); }
private void MapControlOnMouseLeftButtonDown(object sender, TouchedEventArgs e) { var info = MapControl.GetMapInfo(e.ScreenPoints.First(), 12); //GPSEditPopup.IsOpen = false; if (info.Feature is GPSTrackerFeature gpsTrackerFeature) { //GPSEdit.Tracker = gpsTrackerFeature.Tracker; //GPSEditPopup.Placement = PlacementMode.Mouse; //GPSEditPopup.StaysOpen = false; //GPSEditPopup.AllowsTransparency = true; //GPSEditPopup.IsOpen = true; //e.Handled = true; } if (polyDraw == null && CanDraw) { polyDraw = new ActiveMarker { id = GameState.Instance.marker.GenerateMarkerName(MarkerChannel.Global), channel = 0, color = "ColorBlack", type = "hd_dot", shape = "POLYLINE", text = "", size = "1,1", alpha = 1, dir = 0, brush = "Solid" }; polyDraw.pos.Clear(); polyDraw.pos.Add((float)info.WorldPosition.X); polyDraw.pos.Add((float)info.WorldPosition.Y); polyDraw.polyline.Add(new float[] { (float)info.WorldPosition.X, (float)info.WorldPosition.Y }); var markerProvider = MapMarkersLayer.DataSource as MapMarkerProvider; markerProvider?.AddMarker(polyDraw, false); MapMarkersLayer.DataHasChanged(); } }
public void AddMarker(ActiveMarker marker, bool fireDataChanged = true) { if (features.ContainsKey(marker.id)) { return; } try { var feature = new MarkerFeature(marker); feature.DataChanged += (x, y) => MapMarkerLayer.DataHasChanged(); features[marker.id] = feature; if (fireDataChanged) { MapMarkerLayer.DataHasChanged(); } } catch (InvalidOperationException ex) { } }
public MarkerFeature(ActiveMarker marker) { this.marker = marker; this["Label"] = marker.text; Geometry = new Point(marker.pos[0], marker.pos[1]); CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone(); ci.NumberFormat.NumberDecimalSeparator = "."; if (!GameState.Instance.marker.markerColors.ContainsKey(marker.color)) { throw new InvalidOperationException(); } markerColor = GameState.Instance.marker.markerColors[marker.color]; if (string.IsNullOrEmpty(marker.size)) { marker.size = "64,64"; } if (marker.shape == "ICON") { if (string.IsNullOrEmpty(marker.type)) { return; //Can happen, somehow } if (!GameState.Instance.marker.markerTypes.ContainsKey(marker.type)) { throw new InvalidOperationException(); } var markerType = GameState.Instance.marker.markerTypes[marker.type]; if (marker.color == "Default") { markerColor = new MarkerColor { color = markerType.color, name = markerType.name } } ; try { var symStyle = new MarkerIconStyle { SymbolRotation = marker.dir, Opacity = marker.alpha, size = marker.size.Split(',').Select(xy => float.Parse(xy, NumberStyles.Any, ci)).ToArray(), typeSize = markerType.size, color = markerColor.ToSKColor(), shadow = markerType.shadow, text = marker.text }; MarkerCache.Instance.GetImage(markerType, null) .ContinueWith( (image) => { symStyle.markerIcon = image.Result; }); Styles.Add(symStyle); marker.PropertyChanged += OnMarkerOnPropertyChangedIcon; } catch (System.FormatException ex) { } } else if (marker.shape == "RECTANGLE" || marker.shape == "ELLIPSE") { if (!GameState.Instance.marker.markerBrushes.ContainsKey(marker.brush)) { throw new InvalidOperationException(); } var markerBrush = GameState.Instance.marker.markerBrushes[marker.brush]; var markerSize = marker.size.Split(',').Select(xy => float.Parse(xy, NumberStyles.Any, ci)).ToArray(); var center = new Point(marker.pos[0], marker.pos[1]); //set rect Geometry = new BoundBox(center.Offset(-markerSize[0], -markerSize[1]), center.Offset(markerSize[0], markerSize[1])); var tiledBitmap = new TiledBitmapStyle { image = null, rect = new SkiaSharp.SKRect(-markerSize[0], -markerSize[1], markerSize[0], markerSize[1]), rotation = marker.dir, ellipse = marker.shape == "ELLIPSE", border = markerBrush.drawBorder, color = markerColor.ToSKColor() }; Styles.Add(tiledBitmap); MarkerCache.Instance.GetImage(markerBrush, null).ContinueWith( (image) => { tiledBitmap.image = image.Result; }); marker.PropertyChanged += OnMarkerOnPropertyChangedTiled; } else if (marker.shape == "POLYLINE") { if (marker.polyline.Count == 0) { return; } Geometry = new BoundBox(marker.polyline); var polyMarker = new PolylineMarkerStyle(marker.polyline) { color = markerColor.ToSKColor() }; Styles.Add(polyMarker); //Polylines have no propertychanged as (in ACE) they cannot be edited } }