Пример #1
0
        internal void HighlightPrompt(UserInfo user, int dictId, params object[] args)
        {
            //0--null 1--int 2--float 3--string
            GameFrameworkMessage.Msg_CLC_StoryMessage protoData = new GameFrameworkMessage.Msg_CLC_StoryMessage();
            protoData.m_MsgId = string.Format("highlightprompt{0}", args.Length);
            GameFrameworkMessage.Msg_CLC_StoryMessage.MessageArg item0 = new GameFrameworkMessage.Msg_CLC_StoryMessage.MessageArg();
            item0.val_type = LobbyArgType.INT;
            item0.str_val  = dictId.ToString();
            protoData.m_Args.Add(item0);
            for (int i = 0; i < args.Length; ++i)
            {
                GameFrameworkMessage.Msg_CLC_StoryMessage.MessageArg item = new GameFrameworkMessage.Msg_CLC_StoryMessage.MessageArg();
                item.val_type = LobbyArgType.STRING;
                item.str_val  = args[i].ToString();
                protoData.m_Args.Add(item);
            }
            NodeMessage msg = new NodeMessage(LobbyMessageDefine.Msg_CLC_StoryMessage, user.Guid);

            msg.m_ProtoData = protoData;
            TransmitToWorld(user, msg);
        }
Пример #2
0
 internal static void HandleNodeMessage(
     uint seq,
     int source_handle,
     int dest_handle,
     byte[] data)
 {
     if (s_Inited)
     {
         NodeMessage msg = DecodeNodeMessage(data);
         if (null != msg)
         {
             bool isContinue = true;
             if (null != s_MessageFilter)
             {
                 isContinue = s_MessageFilter(msg, source_handle, seq);
             }
             if (isContinue)
             {
                 HandleNodeMessage(msg, source_handle, seq);
             }
         }
     }
 }
Пример #3
0
        internal void SendStoryMessage(UserInfo user, string msgId, params object[] args)
        {
            //0--null 1--int 2--float 3--string
            GameFrameworkMessage.Msg_CLC_StoryMessage protoData = new GameFrameworkMessage.Msg_CLC_StoryMessage();
            protoData.m_MsgId = msgId;
            for (int i = 0; i < args.Length; ++i)
            {
                object arg = args[i];
                GameFrameworkMessage.Msg_CLC_StoryMessage.MessageArg item = new GameFrameworkMessage.Msg_CLC_StoryMessage.MessageArg();
                if (null != arg)
                {
                    if (arg is int)
                    {
                        item.val_type = LobbyArgType.INT;
                    }
                    else if (arg is float)
                    {
                        item.val_type = LobbyArgType.FLOAT;
                    }
                    else
                    {
                        item.val_type = LobbyArgType.STRING;
                    }
                    item.str_val = arg.ToString();
                }
                else
                {
                    item.val_type = LobbyArgType.NULL;
                    item.str_val  = "";
                }
                protoData.m_Args.Add(item);
            }
            NodeMessage msg = new NodeMessage(LobbyMessageDefine.Msg_CLC_StoryMessage, user.Guid);

            msg.m_ProtoData = protoData;
            TransmitToWorld(user, msg);
        }
Пример #4
0
        //===================================================================
        //以下为与RoomServer之间的消息通信
        //响应RoomServer发来的房间创建反馈消息
        internal void OnEnterSceneResult(ulong userGuid, int roomID, int result)
        {
            UserInfo user = LobbyServer.Instance.UserProcessScheduler.GetUserInfo(userGuid);

            if (user == null)
            {
                return;
            }
            if ((int)SceneOperationResultEnum.Success == result)
            {
                user.CurrentState  = UserState.Room;
                user.CurrentRoomID = roomID;
                RoomInfo room = m_LobbyInfo.GetRoomByID(roomID);
                if (null != room)
                {
                    RoomServerInfo svrInfo;
                    if (m_LobbyInfo.RoomServerInfos.TryGetValue(room.RoomServerName, out svrInfo))
                    {
                        if (null != svrInfo)
                        {
                            NodeMessage enterSceneResultMsg = new NodeMessage(LobbyMessageDefine.EnterSceneResult, user.Guid);
                            GameFrameworkMessage.EnterSceneResult protoData = new GameFrameworkMessage.EnterSceneResult();
                            protoData.server_ip   = svrInfo.ServerIp;
                            protoData.server_port = svrInfo.ServerPort;
                            protoData.key         = user.Key;
                            protoData.camp_id     = user.CampId;
                            protoData.scene_type  = room.SceneType;
                            protoData.result      = (int)GeneralOperationResult.LC_Succeed;
                            protoData.prime       = Helper.Random.Next(2, 21);

                            enterSceneResultMsg.m_ProtoData = protoData;
                            LobbyServer.Instance.TransmitToWorld(user, enterSceneResultMsg);

                            LogSys.Log(LOG_TYPE.INFO, "user enter field success! guid {0} room {1} result {2}",
                                       userGuid, roomID, (SceneOperationResultEnum)result);
                        }
                        else
                        {
                            LobbyServer.Instance.HighlightPrompt(user, 42);//进入游戏失败,请稍后重试
                        }
                    }
                    else
                    {
                        LobbyServer.Instance.HighlightPrompt(user, 42);//进入游戏失败,请稍后重试
                    }
                }
                else
                {
                    LobbyServer.Instance.HighlightPrompt(user, 42);//进入游戏失败,请稍后重试
                }
            }
            else
            {
                RoomInfo curRoom = user.Room;
                if (null != curRoom)
                {
                    curRoom.DelUsers(userGuid);
                }
                user.CurrentState = UserState.Online;

                LogSys.Log(LOG_TYPE.INFO, "user enter field failed! guid {0} room {1} result {2}",
                           userGuid, roomID, (SceneOperationResultEnum)result);

                LobbyServer.Instance.HighlightPrompt(user, 42);//进入游戏失败,请稍后重试
            }
        }