Exemplo n.º 1
0
    public static bool IsSuccess_AddCoin(JsonData json)
    {
        if (LiveDefines.JsonDataContainsKey(json, "responseValue"))
        {
            string        responseValue = json ["responseValue"].ToString();
            LiveErrorType errorCode     = (LiveErrorType)Convert.ToInt32(responseValue);


            if (errorCode == LiveErrorType.LET_Coin_FreeAddCoin)
            {
                //Debug.Log("responseValue == success");
                return(true);
            }
        }

        return(false);
    }
Exemplo n.º 2
0
    public void ResponseData(JsonData json)
    {
        string   strJson;
        JsonData jsonData;

        if (LiveDefines.JsonDataContainsKey(json, "blindMode"))
        {
            jsonData  = json ["blindMode"];
            strJson   = jsonData.ToString();
            blindMode = Convert.ToBoolean(Convert.ToInt32(strJson));
        }

        if (LiveDefines.JsonDataContainsKey(json, "vibrate"))
        {
            jsonData = json ["vibrate"];
            strJson  = jsonData.ToString();
            vibrate  = Convert.ToBoolean(Convert.ToInt32(strJson));
        }
    }
Exemplo n.º 3
0
    public static string ErrorMessage(JsonData json, string defaultString)
    {
        if (LiveDefines.JsonDataContainsKey(json, "responseValue"))
        {
            string        responseValue = json ["responseValue"].ToString();
            LiveErrorType errorCode     = (LiveErrorType)Convert.ToInt32(responseValue);



            if (errorCode == LiveErrorType.LET_Login_UserIdNull)
            {
                defaultString = "Facebook Login failed.";
            }
            else if (errorCode == LiveErrorType.LET_Login_TockenNull)
            {
                defaultString = "Facebook Login failed.";
            }
            else if (errorCode == LiveErrorType.LET_Login_SnsTypeNull)
            {
                defaultString = "Facebook Login failed.";
            }

            else if (errorCode == LiveErrorType.LET_Result_UserNoNull)
            {
                defaultString = "There is no user information.";
            }
            else if (errorCode == LiveErrorType.LET_Result_UserIdNull)
            {
                defaultString = "There is no user information.";
            }
            else if (errorCode == LiveErrorType.LET_Result_UserAddCoinNull)
            {
                defaultString = "there is no coin to be added.";
            }
            else if (errorCode == LiveErrorType.LET_Result_ScoreNull)
            {
                defaultString = "There is no score to be added.";
            }
            else if (errorCode == LiveErrorType.LET_Result_UserNull)
            {
                defaultString = "There is no user information.";
            }

            else if (errorCode == LiveErrorType.LET_Ranking_UserNoNull)
            {
                defaultString = "There is no user information.";
            }
            else if (errorCode == LiveErrorType.LET_Ranking_UserIdNull)
            {
                defaultString = "There is no user information.";
            }
            else if (errorCode == LiveErrorType.LET_Ranking_ResetNone)
            {
                defaultString = "Ranking reset error";
            }
            else if (errorCode == LiveErrorType.LET_Ranking_NoneRakingInfo)
            {
                defaultString = "No information Ranking.";
            }
            else if (errorCode == LiveErrorType.LET_Ranking_NotRakingInfoError)
            {
                defaultString = "My Ranking imformation is not resetting.";
            }

            else if (errorCode == LiveErrorType.LET_Coin_FreeAddCoin)
            {
                defaultString = "you added 1,000 free coins.";
            }
            else if (errorCode == LiveErrorType.LET_Coin_UserNoNull)
            {
                defaultString = "There is no user information.";
            }
            else if (errorCode == LiveErrorType.LET_Coin_UserIdNull)
            {
                defaultString = "There is no user information.";
            }
            else if (errorCode == LiveErrorType.LET_Coin_NoneProfile)
            {
                defaultString = "There is no user information.";
            }
            else if (errorCode == LiveErrorType.LET_Coin_NoneUserInfo)
            {
                defaultString = "There is no user information.";
            }
            else if (errorCode == LiveErrorType.LET_Coin_NotFreeAddCoin)
            {
                defaultString = "You can not charge any more.";
            }

            else if (errorCode == LiveErrorType.LET_Option_UserNoNull)
            {
                defaultString = "There is no user information.";
            }
            else if (errorCode == LiveErrorType.LET_Option_UserIdNull)
            {
                defaultString = "There is no user information.";
            }
            else if (errorCode == LiveErrorType.LET_Option_SoundNull)
            {
                defaultString = "Sound settings fail.";
            }
            else if (errorCode == LiveErrorType.LET_Option_BlindModeNull)
            {
                defaultString = "Voice-over settings fail.";
            }
            else if (errorCode == LiveErrorType.LET_Option_VibrateNull)
            {
                defaultString = "Vibration settings fail.";
            }
            else if (errorCode == LiveErrorType.LET_Option_NoneProfile)
            {
                defaultString = "There is no user information.";
            }
        }

        return(defaultString);
    }
