Inheritance: MyServerThread
Ejemplo n.º 1
0
        private void ExtractMailAttachment(MailInfo info, ulong userGuid)
        {
            UserProcessScheduler dataProcess = UserServer.Instance.UserProcessScheduler;
            UserThread userThread = dataProcess.GetUserThread(userGuid);
            userThread.QueueAction(userThread.AddAssets, userGuid, info.m_Money, info.m_Gold);

            int itemCt = info.m_Items.Count;
            for (int itemIx = 0; itemIx < itemCt; ++itemIx) {
                MailItem item = info.m_Items[itemIx];
                userThread.QueueAction(userThread.AddItem, userGuid, item.m_ItemId, item.m_ItemNum);
            }
        }
Ejemplo n.º 2
0
        private void HandleUserQuit(Msg_RL_UserQuit msg_, PBChannel channel, int src, uint session)
        {
            UserProcessScheduler dataProcess = UserServer.Instance.UserProcessScheduler;
            UserThread           userThread  = dataProcess.GetUserThread(msg_.UserGuid);

            if (null != userThread)
            {
                userThread.QueueAction(userThread.HandleUserQuit, msg_);
            }
            else
            {
                dataProcess.DefaultUserThread.QueueAction(dataProcess.DefaultUserThread.HandleUserQuit, msg_);
            }
        }
        internal UserProcessScheduler()
        {
            m_Thread = new MyServerThread();
            m_Thread.TickSleepTime = 10;
            m_Thread.ActionNumPerTick = 10240;
            m_Thread.OnTickEvent += this.OnTick;

            m_NodeMessageManager.Init(3, 10, 4096);

            m_DefaultThread = new UserThread(10, 4096);
            for (int i = 0; i < m_UserThreads.Length; ++i) {
                m_UserThreads[i] = new UserThread(10, 4096);
            }
        }
Ejemplo n.º 4
0
 private void HandleDiscardItem(NodeMessage msg, int handle, uint seq)
 {
     GameFrameworkMessage.NodeMessageWithGuid nodeMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
     if (null != nodeMsg)
     {
         GameFrameworkMessage.Msg_CL_DiscardItem protoData = msg.m_ProtoData as GameFrameworkMessage.Msg_CL_DiscardItem;
         if (null != protoData)
         {
             UserThread userThread = m_UserProcessScheduler.GetUserThread(nodeMsg.m_Guid);
             if (null != userThread)
             {
                 userThread.QueueAction(userThread.DiscardItem, nodeMsg.m_Guid, protoData);
             }
         }
     }
 }
Ejemplo n.º 5
0
        private void HandleStoryMessage(NodeMessage msg, int handle, uint seq)
        {
            GameFrameworkMessage.NodeMessageWithGuid storyMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
            if (null != storyMsg)
            {
                GameFrameworkMessage.Msg_CLC_StoryMessage protoData = msg.m_ProtoData as GameFrameworkMessage.Msg_CLC_StoryMessage;
                if (null != protoData)
                {
                    ulong      guid       = storyMsg.m_Guid;
                    UserThread userThread = m_UserProcessScheduler.GetUserThread(guid);
                    if (null != userThread)
                    {
                        //客户端发来的消息都加上前缀client,防止直接调用服务器端逻辑(服务器消息不能用client前缀!)
                        string    msgId = string.Format("client:{0}", protoData.m_MsgId);
                        ArrayList args  = new ArrayList();
                        args.Add(guid);
                        for (int i = 0; i < protoData.m_Args.Count; i++)
                        {
                            switch (protoData.m_Args[i].val_type)
                            {
                            case LobbyArgType.NULL:    //null
                                args.Add(null);
                                break;

                            case LobbyArgType.INT:    //int
                                args.Add(int.Parse(protoData.m_Args[i].str_val));
                                break;

                            case LobbyArgType.FLOAT:    //float
                                args.Add(float.Parse(protoData.m_Args[i].str_val));
                                break;

                            default:    //string
                                args.Add(protoData.m_Args[i].str_val);
                                break;
                            }
                        }
                        object[] objArgs = args.ToArray();
                        userThread.QueueAction(userThread.SendStoryMessage, msgId, objArgs);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void HandleEnterScene(NodeMessage msg, int handle, uint seq)
        {
            GameFrameworkMessage.NodeMessageWithGuid headerMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
            if (null != headerMsg)
            {
                GameFrameworkMessage.EnterScene protoMsg = msg.m_ProtoData as GameFrameworkMessage.EnterScene;
                if (null != protoMsg)
                {
                    ulong guid       = headerMsg.m_Guid;
                    int   sceneId    = protoMsg.m_SceneId;
                    int   wantRoomId = protoMsg.m_RoomId;

                    UserProcessScheduler dataProcess = UserServer.Instance.UserProcessScheduler;
                    UserInfo             user        = dataProcess.GetUserInfo(guid);
                    if (user != null)
                    {
                        Msg_LB_RequestEnterScene    builder         = new Msg_LB_RequestEnterScene();
                        Msg_LB_BigworldUserBaseInfo baseInfoBuilder = new Msg_LB_BigworldUserBaseInfo();

                        baseInfoBuilder.AccountId       = user.AccountId;
                        baseInfoBuilder.NodeName        = user.NodeName;
                        baseInfoBuilder.WorldId         = UserServerConfig.WorldId;
                        baseInfoBuilder.ClientInfo      = user.ClientInfo;
                        baseInfoBuilder.StartServerTime = UserServerConfig.StartServerTime;
                        baseInfoBuilder.SceneId         = user.SceneId;

                        builder.BaseInfo    = baseInfoBuilder;
                        builder.User        = UserThread.BuildRoomUserInfo(user, 0, 0);
                        builder.SceneId     = sceneId;
                        builder.WantRoomId  = wantRoomId;
                        builder.FromSceneId = user.SceneId;
                        UserServer.Instance.BigworldChannel.Send(builder);
                    }
                }
            }
        }
Ejemplo n.º 7
0
 internal void Init(UserThread userThread)
 {
     StaticInit();
     m_UserThread = userThread;
 }
 internal void Init(UserThread userThread)
 {
     StaticInit();
     m_UserThread = userThread;
 }