Ejemplo n.º 1
0
        private async Task <bool> IsValidateLoginFields()
        {
            bool          isValid = false;
            List <string> errors  = new List <string>();

            if (string.IsNullOrEmpty(Email))
            {
                errors.Add("Email is required.");
            }
            else
            {
                var isValidEmail = Extensions.IsValidEmailAddress(Email);
                if (!isValidEmail)
                {
                    errors.Add("Invalid email address");
                }
            }

            if (string.IsNullOrEmpty(Password))
            {
                errors.Add("Password is required.");
            }

            if (errors.Count > 0)
            {
                isValid = false;
                await _alertView.Show(string.Join(Environment.NewLine, errors));
            }
            else
            {
                isValid = true;
            }

            return(isValid);
        }
Ejemplo n.º 2
0
 public void OnPauseButtonTap()
 {
     game.Pause();
     alertView.SetTitle(Constant.Text.GamePaused);
     alertView.AddButton(Constant.Text.Resume, game.Resume, audioPlayer.PlayResumeClip);
     alertView.AddButton(Constant.Text.NewGame, game.Start, audioPlayer.PlayNewGameClip);
     alertView.Show();
 }
Ejemplo n.º 3
0
    public void ShowConfirm(int id, string content, string ok_name, string cancel_name, System.Action <eAlertBtnType> fun)
    {
        //layer
        Transform layer = UILayerUtils.GetLayer((int)eUILayer.TOP);

        if (layer == null)
        {
            Log.Warning("AlertManager::Show - not find layer:" + eUILayer.TOP);
            layer = UILayerUtils.RootLayer;
        }

        //构建
        GameObject obj = UIManager.Instance.Show(id);

        if (obj == null)
        {
            return;
        }

        GameObjectUtils.SetLayer(obj, LayerMask.NameToLayer(SceneLayerID.UI));
        m_AlertView = obj.GetComponent <AlertView>() as AlertView;
        if (m_AlertView == null)
        {
            m_AlertView = obj.AddComponent <AlertView>() as AlertView;
        }

        //更新数据
        m_AlertView         = obj.GetComponent <AlertView>();
        m_AlertView.Content = content;
        m_AlertView.DicBtn.Add(eAlertBtnType.OK, ok_name);
        m_AlertView.DicBtn.Add(eAlertBtnType.CANCEL, cancel_name);
        m_AlertView.Fun = fun;
        m_AlertView.Show();
    }
Ejemplo n.º 4
0
        partial void ShowAlert(NSObject sender)
        {
            var alert = new AlertView("Alert Title", "This is an alert message");

            alert.SetDestructiveButtonWithTitle("Cancel", null);
            alert.AddButtonWithTitle("OK", () => {
                this.ShowAlert(null);
            });

            alert.Show();
        }
Ejemplo n.º 5
0
    public void CheckResources()
    {
        updateStatusData.Reset();
        if (Application.isEditor && loadMode == LoadModeType.FromResources)
        {
            StartCoroutine(SkipCheckUpdateFiles());
        }
        else
        {
            float time = Time.realtimeSinceStartup;
            float size = 0;

            List <DownloadFile> list = new List <DownloadFile>();
            // list.Add(new DownloadFile("https://speed.hetzner.de/100MB.bin", Path.Combine(Application.persistentDataPath, "test1.bin")));
            list.Add(new DownloadFile("https://image.baidu.com/search/down?tn=download&word=download&ie=utf8&fr=detail&url=https%3A%2F%2Ftimgsa.baidu.com%2Ftimg%3Fimage%26quality%3D80%26size%3Db9999_10000%26sec%3D1535005781611%26di%3Decfa16c783fec6a3eee60d0cb4eee654%26imgtype%3D0%26src%3Dhttp%253A%252F%252Fatt.bbs.duowan.com%252Fforum%252F201209%252F28%252F075324wcewb8zwgb1pgbg0.jpg&thumburl=https%3A%2F%2Fss1.bdstatic.com%2F70cFvXSh_Q1YnxGkpoWK1HF6hhy%2Fit%2Fu%3D3206931758%2C4276788165%26fm%3D26%26gp%3D0.jpg", Path.Combine(Application.persistentDataPath, "test.jpg")));

            FileDownloader downloader = FileDownloader.DownloadFiles(list);
            downloader.timeout = 10;
            downloader.onDownloadStateChanged = (FileDownloader dl, DownloadState state) =>
            {
                if (state == DownloadState.NetworkError)
                {
                    AlertView.Show(dl.error, () =>
                    {
                        Debug.Log("OnCliCked");
                        downloader.Resume();
                    });
                }
                else if (state == DownloadState.HttpError)
                {
                    AlertView.Show("responseCode:" + dl.responseCode);
                }
                else if (state == DownloadState.Finish)
                {
                    updateStatusData.SetPercent(1.0f);
                    SendNotification(NotificationDefine.CHECK_RESOURCES_STATUS_UPDATE, updateStatusData);
                    Destroy(dl);
                }
            };
            downloader.onDownloadedSizeChanged = (FileDownloader dl, float downloadedSize) =>
            {
                float totalSize = 393;
                updateStatusData.SetPercent(downloadedSize / totalSize);
                if ((Time.realtimeSinceStartup - time) > 1.0f)
                {
                    float speed = (downloader.downloadedSize - size) / (Time.realtimeSinceStartup - time);
                    updateStatusData.SetSpeed(speed);
                    time = Time.realtimeSinceStartup;
                    size = downloader.downloadedSize;
                }
                SendNotification(NotificationDefine.CHECK_RESOURCES_STATUS_UPDATE, updateStatusData);
            };
        }
    }
Ejemplo n.º 6
0
    /// <summary>
    /// _Scene Title/0 Menu/1 Battle/2
    /// </summary>
    static public AlertView Make(int _tag, string _Title, string _Description, string[] _choices, GameObject _delegate, int _Scene, bool _CantCancel = false)
    {
        //タップ無効化
        DataManager.Instance.TouchDisable(_Scene);
        //アラート生成
        AlertView _alt = Instantiate(DataManager.Instance.AlertPrefab);

        _alt.transform.SetParent(DataManager.Instance.AlertParents[_Scene]);
        _alt.Show(_delegate, _Title, _Description, _choices, _tag, _CantCancel);
        return(_alt);
    }
Ejemplo n.º 7
0
        public static void AlertView(FormWindowState windowState = FormWindowState.Normal)
        {
            Cursor.Current = Cursors.WaitCursor;

            if (Application.OpenForms["AlertView"] == null)
            {
                AlertView action = new AlertView();
                action.Show();
            }
            else
            {
                {
                    Application.OpenForms["AlertView"].Activate();
                    Application.OpenForms["AlertView"].WindowState = windowState;
                    Application.OpenForms["AlertView"].Show();
                }
            }
        }
Ejemplo n.º 8
0
 void OnGameFinished()
 {
     alertView.SetTitle(Constant.Text.GameFinished);
     alertView.AddButton(Constant.Text.PlayAgain, game.Start, audioPlayer.PlayNewGameClip);
     alertView.Show();
 }