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