java源代码:
public void payFailed(Map paramMap, int paramInt)
{
Log.d("cocos2d-x debug info", "Failed DX_payCode2 == " + IAPListener.DX_PAYCODES[this.this$0.curPayIndex]);
Log.d("cocos2d-x debug info", "FaildCode == " + paramInt);
GameJni.OderFinish(this.this$0.curPayIndex, 0);
IAPListener.iapHandler.sendMessage(Message.obtain(IAPListener.iapHandler, 10005, IAPListener.DX_PAYCODES[this.this$0.curPayIndex]));
}
对应的smali语句:
.method public payFailed(Ljava/util/Map;I)V
.locals 5
.param p1, "params" # Ljava/util/Map;
.param p2, "arg1" # I
.prologue
.line 208
const-string v0, "cocos2d-x debug info"
#1.new instance
new-instance v1, Ljava/lang/StringBuilder;
#2调用构造
invoke-direct {v1}, Ljava/lang/StringBuilder;->()V
#对应源代码中的log.d 中的字符串
const-string v2, "Failed DX_payCode2 == "
#3.调用append函数
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
#获取 DX_PAYCODES对象
sget-object v2, Lcom/payCom/org/IAPListener;->DX_PAYCODES:[Ljava/lang/String;
iget-object v3, p0, Lcom/payCom/org/IAPListener$1;->this$0:Lcom/payCom/org/IAPListener;
iget v3, v3, Lcom/payCom/org/IAPListener;->curPayIndex:I
#获取数组v2里面的第v3个元素v2
aget-object v2, v2, v3
#调用虚方法v1.append(v2),见书20/73
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
#将上一个invoke类型的指令操作的对象赋值给v1,
#将刚才上面所得到的值放入v1当中
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 209
const-string v0, "cocos2d-x debug info"
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;->()V
const-string v2, "FaildCode == "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 210
iget-object v0, p0, Lcom/payCom/org/IAPListener$1;->this$0:Lcom/payCom/org/IAPListener;
iget v0, v0, Lcom/payCom/org/IAPListener;->curPayIndex:I
const/4 v1, 0x0
invoke-static {v0, v1}, Lcom/payCom/org/GameJni;->OderFinish(II)V
.line 211
sget-object v0, Lcom/payCom/org/IAPListener;->iapHandler:Lcom/payCom/org/IAPHandler;
sget-object v1, Lcom/payCom/org/IAPListener;->iapHandler:Lcom/payCom/org/IAPHandler;
const/16 v2, 0x2715
sget-object v3, Lcom/payCom/org/IAPListener;->DX_PAYCODES:[Ljava/lang/String;
iget-object v4, p0, Lcom/payCom/org/IAPListener$1;->this$0:Lcom/payCom/org/IAPListener;
iget v4, v4, Lcom/payCom/org/IAPListener;->curPayIndex:I
aget-object v3, v3, v4
invoke-static {v1, v2, v3}, Landroid/os/Message;->obtain(Landroid/os/Handler;ILjava/lang/Object;)Landroid/os/Message;
move-result-object v1
invoke-virtual {v0, v1}, Lcom/payCom/org/IAPHandler;->sendMessage(Landroid/os/Message;)Z
.line 212
return-void
.end method
.method public payFailed(Ljava/util/Map;I)V
:
.method
表示这是一个方法,
payFailed
为方法名字
(Ljava/util/Map;I)
算是函数里面的形参
v
为返回值,返回值为空,这里
.locals 5
定义局部变量寄存器
.param p1, "params"
声明参数params
这里是p命名方式
.param p2, "arg1"
声明参数arg1
.prologue
表示函数开始
.end method
表示函数结束
const-string v0, "cocos2d-x debug info"
定义了一个字符串常量变量
"Failed DX_payCode2 == " + IAPListener.DX_PAYCODES[this.this$0.curPayIndex]
:
这里表示"Failed DX_payCode2 == "
这个字符串与另外一个字符串合并变成了一个长的字符串,而它"Failed DX_payCode2 == "是需要一个对象来"存“的,所以下面先new出一个对象(实例),然后在调用构造函数;
new-instance v1, Ljava/lang/StringBuilder:
new出一个实例;
invoke-direct {v1}, Ljava/lang/StringBuilder;->
:调用构造;
const-string v2, "Failed DX_payCode2 == "
定义字符串,为"Failed DX_payCode2 == " + IAPListener.DX_PAYCODES[this.this$0.curPayIndex]
这一步做准备;
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder
:调用append这个函数,实施"Failed DX_payCode2 == " + IAPListener.DX_PAYCODES[this.this$0.curPayIndex]
这一步;
move-result-object v1
将刚才所得到的值放入 v1当中;
sget-object v2, Lcom/payCom/org/IAPListener;->DX_PAYCODES:[Ljava/lang/String;
获取Lcom/payCom/org/IAPListener这个类当中的对象DX_PAYCODES
iget-object v3, p0, Lcom/payCom/org/IAPListener$1;->this$0:Lcom/payCom/org/IAPListener;
调用(获取)对象,其实就是点出this$0(内部类)(即 .this$0
)
iget v3, v3, Lcom/payCom/org/IAPListener;->curPayIndex:I
获取索引(整型);
aget-object v2, v2, v3
获取数组v2(第二个v2)里面的第v3个元素v2(第一个v2)
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
调用虚方法v1.append(v2),注意,这里的v1里面已经有了"Failed DX_payCode2 == " + IAPListener.DX_PAYCODES[this.this$0.curPayIndex]
,这里调用append``函数,是想再"加"上v2;
move-result-object v1
将所得的值放入v1当中;
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
调用虚函数,得到最后的字符串;
move-result-object v1
作用同上;
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
调用静态方法,v0应该是指函数内的局部变量const-string v0, "cocos2d-x debug info"
,最后这这个函数相当于Log.d("cocos2d-x debug info", "Failed DX_payCode2 == " + IAPListener.DX_PAYCODES[this.this$0.curPayIndex])
;