Exemplo n.º 1
0
        /// <summary> 推送玩家移动 </summary>
        /// <param name="userid">当前玩家id</param>
        /// <param name="x">当前玩家x</param>
        /// <param name="y">当前玩家y</param>
        private void PushMoving(Int64 userid, int x, int y)
        {
            var list = Common.GetInstance().GetOtherSceneUsers(userid);

            foreach (var item in list)
            {
                var token = new CancellationTokenSource();
                Task.Factory.StartNew(m =>
                {
                    var uid = Convert.ToInt64(m);
                    if (!Variable.OnlinePlayer.ContainsKey(uid))
                    {
                        return;
                    }
                    var session = Variable.OnlinePlayer[uid] as TGGSession;
                    PUSH_PLAYER_MOVING.GetInstance().SendCommandStart(session, userid, x, y);
                }, item.user_id, token.Token);
            }
        }
Exemplo n.º 2
0
 /// <summary>PUSH_PLAYER_MOVING单体模式</summary>
 public static PUSH_PLAYER_MOVING GetInstance()
 {
     return(ObjInstance ?? (ObjInstance = new PUSH_PLAYER_MOVING()));
 }