internal static void Execute(object msg, User user)
        {
            Msg_CRC_StoryMessage target_msg = msg as Msg_CRC_StoryMessage;

            if (target_msg == null)
            {
                return;
            }
            Scene scene = user.OwnRoom.ActiveScene;

            if (scene != null)
            {
                try {
                    //客户端发来的消息都加上前缀client,防止直接调用服务器端逻辑(服务器消息不能用client前缀!)
                    string    msgId = string.Format("client:{0}", target_msg.m_MsgId);
                    ArrayList args  = new ArrayList();
                    args.Add(user.RoleId);
                    for (int i = 0; i < target_msg.m_Args.Count; i++)
                    {
                        switch (target_msg.m_Args[i].val_type)
                        {
                        case ArgType.NULL:    //null
                            args.Add(null);
                            break;

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

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

                        default:    //string
                            args.Add(target_msg.m_Args[i].str_val);
                            break;
                        }
                    }
                    object[] objArgs = args.ToArray();
                    scene.StorySystem.SendMessage(msgId, objArgs);
                } catch (Exception ex) {
                    LogSys.Log(LOG_TYPE.ERROR, "Msg_CRC_StoryMessage throw exception:{0}\n{1}", ex.Message, ex.StackTrace);
                }
            }
        }
Пример #2
0
    internal static void Execute(object msg, NetConnection conn)
    {
        Msg_CRC_StoryMessage _msg = msg as Msg_CRC_StoryMessage;

        if (null == _msg)
        {
            return;
        }
        try {
            string    msgId = _msg.m_MsgId;
            ArrayList args  = new ArrayList();
            for (int i = 0; i < _msg.m_Args.Count; i++)
            {
                switch (_msg.m_Args[i].val_type)
                {
                case ArgType.NULL:    //null
                    args.Add(null);
                    break;

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

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

                default:    //string
                    args.Add(_msg.m_Args[i].str_val);
                    break;
                }
            }
            object[] objArgs = args.ToArray();
            GfxStorySystem.Instance.SendMessage(msgId, objArgs);
        } catch (Exception ex) {
            LogSystem.Error("Msg_CRC_StoryMessage throw exception:{0}\n{1}", ex.Message, ex.StackTrace);
        }
    }