Esempio n. 1
0
        /// <summary>
        /// 存款
        /// </summary>
        /// <param name="accountInfo"></param>
        public static void UpdateSave(UserAccountInfo accountInfo)
        {
            using (var context = new BMS_DBEntities())
            {
                try
                {
                    OperateRecordInfo operateinfo = new OperateRecordInfo();

                    var q = from t in context.UserAccountInfoes
                            where accountInfo.UAccountNumber == t.UAccountNumber
                            select t;
                    foreach (var i in q)
                    {
                        i.Balance += accountInfo.Balance;
                        operateinfo.AccountRemaining = (double)i.Balance;
                    }

                    operateinfo.OTime          = System.DateTime.Now;
                    operateinfo.OType          = "存款";
                    operateinfo.OAccountNumber = accountInfo.UAccountNumber;
                    operateinfo.OAccountChange = (double)accountInfo.Balance;
                    context.OperateRecordInfoes.Add(operateinfo);
                    context.SaveChanges();
                    context.Dispose();
                }
                catch
                {
                    MessageBox.Show("修改失败");
                }
            }
        }
        public async Task DeleteUserAccountAsync_ValidId_DeletesWithCommentsAndLots()
        {
            var user = new UserAccountInfo {
                Name = "User1", Email = "*****@*****.**"
            };
            var comment1 = new LotComment {
                Message = "Message1", UserId = "*****@*****.**", LotId = 1
            };
            var comment2 = new LotComment {
                Message = "Message2", UserId = "*****@*****.**", LotId = 1
            };
            var lot = new Lot {
                SellerUserId = "*****@*****.**", StartDate = DateTime.Now, SellDate = DateTime.Now.AddDays(1),
            };
            await userAccountOperationsHandler.AddUserAccountAsync(user);

            await lotOperationsHandler.AddLotAsync(lot, "", "");

            await lotCommentOperationsHandler.AddCommentAsync(comment1);

            await lotCommentOperationsHandler.AddCommentAsync(comment2);

            await userAccountOperationsHandler.DeleteUserAccountAsync("*****@*****.**", "", "");

            Assert.AreEqual(0, (await userAccountOperationsHandler.GetAllUserAccountsAsync()).Count());
            //Lot was deleted together with user, so lot with Id = 1 doesn`t exist
            Assert.ThrowsAsync <WrongIdException>(() => lotOperationsHandler.GetLotAsync(1));
        }
        public async Task AddUserAccountAsync(UserAccountInfo userAccount)
        {
            await ValidateUserAsync(userAccount);

            UoW.UserAccounts.Add(mapper.Map <UserAccountInfoEntity>(userAccount));
            await UoW.SaveChangesAsync();
        }
Esempio n. 4
0
 private void PlayfabEvents_OnLoginResultEvent(LoginResult result)
 {
     this.userAccountInfo = result?.InfoResultPayload?.AccountInfo;
     this.SessionTicket   = result?.SessionTicket;
     this.forceRelogin    = false;
     this.HasEverLoggedIn = true;
 }
