public void Init(string consumer_key, string consumer_secret)
        {
            FunDebug.DebugLog1("TwitterConnector.Init called.");

            OnEventCallback += new EventHandler(OnEventHandler);
            oauth_handler_   = new OAuthHandler(consumer_key, consumer_secret);

            string oauth_token        = PlayerPrefs.GetString("oauth_token");
            string oauth_token_secret = PlayerPrefs.GetString("oauth_token_secret");

            if (!string.IsNullOrEmpty(oauth_token) && !string.IsNullOrEmpty(oauth_token_secret))
            {
                oauth_handler_.AddParameter("oauth_token", oauth_token);
                oauth_handler_.AddParameter("oauth_token_secret", oauth_token_secret);

                my_info_.id   = PlayerPrefs.GetString("user_id");
                my_info_.name = PlayerPrefs.GetString("screen_name");

                FunDebug.Log("Logged in Twitter using saved token.");
                OnEventNotify(SNResultCode.kLoggedIn);
            }
            else
            {
                OnEventNotify(SNResultCode.kInitialized);
            }
        }
Beispiel #2
0
        public override void Init(params object[] param)
        {
            Debug.Log("TwitterConnector Initialization.");
            DebugUtils.Assert(param[0] is string);
            DebugUtils.Assert(param[1] is string);

            oauth_handler_ = new OAuthHandler(param[0] as string, param[1] as string);

            string oauth_token        = EncryptedPlayerPrefs.GetString("oauth_token");
            string oauth_token_secret = EncryptedPlayerPrefs.GetString("oauth_token_secret");

            if (!string.IsNullOrEmpty(oauth_token) && !string.IsNullOrEmpty(oauth_token_secret))
            {
                oauth_handler_.AddParameter("oauth_token", oauth_token);
                oauth_handler_.AddParameter("oauth_token_secret", oauth_token_secret);

                my_info_.id   = EncryptedPlayerPrefs.GetString("user_id");
                my_info_.name = EncryptedPlayerPrefs.GetString("screen_name");

                Debug.Log("Already logged in.");
                OnEventNotify(SNResultCode.kLoggedIn);
            }
        }