// Invite friends // Return callback(error) public static void Invite(string title, string message, FriendType friendType = FriendType.Invitable, FBObjectType objectType = FBObjectType.Coin, Action <string> callback = null) { #if UNITY_EDITOR if (callback != null) { callback("Not supported!"); } #else if (FB.IsLoggedIn) { InviteInternal(title, message, friendType, objectType, callback); } else { LogIn((error) => { if (!string.IsNullOrEmpty(error)) { if (callback != null) { callback(error); } } else { InviteInternal(title, message, friendType, objectType, callback); } }); } #endif }
/// <summary> /// 删除好友 /// </summary> /// <param name="id"></param> public void DeleteFriend(FriendType friendType, FriendsInfo friendInfo) { var data = new C2SRelationDel(); if (friendInfo != null) { data.target_id = friendInfo.Uid; data.type = (uint)friendType; string tips = string.Format(DBConstText.GetText("FRIENDS_DEL_1"), friendInfo.Name); if (friendType == FriendType.Friend) { tips = string.Format(DBConstText.GetText("FRIENDS_DEL_FRIEND"), friendInfo.Name); } else if (friendType == FriendType.Black) { tips = string.Format(DBConstText.GetText("FRIENDS_DEL_BLACKLIST"), friendInfo.Name); } ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(xc.ui.ugui.UINoticeWindow.EWindowType.WT_OK_Cancel, tips, (dt) => { NetClient.GetBaseClient().SendData <C2SRelationDel>(NetMsg.MSG_RELATION_DEL, data); } , null); } }
private void EnableVisibility(ObjectStatus status, FriendType friend) { visiblilityEnabled = true; TRVisibility.Visible = true; RbtPublic.Text = language.GetString("LableVisibilityVisibility0"); RbtPublic.Checked = status == ObjectStatus.Public; RbtPrivat.Text = language.GetString("LableVisibilityVisibility1"); RbtPrivat.Checked = status == ObjectStatus.Private; RbtUnlisted.Text = language.GetString("LableVisibilityVisibility2"); RbtUnlisted.Checked = status == ObjectStatus.Unlisted; CbxFriends.Items.Clear(); foreach (int i in Enum.GetValues(typeof(FriendType))) { string key = string.Format("TextFriendType{0}", i); string text = language.GetString(key); if (!string.IsNullOrEmpty(text)) { ListItem listItem = new ListItem(text, i.ToString()); FriendType check = (FriendType)i; if ((friend & check) == check) { listItem.Selected = true; } CbxFriends.Items.Add(listItem); } } }
public void sendfriendlist(FriendType ft)//Done { Variant msg = new Variant(); msg["buddy_cmd"] = (uint)ft; sendRPC(PKG_NAME.C2S_ON_ADDFRIEND_BUTTON, msg); }
/// <summary> /// 获取好友列表 /// </summary> public void GetFriendList(FriendType type, uint isFirst) { var data = new C2SRelationInfo(); data.type = (uint)type; data.first_ask = isFirst; NetClient.GetBaseClient().SendData <C2SRelationInfo>(NetMsg.MSG_RELATION_INFO, data); }
public void AddFriends(Dictionary <long, string> FriendsIdsAndNicknames, FriendType friendType) { foreach (long num in FriendsIdsAndNicknames.Keys) { this.AddItem(num, FriendsIdsAndNicknames[num], friendType); } this.loaded = true; this.ShowMode = this.showMode; }
public COMDT_FRIEND_INFO GetInfoAtIndex(FriendType type, int index) { ListView <COMDT_FRIEND_INFO> list = this.GetList(type); if ((list != null) && ((index >= 0) && (index < list.Count))) { return(list[index]); } return(null); }
public void Remove(FriendType type, COMDT_ACNT_UNIQ uniq) { COMDT_FRIEND_INFO info = this.GetInfo(type, uniq); this.Remove(type, info); if (type == FriendType.GameFriend) { this.RemoveIntimacy(uniq.ullUid, uniq.dwLogicWorldId); } }
public bool IsContain(FriendType type, COMDT_FRIEND_INFO data) { ListView <COMDT_FRIEND_INFO> list = this.GetList(type); if (list == null) { return(false); } return(list.Contains(data)); }
public List <FriendsInfo> GetListByType(FriendType type) { List <FriendsInfo> friendList = null; mCommon.TryGetValue(type, out friendList); if (friendList == null) { friendList = new List <FriendsInfo>(); } return(friendList); }
public COMDT_FRIEND_INFO getFriendByUid(ulong uid, FriendType friendType) { ListView <COMDT_FRIEND_INFO> view = this._map[(uint)friendType]; for (int i = 0; i < view.Count; i++) { if (view[i].stUin.ullUid == uid) { return(view[i]); } } return(null); }
public void Remove(FriendType type, COMDT_FRIEND_INFO data) { this.RemoveRankingFriend(type, data); this.GetList(type).Remove(data); if (type == FriendType.RequestFriend) { Singleton <EventRouter> .instance.BroadCastEvent("Friend_LobbyIconRedDot_Refresh"); } if (type == FriendType.Recommend) { Singleton <EventRouter> .instance.BroadCastEvent("Friend_RecommandFriend_Refresh"); } }
public COMDT_FRIEND_INFO getFriendByName(string friendName, FriendType friendType) { ListView <COMDT_FRIEND_INFO> view = this._map[(uint)friendType]; for (int i = 0; i < view.Count; i++) { if (Utility.UTF8Convert(view[i].szUserName) == friendName) { return(view[i]); } } return(null); }
protected override object this[string index] { get { #region switch (index) { case "UserID": return(UserID); case "FriendID": return(FriendID); case "FriendType": return(FriendType); case "ChatTime": return(ChatTime); case "FightTime": return(FightTime); default: throw new ArgumentException(string.Format("UserFriends index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "UserID": _UserID = value.ToNotNullString(); break; case "FriendID": _FriendID = value.ToNotNullString(); break; case "FriendType": _FriendType = value.ToEnum <FriendType>(); break; case "ChatTime": _ChatTime = value.ToDateTime(); break; case "FightTime": _FightTime = value.ToDateTime(); break; default: throw new ArgumentException(string.Format("UserFriends index[{0}] isn't exist.", index)); } #endregion } }
public void RemoveRankingFriend(FriendType type, COMDT_FRIEND_INFO data) { if ((type == FriendType.SNS) || (type == FriendType.GameFriend)) { for (int i = 0; i < this._rankingFriend.Count; i++) { if ((this._rankingFriend[i].stUin.ullUid == data.stUin.ullUid) && (this._rankingFriend[i].stUin.dwLogicWorldId == data.stUin.dwLogicWorldId)) { this._rankingFriend.RemoveAt(i); break; } } } }
public override FriendlyBase GetFriendly(FriendType friendType) { switch (friendType) { case FriendType.WALKING: return(new WalkingFriendly()); case FriendType.FLYING: return(new FlyingFriendly()); default: return(null); } }
protected override void OnShow(INotification notification) { if (friendMediator == null) { friendMediator = Facade.RetrieveMediator("FriendMediator") as FriendMediator; } currentType = FriendType.Friend; m_Panel.friendsnum.text = UtilTools.StringBuilder(onlineNum, "/", friendList.Count); m_Panel.FrindeGrid.enabled = true; m_Panel.FrindeGrid.BindCustomCallBack(UpdateFriendGrid); m_Panel.FrindeGrid.StartCustom(); m_Panel.FrindeGrid.AddCustomDataList(AddListGrid(friendList)); SetBtnState(FriendType.Friend); }
public static FriendList Find(int owner, FriendType type) { List<int> list = new List<int>(); MySql.Data.MySqlClient.MySqlDataReader reader = Utils.DatabaseManager.Instance.Read ( "SELECT * FROM `friend` WHERE `Owner`='" + owner + "' AND `Type`='" + type.ToString() + "';" ); while (reader.Read()) list.Add(reader.GetInt32("Target")); reader.Close(); return new FriendList(list, owner, type); }
public void Remove(FriendType type, uint uid) { List <FriendsInfo> friendList = null; if (mCommon.TryGetValue(type, out friendList)) { var info = mCommon[type].Find(delegate(FriendsInfo _info){ return(_info.Uid == uid); }); if (info != null) { mCommon[type].Remove(info); } } }
public FriendType GetFriendType() { FriendType friendVisibility = 0; if (visiblilityEnabled) { foreach (ListItem item in CbxFriends.Items) { if (item.Selected) { friendVisibility |= (FriendType)Convert.ToInt32(item.Value); } } } return(friendVisibility); }
public bool IsContain(FriendType type, ulong ullUid, uint dwLogicWorldID) { COMDT_FRIEND_INFO comdt_friend_info = null; ListView <COMDT_FRIEND_INFO> list = this.GetList(type); int count = list.Count; for (int i = 0; i < count; i++) { comdt_friend_info = list[i]; if (((comdt_friend_info != null) && (comdt_friend_info.stUin.ullUid == ullUid)) && (comdt_friend_info.stUin.dwLogicWorldId == dwLogicWorldID)) { return(true); } } return(false); }
/// <summary> /// 获取好友字典中数据 /// </summary> FriendData GetfriendList(List <object> friendsList, int i, FriendType type) { FriendData data = new FriendData(); Dictionary <string, object> Info = friendsList[i] as Dictionary <string, object>; data.type = type; data.dbid = int.Parse(Info["dbid"].ToString()); data.photoIndex = Info["photoIndex"].ToString(); data.name = Info["name"].ToString(); data.level = int.Parse(Info["level"].ToString()); data.vipLevel = int.Parse(Info["vipLevel"].ToString()); data.fightValue = int.Parse(Info["fightValue"].ToString()); data.clubName = Info["clubName"].ToString(); data.onlineState = int.Parse(Info["onlineState"].ToString()); return(data); }
public void FindMyFriends(string username, Server serverObject) { System.Collections.ArrayList friendList = new System.Collections.ArrayList(); foreach (XmlNode n in xmlDom.SelectNodes(gSchemaRootName + "/" + gFriendRootName + "/" + gRowName + "/" + gClientName)) { if (n.FirstChild.Value.ToLower() == username.ToLower()) { FriendType f = new FriendType(); f.friendName = n.NextSibling.FirstChild.Value; XmlNode friendNode = GetUserNode(f.friendName); f.friend = bool.Parse(n.NextSibling.NextSibling.FirstChild.Value); f.friendId = int.Parse(friendNode.NextSibling.NextSibling.NextSibling.FirstChild.Value); friendList.Add(f); } } if (friendList.Count > 0) { byte[] buffer = null; int offset = 0; // Well, we obviously have some friends, tell me all about them int sendId = GetCurrentPlayerId(username); DXHelp.AddDataToBuffer(ref buffer, MessageType.SendClientFriends, ref offset); // How many friends are we sending? DXHelp.AddDataToBuffer(ref buffer, friendList.Count, ref offset); foreach (FriendType f in friendList) { // Add whether they are a friend or blocked as well as the name DXHelp.AddDataToBuffer(ref buffer, f.friend, ref offset); DXHelp.AddDataToBuffer(ref buffer, f.friendName, ref offset); } serverObject.SendTo(sendId, buffer, 0, 0); // Now that's done, for every friend that's online, notify me again foreach (FriendType f in friendList) { if (f.friendId != 0) { buffer = null; offset = 0; DXHelp.AddDataToBuffer(ref buffer, MessageType.FriendLogon, ref offset); DXHelp.AddDataToBuffer(ref buffer, f.friendName, ref offset); serverObject.SendTo(sendId, buffer, 0, 0); } } } }
public void AddItem(long userId, string userUid, FriendType friendType) { UserCellData item = new UserCellData(userId, userUid); if (friendType == FriendType.Incoming) { this.incoming.Add(item); } else if (friendType != FriendType.Outgoing) { this.accepted.Add(item); } else { this.outgoing.Add(item); } }
public int GetFriend(int friendId = 0, FriendType friendType = FriendType.FriendList, int playerId = 0, string token = "") { if (ParseToken(playerId, token)) { FriendParam param = new FriendParam(); param.player_id = apiPlayerId; param.token = apiToken; param.friend_id = friendId; param.friend_type = (int)friendType; string paramJson = JsonUtility.ToJson(param); API api = new API("getfriend.php", "RGetFriend", paramJson, 1); param = null; paramJson = ""; StartCoroutine(Congest.SendPOST(this, api)); return(api.seed); } return(0); }
public void Add(FriendType type, COMDT_FRIEND_INFO data, bool ingore_worldid = false) { this.AddRankingFriend(type, data); ListView <COMDT_FRIEND_INFO> list = this.GetList(type); int num = this.getIndex(data, list, ingore_worldid); if (num == -1) { UT.Add2List <COMDT_FRIEND_INFO>(data, list); } else { list[num] = data; } if (type == FriendType.RequestFriend) { Singleton <EventRouter> .instance.BroadCastEvent("Friend_LobbyIconRedDot_Refresh"); } }
/// <summary> /// 发送申请好友请求 /// </summary> /// <param name="id"></param> public void SendAddFriendRequest(FriendType type, uint id, uint targetLv = 0) { if (targetLv > 0) { uint limit = GameConstHelper.GetUint("GAME_FRIEND_LV_LIMIT"); if (targetLv < limit) { UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("FRIENDS_ADD_OTHER_LEVEL_NOT_ENOUGH"), limit)); return; } } var data = new C2SRelationAdd(); data.type = (uint)type; data.target_id = id; NetClient.GetBaseClient().SendData <C2SRelationAdd>(NetMsg.MSG_RELATION_ADD, data); //if (type == FriendType.Friend) // UINotice.Instance.ShowMessage(DBConstText.GetText("HAS_SENT_FRIEND_APPLICATION")); }
public void AddRankingFriend(FriendType type, COMDT_FRIEND_INFO data) { if ((type == FriendType.SNS) || (type == FriendType.GameFriend)) { bool flag = false; for (int i = 0; i < this._rankingFriend.Count; i++) { if ((this._rankingFriend[i].stUin.ullUid == data.stUin.ullUid) && (this._rankingFriend[i].stUin.dwLogicWorldId == data.stUin.dwLogicWorldId)) { this._rankingFriend[i] = data; flag = true; break; } } if (!flag) { this._rankingFriend.Add(data); } } }
/// <summary> /// 刷新界面 /// </summary> /// <param name="type"></param> public void AddFriendGridList(FriendType type) { if (type == FriendType.Friend) { m_Panel.friendsnum.text = UtilTools.StringBuilder(onlineNum, "/", friendList.Count); m_Panel.FrindeGrid.AddCustomDataList(AddListGrid(friendList)); } if (type == FriendType.Find) { m_Panel.FrindeGrid.AddCustomDataList(AddListGrid(recommenFriendList)); } if (type == FriendType.Apply) { m_Panel.FrindeGrid.AddCustomDataList(AddListGrid(applyFriendList)); } if (type == FriendType.Black) { m_Panel.FrindeGrid.AddCustomDataList(AddListGrid(blackFriendList)); } }
// Get friend filters static List <object> GetFriendFilters(FriendType type) { // Game if (type == FriendType.Game) { return(new List <object>() { "app_users" }); } // Invitable if (type == FriendType.Invitable) { return(new List <object>() { "app_non_users" }); } // None return(null); }
public FriendsInfo GetFriend(FriendType type, uint uid) { FriendsInfo info = null; List <FriendsInfo> list = null; if (mCommon.TryGetValue(type, out list) == false) { return(info); } else { info = list.Find(delegate(FriendsInfo _info) { return(_info.Uid == uid); }); if (info != null) { return(info); } } return(info); }
public static string GetTypedPlayerName(FriendType t, string name) { string suffix = string.Empty; switch (t) { case FriendListItem.FriendType.Friend: suffix = "(FRIEND)"; break; case FriendListItem.FriendType.FriendRequest: suffix = "(waiting your approval)"; break; case FriendListItem.FriendType.Pending: suffix = "(request sent)"; break; case FriendListItem.FriendType.You: suffix = "(YOU)"; break; default: break; } return string.Format("{0} {1}", name, suffix); }
public void SetFriendData(FriendType t, string playerId, Action rebindCallback) { RebindCallback = rebindCallback; PlayerId = playerId; Type = t; HideAll(); Background.color = Color.clear; switch (this.Type) { case FriendType.Friend: Show(Delete); break; case FriendType.Removed: Background.color = Color.Lerp(Color.red, Color.black, 0.7f); break; case FriendType.FriendRequest: Background.color = FriendRequestColor; Show(Accept); Show(Reject); break; case FriendType.Pending: Background.color = FriendPendingColor; Show(Delete); break; case FriendType.You: Background.color = YouColor; break; case FriendType.Nothing: Show(Request); break; default: break; } var bindableItem = this.GetComponent<BindableListItem>(); if(bindableItem != null) { if (string.IsNullOrEmpty(OriginalName)) OriginalName = bindableItem.ItemText; bindableItem.SetData(GetTypedPlayerName(Type, OriginalName), playerId); } }
protected override object this[string index] { get { #region switch (index) { case "UserID": return UserID; case "FriendID": return FriendID; case "FriendType": return FriendType; case "ChatTime": return ChatTime; case "FightTime": return FightTime; default: throw new ArgumentException(string.Format("UserFriends index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "UserID": _UserID = value.ToNotNullString(); break; case "FriendID": _FriendID = value.ToNotNullString(); break; case "FriendType": _FriendType = value.ToEnum<FriendType>(); break; case "ChatTime": _ChatTime = value.ToDateTime(); break; case "FightTime": _FightTime = value.ToDateTime(); break; default: throw new ArgumentException(string.Format("UserFriends index[{0}] isn't exist.", index)); } #endregion } }
private FriendList(List<int> friends, int owner, FriendType type) { _owner = owner; _type = type; _friends = ( from int friendId in friends select new FriendInformations(Account.FindById(friendId)) ).ToList(); }
/// <summary> /// 给定一个字节流,解析结构 /// </summary> /// <param name="buf">The buf.</param> public void Read(ByteBuffer buf) { QQ = buf.GetUInt(); Type = (FriendType)buf.Get(); Group = buf.Get() >> 2; }