Esempio n. 5
0
    public void FinalizeJoinRequest(string matchmakerTicket, UserAccountInfo userInfo, bool approved)
    {
        IClient client = tempTicketMap[matchmakerTicket];

        tempTicketMap.Remove(matchmakerTicket);

        //Respond to client with approval status
        using (DarkRiftWriter writer = DarkRiftWriter.Create()) {
            writer.Write(approved);

            using (Message message = Message.Create(NetworkTags.Connection, writer)) {
                client.SendMessage(message, SendMode.Reliable);
            }
        }

        //Record client in lobby map
        if (LobbyClientAccountMap.ContainsKey(client))
        {
            LobbyClientAccountMap[client] = userInfo;
        }
        else
        {
            LobbyClientAccountMap.Add(client, userInfo);
        }
    }
        public void ChangeUserAccount_ChangedNameAndComments_NameChangedCommentsNotChanged()
        {
            var user = new UserAccountInfo {
                Name = "User1", Email = "*****@*****.**"
            };

            userAccountOperationsHandler.AddUserAccount(user);

            var changedUser = userAccountOperationsHandler.GetUserAccount("*****@*****.**");

            changedUser.LotComments = new List <LotComment> {
                new LotComment {
                    Message = "Message1", LotId = 1, UserId = "*****@*****.**"
                }
            };
            changedUser.Name = "User2";
            userAccountOperationsHandler.ChangeUserAccount("*****@*****.**", changedUser);

            var resultUser = userAccountOperationsHandler.GetUserAccount("*****@*****.**");

            resultUser.LotComments = lotCommentOperationsHandler.GetUserComments("*****@*****.**").ToList();

            Assert.AreEqual("User2", resultUser.Name);
            Assert.AreEqual(0, resultUser.LotComments.Count());
        }
    /// <summary>
    /// Successfunction that is called after the combinedInfoRequest was successfull
    /// </summary>
    /// <param name="result"></param>
    public void CombinedInfoSuccess(GetPlayerCombinedInfoResult result)
    {
        CurrentPlayer        = result.InfoResultPayload.PlayerProfile;
        CurrentPlayerAccount = result.InfoResultPayload.AccountInfo;

        if (result.InfoResultPayload.UserVirtualCurrency.TryGetValue("CR", out int balance))
        {
            GameInstance.instance.credits = balance;
            Credits = balance.ToString();
        }
        else
        {
            GameInstance.instance.credits = 0;
            Credits = "0";
        }

        var statisticList = new List <StatisticModel>();

        foreach (var statisticValue in result.InfoResultPayload.PlayerStatistics)
        {
            var model = new StatisticModel
            {
                Value = statisticValue.Value,
                Name  = statisticValue.StatisticName
            };
            statisticList.Add(model);
        }

        CurrentPlayer.Statistics = statisticList;

        fullyLoaded = true;
    }
Esempio n. 8
0
        /// <summary>
        /// 开户
        /// </summary>
        /// <param name="accountInfo"></param>
        public static void CreateUser(UserAccountInfo accountInfo)
        {
            using (var context = new BMS_DBEntities())
            {
                try
                {
                    accountInfo.Statement = "normal";
                    context.UserAccountInfoes.Add(accountInfo);

                    OperateRecordInfo operateinfo = new OperateRecordInfo();
                    operateinfo.OTime            = System.DateTime.Now;
                    operateinfo.OType            = "开户";
                    operateinfo.OAccountNumber   = accountInfo.UAccountNumber;
                    operateinfo.OAccountChange   = (double)accountInfo.Balance;
                    operateinfo.AccountRemaining = (double)accountInfo.Balance;
                    context.OperateRecordInfoes.Add(operateinfo);
                    context.SaveChanges();

                    context.Dispose();
                }
                catch
                {
                    MessageBox.Show("修改失败");
                }
            }
        }
 /// <summary>
 /// Callback for GetAccountInfo Success
 /// </summary>
 /// <param name="Result"> Result - from the API Call</param>
 static void OnGetAccountInfoSuccess(GetAccountInfoResult result)
 {
     PlayFabLoginCalls.LoggedInUserInfo = result.AccountInfo;
     if (OnPlayfabCallbackSuccess != null)
     {
         OnPlayfabCallbackSuccess("", PlayFabAPIMethods.GetAccountInfo);
     }
 }
        //hostingEnvironmentPath - physical path to WebAPI folder
        //requestUriLeftPart - URL
        public void DeleteUserAccount(string userEmail, string hostingEnvironmentPath, string requestUriLeftPart)
        {
            UserAccountInfo user = GetUserAccount(userEmail);

            lotPhotoOperationsHandler.DeleteAllUserPhotos(userEmail, hostingEnvironmentPath);
            UoW.UserAccounts.Delete(userEmail);
            UoW.SaveChanges();
        }
        public void AddUserAccountAsync_InvalidEmailFormat_ThrowsWrongModelException()
        {
            var user = new UserAccountInfo {
                Name = "User1", Email = "Kek"
            };

            Assert.ThrowsAsync <WrongModelException>(() => userAccountOperationsHandler.AddUserAccountAsync(user));
        }
        public void AddUserAccountAsync_InvalidTelephoneNumberFormat_ThrowsWrongModelException()
        {
            var user = new UserAccountInfo {
                Name = "User1", TelephoneNumber = "+388", Email = "*****@*****.**"
            };

            Assert.ThrowsAsync <WrongModelException>(() => userAccountOperationsHandler.AddUserAccountAsync(user));
        }
        //hostingEnvironmentPath - physical path to WebAPI folder
        //requestUriLeftPart - URL
        public async Task DeleteUserAccountAsync(string userEmail, string hostingEnvironmentPath, string requestUriLeftPart)
        {
            UserAccountInfo user = await GetUserAccountAsync(userEmail);

            await lotPhotoOperationsHandler.DeleteAllUserPhotosAsync(userEmail, hostingEnvironmentPath);

            UoW.UserAccounts.Delete(userEmail);
            await UoW.SaveChangesAsync();
        }
