當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript authmanager.authManager類代碼示例

本文整理匯總了TypeScript中poker/authmanager.authManager的典型用法代碼示例。如果您正苦於以下問題:TypeScript authManager類的具體用法?TypeScript authManager怎麽用?TypeScript authManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了authManager類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

 constructor() {
     super();
     const self = this;
     this.withdrawalAmount = ko.observable(null);
     this.withdrawalMethod = ko.observable(null);
     this.withdrawalMethods = ko.observableArray([
         { id: 1, text: "Unitbag" },
         { id: 2, text: "Visa" },
         { id: 3, text: "MasterCard" },
     ]);
     this.accountNumber = ko.observable(null);
     authManager.registerAuthenticationChangedHandler(async (newValue) => {
         if (newValue) {
             const api = new AccountManager();
             const data = await api.getAccount();
             const personalAccountData = data.Data;
             self.player({
                 login: authManager.login(),
                 amount: personalAccountData.RealMoney,
             });
         } else {
             self.player({
                 login: "",
                 amount: null,
             });
         }
     });
     this.player = ko.observable({
         login: "",
         amount: null,
     });
 }
開發者ID:online-poker,項目名稱:poker-html-client,代碼行數:32,代碼來源:withdrawalpage.ts

示例2: checkTableReload

    private async checkTableReload(tableId: number) {
        const reloadData = await this.getReload(tableId);
        if (reloadData.emergencyReload) {
            console.log("Emergency reload requested.");
            const api = this.getApi();

            // await api.confirmEmergencyReload(tableId);
            window.location.replace("http://google.com/");
            return;
        }

        if (reloadData.reloadRequired) {
            console.log("Normal reload requested.");
            if (appConfig.game.seatMode) {
                const seatId = parseInt(authManager.login().replace("Игрок", ""), 10);
                const propertyName = `seat${seatId}Reloaded`;
                if (reloadData[propertyName] === false) {
                    console.log(`Reloading seat ${seatId}.`);
                    const api = this.getApi();
                    await api.confirmSeatReload(tableId, seatId);
                    location.reload();
                }
            }

            if (appConfig.game.tablePreviewMode && !reloadData.tableReloaded) {
                console.log("Reloading table.");
                const api = this.getApi();
                await api.confirmTableReload(tableId);
                location.reload();
            }
        }
    }
開發者ID:online-poker,項目名稱:poker-html-client,代碼行數:32,代碼來源:appreloadservice.ts

示例3:

 authManager.registerAuthenticationChangedHandler(function (newValue) {
     if (authManager.login() === null) {
         self.amount(0);
     } else {
         self.updateAccount();
     }
 });
開發者ID:online-poker,項目名稱:poker-html-client,代碼行數:7,代碼來源:lobbypage.ts

示例4: constructor

    constructor(messageId: number, date: Date, sender: string, message: string) {
        this.messageId = messageId;
        this.isAdmin = false;
        if (sender.toLowerCase() === "admin") {
            this.isAdmin = true;
        }

        this.isMy = ko.observable(authManager.login() === sender);
        authManager.registerAuthenticationChangedHandler(() => {
            this.isMy(authManager.login() === sender);
        });

        this.sender = sender;
        this.message = ko.observable(message);
        this.date = date.getHours() + ":" + date.getMinutes();
        this.fullMessage = ko.computed(() => {
            return "[" + this.date + "]" + this.sender + " - " + this.message();
        });
    }
開發者ID:online-poker,項目名稱:poker-html-client,代碼行數:19,代碼來源:playerMessage.ts

示例5: updateAccount

    public async updateAccount() {
        if (!authManager.authenticated()) {
            return;
        }

        const self = this;
        try {
            await this.updateAccountData();
        } catch (e) {
            self.updateAccount();
        }
    }
開發者ID:online-poker,項目名稱:poker-html-client,代碼行數:12,代碼來源:lobbypage.ts

