void Load(EventArgs args) { EventArgs <IState <string> > tmpArgs = args as EventArgs <IState <string> >; ConditionLog.BasicLog($"Start Load {Identify} GameObject"); tmpArgs.Parameter.ReductionState(); }
/// <summary> /// 输出每一次访问传入的参数 /// </summary> /// <param name="text"></param> /// <param name="parameter"></param> public void LogParameter(string text, params string[] parameter) { for (int i = 0; i < parameter.Length; i++) { text = text + " " + parameter[i]; } ConditionLog.BasicLog("IOC:" + text); }
/// <summary> /// 输出每一次访问传入的参数 /// </summary> /// <param name="nam"></param> /// <param name="parameter"></param> public void LogParameter(string nam, params string[] parameter) { for (int i = 0; i < parameter.Length; i++) { nam = nam + " " + parameter[i]; } ConditionLog.BasicLog("AssetBundle:" + nam); }
void Load(EventArgs args) { EventArgs <IState <string> > tmpArgs = args as EventArgs <IState <string> >; ConditionLog.BasicLog($"Start Load {Identify} Asset"); baseState = tmpArgs.Parameter; LoadLevelState.ChangeState(Identify); }
/// <summary> /// 注销一个消息 /// </summary> /// <param name="id">消息的token</param> /// <param name="data">注销的对象</param> public void UnRegistSingle(string token, NotifiedObject targetObject) { if (!sendList.ContainsKey(token)) { ConditionLog.MsgLogError($"执行注销操作时,传入了没有注册的消息:{token}"); } else { sendList[token].RemoveNode(targetObject); } }
public void ProcessEvent(MsgBase msg) { if (MsgEventHandlers.ContainsKey(msg.Token)) { MsgEventHandlers[msg.Token].Invoke(msg); } else { ConditionLog.MsgLog($"Common中没有注册用于处理{msg.Token}的方法"); } }
/// <summary> /// 发送消息 /// </summary> /// <param name="msg"></param> public void SendMsg(MsgBase msg, string handler = AppConst.MsgHandler_Common, params Action[] operations)//发送消息方法 { msg.Source = this; if (MsgHandlers.ContainsKey(handler)) { MsgHandlers[handler].StartOperation(msg, operations); } else { ConditionLog.MsgLogError($"没有找到指定的消息处理器{handler}在{GetType()}"); } }
/// <summary> /// 接收消息 /// 接收消息后对消息进行判断 /// 找到对应的消息特性进行消息处理 /// </summary> /// <param name="tmpMsg"></param> public void ProcessEvent(MsgBase msg) { foreach (var kv in MsgHandlers.Values) { if (kv.MsgEventHandlers.ContainsKey(msg.Token)) { kv.ProcessEvent(msg); break; } } ConditionLog.MsgLogError($"查找{msg.Token}的执行方法时出错!在{GetType()}"); }
/// <summary> /// 接收到一个消息,根据 /// </summary> /// <param name="tmpMsg"></param> public void LaunchEvent(EventArgs args) { MsgBase msg = args as MsgBase; switch (msg.SendMode) { case MsgSendMode.Auto: if (!sendList.ContainsKey(msg.Token)) { ConditionLog.MsgLog($"收到了未注册的自动消息:{msg.Token},转为全局消息"); msg.SendMode = MsgSendMode.Global; MsgTools.SendGlobalMsg(); } else { sendList[msg.Token].HandleEvent(msg); } break; case MsgSendMode.Local: if (!sendList.ContainsKey(msg.Token)) { ConditionLog.MsgLogError($"收到了本地消息:{msg.Token},但是该消息没有注册"); } else { sendList[msg.Token].HandleEvent(msg); } break; case MsgSendMode.Global: if (!sendList.ContainsKey(msg.Token)) { ConditionLog.MsgLog($"收到了未注册的全局消息:{msg.Token}"); } else { sendList[msg.Token].HandleEvent(msg); } break; default: ConditionLog.MsgLogError("Manager收到了一个 未标注发送模式,或无法处理对应模式的Msg"); break; } }
public void StartOperation(MsgBase msg, params Action[] operations) { ConditionLog.MsgLog($"由Common发送了一个{msg.Token}消息"); }