コード例 #1
0
        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();
                }
            }
        }
コード例 #2
0
    public static void AddPosition(PhotoPosition position)
    {
        session.Photos.Add(new PhotoData
        {
            PositionName   = position.name,
            PositionObject = position
        });

        OnItemSelectedChange?.Invoke(session.Photos.Count > 0);
    }
コード例 #3
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;
    }
コード例 #4
0
 public void SetPosition(PhotoPosition position)
 {
     carSolid.transform.localRotation = Quaternion.Euler(position.rotation);
     carSolid.transform.position      = position.position;
     //        StartCoroutine(SmoothRotate(position.rotation));
 }
コード例 #5
0
    public static void RemovePosition(PhotoPosition position)
    {
        session.Photos.RemoveAll(m => m.PositionName == position.name);

        OnItemSelectedChange?.Invoke(session.Photos.Count > 0);
    }