Esempio n. 14
0
    protected void UserJoinGame(IClient client)
    {
        UserAccountInfo userInfo = null;

        if (LobbyClientAccountMap.ContainsKey(client))
        {
            userInfo = LobbyClientAccountMap[client];
            LobbyClientAccountMap.Remove(client);
        }
        else if (InGameClientAccountMap.ContainsKey(client))
        {
            userInfo = InGameClientAccountMap[client];
        }

        //Record client in game map
        if (InGameClientAccountMap.ContainsKey(client))
        {
            InGameClientAccountMap[client] = userInfo;
        }
        else
        {
            InGameClientAccountMap.Add(client, userInfo);
        }

        Player     player     = ServerGameManager.Instance.PlayerJoined(userInfo.PlayFabId, userInfo.TitleInfo.DisplayName);
        PlayerData playerData = DatabaseManager.GetPlayerData(userInfo.PlayFabId);

        player.maxSquadCost = playerData.MaxSquadCost;

        //Alert other players of the new player
        using (DarkRiftWriter writer = DarkRiftWriter.Create()) {
            writer.Write(player);

            using (Message message = Message.Create(NetworkTags.PlayerJoined, writer)) {
                foreach (IClient otherClient in InGameClientAccountMap.Keys)
                {
                    if (!otherClient.Equals(client))
                    {
                        otherClient.SendMessage(message, SendMode.Reliable);
                    }
                }
            }
        }

        //Send current game state to newly-joined player
        using (DarkRiftWriter writer = DarkRiftWriter.Create()) {
            writer.Write(ServerGameManager.Instance.GameState);
            //whether player already has entities spawned
            writer.Write(ServerEntityManager.Instance.GetUnitsForPlayer(player.id).Count > 0);

            using (Message message = Message.Create(NetworkTags.GameState, writer)) {
                client.SendMessage(message, SendMode.Reliable);
            }
        }

        ServerGameManager.Instance.TryToStartGame();
    }
Esempio n. 15
0
        public ActionResult Show(UserAccountInfo page)
        {
            if (CurrentRequestData.CurrentUser != null)
            {
                return(View(page));
            }

            return(_uniquePageService.RedirectTo <LoginPage>());
        }
        public async Task DeleteUserAccountAsync_InvalidId_ThrowsWrongIdException()
        {
            var user = new UserAccountInfo {
                Name = "User1", Email = "*****@*****.**"
            };
            await userAccountOperationsHandler.AddUserAccountAsync(user);

            Assert.ThrowsAsync <WrongIdException>(() => userAccountOperationsHandler.DeleteUserAccountAsync("*****@*****.**", "", ""));
        }
