Exemplo n.º 1
0
        /// <summary>
        /// Start the login coroutine where the login is done by pre-created User object.
        /// If the user is not present in the Ebenit API, this request does create him.
        ///
        /// We recommend using of this login only for logins from platform with its own authorization.
        /// </summary>
        /// <param name="user">User object.</param>
        /// <param name="platform_id">ID of platform in Ebenit API.</param>
        public void initializeApiPlatform(User user, uint platform_id)
        {
            this.pt_login_done = false;

            this.pt_timeout = false;
            this.pt_online  = false;

            this.pt_user        = null;
            this.pt_platform_id = 0;

            CurrencyManager.getInstance().resetToDefault();
            HighscoreManager.getInstance().resetToDefault();
            ProductManager.getInstance().resetToDefault();

            if (user == null || platform_id <= 0)
            {
                this.pt_login_done = true;
                return;
            }

            this.pt_user        = user;
            this.pt_platform_id = platform_id;

            StartCoroutine(doInitializeApiPlatform());
        }
Exemplo n.º 2
0
        void Awake()
        {
            if (t_instance != null)
            {
                Destroy(gameObject);
            }
            else
            {
                t_instance = this;
                DontDestroyOnLoad(this.gameObject);

                m_request_manager = RequestManager.getInstance();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Logs out and resets the managers.
        /// </summary>
        public void logout()
        {
            this.pt_login_done = true;

            this.pt_timeout = false;
            this.pt_online  = false;

            this.pt_user        = null;
            this.pt_platform_id = 0;

            CurrencyManager.getInstance().resetToDefault();
            HighscoreManager.getInstance().resetToDefault();
            ProductManager.getInstance().resetToDefault();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Starts the login coroutine where the login is done by the user token.
        /// </summary>
        /// <param name="user_token">User token previously obtained from Ebenit API.</param>
        public void initializeApi(string user_token)
        {
            this.pt_login_done = false;

            this.pt_timeout = false;
            this.pt_online  = false;

            this.pt_user        = null;
            this.pt_platform_id = 0;

            CurrencyManager.getInstance().resetToDefault();
            HighscoreManager.getInstance().resetToDefault();
            ProductManager.getInstance().resetToDefault();

            if (string.IsNullOrEmpty(user_token))
            {
                this.pt_login_done = true;
                return;
            }

            StartCoroutine(doInitializeApi(user_token));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Starts the login coroutine where the login is done by the user credentials.
        /// </summary>
        /// <param name="platform_id">ID of platform in Ebenit API.</param>
        /// <param name="email">User e-mail.</param>
        /// <param name="password">User password in plain text.</param>
        /// <param name="permanent_login">True to longer token validity.</param>
        public void initializeApi(uint platform_id, string email, string password, bool permanent_login = false)
        {
            this.pt_login_done = false;

            this.pt_timeout = false;
            this.pt_online  = false;

            this.pt_user        = null;
            this.pt_platform_id = 0;

            CurrencyManager.getInstance().resetToDefault();
            HighscoreManager.getInstance().resetToDefault();
            ProductManager.getInstance().resetToDefault();

            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
            {
                this.pt_login_done = true;
                return;
            }

            this.pt_platform_id = platform_id;

            StartCoroutine(doInitializeApi(email, password, permanent_login));
        }