示例6: AccountManager

 authManager.registerAuthenticationChangedHandler(async (newValue) => {
     if (newValue) {
         const api = new AccountManager();
         const data = await api.getAccount();
         const personalAccountData = data.Data;
         self.player({
             login: authManager.login(),
             amount: personalAccountData.RealMoney,
         });
     } else {
         self.player({
             login: "",
             amount: null,
         });
     }
 });
開發者ID:online-poker,項目名稱:poker-html-client,代碼行數:16,代碼來源:withdrawalpage.ts

示例7:

 authManager.registerAuthenticationChangedHandler(() => {
     this.isMy(authManager.login() === sender);
 });
開發者ID:online-poker,項目名稱:poker-html-client,代碼行數:3,代碼來源:playerMessage.ts

示例8: constructor

    constructor() {
        super();
        const self = this;
        this.showScreenOverlay = ko.computed(() => {
            if (!appConfig.ui.enableScreenOverlay) {
                return false;
            }

            if ((/iphone|ipod|ipad/gi).test(navigator.platform)) {
                if (!navigator.standalone) {
                    return true;
                }

                return false;
            }

            return false;
        });
        this.currentTime = ko.computed(function () {
            return timeService.currentTime();
        }, this);
        this.online = metadataManager.online;
        this.registered = metadataManager.registered;
        this.captionLabel = ko.computed(() => {
            return _("header.onlinePlayersShort")
                .replace("#registered", this.registered())
                .replace("#online", this.online());
        });
        this.tournamentsCaption = ko.computed(function () {
            return _("tournamentsList.headerCaption")
                .replace("#count", "0".toString());
        }, this);
        this.cashOptions = new CashOptions();
        this.tournamentOptions = new TournamentOptions();
        this.sngOptions = new TournamentOptions();
        this.tournaments = ko.observableArray<LobbyTournamentItemEx>([]);
        this.sngs = ko.observableArray<LobbyTournamentItemEx>([]);
        this.tables = ko.observableArray([]);
        this.showFilterSlider = ko.observable(false);
        this.showItemsListSlider = ko.observable(true);
        this.filterLocked = ko.observable(false);
        this.slider = new Slider();
        this.slider.addOption(_("lobby.cashGames"), "cash", null);
        this.slider.addOption(_("lobby.tournaments"), "tournaments", null);
        this.slider.addOption(_("lobby.sitAndGo"), "sng", null);
        this.cashTablesEnabled = ko.observable(appConfig.lobby.cashTablesEnabled);
        this.tournamentTablesEnabled = ko.observable(appConfig.lobby.tournamentTablesEnabled);
        this.sngTablesEnabled = ko.observable(appConfig.lobby.sngTablesEnabled);

        if (!appConfig.tournament.enabled) {
            this.slider.enabled(false);
            this.tournamentTablesEnabled(false);
            this.sngTablesEnabled(false);
        }

        if (appConfig.tournament.enableTournamentOnly) {
            this.slider.enabled(false);
            this.slider.currentIndex(1);
        }

        this.loading = ko.observable(false);
        this.selectionCaption = ko.computed(function () {
            if (self.slider.currentIndex() === 0) {
                return _("tablesList.headerCaption")
                    .replace("#count", self.tables().length.toString());
            }

            if (self.slider.currentIndex() === 1) {
                return _("tournamentsList.headerCaption")
                    .replace("#count", self.tournaments().length.toString());
            }

            return _("tournamentsList.sngCaption")
                .replace("#count", self.sngs().length.toString());
        }, this);

        tableManager.tables.subscribe(function () {
            self.updateOpenedTables();
        });

        this.authenticated = ko.computed(function () {
            return authManager.authenticated();
        }, this);
        this.login = ko.computed(function () {
            return authManager.login();
        }, this);
        authManager.registerAuthenticationChangedHandler(function (newValue) {
            if (authManager.login() === null) {
                self.amount(0);
            } else {
                self.updateAccount();
            }
        });
        this.amount = ko.observable(0);
    }
開發者ID:online-poker,項目名稱:poker-html-client,代碼行數:95,代碼來源:lobbypage.ts


注:本文中的poker/authmanager.authManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。