Esempio n. 17
0
    private void OnLoginSuccess(LoginResult result)
    {
        string        arg           = string.Empty;
        StringBuilder stringBuilder = new StringBuilder();

        stringBuilder.Append("[PlayFabManager] - OnLoginSuccessfull!\n");
        stringBuilder.AppendFormat("SessionTicket: {0}\n", result.SessionTicket);
        stringBuilder.AppendFormat("PlayFabId: {0}\n", result.PlayFabId);
        stringBuilder.AppendFormat("NewlyCreated: {0}\n", result.NewlyCreated);
        stringBuilder.AppendFormat("LastLoginTime: {0}\n", result.LastLoginTime);
        if (result.CustomData != null && result.CustomData is JsonObject)
        {
            stringBuilder.AppendLine("CustomData: " + JsonWrapper.SerializeObject(result.CustomData));
        }
        bool flag = this.HasCakeRacePersonalBests();

        GameProgress.DeleteKey("Statistics_" + PlayFabLeaderboard.Leaderboard.CakeRaceWins.ToString(), GameProgress.Location.Local);
        GameProgress.DeleteKey("Statistics_" + PlayFabLeaderboard.Leaderboard.CakeRaceWins.ToString() + "_Version", GameProgress.Location.Local);
        if (result.InfoResultPayload != null)
        {
            stringBuilder.Append("InfoResultPayload.AccountInfo:\n");
            UserAccountInfo accountInfo = result.InfoResultPayload.AccountInfo;
            if (accountInfo != null && accountInfo.TitleInfo != null)
            {
                stringBuilder.AppendFormat("DisplayName: {0}\n", accountInfo.TitleInfo.DisplayName);
                HatchManager.CurrentPlayer.AddPlayFabDisplayName(accountInfo.TitleInfo.DisplayName);
            }
            if (accountInfo != null && accountInfo.FacebookInfo != null)
            {
                arg = accountInfo.FacebookInfo.FacebookId;
            }
            stringBuilder.Append("InfoResultPayload.PlayerStatistics:\n");
            List <StatisticValue> playerStatistics = result.InfoResultPayload.PlayerStatistics;
            if (playerStatistics != null)
            {
                foreach (StatisticValue statisticValue in playerStatistics)
                {
                    stringBuilder.AppendFormat("{0}: {1}\n", statisticValue.StatisticName, statisticValue.Value);
                    GameProgress.SetInt("Statistics_" + statisticValue.StatisticName, statisticValue.Value, GameProgress.Location.Local);
                    GameProgress.SetInt("Statistics_" + statisticValue.StatisticName + "_Version", (int)statisticValue.Version, GameProgress.Location.Local);
                    if (statisticValue.StatisticName == PlayFabLeaderboard.Leaderboard.CakeRaceWins.ToString() && flag && statisticValue.Value <= 0)
                    {
                        this.ResetCakeRacePersonalBests();
                    }
                }
            }
        }
        stringBuilder.AppendLine("result.Request: " + result.Request.ToString());
        this.SessionTicket = result.SessionTicket;
        this.initialized   = true;
        if (this.OnLogin != null)
        {
            this.OnLogin(result.PlayFabId, arg);
        }
        this.OnFacebookNameCallback(string.Empty, string.Empty);
    }
Esempio n. 18
0
    void SetUserTitle(UserAccountInfo info, string playerName)
    {
        var dis = new UpdateUserTitleDisplayNameRequest()
        {
            DisplayName = playerName
        };

        //print(playerName);
        PlayFabClientAPI.UpdateUserTitleDisplayName(dis, x => SetScore(info.PlayFabId), y => print("FAILED USERDISPLAYNAME: " + y.ErrorMessage));
    }
        public void DeleteUserAccount_InvalidId_ThrowsWrongIdException()
        {
            var user = new UserAccountInfo {
                Name = "User1", Email = "*****@*****.**"
            };

            userAccountOperationsHandler.AddUserAccount(user);

            Assert.Throws <WrongIdException>(() => userAccountOperationsHandler.DeleteUserAccount("*****@*****.**", "", ""));
        }
        public async Task GetAllLotsAsync_DBContains1Elem_CountReturns1Elem()
        {
            var user = new UserAccountInfo {
                Name = "User1", Email = "*****@*****.**"
            };
            await userAccountOperationsHandler.AddUserAccountAsync(user);

            var resultUsers = await userAccountOperationsHandler.GetAllUserAccountsAsync();

            Assert.AreEqual(1, resultUsers.Count());
        }
        public void GetAllLots_DBContains1Elem_CountReturns1Elem()
        {
            var user = new UserAccountInfo {
                Name = "User1", Email = "*****@*****.**"
            };

            userAccountOperationsHandler.AddUserAccount(user);

            var resultUsers = userAccountOperationsHandler.GetAllUserAccounts();

            Assert.AreEqual(1, resultUsers.Count());
        }
        public void ChangeUserAccount(string userEmail, UserAccountInfo newUserAccount)
        {
            UserAccountInfo currentUser = GetUserAccount(userEmail);

            if (currentUser.Email != newUserAccount.Email)
            {
                throw new WrongModelException("No permission to change Email");
            }
            ValidateUser(newUserAccount, currentUser, false);
            UoW.UserAccounts.Modify(userEmail, mapper.Map <UserAccountInfoEntity>(newUserAccount));
            UoW.SaveChanges();
        }
        public void AddUserAccount_RepeatedEmail_ThrowsWrongModelException()
        {
            var user = new UserAccountInfo {
                Name = "User1", Email = "*****@*****.**"
            };

            userAccountOperationsHandler.AddUserAccount(user);
            var user2 = new UserAccountInfo {
                Name = "User1", Email = "*****@*****.**"
            };

            Assert.Throws <WrongModelException>(() => userAccountOperationsHandler.AddUserAccount(user2));
        }
