示例#1
0
 /// <summary>
 /// 注册接口(获取 string)
 /// </summary>
 /// <param name="interfaceName">接口名称</param>
 /// <param name="interfaceUrl">接口url</param>
 /// <param name="handler">获取 string 之后的处理者</param>
 /// <param name="offlineHandle">离线模式处理者</param>
 public void RegisterInterface(string interfaceName, string interfaceUrl, HTFAction <string> handler, HTFAction offlineHandle)
 {
     if (!WebInterfaces.ContainsKey(interfaceName))
     {
         WebInterfaceGetString wi = Main.m_ReferencePool.Spawn <WebInterfaceGetString>();
         wi.Name           = interfaceName;
         wi.Url            = interfaceUrl;
         wi.OfflineHandler = offlineHandle;
         wi.Handler        = handler;
         WebInterfaces.Add(interfaceName, wi);
     }
     else
     {
         throw new HTFrameworkException(HTFrameworkModule.WebRequest, "添加接口失败:已存在名为 " + interfaceName + " 的网络接口!");
     }
 }
示例#2
0
 /// <summary>
 /// 注册接口(获取 string)
 /// </summary>
 public void RegisterInterface(string name, string url, HTFAction <string> handler, HTFAction offlineHandle = null)
 {
     if (!_interfaces.ContainsKey(name))
     {
         WebInterfaceGetString wi = Main.m_ReferencePool.Spawn <WebInterfaceGetString>();
         wi.Name           = name;
         wi.Url            = url;
         wi.OfflineHandler = offlineHandle;
         wi.Handler        = handler;
         _interfaces.Add(name, wi);
     }
     else
     {
         GlobalTools.LogError("添加接口失败:已存在名为 " + name + " 的网络接口!");
     }
 }
 /// <summary>
 /// 注册接口(获取 string)
 /// </summary>
 /// <param name="interfaceName">接口名称</param>
 /// <param name="interfaceUrl">接口url</param>
 /// <param name="handler">获取 string 之后的处理者</param>
 /// <param name="offlineHandle">离线模式处理者</param>
 public void RegisterInterface(string interfaceName, string interfaceUrl, HTFAction <string> handler, HTFAction offlineHandle)
 {
     if (!WebInterfaces.ContainsKey(interfaceName))
     {
         WebInterfaceGetString wi = Main.m_ReferencePool.Spawn <WebInterfaceGetString>();
         wi.Name           = interfaceName;
         wi.Url            = interfaceUrl;
         wi.OfflineHandler = offlineHandle;
         wi.Handler        = handler;
         WebInterfaces.Add(interfaceName, wi);
     }
     else
     {
         Log.Error(string.Format("注册接口失败:已存在名为 {0} 的网络接口!", interfaceName));
     }
 }