Example #1
0
    public void Show(MobileSystemDialog mobileSystemDialog)
    {
        if (mobileSystemDialog.Buttons.Count <= 0 || mobileSystemDialog.Buttons.Count > 3 ||
            !(Application.platform == RuntimePlatform.WindowsEditor ||
              Application.platform == RuntimePlatform.OSXEditor ||
              Application.platform == RuntimePlatform.LinuxEditor))
        {
            return;
        }

        switch (mobileSystemDialog.Buttons.Count)
        {
        case 1:
            if (EditorUtility.DisplayDialog(mobileSystemDialog.TitleText, mobileSystemDialog.BodyText,
                                            mobileSystemDialog.Buttons[0].ButtonLabel, string.Empty))
            {
                mobileSystemDialog.Buttons[0].Action();
            }

            break;

        case 2:
            if (EditorUtility.DisplayDialog(mobileSystemDialog.TitleText, mobileSystemDialog.BodyText,
                                            mobileSystemDialog.Buttons[0].ButtonLabel, mobileSystemDialog.Buttons[1].ButtonLabel))
            {
                mobileSystemDialog.Buttons[0].Action();
            }
            else
            {
                mobileSystemDialog.Buttons[1].Action();
            }

            break;

        case 3:
            var option = EditorUtility.DisplayDialogComplex(
                mobileSystemDialog.TitleText,
                mobileSystemDialog.BodyText,
                mobileSystemDialog.Buttons[0].ButtonLabel,
                mobileSystemDialog.Buttons[1].ButtonLabel,
                mobileSystemDialog.Buttons[2].ButtonLabel);
            switch (option)
            {
            case 0:
            case 1:
            case 2:
                mobileSystemDialog.Buttons[option].Action();
                break;

            default:
                _debugService.Log("Dialog unrecognized option.");
                break;
            }

            break;
        }
    }
        public string GetText(string key)
        {
            var value = string.Empty;

            if (!CurrentLanguage.TextValues.TryGetValue(key, out value))
            {
                _debugService.Log(string.Format("Missing text with key: {0}", key), Color.red);
            }

            if (string.IsNullOrEmpty(value))
            {
                _debugService.Log(
                    string.Format("Empty localized text with key: {0}, languageCode: {1}", key, CurrentLanguageCode),
                    Color.red);
            }

            return(value);
        }
Example #3
0
        public void OpenMailTemplate(string emailAdress, string subject, string body)
        {
            _debugService.Log(DebugServiceTagConsts.FEEDBACK, "Subject: " + subject, Color.green);
            _debugService.Log(DebugServiceTagConsts.FEEDBACK, "Body: " + body, Color.green);

#if UNITY_IOS
            if (Application.platform == RuntimePlatform.IPhonePlayer && Prime31.EtceteraBinding.isEmailAvailable())
            {
                Prime31.EtceteraBinding.showMailComposer(emailAdress, subject, body, false);
            }
#elif UNITY_ANDROID
            if (Application.platform == RuntimePlatform.Android)
            {
                //TODO:Add android native
                Application.OpenURL(string.Format("mailto:{0}?subject={1}&body={2}", emailAdress, WWW.EscapeURL(subject).Replace("+", "%20"), WWW.EscapeURL(body).Replace("+", "%20")));
            }
#endif
        }
        public async Task Invoke(HttpContext context, IWebHostEnvironment env, UserManager <UserProfileModel> users, IDebugService debug)
        {
            try
            {
                await _next(context);
            }
            catch (Exception e)
            {
                var user = await users.GetUserAsync(context.User);

                await debug.Log(e, context.TraceIdentifier, user?.Id);

                context.Response.Redirect("/Error/500", permanent: false);
                if (env.IsDevelopment())
                {
                    throw;
                }
                else
                {
                    context.Response.Redirect("/Error/500", permanent: false);
                }
            }
        }