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; } }
/// <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; } }
/// <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); } }
/// <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); } }
/// <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)); } } } }
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); } }
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; } }
public FromWinformMsg(MsgEnum command, string[] parameters, object objectParam) { _command = command; _parameters = parameters; _object = objectParam; }
public FromWinformMsg(MsgEnum command, string[] parameters) { _command = command; _parameters = parameters; }
/// <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; }
/// <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); }
/// <summary> /// 使用消息类型msg和string型参数数组创建消息对象 /// </summary> /// <param name="msg">消息类型</param> /// <param name="parameters">string型参数数组,不需要参数则使用null初始化</param> public FromClientUiMsg(MsgEnum msg, string[] parameters) { _msg = msg; _parameters = parameters; }