Exemplo n.º 4
0
    /*
     * public string RequestData()
     * {
     *      StringBuilder sb = new StringBuilder();
     *      JsonWriter writer = new JsonWriter(sb);
     *      writer.PrettyPrint = true;
     *
     *
     *      writer.WriteObjectStart();
     *
     *
     *      // my rank
     *      writer.WritePropertyName("rank");
     *      writer.Write (myRankInfo.rank);
     *
     *      writer.WritePropertyName("distance");
     *      writer.Write (myRankInfo.distance);
     *
     *      writer.WritePropertyName("point");
     *      writer.Write (myRankInfo.point);
     *
     *
     *      // rank list
     *      writer.WritePropertyName ("ranklist");
     *
     *      writer.WriteArrayStart ();
     *
     *      for(int i=0; i<rankInfoList.Count; i++)
     *      {
     *              writer.WriteObjectStart();
     *
     *              writer.WritePropertyName("rank");
     *              writer.Write(rankInfoList[i].rank);
     *
     *              writer.WritePropertyName("name");
     *              writer.Write(rankInfoList[i].name);
     *
     *              writer.WritePropertyName("distance");
     *              writer.Write(rankInfoList[i].distance);
     *
     *              writer.WritePropertyName("point");
     *              writer.Write(rankInfoList[i].point);
     *
     *              writer.WriteObjectEnd();
     *      }
     *
     *      writer.WriteArrayEnd ();
     *
     *
     *      writer.WriteObjectEnd ();
     *
     *
     *
     *      return writer.ToString ();
     *
     * }
     */

    public void ResponseData(JsonData json)
    {
        string   strJson;
        JsonData jsonData;



        // my rank
        if (LiveDefines.JsonDataContainsKey(json, "rank"))
        {
            strJson         = LiveDefines.JsonToString(json["rank"]);
            myRankInfo.rank = Convert.ToInt32(strJson);
        }

        if (LiveDefines.JsonDataContainsKey(json, "distance"))
        {
            strJson             = LiveDefines.JsonToString(json["distance"]);
            myRankInfo.distance = Convert.ToInt32(strJson);
        }

        if (LiveDefines.JsonDataContainsKey(json, "score"))
        {
            strJson          = LiveDefines.JsonToString(json["score"]);
            myRankInfo.score = Convert.ToInt32(strJson);
        }



        // rank list
        rankInfoList.Clear();

        if (LiveDefines.JsonDataContainsKey(json, "ranklist"))
        {
            jsonData = json["ranklist"];
            for (int i = 0; i < jsonData.Count; i++)
            {
                LiveRankinfo rankInfo = new LiveRankinfo();

                if (LiveDefines.JsonDataContainsKey(jsonData[i], "rank"))
                {
                    strJson       = LiveDefines.JsonToString(jsonData[i]["rank"]);
                    rankInfo.rank = Convert.ToInt32(strJson);
                }

                if (LiveDefines.JsonDataContainsKey(jsonData[i], "name"))
                {
                    strJson       = LiveDefines.JsonToString(jsonData[i]["name"]);
                    rankInfo.name = strJson;
                }

                if (LiveDefines.JsonDataContainsKey(jsonData[i], "distance"))
                {
                    strJson           = LiveDefines.JsonToString(jsonData[i]["distance"]);
                    rankInfo.distance = Convert.ToInt32(strJson);
                }

                if (LiveDefines.JsonDataContainsKey(jsonData[i], "score"))
                {
                    strJson        = LiveDefines.JsonToString(jsonData[i]["score"]);
                    rankInfo.score = Convert.ToInt32(strJson);
                }


                rankInfoList.Add(rankInfo);
            }
        }
    }