public void photoDragged(object sender, ManipulationDeltaRoutedEventArgs e) { Grid photo = (Grid)sender; CompositeTransform transforms = (CompositeTransform)photo.RenderTransform; // Move the image transforms.TranslateX += e.Delta.Translation.X; transforms.TranslateY += e.Delta.Translation.Y; // Rotate the image double angle = calculateImageAngle(e.Cumulative.Translation); transforms.Rotation = angle; if (e.IsInertial) { PhotoPosition m = getPhotoPosition(photo); if (m == PhotoPosition.OffscreenLeft) { e.Complete(); passCurrent(); } else if (m == PhotoPosition.OffscreenTop) { e.Complete(); superlikeCurrent(); } else if (m == PhotoPosition.OffscreenRight) { e.Complete(); likeCurrent(); } } }
public static void AddPosition(PhotoPosition position) { session.Photos.Add(new PhotoData { PositionName = position.name, PositionObject = position }); OnItemSelectedChange?.Invoke(session.Photos.Count > 0); }
public static void CreateAsset(string name, PhotoPosition asset) { string path = AssetDatabase.GetAssetPath(Selection.activeObject); if (path == "") { path = "Assets"; } else if (Path.GetExtension(path) != "") { path = path.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), ""); } string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath($"{path}/Resources/{name}.asset"); AssetDatabase.CreateAsset(asset, assetPathAndName); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); EditorUtility.FocusProjectWindow(); Selection.activeObject = asset; }
public void SetPosition(PhotoPosition position) { carSolid.transform.localRotation = Quaternion.Euler(position.rotation); carSolid.transform.position = position.position; // StartCoroutine(SmoothRotate(position.rotation)); }
public static void RemovePosition(PhotoPosition position) { session.Photos.RemoveAll(m => m.PositionName == position.name); OnItemSelectedChange?.Invoke(session.Photos.Count > 0); }