Example #1
0
        public void Add(PluginBase plugin)
        {
            if (plugin == null || string.IsNullOrEmpty(plugin.GetPluginName()))
            {
                throw new Exception("Plugin Name and plugin instance could not be empty or null");
            }
            string pluginName = plugin.GetPluginName();

            if (this.pluginCollection.ContainsKey(pluginName))
            {
                this.pluginCollection[pluginName] = plugin;
            }
            else
            {
                this.pluginCollection.Add(pluginName, plugin);
            }
        }
Example #2
0
 public void OnApolloPaySvrNotify(byte[] data)
 {
     ADebug.Log("ApolloPay OnApolloPaySvrNotify!");
     if (this.PayEvent != null)
     {
         PluginBase currentPlugin = PluginManager.Instance.GetCurrentPlugin();
         if (currentPlugin == null)
         {
             ADebug.LogError("OnApolloPaySvrNotify plugin is null");
         }
         else
         {
             ApolloAction action = new ApolloAction();
             if (!action.Decode(data))
             {
                 ADebug.LogError("OnApolloPaySvrNotify Action Decode failed");
             }
             else
             {
                 ApolloBufferBase payResponseInfo = currentPlugin.CreatePayResponseInfo(action.Action);
                 if (payResponseInfo != null)
                 {
                     if (!payResponseInfo.Decode(data))
                     {
                         ADebug.LogError("OnApolloPaySvrNotify Decode failed");
                     }
                     else
                     {
                         this.PayEvent(payResponseInfo);
                     }
                 }
                 else
                 {
                     ADebug.LogError("OnApolloPaySvrNotify info is null");
                 }
             }
         }
     }
     else
     {
         ADebug.Log("PayEvent is null");
     }
 }
Example #3
0
        public override IApolloServiceBase GetService(int type)
        {
            switch (type)
            {
            case 0x3e8:
                return(TssService.Instance);

            case 0x3e9:
                return(ApolloNetworkService.Intance);

            case 2:
                return(ApolloPayService.Instance);
            }
            PluginBase currentPlugin = PluginManager.Instance.GetCurrentPlugin();

            if (currentPlugin == null)
            {
                return(null);
            }
            return(currentPlugin.GetService(type));
        }
Example #4
0
        public override IApolloServiceBase GetService(int type)
        {
            if (type == 1000)
            {
                return(TssService.Instance);
            }
            if (type == 1001)
            {
                return(ApolloNetworkService.Intance);
            }
            if (type == 2)
            {
                return(ApolloPayService.Instance);
            }
            PluginBase currentPlugin = PluginManager.Instance.GetCurrentPlugin();

            if (currentPlugin == null)
            {
                return(null);
            }
            return(currentPlugin.GetService(type));
        }