Beispiel #1
0
        public override void Init(LoginUiControl loginUi)
        {
            base.Init(loginUi);
            loginUi.Field.gameObject.SetActive(false);
            loginUi.PrimaryButton.text = "JOIN";
            loginUi.PrimaryButton.SetCallback(() =>
            {
                if (CanTransit())
                {
                    return;
                }
                else
                {
                    joinPressed = true;
                }
            });

            loginUi.SecondaryButton.buttonType = ButtonControl.Type.Primary;
            loginUi.SecondaryButton.text       = "HOST";
            loginUi.SecondaryButton.SetCallback(() =>
            {
                if (CanTransit())
                {
                    return;
                }
                else
                {
                    hostPressed = true;
                }
            });

            loginUi.DialogTitle.text = $"Welcome {loginUi.Client.State().Username}";
        }
Beispiel #2
0
 public override UiState <LoginUiControl> TryTransition(LoginUiControl monoBehavior)
 {
     if (BackPressed)
     {
         return(new JoinModeState());
     }
     return(null);
 }
Beispiel #3
0
 public override UiState <LoginUiControl> TryTransition(LoginUiControl loginUi)
 {
     if (LoginSuccess)
     {
         return(new JoinModeState());
     }
     return(null);
 }
Beispiel #4
0
 public override UiState <LoginUiControl> TryTransition(LoginUiControl loginUi)
 {
     if (BackPressed)
     {
         loginUi.Client.Exit();
         loginUi.Client.ClearState();
         return(new LoginState());
     }
     if (joinPressed)
     {
         return(new JoinRoomState());
     }
     if (hostPressed)
     {
         return(new CreateRoomState());
     }
     return(null);
 }
Beispiel #5
0
        public override void Init(LoginUiControl loginUi)
        {
            base.Init(loginUi);

            loginUi.DialogTitle.text  = "JOIN A ROOM";
            loginUi.Field.label       = "room ID";
            loginUi.Field.placeholder = "room ID";
            loginUi.Field.text        = "";
            loginUi.SecondaryButton.gameObject.SetActive(false);
            loginUi.PrimaryButton.text = "JOIN!";
            loginUi.PrimaryButton.SetCallback(async() =>
            {
                if (!joinPressed)
                {
                    joinPressed = true;
                    await loginUi.Join(loginUi.Field.text);
                    joinSuccess = true;
                }
            });
        }
Beispiel #6
0
        public override void Init(LoginUiControl loginUi)
        {
            base.Init(loginUi);

            loginUi.DialogTitle.text  = "CREATE A ROOM";
            loginUi.Field.label       = "room name";
            loginUi.Field.placeholder = "Choose a name";
            loginUi.Field.text        = "My Room";
            loginUi.SecondaryButton.gameObject.SetActive(false);
            loginUi.PrimaryButton.text = "CREATE!";
            loginUi.PrimaryButton.SetCallback(async() =>
            {
                if (!createPressed)
                {
                    createPressed = true;
                    await loginUi.CreateRoom(loginUi.Field.text);
                    createSuccess = true;
                }
            });
        }
Beispiel #7
0
        public override void Init(LoginUiControl loginUi)
        {
            base.Init(loginUi);

            loginUi.BackButton.gameObject.SetActive(false);
            loginUi.DialogTitle.text  = "PLAY AS";
            loginUi.Field.label       = "name";
            loginUi.Field.placeholder = "Enter a cool name";
            loginUi.Field.text        = "Superman";
            loginUi.SecondaryButton.gameObject.SetActive(false);
            loginUi.PrimaryButton.text = "ENTER";
            loginUi.PrimaryButton.SetCallback(async() =>
            {
                if (!EnterPressed)
                {
                    EnterPressed = true;
                    await loginUi.Connect();
                    await loginUi.Login(loginUi.Field.text);
                    LoginSuccess = true;
                    EnterPressed = false;
                }
            });
        }