コード例 #1
0
ファイル: ScreenViewEditor.cs プロジェクト: dqchess/Linyx
        void OnEnable()
        {
            OnBaseEnable();

            m_ScreenView      = target as ScreenView;
            m_MaterialScreens = serializedObject.FindProperty("m_MaterialScreens");

            m_AutoTrackScreens       = serializedObject.FindProperty("m_AutoTrackScreens");
            m_OnlyShowSelectedScreen = serializedObject.FindProperty("m_OnlyShowSelectedScreen");

            m_FadeIn          = serializedObject.FindProperty("m_FadeIn");
            m_FadeInTweenType = serializedObject.FindProperty("m_FadeInTweenType");
            m_FadeInAlpha     = serializedObject.FindProperty("m_FadeInAlpha");

            m_ScaleIn          = serializedObject.FindProperty("m_ScaleIn");
            m_ScaleInTweenType = serializedObject.FindProperty("m_ScaleInTweenType");
            m_ScaleInScale     = serializedObject.FindProperty("m_ScaleInScale");

            m_SlideIn           = serializedObject.FindProperty("m_SlideIn");
            m_SlideInTweenType  = serializedObject.FindProperty("m_SlideInTweenType");
            m_SlideInDirection  = serializedObject.FindProperty("m_SlideInDirection");
            m_AutoSlideInAmount = serializedObject.FindProperty("m_AutoSlideInAmount");
            m_SlideInAmount     = serializedObject.FindProperty("m_SlideInAmount");
            m_SlideInPercent    = serializedObject.FindProperty("m_SlideInPercent");

            m_RippleIn          = serializedObject.FindProperty("m_RippleIn");
            m_RippleInTweenType = serializedObject.FindProperty("m_RippleInTweenType");
            m_RippleInType      = serializedObject.FindProperty("m_RippleInType");
            m_RippleInPosition  = serializedObject.FindProperty("m_RippleInPosition");

            m_FadeOut          = serializedObject.FindProperty("m_FadeOut");
            m_FadeOutTweenType = serializedObject.FindProperty("m_FadeOutTweenType");
            m_FadeOutAlpha     = serializedObject.FindProperty("m_FadeOutAlpha");

            m_ScaleOut          = serializedObject.FindProperty("m_ScaleOut");
            m_ScaleOutTweenType = serializedObject.FindProperty("m_ScaleOutTweenType");
            m_ScaleOutScale     = serializedObject.FindProperty("m_ScaleOutScale");

            m_SlideOut           = serializedObject.FindProperty("m_SlideOut");
            m_SlideOutTweenType  = serializedObject.FindProperty("m_SlideOutTweenType");
            m_SlideOutDirection  = serializedObject.FindProperty("m_SlideOutDirection");
            m_AutoSlideOutAmount = serializedObject.FindProperty("m_AutoSlideOutAmount");
            m_SlideOutAmount     = serializedObject.FindProperty("m_SlideOutAmount");
            m_SlideOutPercent    = serializedObject.FindProperty("m_SlideOutPercent");

            m_RippleOut          = serializedObject.FindProperty("m_RippleOut");
            m_RippleOutTweenType = serializedObject.FindProperty("m_RippleOutTweenType");
            m_RippleOutType      = serializedObject.FindProperty("m_RippleOutType");
            m_RippleOutPosition  = serializedObject.FindProperty("m_RippleOutPosition");

            m_TransitionDuration = serializedObject.FindProperty("m_TransitionDuration");
            m_TransitionType     = serializedObject.FindProperty("m_TransitionType");

            m_OnScreenBeginTransition = serializedObject.FindProperty("m_OnScreenBeginTransition");
            m_OnScreenEndTransition   = serializedObject.FindProperty("m_OnScreenEndTransition");

            Selection.selectionChanged += () => m_ScreenView.TrackScreens();
        }
コード例 #2
0
        public static T CreateCustomScreen <T>(string screenPrefabPath, ScreenView screenView) where T : MaterialScreen
        {
            T screen = PrefabManager.InstantiateGameObject(screenPrefabPath, screenView != null ? screenView.transform : Instance.transform).GetComponent <T>();

            if (screen != null)
            {
                screen.name = screenPrefabPath;
            }

            return(screen);
        }
