GetUserByGuid() private method

private GetUserByGuid ( ulong guid ) : User
guid ulong
return User
Ejemplo n.º 1
0
        internal void RemoveUser(IList <ulong> guids, int roomId, bool free, MyAction <bool, int, IList <User> > callbackOnFinish)
        {
            Room room = GetRoomByID(roomId);

            if (null != room)
            {
                List <User> users = new List <User>();
                for (int i = 0; i < guids.Count; ++i)
                {
                    User user = room.GetUserByGuid(guids[i]);
                    if (null != user)
                    {
                        room.RemoveUserFromRoomThread(user, free);
                        users.Add(user);
                    }
                }
                if (null != callbackOnFinish)
                {
                    int   sceneId = 0;
                    Scene scene   = room.ActiveScene;
                    if (null != scene)
                    {
                        sceneId = scene.SceneResId;
                    }
                    callbackOnFinish(true, sceneId, users);
                    return;
                }
            }
            if (null != callbackOnFinish)
            {
                callbackOnFinish(false, -1, null);
            }
        }
Ejemplo n.º 2
0
        internal void HandleReclaimItem(Msg_LR_ReclaimItem msg, PBChannel channel)
        {
            Room room = GetRoomByID(msg.RoomID);

            if (null != room)
            {
                User  user     = room.GetUserByGuid(msg.UserGuid);
                Scene curScene = room.ActiveScene;
                if (null != curScene)
                {
                }
            }
        }
Ejemplo n.º 3
0
        internal void HandleUserQuit(Msg_LR_UserQuit msg, PBChannel channel)
        {
            Room room = GetRoomByID(msg.RoomID);

            if (null != room)
            {
                User user = room.GetUserByGuid(msg.UserGuid);
                if (null != user)
                {
                    room.DeleteUser(user);
                }
            }
            Msg_RL_UserQuit replyBuilder = new Msg_RL_UserQuit();

            replyBuilder.UserGuid = msg.UserGuid;
            replyBuilder.RoomID   = msg.RoomID;
            channel.Send(replyBuilder);
        }
Ejemplo n.º 4
0
        internal void HandleRoomStoryMessage(Msg_LRL_StoryMessage msg, PBChannel channel)
        {
            Room room = GetRoomByID(msg.RoomId);

            if (null != room)
            {
                User  user     = room.GetUserByGuid(msg.UserGuid);
                Scene curScene = room.ActiveScene;
                if (null != user && null != curScene)
                {
                    try {
                        string    msgId = string.Format("server:{0}", msg.MsgId);
                        ArrayList args  = new ArrayList();
                        args.Add(user.RoleId);
                        for (int i = 0; i < msg.Args.Count; i++)
                        {
                            switch (msg.Args[i].val_type)
                            {
                            case Msg_LRL_StoryMessage.ArgType.NULL:    //null
                                args.Add(null);
                                break;

                            case Msg_LRL_StoryMessage.ArgType.INT:    //int
                                args.Add(int.Parse(msg.Args[i].str_val));
                                break;

                            case Msg_LRL_StoryMessage.ArgType.FLOAT:    //float
                                args.Add(float.Parse(msg.Args[i].str_val));
                                break;

                            default:    //string
                                args.Add(msg.Args[i].str_val);
                                break;
                            }
                        }
                        object[] objArgs = args.ToArray();
                        curScene.StorySystem.SendMessage(msgId, objArgs);
                    } catch (Exception ex) {
                        LogSys.Log(LOG_TYPE.ERROR, "Msg_CRC_StoryMessage throw exception:{0}\n{1}", ex.Message, ex.StackTrace);
                    }
                }
            }
        }