Esempio n. 1
0
 internal static void DrawFeaturePointsSection(IWizardFeaturePointPage wizardPage, Texture2D texture)
 {
     try
     {
         DrawResetBackNext(wizardPage, true, "Next");
         DrawEditorButtons();
         var box = DrawPhotoBox(wizardPage, texture);
         if (wizardPage is IWizardFeaturePointPage)
         {
             DrawPoints((IWizardFeaturePointPage)wizardPage);
         }
         DrawExamplePhoto(box, wizardPage);
     }
     catch (UnityException exp)
     {
         Debug.LogError(exp.Message);
     }
 }
Esempio n. 2
0
        private static void DrawPoints(IWizardFeaturePointPage pointPage)
        {
            if (pointPage.PointsNumber < 1)
            {
                return;
            }

            Rect    pointRect;
            Vector2 halfPointSize = new Vector2(halfDotSize, halfDotSize);

            foreach (PickedPoint point in pointPage.Points)
            {
                pointRect = new Rect(lastTextureRect.x + lastTextureRect.width * point.RelativeLocation.x - halfPointSize.x,
                                     lastTextureRect.y + lastTextureRect.height * point.RelativeLocation.y - halfPointSize.y,
                                     dotSize,
                                     dotSize);

                GUI.DrawTexture(pointRect, PointTexture);
            }
        }
Esempio n. 3
0
        private static Rect DrawPhotoBox(IWizardPage wizardPage, Texture2D texture)
        {
            var boxRect = new Rect(110, 70, 400, 400);

            try
            {
                GUI.Box(boxRect, "");
                GUIUtils.TouchInfo touchInfo;
                lastTextureRect = GUIUtils.DrawTouchableTexture(boxRect, texture, out touchInfo);


                if (wizardPage is IWizardFeaturePointPage)
                {
                    IWizardFeaturePointPage pointPage = (IWizardFeaturePointPage)wizardPage;

                    if (touchInfo.isTouching && touchInfo.touchInside)
                    {
                        bool        collidingExistingPoint = false;
                        PickedPoint collidingPoint         = new PickedPoint();

                        foreach (PickedPoint existingPoint in pointPage.Points)
                        {
                            Rect testRect = new Rect(boxRect);
                            if (IsTouchExisting(existingPoint, touchInfo.textureTouchPosition, testRect))
                            {
                                collidingExistingPoint = true;
                                collidingPoint         = existingPoint;
                                break;
                            }
                        }

                        if (!collidingExistingPoint && addingPoint)
                        {
                            PickedPoint pickedPt = new PickedPoint(touchInfo.textureTouchPosition, touchInfo.relativePercentageTouchPosition);
                            pointPage.Points.Add(pickedPt);
                        }
                        else if (collidingExistingPoint && removingPoint)
                        {
                            pointPage.Points.Remove(collidingPoint);

                            Debug.Log("Removing point at " + collidingPoint.Location);
                        }
                    }
                    else if (touchInfo.isTouching && !touchInfo.touchInside)
                    {
                    }


                    if (undoPoint)
                    {
                        int ptCnt = pointPage.Points.Count;

                        if (1 <= ptCnt)
                        {
                            pointPage.Points.RemoveAt(ptCnt - 1);
                        }

                        undoPoint = false;
                    }

                    ActiveWindow.Repaint();
                }
            }
            catch (UnityException exp)
            {
                Debug.LogError(exp.Message);
            }

            return(boxRect);
        }
Esempio n. 4
0
 private static void DrawExamplePhoto(Rect photoBox, IWizardFeaturePointPage wizardPage)
 {
     GUI.DrawTexture(new Rect(photoBox.xMax + 10, photoBox.yMin, 170, 185), wizardPage.ExampleTexture, ScaleMode.ScaleToFit);
 }