コード例 #1
0
    public void OnClick_Login()
    {
        ConnectingDialog.Connecting(true);
        var loginToServer = new LoginToServer();

        loginToServer.OnLogin += LoginCallback;
        loginToServer.Login(username.text, password.text);
        enabled = true;
    }
コード例 #2
0
    public void TryToConnectToHelloWorld()
    {
        var helloWorldIP = FindObjectOfType <LANForm_ServerIPInput>().LanIP;

        helloWorldIP = $"http://{helloWorldIP}/HelloWorld.php";
        ConnectingDialog.Connecting();
        ConnectingDialog.OnHide += ConnectingDialog_OnHide;
        new GameObject(nameof(ConnectToServer)).AddComponent <ConnectToServer>().ConnectToHelloWorld(helloWorldIP, HelloWorldCallback);
    }
コード例 #3
0
    public void OnClickRegister()
    {
        var username = this.username.text;

        if (IsUsernameValid(username) == false)
        {
            // TODO : Show username not valid error
            ErrorDialog.Instance.Open("Username is not valid");
            Debug.Log("Username is not valid");
            return;
        }

        if (gender_male.IsActive == false && gender_female.IsActive == false)
        {
            // TODO : Show gender is not currently selected error
            ErrorDialog.Instance.Open("Gender error");
            Debug.Log("Gender error");
            return;
        }

        var birthday = $"{bd_year.text}-{bd_month.text}-{bd_day.text}";

        if (System.DateTime.TryParse(birthday, out System.DateTime result) == false)
        {
            // TODO : Show invalid birthday error;
            ErrorDialog.Instance.Open("Birthday is not valid");
            Debug.Log("Birthday is not valid");
            return;
        }

        var password = this.password.text;
        var kakunin  = this.kakunin.text;

        if (string.IsNullOrEmpty(password) || string.IsNullOrEmpty(kakunin) || password != kakunin)
        {
            // TODO : Show password / kakunin error.
            ErrorDialog.Instance.Open("password or kakunin is not valid");
            Debug.Log("password or kakunin is not valid");
            return;
        }

        ConnectingDialog.Connecting();
        var gender  = gender_male.IsActive ? Gender.Male.ToString() : Gender.Female.ToString();
        var account = new RegisterAccountToServer(username, password, gender, birthday);

        account.RegisterCompleted += OnRegisterCompleted;
        account.Register();
    }
コード例 #4
0
    public void Awake()
    {
        if (string.IsNullOrEmpty(ServerAddress.ServerIP) == false)
        {
            void _local_HelloWorldCallback(string message)
            {
                if (message == ServerAddress.HelloWorldMessage)
                {
                    ConnectingDialog.Success();
                    GetComponent <UITweenFormTransition>().Execute();
                }

                else
                {
                    ConnectingDialog.Failed();
                }
            }

            ConnectingDialog.Connecting(true);
            new GameObject(nameof(ConnectToServer)).AddComponent <ConnectToServer>().ConnectToHelloWorld(ServerAddress.HelloWorldAdderss, _local_HelloWorldCallback);
        }
    }