void AddFBFriendCallback(string str) { //print (str); AddFriendData _addFriendData = JsonUtility.FromJson <AddFriendData>(str); if (_addFriendData.scriptData.findQueryResult.Count > 0) { //GameSparkRequests addFriendRequest = new GameSparkRequests(); //addFriendRequest.Request("AddFriend", "ID", _addFriendData.scriptData.findQueryResult[0].playerID, FriendAdded); AccountDetails.instance.Save(friendID: _addFriendData.scriptData.findQueryResult[0].playerID); } else { friendsAdded.Add(false); //print (str); } }
/// <summary> /// 处理好友申请消息 /// </summary> /// <param name="afd"></param> private static bool AskToBeFriend(AddFriendData afd) { bool result = false; if (isdebug) { Console.WriteLine("用户{0}要加用户{1}为好友", afd.id, afd.f_id); } try { OnlineUserManager.user_list[afd.id].VitalityRefresh(); //用户afd.id请求加用户afd.f_id为好友,将给用户afd.f_id添加4号S-B消息 lock (OnlineUserManager.user_list) { Console.WriteLine("这里的在线人数{0}", OnlineUserManager.user_list.Count); OnlineUserMessge afdMsg = new OnlineUserMessge(4, OnlineUserManager.user_list[afd.id].ToUser()); if (isOnline(afd.f_id))//在线就直接放到人家的消息列表,离线将消息串行化存入数据库 { if (isdebug) { Console.WriteLine("用户{0}在线,Ta的消息容器", afd.f_id); } OnlineUserManager.user_list[afd.f_id].ReciveMessage(afd.id, afdMsg); } else { if (isdebug) { Console.WriteLine("用户{0}不在线,塞入数据库", afd.f_id); } List <pair <int, OnlineUserMessge> > ll = new List <pair <int, OnlineUserMessge> >(); ll.Add(new pair <int, OnlineUserMessge>(afd.id, afdMsg)); SqlManager.storeOnlineMessagesOfUser(afd.f_id, ll); result = true; } } } catch (Exception e) { Console.WriteLine("error in AskToBeFriend..{0}", e.Message); result = false; } return(result); }
public void Write(TProtocol oprot) { oprot.IncrementRecursionDepth(); try { TStruct struc = new TStruct("ButtonActionData"); oprot.WriteStructBegin(struc); TField field = new TField(); if (AddFriendData != null && __isset.addFriendData) { field.Name = "addFriendData"; field.Type = TType.Struct; field.ID = 1; oprot.WriteFieldBegin(field); AddFriendData.Write(oprot); oprot.WriteFieldEnd(); } if (InstallAppData != null && __isset.installAppData) { field.Name = "installAppData"; field.Type = TType.Struct; field.ID = 2; oprot.WriteFieldBegin(field); InstallAppData.Write(oprot); oprot.WriteFieldEnd(); } if (JumpUrlData != null && __isset.jumpUrlData) { field.Name = "jumpUrlData"; field.Type = TType.Struct; field.ID = 3; oprot.WriteFieldBegin(field); JumpUrlData.Write(oprot); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); } finally { oprot.DecrementRecursionDepth(); } }
public override string ToString() { StringBuilder __sb = new StringBuilder("ButtonActionData("); bool __first = true; if (AddFriendData != null && __isset.addFriendData) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("AddFriendData: "); __sb.Append(AddFriendData == null ? "<null>" : AddFriendData.ToString()); } if (InstallAppData != null && __isset.installAppData) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("InstallAppData: "); __sb.Append(InstallAppData == null ? "<null>" : InstallAppData.ToString()); } if (JumpUrlData != null && __isset.jumpUrlData) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("JumpUrlData: "); __sb.Append(JumpUrlData == null ? "<null>" : JumpUrlData.ToString()); } __sb.Append(")"); return(__sb.ToString()); }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Struct) { AddFriendData = new AddFriendData(); AddFriendData.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Struct) { InstallAppData = new InstallAppData(); InstallAppData.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Struct) { JumpUrlData = new JumpUrlData(); JumpUrlData.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }