Esempio n. 1
0
        public static bool GetDialogOptOutDecision(DialogOptOutDecisionType dialogOptOutDecisionType, string dialogOptOutDecisionStorageKey)
        {
            switch (dialogOptOutDecisionType)
            {
            case DialogOptOutDecisionType.ForThisMachine:
                return(EditorPrefs.GetBool(dialogOptOutDecisionStorageKey, false));

            case DialogOptOutDecisionType.ForThisSession:
                return(SessionState.GetBool(dialogOptOutDecisionStorageKey, false));

            default:
                throw new NotImplementedException(string.Format("The DialogOptOut type named {0} has not been implemented.", dialogOptOutDecisionType));
            }
        }
Esempio n. 2
0
            public static string GetDialogOptOutMessage(DialogOptOutDecisionType dialogOptOutType)
            {
                switch (dialogOptOutType)
                {
                case DialogOptOutDecisionType.ForThisMachine:
                    return(k_DialogOptOutForThisMachine);

                case DialogOptOutDecisionType.ForThisSession:
                    return(k_DialogOptOutForThisSession);

                default:
                    throw new NotImplementedException(string.Format("The DialogOptOut type named {0} has not been implemented.", dialogOptOutType));
                }
            }
Esempio n. 3
0
        public static void SetDialogOptOutDecision(DialogOptOutDecisionType dialogOptOutDecisionType, string dialogOptOutDecisionStorageKey, bool optOutDecision)
        {
            switch (dialogOptOutDecisionType)
            {
            case DialogOptOutDecisionType.ForThisMachine:
                EditorPrefs.SetBool(dialogOptOutDecisionStorageKey, optOutDecision);
                break;

            case DialogOptOutDecisionType.ForThisSession:
                SessionState.SetBool(dialogOptOutDecisionStorageKey, optOutDecision);
                break;

            default:
                throw new NotImplementedException(string.Format("The DialogOptOut type named {0} has not been implemented.", dialogOptOutDecisionType));
            }
        }
        public static bool GetDialogOptOutDecision(DialogOptOutDecisionType dialogOptOutDecisionType, string dialogOptOutDecisionStorageKey)
        {
#if UNITY_2019_4_OR_NEWER
            return(EditorUtility.GetDialogOptOutDecision((UnityEditor.DialogOptOutDecisionType)dialogOptOutDecisionType, dialogOptOutDecisionStorageKey));
#else
            switch (dialogOptOutDecisionType)
            {
            case DialogOptOutDecisionType.ForThisMachine:
                return(EditorPrefs.GetBool(dialogOptOutDecisionStorageKey, false));

            case DialogOptOutDecisionType.ForThisSession:
                return(SessionState.GetBool(dialogOptOutDecisionStorageKey, false));

            default:
                throw new NotImplementedException(string.Format("The DialogOptOut type named {0} has not been implemented.", dialogOptOutDecisionType));
            }
#endif
        }
        public static void SetDialogOptOutDecision(DialogOptOutDecisionType dialogOptOutDecisionType, string dialogOptOutDecisionStorageKey, bool optOutDecision)
        {
#if UNITY_2019_4_OR_NEWER
            EditorUtility.SetDialogOptOutDecision((UnityEditor.DialogOptOutDecisionType)dialogOptOutDecisionType, dialogOptOutDecisionStorageKey, optOutDecision);
#else
            switch (dialogOptOutDecisionType)
            {
            case DialogOptOutDecisionType.ForThisMachine:
                EditorPrefs.SetBool(dialogOptOutDecisionStorageKey, optOutDecision);
                break;

            case DialogOptOutDecisionType.ForThisSession:
                SessionState.SetBool(dialogOptOutDecisionStorageKey, optOutDecision);
                break;

            default:
                throw new NotImplementedException(string.Format("The DialogOptOut type named {0} has not been implemented.", dialogOptOutDecisionType));
            }
#endif
        }
Esempio n. 6
0
 public static bool DisplayDialog(string title, string message, string ok, [DefaultValue("\"\"")] string cancel, DialogOptOutDecisionType dialogOptOutDecisionType, string dialogOptOutDecisionStorageKey)
 {
     if (GetDialogOptOutDecision(dialogOptOutDecisionType, dialogOptOutDecisionStorageKey))
     {
         return(true);
     }
     else
     {
         bool optOutDecision;
         bool dialogDecision = DisplayDialog(title, message, ok, cancel, Content.GetDialogOptOutMessage(dialogOptOutDecisionType), out optOutDecision);
         // Cancel means the user pressed ESC as the Cancel button was grayed out. Don't store the opt-out decision on cancel. Also, only store it if the user opted out since it defaults to opt-in.
         if (dialogDecision && optOutDecision)
         {
             SetDialogOptOutDecision(dialogOptOutDecisionType, dialogOptOutDecisionStorageKey, optOutDecision);
         }
         return(dialogDecision);
     }
 }
Esempio n. 7
0
 public static bool DisplayDialog(string title, string message, string ok, DialogOptOutDecisionType dialogOptOutDecisionType, string dialogOptOutDecisionStorageKey)
 {
     return(DisplayDialog(title, message, ok, string.Empty, dialogOptOutDecisionType, dialogOptOutDecisionStorageKey));
 }