Пример #1
0
        public void OnApolloPayActionProc(int ret, byte[] data)
        {
            ADebug.Log("OnApolloPayActionProc!");
            PluginBase currentPlugin = PluginManager.Instance.GetCurrentPlugin();

            if (currentPlugin == null)
            {
                ADebug.LogError("OnApolloPayActionProc plugin is null");
            }
            else
            {
                ApolloAction action = new ApolloAction();
                if (!action.Decode(data))
                {
                    ADebug.LogError("OnApolloPayActionProc Action Decode failed");
                }
                else if (this.actionCallbackCollection.ContainsKey(action.Action))
                {
                    ApolloActionBufferBase base3 = currentPlugin.CreatePayResponseAction(action.Action);
                    if (base3 != null)
                    {
                        if (!base3.Decode(data))
                        {
                            ADebug.LogError("OnApolloPayActionProc Decode failed");
                        }
                        else
                        {
                            ApolloActionDelegate delegate2 = this.actionCallbackCollection[action.Action];
                            if (delegate2 != null)
                            {
                                try
                                {
                                    delegate2((ApolloResult)ret, base3);
                                }
                                catch (Exception exception)
                                {
                                    ADebug.LogError("OnApolloPayActionProc exception:" + exception);
                                }
                            }
                            else
                            {
                                ADebug.LogError("OnApolloPayActionProc callback is null while action == " + action.Action);
                            }
                        }
                    }
                    else
                    {
                        ADebug.LogError("OnApolloPayActionProc info is null");
                    }
                }
                else
                {
                    ADebug.LogError("OnApolloPayActionProc not exist action:" + action.Action);
                }
            }
        }
Пример #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");
     }
 }