Esempio n. 24
0
 void LoggedIn(string playerName)
 {
     if (accountInfo == null)
     {
         var info = new GetAccountInfoRequest();
         PlayFabClientAPI.GetAccountInfo(info, x => { accountInfo = x.AccountInfo; SetUserTitle(x.AccountInfo, playerName); RefreshHighScore(); }, y => print("FAILED GETTING INFO: " + y.ErrorMessage));
     }
     else
     {
         RefreshHighScore();
         SetUserTitle(accountInfo, playerName);
     }
 }
        public async Task ChangeUserAccountAsync(string userEmail, UserAccountInfo newUserAccount)
        {
            UserAccountInfo currentUser = await GetUserAccountAsync(userEmail);

            if (currentUser.Email != newUserAccount.Email)
            {
                throw new WrongModelException("No permission to change Email");
            }
            await ValidateUserAsync(newUserAccount, currentUser, false);

            UoW.UserAccounts.Modify(userEmail, mapper.Map <UserAccountInfoEntity>(newUserAccount));
            await UoW.SaveChangesAsync();
        }
        public async Task AddUserAccountAsync_RepeatedTelephoneNumber_ThrowsWrongModelException()
        {
            var user = new UserAccountInfo {
                Name = "User1", TelephoneNumber = "+380678522221", Email = "*****@*****.**"
            };
            await userAccountOperationsHandler.AddUserAccountAsync(user);

            var user2 = new UserAccountInfo {
                Name = "User1", TelephoneNumber = "+380678522221", Email = "*****@*****.**"
            };

            Assert.ThrowsAsync <WrongModelException>(() => userAccountOperationsHandler.AddUserAccountAsync(user2));
        }
        public async Task AddUserAccountAsync_ValidInput_AddsUserToDB()
        {
            var user = new UserAccountInfo {
                Name = "User1", Email = "*****@*****.**", TelephoneNumber = "+380678522221"
            };

            await userAccountOperationsHandler.AddUserAccountAsync(user);

            var resultUser = await userAccountOperationsHandler.GetUserAccountAsync("*****@*****.**");

            Assert.AreEqual(1, (await userAccountOperationsHandler.GetAllUserAccountsAsync()).Count());
            Assert.AreEqual("User1", resultUser.Name);
        }
        public void AddUserAccount_ValidInput_AddsUserToDB()
        {
            var user = new UserAccountInfo {
                Name = "User1", Email = "*****@*****.**", TelephoneNumber = "+380678522221"
            };

            userAccountOperationsHandler.AddUserAccount(user);

            var resultUser = userAccountOperationsHandler.GetUserAccount("*****@*****.**");

            Assert.AreEqual(1, userAccountOperationsHandler.GetAllUserAccounts().Count());
            Assert.AreEqual("User1", resultUser.Name);
        }
