public override void UserMsgRead(ParsePack dp)
        {
            string  time = dp.getString();
            int     s    = dp.getInt();
            MsgEnum me   = (MsgEnum)s;

            switch (me)
            {
            case MsgEnum.DesktopImg:
                if (MainWindow.instances.ControlDic.ContainsKey(bc))
                {
                    int wid = dp.getInt();
                    int hig = dp.getInt();
                    int len = dp.getInt();
                    MainWindow.instances.ControlDic[bc].RushDesktopImg(dp.getBytes(len));
                }
                break;

            case MsgEnum.ComputerName:
                string n = dp.getString();
                if (MainWindow.instances.ClientNameDic.ContainsKey(bc) == false)
                {
                    MainWindow.instances.ClientNameDic.Add(bc, n);
                    MainWindow.instances.RushClientList();
                }
                break;

            default:
                break;
            }
        }
示例#2
0
 /// <summary>
 /// 清空所有事件
 /// </summary>
 public static void Clear(MsgEnum msgEnum)
 {
     if (eventsBuffer.ContainsKey(msgEnum))
     {
         eventsBuffer.Remove(msgEnum);
     }
 }
        public override void UserMsgRead(ParsePack dp)
        {
            string  time = dp.getString();
            MsgEnum me   = (MsgEnum)dp.getInt();

            switch (me)
            {
            case MsgEnum.DesktopImg:
                ClientManger.instaces.HandleDesktopImg();
                break;

            case MsgEnum.MouseClick:
                ClientManger.instaces.HandleMouseClick(dp);
                break;

            case MsgEnum.MouseMove:
                ClientManger.instaces.HnadleMouseMove(dp);
                break;

            case MsgEnum.SendFiles:
                ClientManger.instaces.HandleFile(dp);
                break;

            case MsgEnum.KeyBoard:
                ClientManger.instaces.HandleKeyBD(dp);
                break;

            case MsgEnum.SpeKeyBoard:
                ClientManger.instaces.HandleSpeBD(dp);
                break;
            }
        }
示例#4
0
 /// <summary>
 /// 注销事件监听
 /// </summary>
 public static void Remove(MsgEnum msgEnum, Action <BaseMsg> callback)
 {
     if (eventsBuffer.ContainsKey(msgEnum))
     {
         List <Action <BaseMsg> > callbacks = eventsBuffer[msgEnum];
         if (callbacks.Contains(callback))
         {
             callbacks.Remove(callback);
         }
     }
 }
        public static BaseMsg DecodeMessage(byte[] msg)
        {
            MsgEnum type = getMessageType(msg);

            if (type != MsgEnum.None && msgDic.ContainsKey(type))
            {
                return(msgDic[type]().decode(msg));
            }
            else
            {
                return(null);
            }
        }
示例#6
0
        /// <summary>
        /// 注册事件监听
        /// </summary>
        public static void Add(MsgEnum msgEnum, Action <BaseMsg> callback)
        {
            if (!eventsBuffer.ContainsKey(msgEnum))
            {
                eventsBuffer.Add(msgEnum, new List <Action <BaseMsg> >());
            }
            List <Action <BaseMsg> > callbacks = eventsBuffer[msgEnum];

            if (!callbacks.Contains(callback))
            {
                callbacks.Add(callback);
            }
        }
示例#7
0
 /// <summary>
 /// 触发事件
 /// </summary>
 public static void Dispatch(MsgEnum msgEnum, params object[] args)
 {
     Debug.Log("触发事件: " + msgEnum);
     if (eventsBuffer.ContainsKey(msgEnum))
     {
         List <Action <BaseMsg> > callbacks = eventsBuffer[msgEnum];
         for (int i = 0; i < callbacks.Count; i++)
         {
             if (callbacks[i] != null)
             {
                 callbacks[i].Invoke(new BaseMsg(args));
             }
         }
     }
 }
示例#8
0
    public T ShowMsg <T>(MsgEnum msgType, string content, Vector3 msgPosition) where T : MsgView
    {
        string     msgName = EnumUtil.GetEnumName(msgType);
        GameObject objMsg  = CreateMsg(msgName);

        if (objMsg)
        {
            MsgView msgView = objMsg.GetComponent <MsgView>();
            msgView.SetContent(content);
            RectTransform rtfMsg = (RectTransform)msgView.transform;
            rtfMsg.anchoredPosition = msgPosition;
            return(msgView as T);
        }
        else
        {
            LogUtil.LogError("没有找到指定Msg:" + "Resources/" + resUrl + msgName);
            return(null);
        }
    }
示例#9
0
        public override void UserMsgRead(DataPack dp)
        {
            MsgEnum me = (MsgEnum)dp.ReadShort();

            Console.WriteLine(me);
            switch (me)
            {
            case MsgEnum.DesktopImg:
                clientManger.instaces.HandleDesktopImg();
                break;

            case MsgEnum.MouseClick:
                clientManger.instaces.HandleMouseClick(dp);
                break;

            case MsgEnum.MouseMove:
                clientManger.instaces.HnadleMouseMove(dp);
                break;
            }
        }
示例#10
0
 public FromWinformMsg(MsgEnum command, string[] parameters, object objectParam)
 {
     _command    = command;
     _parameters = parameters;
     _object     = objectParam;
 }
示例#11
0
 public FromWinformMsg(MsgEnum command, string[] parameters)
 {
     _command    = command;
     _parameters = parameters;
 }
示例#12
0
 /// <summary>
 /// 使用消息类型msg/string型参数数组/Object型参数创建消息对象
 /// </summary>
 /// <param name="msg">消息类型</param>
 /// <param name="parameters">string型参数数组,不需要参数则使用null初始化</param>
 /// <param name="objectParam">Object型参数,不需要则使用null初始化</param>
 public FromServerUiMsg(MsgEnum msg, string[] parameters, object objectParam)
 {
     _msg        = msg;
     _parameters = parameters;
     _object     = objectParam;
 }
示例#13
0
 /// <summary>
 /// 使用消息类型msg和string型参数数组创建消息对象
 /// </summary>
 /// <param name="msg">消息类型</param>
 /// <param name="parameters">string型参数数组,不需要参数则使用null初始化</param>
 public FromServerUiMsg(MsgEnum msg, string[] parameters)
 {
     _msg        = msg;
     _parameters = parameters;
 }
 void registeAction(MsgEnum type, BaseOrder actionInc)
 {
     this.actionFactory.Add(type, actionInc);
 }
示例#15
0
 /// <summary>
 /// 使用消息类型msg和string型参数数组创建消息对象
 /// </summary>
 /// <param name="msg">消息类型</param>
 /// <param name="parameters">string型参数数组,不需要参数则使用null初始化</param>
 public FromClientUiMsg(MsgEnum msg, string[] parameters)
 {
     _msg        = msg;
     _parameters = parameters;
 }