Exemplo n.º 1
0
 public void Action(ApolloActionBufferBase info, ApolloActionDelegate callback)
 {
     if (info == null)
     {
         ADebug.LogError("PayService Action Info == null");
     }
     else
     {
         byte[] buffer;
         if (!info.Encode(out buffer))
         {
             ADebug.LogError("Action Encode error!");
         }
         else
         {
             if (this.actionCallbackCollection.ContainsKey(info.Action))
             {
                 this.actionCallbackCollection[info.Action] = callback;
             }
             else
             {
                 this.actionCallbackCollection.Add(info.Action, callback);
             }
             apollo_pay_action(buffer, buffer.Length);
         }
     }
 }
Exemplo n.º 2
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);
                }
            }
        }
Exemplo n.º 3
0
 public void Action(ApolloActionBufferBase info, ApolloActionDelegate callback)
 {
     if (info == null)
     {
         ADebug.LogError("PayService Action Info == null");
         return;
     }
     byte[] array;
     if (!info.Encode(out array))
     {
         ADebug.LogError("Action Encode error!");
         return;
     }
     if (this.actionCallbackCollection.ContainsKey(info.Action))
     {
         this.actionCallbackCollection[info.Action] = callback;
     }
     else
     {
         this.actionCallbackCollection.Add(info.Action, callback);
     }
     ApolloPayService.apollo_pay_action(array, array.Length);
 }
Exemplo n.º 4
0
 public bool Pay(ApolloActionBufferBase payInfo)
 {
     byte[] array;
     payInfo.Encode(out array);
     return(this.inited && ApolloPayService.apollo_pay_Pay(array, array.Length));
 }
Exemplo n.º 5
0
 public bool Pay(ApolloActionBufferBase payInfo)
 {
     byte[] buffer;
     payInfo.Encode(out buffer);
     return(this.inited && apollo_pay_Pay(buffer, buffer.Length));
 }