private Dictionary <string, ServerMsgStruct> DefaulatAnalyzeCallback(object data) { //解析完之后得到的Dictionary Dictionary <string, ServerMsgStruct> ServerMsgList = new Dictionary <string, ServerMsgStruct>(); Dictionary <string, object> reponseData = (Dictionary <string, object>)data; foreach (KeyValuePair <string, object> respondStructData in reponseData) { MessageAnalizer analizer = GetAnalizer(respondStructData.Key); if (analizer == null) { Debug.Log("no default analizer, key = " + respondStructData.Key); continue; } //调用默认解析 ServerMsgStruct msgStruct = analizer(respondStructData.Value); if (msgStruct == null) { Debug.Log("msgStruct is null, key = " + respondStructData.Key); } else { ServerMsgList.Add(respondStructData.Key, msgStruct); } } return(ServerMsgList); }
private void RegisterDefaultAnalyzer(string keyWord, MessageAnalizer analyzer) { m_defaultAnalizerDic.Add(keyWord, analyzer); }