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);
         }
     });
 }
예제 #2
0
    /// <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
    }
예제 #3
0
        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();
            }
        }
예제 #4
0
        /// <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);
					}
				});
		}
예제 #6
0
        void SetAnswerer(IEnumerable <ChannelUserInfo> users)
        {
            ChannelUserInfo user = null;

            if (mainForm != null && (user = users.FirstOrDefault()) != null)
            {
                mainForm.SetAnswerer(user.NickName);
            }
        }
예제 #7
0
    /// <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);
    }
예제 #8
0
        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);
        }
예제 #9
0
        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);
                }
            }
        }
예제 #10
0
        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);
         }
     }
 }
예제 #13
0
 protected override void client_ChannelUserAdded(object sender, ChannelUserInfo e)
 {
 }
예제 #14
0
 /// <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)
 {
 }
예제 #15
0
 public ICIRCeChannelUserItem GetItem(ChannelUserInfo userInfo)
 {
     return(new CIRCeChannelUserItem {
         DataRow = this.list[userInfo.NickName]
     });
 }