void client_ChannelUserAdded(object sender, ChannelUserInfo e) { Task.Run(async() => { try { var chan = e.Channel.Name; List <LobbyMessage> messages; foreach (var user in e.Users) { using (var db = new ZkDataContext()) { messages = db.LobbyMessages.Where(x => x.TargetName == user.Name && x.Channel == chan).ToList(); db.LobbyMessages.DeleteAllOnSubmit(messages); db.SubmitChanges(); } foreach (var m in messages) { var text = string.Format("!pm|{0}|{1}|{2}|{3}", m.Channel, m.SourceName, m.Created.ToString(CultureInfo.InvariantCulture), m.Message); await client.Say(SayPlace.User, user.Name, text, false); await Task.Delay(MessageDelay); } } } catch (Exception ex) { Trace.TraceError("Error adding user: {0}", ex); } }); }
/// <summary> /// 设置角色数据(登录成功后调用) /// </summary> /// <param name="roleId">角色唯一标识</param> /// <param name="roleName">角色名</param> /// <param name="roleLevel">角色等级</param> /// <param name="zoneId">区域唯一标识</param> /// <param name="zoneName">区域名称</param> public override void SetRoleData(ChannelUserInfo userInfo, long createTime = 0) { Debug.Log("AndroidSingleSDKHelper::SetRoleData() Called!!!"); if (Application.platform != RuntimePlatform.Android) { Debug.Log("AndroidSingleSDKHelper::SetRoleData() Application.platform != RuntimePlatform.Android, return!!!"); return; } if (mCurSDKPhase < SDKPhase.LoginFinish) { Debug.Log("AndroidSingleSDKHelper::SetRoleData() mCurSDKState < SDKState.Logined, return!!!"); return; } #if UNITY_ANDROID if (_SDKHelperPlugin == null) { Debug.LogError(" Login() _SDKHelperPlugin == null!!!!!!!"); return; } _SDKHelperPlugin.Call("SetRoleData", userInfo.RoleId, userInfo.RoleName, userInfo.RoleLevel, userInfo.ZoneId, userInfo.ZoneName, createTime); JSONObject gameinfo = new JSONObject(); gameinfo.AddField("roleId", userInfo.RoleId); gameinfo.AddField("roleName", userInfo.RoleName); gameinfo.AddField("roleLevel", userInfo.RoleLevel); gameinfo.AddField("zoneId", userInfo.ZoneId); gameinfo.AddField("zoneName", userInfo.ZoneName); _SDKHelperPlugin.Call("SetData", "gameinfo", gameinfo.ToString()); #endif }
protected virtual void client_ChannelUserAdded(object sender, ChannelUserInfo e) { var channelName = e.Channel.Name; if (ChannelName != channelName) { return; } // todo fix/simplify code .. does not need separate adduser and mass add if (e.Users.Count == 1) { AddLine(new JoinLine(e.Users.First().Name)); AddUser(e.Users.First().Name); } else { foreach (var user in e.Users) { if (!playerListItems.Any(x => x.UserName == user.Name)) { playerListItems.Add(new PlayerListItem() { UserName = user.Name }); } } playerBox.AddItemRange(playerListItems.Where(x => !playerBox.Items.Any(y => y.UserName == x.UserName)).ToList()); FilterPlayers(); } }
/// <summary> /// 设置角色数据(登录成功后调用) /// </summary> /// <param name="roleId">角色唯一标识</param> /// <param name="roleName">角色名</param> /// <param name="roleLevel">角色等级</param> /// <param name="zoneId">区域唯一标识</param> /// <param name="zoneName">区域名称</param> public override void SetRoleData(ChannelUserInfo userInfo, long createTime = 0) { Debug.Log("AndroidMultSDKHelper::SetRoleData() Called!!!"); if (Application.platform != RuntimePlatform.Android) { Debug.Log("AndroidMultSDKHelper::SetRoleData() Application.platform != RuntimePlatform.Android, return!!!"); return; } if (mCurSDKPhase < SDKPhase.LoginFinish) { Debug.Log("AndroidMultSDKHelper::SetRoleData() mCurSDKState < SDKState.Logined, return!!!"); return; } #if UNITY_ANDROID using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { using (AndroidJavaObject curActivity = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity")) { setRoleData(curActivity.GetRawObject(), userInfo.RoleId, userInfo.RoleName, userInfo.RoleLevel.ToString(), userInfo.ZoneId, userInfo.ZoneName); JSONObject gameinfo = new JSONObject(); gameinfo.AddField("roleId", userInfo.RoleId); gameinfo.AddField("roleName", userInfo.RoleName); gameinfo.AddField("roleLevel", userInfo.RoleLevel.ToString()); gameinfo.AddField("zoneId", userInfo.ZoneId); gameinfo.AddField("zoneName", userInfo.ZoneName); setData(curActivity.GetRawObject(), "gameinfo", gameinfo.ToString()); } } #endif }
void client_ChannelUserAdded(object sender, ChannelUserInfo e) { Task.Run(async () => { try { var chan = e.Channel.Name; List<LobbyMessage> messages; foreach (var user in e.Users) { using (var db = new ZkDataContext()) { messages = db.LobbyMessages.Where(x => x.TargetName == user.Name && x.Channel == chan).OrderBy(x => x.Created).ToList(); db.LobbyMessages.DeleteAllOnSubmit(messages); db.SubmitChanges(); } foreach (var m in messages) { var text = string.Format("!pm|{0}|{1}|{2}|{3}", m.Channel, m.SourceName, m.Created.ToString(CultureInfo.InvariantCulture), m.Message); await client.Say(SayPlace.User, user.Name, text, false); await Task.Delay(MessageDelay); } } } catch (Exception ex) { Trace.TraceError("Error adding user: {0}", ex); } }); }
void SetAnswerer(IEnumerable <ChannelUserInfo> users) { ChannelUserInfo user = null; if (mainForm != null && (user = users.FirstOrDefault()) != null) { mainForm.SetAnswerer(user.NickName); } }
/// <summary> /// 设置角色数据(登录成功后调用) /// </summary> /// <param name="roleId">角色唯一标识</param> /// <param name="roleName">角色名</param> /// <param name="roleLevel">角色等级</param> /// <param name="zoneId">区域唯一标识</param> /// <param name="zoneName">区域名称</param> public static void SetRoleData(ChannelUserInfo userInfo, long createTime = 0) { if (Application.platform != RuntimePlatform.Android) { return; } SDKHelper.SetRoleData(userInfo, createTime); }
internal static ChannelUserInfo ToNew(this IRCProviders.IChannelUser user) { var channelUserInfo = new ChannelUserInfo { NickName = user.NickName }; foreach (var mode in IRC.Client.Application.ChannelUserModesTable) { if (user.Modes.ContainsKey(mode.Value) && user.Modes[mode.Value]) { channelUserInfo.Modes |= mode.Key; } } return(channelUserInfo); }
void SetChooser(IEnumerable <ChannelUserInfo> users) { ChannelUserInfo user = null; if (mainForm != null && (user = users.FirstOrDefault()) != null) { if (this.mainForm.InvokeRequired) { this.mainForm.BeginInvoke(new Action <string>(mainForm.SetChooser), user.NickName); } else { mainForm.SetChooser(user.NickName); } } }
protected virtual void client_ChannelUserAdded(object sender, ChannelUserInfo e) { var channelName = e.Channel.Name; if (ChannelName != channelName) return; // todo fix/simplify code .. does not need separate adduser and mass add if (e.Users.Count == 1) { AddLine(new JoinLine(e.Users.First().Name)); AddUser(e.Users.First().Name); } else { foreach (var user in e.Users) { if (!playerListItems.Any(x => x.UserName == user.Name)) { playerListItems.Add(new PlayerListItem() { UserName = user.Name }); } } playerBox.AddItemRange(playerListItems.Where(x => !playerBox.Items.Any(y => y.UserName == x.UserName)).ToList()); FilterPlayers(); } }
protected override void client_ChannelUserAdded(object sender, ChannelUserInfo e) {}
void TasOnChannelUserAdded(object sender, ChannelUserInfo e) { string chan = e.Channel.Name; foreach (var user in e.Users) { Faction faction = factions.FirstOrDefault(x => x.Shortcut == chan); if (faction != null) { var db = new ZkDataContext(); var acc = Account.AccountByName(db, user.Name); if (acc != null && acc.CanPlayerPlanetWars()) UpdateLobby(user.Name); } } }
protected override void client_ChannelUserAdded(object sender, ChannelUserInfo e) { }
/// <summary> /// 设置角色数据(登录成功后调用) /// </summary> /// <param name="roleId">角色唯一标识</param> /// <param name="roleName">角色名</param> /// <param name="roleLevel">角色等级</param> /// <param name="zoneId">区域唯一标识</param> /// <param name="zoneName">区域名称</param> public virtual void SetRoleData(ChannelUserInfo userInfo, long createTime) { }
public ICIRCeChannelUserItem GetItem(ChannelUserInfo userInfo) { return(new CIRCeChannelUserItem { DataRow = this.list[userInfo.NickName] }); }