コード例 #3
0
        protected override void OnTransformParentChanged()
        {
            base.OnTransformParentChanged();

            var newScreenView = GetComponentInParent <ScreenView>();

            newScreenView = newScreenView != null && (newScreenView.content == this.transform.parent ||
                                                      (frameAnimator != null && frameAnimator.ripple != null && frameAnimator.ripple.parent == newScreenView.content)) ? newScreenView : null;

            if (screenView != newScreenView)
            {
                TryUnregisterInScreenView();
                m_ScreenView = newScreenView;
                TryRegisterInScreenView();
            }
        }
コード例 #4
0
        public static void CreateCustomScreenAsync <T>(string screenPrefabPath, ScreenView screenView, System.Action <string, T> callback) where T : MaterialScreen
        {
            System.Action <string, GameObject> internalCallback = (path, screen) =>
            {
                if (screen != null)
                {
                    screen.name = screenPrefabPath;
                    screen.gameObject.SetActive(false);
                }

                T assetComponent = null;
                if (screen != null)
                {
                    assetComponent = screen.GetComponent <T>();
                }
                callback(path, assetComponent);
            };
            PrefabManager.InstantiateGameObjectAsync(screenPrefabPath, screenView != null ? screenView.transform : Instance.transform, internalCallback);
        }
        public override void OnInspectorGUI()
        {
            m_ScreenView = (ScreenView)target;

            serializedObject.Update();

            EditorGUILayout.PropertyField(m_AutoTrackScreens);
            if (!m_AutoTrackScreens.boolValue)
            {
                EditorGUILayout.PropertyField(m_MaterialScreens, true);
            }

            EditorGUILayout.PropertyField(m_OnlyShowSelectedScreen);

            MaterialScreen[] materialScreen = m_ScreenView.materialScreen;

            if (materialScreen.Length > 0)
            {
                string[] names = new string[materialScreen.Length];

                for (int i = 0; i < materialScreen.Length; i++)
                {
                    names[i] = (i + 1) + " - " + materialScreen[i].name;
                }

                m_ScreenView.currentScreen = EditorGUILayout.Popup("Current screen", m_ScreenView.currentScreen, names);

                m_ScreenView.screensDirty = true;

                EditorGUILayout.Space();
            }

            bool controllingAnyScreenConfigs = false;

            for (int i = 0; i < m_ScreenView.materialScreen.Length; i++)
            {
                MaterialScreen t = m_ScreenView.materialScreen[i];
                if (t.optionsControlledByScreenView)
                {
                    controllingAnyScreenConfigs = true;
                    break;
                }
            }
            if (controllingAnyScreenConfigs)
            {
                bool fadeIn    = m_FadeIn.boolValue;
                bool scaleIn   = m_ScaleIn.boolValue;
                bool slideIn   = m_SlideIn.boolValue;
                bool rippleIn  = m_RippleIn.boolValue;
                bool fadeOut   = m_FadeOut.boolValue;
                bool scaleOut  = m_ScaleOut.boolValue;
                bool slideOut  = m_SlideOut.boolValue;
                bool rippleOut = m_RippleOut.boolValue;

                if (fadeIn)
                {
                    using (new GUILayout.VerticalScope("Box"))
                    {
                        EditorGUILayout.PropertyField(m_FadeIn);
                        EditorGUILayout.PropertyField(m_FadeInTweenType,
                                                      new GUIContent("Tween type"));
                        if (m_FadeInTweenType.enumValueIndex == 0)
                        {
                            m_ScreenView.fadeInCustomCurve =
                                Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.fadeInCustomCurve));
                        }
                        EditorGUILayout.PropertyField(m_FadeInAlpha,
                                                      new GUIContent("Initial Alpha"));
                    }
                    EditorGUILayout.Space();
                }
                else
                {
                    EditorGUILayout.PropertyField(m_FadeIn);
                }

                if (scaleIn)
                {
                    using (new GUILayout.VerticalScope("Box"))
                    {
                        EditorGUILayout.PropertyField(m_ScaleIn);
                        EditorGUILayout.PropertyField(m_ScaleInTweenType,
                                                      new GUIContent("Tween type"));
                        if (m_ScaleInTweenType.enumValueIndex == 0)
                        {
                            m_ScreenView.scaleInCustomCurve =
                                Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.scaleInCustomCurve));
                        }
                        EditorGUILayout.PropertyField(m_ScaleInScale,
                                                      new GUIContent("Initial Scale"));
                    }
                    EditorGUILayout.Space();
                }
                else
                {
                    EditorGUILayout.PropertyField(m_ScaleIn);
                }

                if (slideIn)
                {
                    using (new GUILayout.VerticalScope("Box"))
                    {
                        EditorGUILayout.PropertyField(m_SlideIn);
                        EditorGUILayout.PropertyField(m_SlideInTweenType,
                                                      new GUIContent("Tween type"));
                        if (m_SlideInTweenType.enumValueIndex == 0)
                        {
                            m_ScreenView.slideInCustomCurve =
                                Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.slideInCustomCurve));
                        }
                        EditorGUILayout.PropertyField(m_SlideInDirection,
                                                      new GUIContent("From the"));
                        EditorGUILayout.PropertyField(m_AutoSlideInAmount,
                                                      new GUIContent("Auto distance"));
                        if (m_AutoSlideInAmount.boolValue)
                        {
                            EditorGUILayout.PropertyField(m_SlideInPercent,
                                                          new GUIContent("Auto distance percent"));
                        }
                        else
                        {
                            EditorGUILayout.PropertyField(m_SlideInAmount,
                                                          new GUIContent("Distance"));
                        }
                    }
                    EditorGUILayout.Space();
                }
                else
                {
                    EditorGUILayout.PropertyField(m_SlideIn);
                }

                if (rippleIn)
                {
                    using (new GUILayout.VerticalScope("Box"))
                    {
                        EditorGUILayout.PropertyField(m_RippleIn);
                        EditorGUILayout.PropertyField(m_RippleInTweenType,
                                                      new GUIContent("Tween type"));
                        if (m_RippleInTweenType.enumValueIndex == 0)
                        {
                            m_ScreenView.rippleInCustomCurve =
                                Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.rippleInCustomCurve));
                        }
                        EditorGUILayout.PropertyField(m_RippleInType,
                                                      new GUIContent("Position type"));
                        if (m_RippleInType.enumValueIndex == 1)
                        {
                            EditorGUILayout.PropertyField(m_RippleInPosition,
                                                          new GUIContent("Position"));
                        }
                    }
                    EditorGUILayout.Space();
                }
                else
                {
                    EditorGUILayout.PropertyField(m_RippleIn);
                }

                EditorGUILayout.Space();

                if (fadeOut)
                {
                    using (new GUILayout.VerticalScope("Box"))
                    {
                        EditorGUILayout.PropertyField(m_FadeOut);
                        EditorGUILayout.PropertyField(m_FadeOutTweenType,
                                                      new GUIContent("Tween type"));
                        if (m_FadeOutTweenType.enumValueIndex == 0)
                        {
                            m_ScreenView.fadeOutCustomCurve =
                                Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.fadeOutCustomCurve));
                        }
                        EditorGUILayout.PropertyField(m_FadeOutAlpha,
                                                      new GUIContent("Initial Alpha"));
                    }
                    EditorGUILayout.Space();
                }
                else
                {
                    EditorGUILayout.PropertyField(m_FadeOut);
                }

                if (scaleOut)
                {
                    using (new GUILayout.VerticalScope("Box"))
                    {
                        EditorGUILayout.PropertyField(m_ScaleOut);
                        EditorGUILayout.PropertyField(m_ScaleOutTweenType,
                                                      new GUIContent("Tween type"));
                        if (m_ScaleOutTweenType.enumValueIndex == 0)
                        {
                            m_ScreenView.scaleOutCustomCurve =
                                Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.scaleOutCustomCurve));
                        }
                        EditorGUILayout.PropertyField(m_ScaleOutScale,
                                                      new GUIContent("Initial Scale"));
                    }
                    EditorGUILayout.Space();
                }
                else
                {
                    EditorGUILayout.PropertyField(m_ScaleOut);
                }

                if (slideOut)
                {
                    using (new GUILayout.VerticalScope("Box"))
                    {
                        EditorGUILayout.PropertyField(m_SlideOut);
                        EditorGUILayout.PropertyField(m_SlideOutTweenType,
                                                      new GUIContent("Tween type"));
                        if (m_SlideOutTweenType.enumValueIndex == 0)
                        {
                            m_ScreenView.slideOutCustomCurve =
                                Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.slideOutCustomCurve));
                        }
                        EditorGUILayout.PropertyField(m_SlideOutDirection,
                                                      new GUIContent("From the"));
                        EditorGUILayout.PropertyField(m_AutoSlideOutAmount,
                                                      new GUIContent("Auto distance"));
                        if (m_AutoSlideOutAmount.boolValue)
                        {
                            EditorGUILayout.PropertyField(m_SlideOutPercent,
                                                          new GUIContent("Auto distance percent"));
                        }
                        else
                        {
                            EditorGUILayout.PropertyField(m_SlideOutAmount,
                                                          new GUIContent("Distance"));
                        }
                    }
                    EditorGUILayout.Space();
                }
                else
                {
                    EditorGUILayout.PropertyField(m_SlideOut);
                }

                if (rippleOut)
                {
                    using (new GUILayout.VerticalScope("Box"))
                    {
                        EditorGUILayout.PropertyField(m_RippleOut);
                        EditorGUILayout.PropertyField(m_RippleOutTweenType,
                                                      new GUIContent("Tween type"));
                        if (m_RippleOutTweenType.enumValueIndex == 0)
                        {
                            m_ScreenView.rippleOutCustomCurve =
                                Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.rippleOutCustomCurve));
                        }
                        EditorGUILayout.PropertyField(m_RippleOutType,
                                                      new GUIContent("Position type"));
                        if (m_RippleOutType.enumValueIndex == 1)
                        {
                            EditorGUILayout.PropertyField(m_RippleOutPosition,
                                                          new GUIContent("Position"));
                        }
                    }
                    EditorGUILayout.Space();
                }
                else
                {
                    EditorGUILayout.PropertyField(m_RippleOut);
                }

                EditorGUILayout.PropertyField(m_TransitionDuration);
                EditorGUILayout.PropertyField(m_TransitionType, new GUIContent("Default transition type"));
            }
            else
            {
                EditorGUILayout.LabelField("Not controlling any MaterialScreen settings", EditorStyles.boldLabel);
            }

            EditorGUILayout.PropertyField(m_OnScreenBeginTransition);
            EditorGUILayout.PropertyField(m_OnScreenEndTransition);

            serializedObject.ApplyModifiedProperties();
        }
