예제 #1
0
        public override void OnEnable()
        {
            documentPath = SetupUtility.GetDocumentationPath();

            // this is disabled when the window is closed
            if (SetupUtility.timedFeedbackPopupActive)
            {
                timedFeedbackPopupMode = true;
            }
        }
예제 #2
0
        string GetDemoPath()
        {
            var path = SetupUtility.GetAssetRoot();

            if (SetupUtility.projectMode == ProjectMode.VR)
            {
                path = path + "DemoScenes/VR/VRDemoScene.unity";
            }
            else
            {
                path = path + "DemoScenes/Non VR/Demo Scene.unity";
            }
            path = path.Replace(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar, "");
            if (File.Exists(path))
            {
                return(path);
            }
            return(string.Empty);
        }
예제 #3
0
 public override void OnEnable()
 {
     documentPath = SetupUtility.GetDocumentationPath();
 }
예제 #4
0
        public void Draw(Rect rect)
        {
            Styles.Init();

            var ignoreButtonRect = new Rect(rect.x + rect.width * 0.5f - rect.width * 0.25f, rect.y + rect.height - 50, rect.width * 0.5f, 40);

            var selectedMode = window.selectedMode;

            if (SetupUtility.projectMode == ProjectMode.None)
            {
                if (selectedMode == ProjectMode.None)
                {
                    GlobalPortalSettings.TimeInstalled = System.DateTime.UtcNow.Ticks;

                    if (GUI.Button(ignoreButtonRect, Content.ignoreButtonText))
                    {
                        if (EditorUtility.DisplayDialog("PKPro Setup", Content.ignorePopupWarningText, "Ok", "Cancel"))
                        {
                            SetupUtility.ignoringInitialSetup = true;
                            window.Close();
                        }
                    }
                }
                else
                {
                    GUI.Box(ignoreButtonRect, Content.ignoreButtonText, new GUIStyle("button"));
                }
            }

            int tooltipHeight = 60;
            var localRect     = new Rect(0, 0, (int)rect.width, (int)rect.height - tooltipHeight);

            var currentTooltipHeight = showModeTooltip.Fade(0, tooltipHeight);

            rect.height -= tooltipHeight - currentTooltipHeight;
            GUI.BeginGroup(rect);

            var boxRect = localRect;

            boxRect.height += currentTooltipHeight;

            GUI.Box(boxRect, GUIContent.none, Styles.bgStyle);

            var tooltipRect = new Rect();

            tooltipRect.width  = Mathf.Clamp(boxRect.width * 0.6f, 380, 500);
            tooltipRect.height = tooltipHeight;
            tooltipRect.x      = (int)(boxRect.width * 0.5f - tooltipRect.width * 0.5f);
            tooltipRect.y      = boxRect.height - currentTooltipHeight;
            GUI.BeginClip(tooltipRect, Vector2.zero, Vector2.zero, false);

            var tooltipText = selectedMode == ProjectMode.VR ? Content.vrModeTooltipText : Content.defaultModeTooltipText;

            GUI.Label(new Rect(10, 0, tooltipRect.width - 130, tooltipRect.height), tooltipText, Styles.modeTooltipStyle);


            if (selectedMode == ProjectMode.VR)
            {
                var effectiveTextHeight = Styles.modeTooltipStyle.CalcHeight(tooltipText, tooltipRect.width - 130);

                var toggleRect = new Rect(10, effectiveTextHeight + 2, tooltipRect.width - 130, 20);
                GUI.enabled = SetupUtility.projectMode != selectedMode;
                needVRTK    = GUI.Toggle(toggleRect, needVRTK, Content.importVRTKText);
                GUI.enabled = true;
            }


            var alreadyUsingMode = selectedMode == SetupUtility.projectMode;

            GUIContent buttonText = GUIContent.none;

            if (alreadyUsingMode)
            {
                if (selectedMode == ProjectMode.Default)
                {
                    buttonText = Content.usingDefaultModeText;
                }
                else
                {
                    buttonText = Content.usingVrModeText;
                }
            }
            else
            {
                if (selectedMode == ProjectMode.Default)
                {
                    buttonText = Content.applyDefaultModeText;
                }
                else
                {
                    buttonText = Content.applyVrModeText;
                }
            }
            GUI.enabled = !alreadyUsingMode;
            if (GUI.Button(new Rect(tooltipRect.width - 110, 0, 100, 30), buttonText))
            {
                if (selectedMode == ProjectMode.VR)
                {
                    SetupUtility.ApplyVR(!needVRTK);
                }
                else
                {
                    SetupUtility.ApplyDefault();
                }
            }

            GUI.enabled = true;
            GUI.EndClip();

            localRect.width = Mathf.Clamp(localRect.width * 0.6f, 380, 500);
            localRect.x     = rect.width * 0.5f - localRect.width * 0.5f;

            var buttonHeight = 150;
            var buttonRect   = new Rect(localRect.x + 5, localRect.height * 0.5f - buttonHeight * 0.5f, localRect.width * 0.5f - 10, buttonHeight);



            DoDefaultButton(buttonRect, selectedMode == ProjectMode.Default);
            buttonRect.x += localRect.width * 0.5f;
            DoVRButton(buttonRect, selectedMode == ProjectMode.VR);

            GUI.EndGroup();
        }