コード例 #1
0
 public void InitBy(MTJSONObject js)
 {
     StartStateName = js.GetString(TrackGameStateName);
     LvId           = js.GetString(TrackLvId);
     trackMode      = js.GetString("trackMode");
     Win            = js.GetString(TrackWin);
 }
コード例 #2
0
    private void GetFriendsCallback(IResult result)
    {
        FacebookHelperDebug("GetFriendsCallback");
        if (result == null)
        {
            FacebookHelperDebug("GetFriendsCallback Null Response\n");
            return;
        }

        if (!string.IsNullOrEmpty(result.Error))
        {
            FacebookHelperDebug("GetFriendsCallback Error Response:\n" + result.Error);
        }
        else if (result.Cancelled)
        {
            FacebookHelperDebug("GetFriendsCallback Cancelled Response:\n" + result.RawResult);
        }
        else if (!string.IsNullOrEmpty(result.RawResult))
        {
            ShowInvite();
            FacebookHelperDebug("GetFriendsCallback Success Response:\n" + result.RawResult);

            MTJSONObject mtJson = MTJSON.Deserialize(result.RawResult);
            {// friend
                List <MTJSONObject> friends = mtJson.Get("data").list;

                for (int i = 0; i < friends.Count; i++)
                {
                    MTJSONObject friendJson  = friends[i];
                    FriendModel  friendModel = _user.GetFriendModel(friendJson.GetString("id", ""), true);
                    friendModel.Name = friendJson.GetString("name", "");
                    FacebookInviteMgr.current.AddIcon(friendModel);

                    AddDownloadPictureId(friendModel.Id);
                }
                // Tracker.Instance.FacebookGameFriendsCount(_currFacebookId, friends.Count);
            }
        }
        else
        {
            FacebookHelperDebug("GetFriendsCallback Empty Response\n");
        }
    }
コード例 #3
0
    public void DeserializeFromJson(MTJSONObject curJson, bool sync)
    {
        Id       = curJson.GetString("id", Id);
        Name     = curJson.GetString("name", Name);
        MaxLevel = curJson.GetInt("maxLevel", MaxLevel);

        //  levels
        MTJSONObject levelsJson = curJson.Get("levels");

        if (levelsJson != null)
        {
            if (!sync)
            {
                _levels.Clear();
            }

            if (levelsJson.count > 0)
            {
                var itemEnum = levelsJson.dict.GetEnumerator();
                while (itemEnum.MoveNext())
                {
                    string curKey    = itemEnum.Current.Key;
                    int    curValue  = itemEnum.Current.Value.i;
                    int    curKeyInt = Convert.ToInt32(curKey);

                    if (!_levels.ContainsKey(curKeyInt))
                    {
                        _levels.Add(curKeyInt, curValue);
                    }
                    else
                    {
                        _levels[curKeyInt] = curValue;
                    }
                }
            }
        }
    }
コード例 #4
0
    private void GetInviteFriendsCallback(IResult result)
    {
        if (debugInfo)
        {
            FacebookHelperDebug("GetInviteFriendsCallback");
        }
        if (result == null)
        {
            if (debugInfo)
            {
                FacebookHelperDebug("GetInviteFriendsCallback Null Response\n");
            }
            return;
        }

        if (!string.IsNullOrEmpty(result.Error))
        {
            if (debugInfo)
            {
                FacebookHelperDebug("GetInviteFriendsCallback Error Response:\n" + result.Error);
            }
        }
        else if (result.Cancelled)
        {
            if (debugInfo)
            {
                FacebookHelperDebug("GetInviteFriendsCallback Cancelled Response:\n" + result.RawResult);
            }
        }
        else if (!string.IsNullOrEmpty(result.RawResult))
        {
            if (debugInfo)
            {
                FacebookHelperDebug("GetInviteFriendsCallback Success Response:\n" + result.RawResult);
            }
            MTJSONObject mtJson = MTJSON.Deserialize(result.RawResult);
            {// friend
                List <MTJSONObject> friends = mtJson.Get("data").list;
                _inviteFriends.Clear();
                for (int i = 0; i < friends.Count; i++)
                {
                    MTJSONObject friendJson  = friends[i];
                    FriendModel  friendModel = _user.GetFriendModel(friendJson.GetString("id", ""), true);
                    friendModel.Name = friendJson.GetString("name", "");
                    FacebookInviteMgr.current.AddIcon(friendModel);

                    AddDownloadPictureId(friendModel.Id);

                    //string id = friends[i].GetString("id", "");
                    //if (id.Length > 0)
                    //{
                    //    _inviteFriends.Add(id);
                    //}
                }
            }
        }
        else
        {
            if (debugInfo)
            {
                FacebookHelperDebug("GetInviteFriendsCallback Empty Response\n");
            }
        }
    }