Esempio n. 29
0
        public async Task <UserAccountInfo> GetUserAccountInfo()
        {
            var userAccountInfo = new UserAccountInfo();
            var apiKeys         = await _account.GetApiKeys().FirstAsync();

            var accountCustomData = await _account.GetCustomDataAsync();

            userAccountInfo.ApiKeyId     = apiKeys.Id;
            userAccountInfo.ApiKeySecret = apiKeys.Secret;
            userAccountInfo.Balance      = decimal.Parse(accountCustomData[BalanceKey].ToString());
            userAccountInfo.TotalQueries = int.Parse(accountCustomData[TotalQueriesKey].ToString());

            return(userAccountInfo);
        }
        public async Task ChangeUserAccountAsync_InvalidUser_ThrowsExceptions()
        {
            var user = new UserAccountInfo {
                Name = "User1", Email = "*****@*****.**"
            };
            await userAccountOperationsHandler.AddUserAccountAsync(user);

            var changedUser = await userAccountOperationsHandler.GetUserAccountAsync("*****@*****.**");

            changedUser.Email = "changedEmail";

            Assert.ThrowsAsync <WrongIdException>(() => userAccountOperationsHandler.ChangeUserAccountAsync("*****@*****.**", changedUser));  //Invalid email
            Assert.ThrowsAsync <WrongModelException>(() => userAccountOperationsHandler.ChangeUserAccountAsync("*****@*****.**", changedUser)); //Changed email
        }
Esempio n. 31
0
 /// <summary>
 /// Converts the player data from the Playfab service to a Hashtable to be saved in the Photon service.
 /// </summary>
 /// <param name="accountInfo">UserAccountInfo retrieved from the Playfab service.</param>
 /// <param name="playerData">Dictionary of UserDataRecord retrieved from the Playfab service.</param>
 public void SetPlayerData(UserAccountInfo accountInfo, Dictionary<string, UserDataRecord> playerData)
 {
     PhotonNetwork.player.name = accountInfo.Username;
     Hashtable customProperties = new Hashtable();
     customProperties.Add("playFabID", accountInfo.PlayFabId);
     foreach (KeyValuePair<string, UserDataRecord> entry in playerData)
     {
         customProperties.Add(entry.Key, entry.Value.Value);
     }
     PhotonNetwork.SetPlayerCustomProperties(customProperties);
     if (onLocalPlayerDataSet != null)
     {
         onLocalPlayerDataSet(PhotonNetwork.player);
     }
 }
    /// <summary>
    /// Parses Unity PlayerPrefs for saved login information. See the gitHub readme for more information
    /// </summary>
    /// <returns> used for coroutine yielding </returns>
    IEnumerator ReadLoginDataRecord()
    {
        this.status.text = "Finding previous logins...";

        if(PlayerPrefs.HasKey("loginMethodUsed"))
        {
            this.status.text = "Previous login found... ";
            string raw = PlayerPrefs.GetString("loginMethodUsed");

            PlayFabLoginCalls.LoginPathways method = (PlayFabLoginCalls.LoginPathways) Enum.Parse(typeof(PlayFabLoginCalls.LoginPathways), raw);
            Debug.Log(method.ToString());

            switch(method)
            {
                case PlayFabLoginCalls.LoginPathways.pf_username:
                    if(PlayerPrefs.HasKey("accountInfo"))
                    {
                    this.accountInfo =  JsonConvert.DeserializeObject<UserAccountInfo>(PlayerPrefs.GetString("accountInfo"));
                        this.createNewAccount = false;
                        PrompForPassword();
                        this.details.text = string.Format("PlayFab Username: {0} found...", this.accountInfo.Username);
                        this.instructions.text = "Enter password to continue, or change accounts manually by clicking below.";
                        this.loginPathToUse = PlayFabLoginCalls.LoginPathways.pf_username;
                    }
                    break;

                case PlayFabLoginCalls.LoginPathways.pf_email:
                    if(PlayerPrefs.HasKey("accountInfo"))
                    {
                        this.accountInfo =  JsonConvert.DeserializeObject<UserAccountInfo>(PlayerPrefs.GetString("accountInfo"));
                        this.createNewAccount = false;
                        PrompForPassword();
                        this.details.text = string.Format("Email: {0} found...", this.accountInfo.PrivateInfo.Email);
                        this.instructions.text = "Enter password to continue, or change accounts manually by clicking below.";
                        this.loginPathToUse = PlayFabLoginCalls.LoginPathways.pf_email;
                    }
                    break;

                case PlayFabLoginCalls.LoginPathways.deviceId:
                        EnableCountdown();
                        this.createNewAccount = false;
                        this.details.text = "Device Id, click below to manually change accounts";
                        this.loginPathToUse = PlayFabLoginCalls.LoginPathways.deviceId;
                    break;

                case PlayFabLoginCalls.LoginPathways.facebook:
                        EnableCountdown();
                        this.createNewAccount = false;
                        this.details.text = "Facebook, click below to manually change accounts";
                        this.loginPathToUse = PlayFabLoginCalls.LoginPathways.facebook;
                    break;

                case PlayFabLoginCalls.LoginPathways.gameCenter:
                        EnableCountdown();
                        this.createNewAccount = false;
                        this.details.text = "GameCenter, click below to manually change accounts";
                        this.loginPathToUse = PlayFabLoginCalls.LoginPathways.gameCenter;
                    break;

                case PlayFabLoginCalls.LoginPathways.googlePlus:
                        EnableCountdown();
                        this.createNewAccount = false;
                        this.details.text = "Google+, click below to manually change accounts";
                        this.loginPathToUse = PlayFabLoginCalls.LoginPathways.googlePlus;
                    break;

                case PlayFabLoginCalls.LoginPathways.steam:
                        EnableCountdown();
                        this.createNewAccount = false;
                        this.details.text = "Steam, click below to manually change accounts";
                        this.loginPathToUse = PlayFabLoginCalls.LoginPathways.steam;
                    break;
                default:
                    AutoNewAccount();
                break;
            }
        }
        else
        {
            if(PlayFabLoginCalls.CheckForSupportedMobilePlatform())
            {
                AutoNewAccount();
            }
            else
            {
                PlayFabLoginCalls.TestDeviceIdHasAccount();
                yield return new WaitForSeconds(.333f);
                authController.activeState = AuthenticationController.LoginStates.Manual;
            }
        }
    }