コード例 #6
0
        public static void ShowCustomScreenAsync <T>(string screenPrefabPath, ScreenView screenView, System.Action <T> initializeCallback, DialogProgress progressIndicator = null, bool p_searchForScreensWithSameName = true) where T : MaterialScreen
        {
            T screenWithSameName = null;

            if (screenView != null)
            {
                if (p_searchForScreensWithSameName)
                {
                    foreach (var screen in screenView.materialScreen)
                    {
                        if (screen != null && screen is T && screen.name == screenPrefabPath)
                        {
                            screenWithSameName = screen as T;
                            break;
                        }
                    }
                }
            }

            System.Action <T> internalShowCallback = (screen) =>
            {
                if (screen != null)
                {
                    if (screenView != null)
                    {
                        if (!screenView.materialScreen.Contains(screen))
                        {
                            screenView.materialScreen.Add(screen);
                        }
                    }
                    //Init
                    if (initializeCallback != null)
                    {
                        initializeCallback.Invoke(screen);
                    }

                    if (screenView != null)
                    {
                        screen.Show();
                    }
                    else
                    {
                        Debug.Log("Invalid ScreenView");
                    }
                }
            };
            //Show Pre-Loaded Screen
            if (screenWithSameName != null)
            {
                internalShowCallback(screenWithSameName);
            }

            //Load and show Screen
            else
            {
                DialogProgress currentProgress = progressIndicator;

                System.Action <string, T> internalLoadCallback = (path, dialog) =>
                {
                    //_dialogGenericDialog = dialog;
                    if (dialog != null)
                    {
                        dialog.gameObject.SetActive(false);
                    }
                    System.Action callbackDelayed = () =>
                    {
                        //Show
                        if (internalShowCallback != null)
                        {
                            internalShowCallback.Invoke(dialog);
                        }

                        //Hide Progress Indicator
                        currentProgress.Hide();
                    };
                    Kyub.DelayedFunctionUtils.CallFunction(callbackDelayed, 0.5f);
                };

                if (currentProgress == null)
                {
                    currentProgress = DialogManager.ShowProgressModalCircular();
                }
                else
                {
                    currentProgress.Show();
                }
                CreateCustomScreenAsync <T>(screenPrefabPath, screenView, internalLoadCallback);
            }
        }
コード例 #7
0
 protected virtual void OnValidate()
 {
     _cachedScreenView = null;
 }
コード例 #8
0
 protected virtual void OnDisable()
 {
     _cachedScreenView = null;
 }