Exemplo n.º 1
0
        private void OpenLoginPage()
        {
            var usernameInput = new MenuItemInfo
            {
                Path        = "Email",
                Text        = "Emaiil",
                Command     = "Email",
                Icon        = null,
                Data        = TMP_InputField.ContentType.Standard,
                CommandType = MenuCommandType.FORM_INPUT
            };

            var passwordInput = new MenuItemInfo
            {
                Path        = "Password",
                Text        = "Password",
                Command     = "Password",
                Icon        = null,
                Data        = TMP_InputField.ContentType.Password,
                CommandType = MenuCommandType.FORM_INPUT
            };

            MenuItemInfo[] formItems = new MenuItemInfo[] { usernameInput, passwordInput };
            MenuArgs       args      = new MenuArgs()
            {
                Items    = new MenuItemInfo[] { },
                OnAction = (inputs) =>
                {
                    m_uiEngine.DisplayProgress("Validating user...");

                    m_webInterface.UserLogin(inputs[0], inputs[1],
                                             (isNetworkError, message) =>
                    {
                        Error error = new Error();

                        JsonData validateUserLoginResult = JsonMapper.ToObject(message);

                        if (validateUserLoginResult["status"].ToString() == "200")
                        {
                            return;
                        }

                        error.ErrorCode = Error.E_NotFound;
                        error.ErrorText = validateUserLoginResult["message"].ToString();
                        m_uiEngine.DisplayResult(error, false);
                    });
                }
            };

            m_uiEngine.OpenLoginPage(args);
        }
Exemplo n.º 2
0
        public void CreateRoom(string roomName)
        {
            Debug.LogError("CreateRoom: " + PhotonNetwork.IsConnectedAndReady);
            if (!PhotonNetwork.IsConnectedAndReady)
            {
                m_uiEngine.DisplayResult(new Error()
                {
                    ErrorCode = Error.E_InvalidOperation,
                    ErrorText = "Not connected to multiplayer server yet."
                });
                return;
            }

            m_uiEngine.DisplayProgress("Creating room: " + roomName);
            RoomOptions options = new RoomOptions
            {
                IsVisible  = true,
                IsOpen     = true,
                MaxPlayers = 10
            };

            PhotonNetwork.CreateRoom(roomName, options);
        }