Esempio n. 33
0
        public PageModel Setup(MediaModel mediaModel)
        {
            var pageModel = new PageModel();

            var productSearch = new ProductSearch
            {
                Name = "Categories",
                UrlSegment = "categories",
                RevealInNavigation = true
            };
            var categoryContainer = new ProductContainer
            {
                Name = "Products",
                UrlSegment = "products",
                RevealInNavigation = false
            };
            _documentService.AddDocument(productSearch);
            _documentService.PublishNow(productSearch);
            _documentService.AddDocument(categoryContainer);
            _documentService.PublishNow(categoryContainer);
            pageModel.ProductSearch = productSearch;

            var now = DateTime.UtcNow;
            var yourBasket = new Cart
            {
                Name = "Your Basket",
                UrlSegment = "basket",
                RevealInNavigation = false,
                PublishOn = now
            };
            _documentService.AddDocument(yourBasket);
            var enterOrderEmail = new EnterOrderEmail
            {
                Name = "Enter Order Email",
                UrlSegment = "enter-order-email",
                RevealInNavigation = false,
                Parent = yourBasket,
                DisplayOrder = 0,
                PublishOn = now,
            };
            _documentService.AddDocument(enterOrderEmail);
            var setPaymentDetails = new PaymentDetails
            {
                Name = "Set Payment Details",
                UrlSegment = "set-payment-details",
                RevealInNavigation = false,
                Parent = yourBasket,
                DisplayOrder = 1,
                PublishOn = now,
            };
            _documentService.AddDocument(setPaymentDetails);
            var setDeliveryDetails = new SetShippingDetails
            {
                Name = "Set Shipping Details",
                UrlSegment = "set-shipping-details",
                RevealInNavigation = false,
                Parent = yourBasket,
                DisplayOrder = 2,
                PublishOn = now,
            };
            _documentService.AddDocument(setDeliveryDetails);
            var orderPlaced = new OrderPlaced
            {
                Name = "Order Placed",
                UrlSegment = "order-placed",
                RevealInNavigation = false,
                Parent = yourBasket,
                DisplayOrder = 3,
                PublishOn = now,
            };
            _documentService.AddDocument(orderPlaced);

            // User Account
            var userAccount = new SitemapPlaceholder
            {
                Name = "User Account",
                UrlSegment = "user-account",
                RevealInNavigation = false,
                PublishOn = now
            };
            _documentService.AddDocument(userAccount);

            var userAccountInfo = new UserAccountInfo
            {
                Name = "Account Details",
                UrlSegment = "user-account-details",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccount
            };
            _documentService.AddDocument(userAccountInfo);

            var userAccountPassword = new UserAccountChangePassword
            {
                Name = "Change Password",
                UrlSegment = "user-account-change-password",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccount
            };
            _documentService.AddDocument(userAccountPassword);

            var userAccountAddresses = new UserAccountAddresses
            {
                Name = "Account Addresses",
                UrlSegment = "user-account-addresses",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccount
            };
            _documentService.AddDocument(userAccountAddresses);

            var editAddress = new UserAccountEditAddress
            {
                Name = "Edit Address",
                UrlSegment = userAccountAddresses.UrlSegment + "/edit-address",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccountAddresses
            };
            _documentService.AddDocument(editAddress);

            var userAccountOrders = new UserAccountOrders
            {
                Name = "Orders",
                UrlSegment = "user-account-orders",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccount
            };
            _documentService.AddDocument(userAccountOrders);

            var userOrder = new UserOrder
            {
                Name = "View Order",
                UrlSegment = "user-account-orders/order",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccountOrders
            };
            _documentService.AddDocument(userOrder);

            var userAccountReviews = new UserAccountReviews
            {
                Name = "Reviews",
                UrlSegment = "user-account-reviews",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccount
            };
            _documentService.AddDocument(userAccountReviews);

            var userAccountRewards = new UserAccountRewardPoints
            {
                Name = "Reward Points",
                UrlSegment = "user-account-reward-points",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccount
            };
            _documentService.AddDocument(userAccountRewards);

            // End User Account


            //Added to cart
            var addedToCart = new ProductAddedToCart
            {
                Name = "Added to Basket",
                UrlSegment = "add-to-basket",
                RevealInNavigation = false,
                PublishOn = now
            };
            _documentService.AddDocument(addedToCart);
            pageModel.ProductAddedToCart = addedToCart;

            var wishlist = new ShowWishlist
            {
                Name = "Wishlist",
                UrlSegment = "wishlist",
                RevealInNavigation = true,
                PublishOn = now
            };
            _documentService.AddDocument(wishlist);

            var newIn = new NewInProducts
            {
                Name = "New In",
                UrlSegment = "new-in",
                RevealInNavigation = true,
                PublishOn = now
            };
            _documentService.AddDocument(newIn);

            var about = new TextPage()
            {
                Name = "About us",
                UrlSegment = "about-us",
                RevealInNavigation = true,
                PublishOn = now,
                BodyContent = EcommerceInstallInfo.AboutUsText
            };
            _documentService.AddDocument(about);

            //update core pages
            var homePage = _documentService.GetDocumentByUrl<TextPage>("home");
            if (homePage != null)
            {
                homePage.BodyContent = EcommerceInstallInfo.HomeCopy;
                var templates = _pageTemplateAdminService.Search(new PageTemplateSearchQuery());
                var homeTemplate = templates.FirstOrDefault(x => x.Name == "Home Page");
                if (homeTemplate != null)
                {
                    homePage.PageTemplate = homeTemplate;
                }

                homePage.SubmitButtonText = "Sign up";
                _documentService.SaveDocument(homePage);
                pageModel.HomePage = homePage;
            }
            var page2 = _documentService.GetDocumentByUrl<TextPage>("page-2");
            if (page2 != null)//demopage in core not needed
                _documentService.DeleteDocument(page2);

            var contactus = _documentService.GetDocumentByUrl<TextPage>("contact-us");
            if (contactus != null)//demopage in core not needed
                _documentService.DeleteDocument(contactus);

            //Added to cart
            var contactUs = new ContactUs()
            {
                Name = "Contact Us",
                UrlSegment = "contact-us",
                RevealInNavigation = true,
                PublishOn = now,
                Latitude = 55.01021m,
                Longitude = -1.44998m,
                Address = EcommerceInstallInfo.Address,
                PinImage = mediaModel.Logo.FileUrl,
                BodyContent = "[form]",
                FormDesign = EcommerceInstallInfo.ContactFormDesign
            };
            _documentService.AddDocument(contactUs);
            GetFormProperties(contactUs);

            var brandListing = new BrandListing
            {
                Name = "Brands",
                UrlSegment = "brands",
                RevealInNavigation = true,
                PublishOn = now,
                BodyContent = ""
            };
            _documentService.AddDocument(brandListing);

            return pageModel;
        }