示例#1
0
        public void onBandResult(string jsonResult)
        {
            JsonParser   jsonParser = new JsonParser(new StringReader(jsonResult), true);
            JsonObject   jsonObject = jsonParser.ParseObject();
            RequestCode  reqCode    = (RequestCode)((JsonNumber)jsonObject[BandGameObject.REQUEST_CODE]).Value;
            int          num        = -1;
            NXBandResult result     = null;

            if (jsonObject.ContainsKey(BandGameObject.RESULT))
            {
                JsonObject jsonObject2 = (JsonObject)jsonObject[BandGameObject.RESULT];
                if (jsonObject2.ContainsKey("result_data"))
                {
                    result = NXBandResult.makeFromJson(reqCode, (JsonObject)jsonObject2["result_data"]);
                }
                if (jsonObject2.ContainsKey("result_code"))
                {
                    num = (int)((JsonNumber)((JsonObject)jsonObject[BandGameObject.RESULT])["result_code"]).Value;
                }
            }
            if (num < 0)
            {
                num = (int)((JsonNumber)jsonObject[BandGameObject.RESULT_CODE]).Value;
            }
            if (this._resultHandler != null)
            {
                BandResultHandler resultHandler = this._resultHandler;
                this._resultHandler = null;
                resultHandler.onResult(reqCode, num, result);
            }
        }
示例#2
0
 public void getAccessToken(BandResultHandler resultHandler)
 {
     if (!this.isInitilazed)
     {
         throw new InvalidOperationException("You must call init() before call getUserKey()");
     }
     this._gameObject.SendMessage(BandManager.SET_HANDLER, resultHandler);
     this.callJavaMethod(RequestCode.REQUEST_ACCESS_TOKEN, new object[0]);
 }
示例#3
0
 public void login(BandResultHandler resultHandler)
 {
     if (!this.isInitilazed)
     {
         throw new InvalidOperationException("You must call init() before call login()");
     }
     this._gameObject.SendMessage(BandManager.SET_HANDLER, resultHandler);
     this.callJavaMethod(RequestCode.REQUEST_LOGIN, new object[0]);
 }
示例#4
0
 public void getProfile(string userKey, BandResultHandler resultHandler)
 {
     if (!this.isInitilazed)
     {
         throw new InvalidOperationException("You must call init() before call getProfile()");
     }
     this._gameObject.SendMessage(BandManager.SET_HANDLER, resultHandler);
     this.callJavaMethod(RequestCode.REQUEST_PROFILE, new object[]
     {
         userKey
     });
 }
示例#5
0
        public void listBands(BandListOption option, BandResultHandler resultHandler)
        {
            if (!this.isInitilazed)
            {
                throw new InvalidOperationException("You must call init() before call listBands()");
            }
            this._gameObject.SendMessage(BandManager.SET_HANDLER, resultHandler);
            string text = null;

            if (option != null)
            {
                text = option.getJsonString();
            }
            this.callJavaMethod(RequestCode.REQUEST_LIST_BAND, new object[]
            {
                text
            });
        }
示例#6
0
 public void writePost(string bandKey, string body, string imageUrl, string subTitle, string subText, BandMessageCustomUrl customUrl, BandResultHandler resultHandler)
 {
     this.writePost(bandKey, body, imageUrl, subTitle, subText, customUrl.getCustomUrlDictionary(), resultHandler);
 }
示例#7
0
 public void writePost(string bandKey, string body, string imageUrl, string subTitle, string subText, Dictionary <string, string> customUrl, BandResultHandler resultHandler)
 {
     if (!this.isInitilazed)
     {
         throw new InvalidOperationException("You must call init() before call writePost()");
     }
     this._gameObject.SendMessage(BandManager.SET_HANDLER, resultHandler);
     this.callJavaMethod(RequestCode.REQUEST_WRITE_POST, new object[]
     {
         this.postJson(bandKey, body, imageUrl, subTitle, subText, customUrl)
     });
 }
示例#8
0
 public void sendMessage(string receiverKey, string message, string title, string imageUrl, BandMessageCustomUrl customUrl, BandResultHandler resultHandler)
 {
     this.sendMessage(receiverKey, message, title, imageUrl, customUrl.getCustomUrlDictionary(), resultHandler);
 }
示例#9
0
 public void sendMessage(string receiverKey, string message, string title, string imageUrl, Dictionary <string, string> customUrl, BandResultHandler resultHandler)
 {
     if (!this.isInitilazed)
     {
         throw new InvalidOperationException("You must call init() before call sendMessage()");
     }
     this._gameObject.SendMessage(BandManager.SET_HANDLER, resultHandler);
     this.callJavaMethod(RequestCode.REQUEST_SEND_MESSAGE, new object[]
     {
         this.messageJson(receiverKey, message, title, imageUrl, customUrl)
     });
 }
示例#10
0
 public void setHandler(BandResultHandler resultHandler)
 {
     this._resultHandler = resultHandler;
 }