@@ -40,18 +40,14 @@ private async void OnCreateButtonClick()
40
40
41
41
#region 创建角色
42
42
43
- var respPlayerCreateWebResult = await GameApp . Web . PostToString ( $ "http://127.0.0.1:28080/game/api/{ nameof ( ReqPlayerCreate ) } ", Utility . Json . ToObject < Dictionary < string , object > > ( Utility . Json . ToJson ( req ) ) ) ;
44
- HttpJsonResult respPlayerCreateHttpJsonResult = Utility . Json . ToObject < HttpJsonResult > ( respPlayerCreateWebResult . Result ) ;
45
- if ( respPlayerCreateHttpJsonResult . Code > 0 )
43
+ var respPlayerCreate = await GameApp . Web . Post < RespPlayerCreate > ( $ "http://127.0.0.1:28080/game/api/{ nameof ( ReqPlayerCreate ) } ", req ) ;
44
+
45
+ if ( respPlayerCreate . ErrorCode > 0 )
46
46
{
47
- Log . Error ( "登录失败,错误信息:" + respPlayerCreateHttpJsonResult . Message ) ;
47
+ Log . Error ( "登录失败,错误信息:" + respPlayerCreate . ErrorCode ) ;
48
48
return ;
49
49
}
50
50
51
- Log . Info ( respPlayerCreateWebResult . Result ) ;
52
- Log . Info ( respPlayerCreateHttpJsonResult . Data ) ;
53
-
54
- var respPlayerCreate = Utility . Json . ToObject < RespPlayerCreate > ( respPlayerCreateHttpJsonResult . Data ) ;
55
51
if ( respPlayerCreate . PlayerInfo != null )
56
52
{
57
53
Log . Info ( "创建角色成功" ) ;
@@ -64,23 +60,19 @@ private async void OnCreateButtonClick()
64
60
ReqPlayerList reqPlayerList = new ReqPlayerList ( ) ;
65
61
66
62
reqPlayerList . Id = req . Id ;
67
- var respPlayerListWebResult = await GameApp . Web . PostToString ( $ "http://127.0.0.1:28080/game/api/{ nameof ( ReqPlayerList ) } ", Utility . Json . ToObject < Dictionary < string , object > > ( Utility . Json . ToJson ( reqPlayerList ) ) ) ;
68
- HttpJsonResult respPlayerListHttpJsonResult = Utility . Json . ToObject < HttpJsonResult > ( respPlayerListWebResult . Result ) ;
69
- if ( respPlayerListHttpJsonResult . Code > 0 )
63
+ var respPlayerList = await GameApp . Web . Post < RespPlayerList > ( $ "http://127.0.0.1:28080/game/api/{ nameof ( ReqPlayerList ) } ", reqPlayerList ) ;
64
+
65
+ if ( respPlayerList . ErrorCode > 0 )
70
66
{
71
- Log . Error ( "登录失败,错误信息:" + respPlayerListHttpJsonResult . Message ) ;
67
+ Log . Error ( "登录失败,错误信息:" + respPlayerList . ErrorCode ) ;
72
68
return ;
73
69
}
74
70
75
- Log . Info ( respPlayerListWebResult . Result ) ;
76
- Log . Info ( respPlayerListHttpJsonResult . Data ) ;
77
-
78
- var respPlayerList = Utility . Json . ToObject < RespPlayerList > ( respPlayerListHttpJsonResult . Data ) ;
79
71
AccountManager . Instance . PlayerList = respPlayerList . PlayerList ;
80
72
81
73
#endregion
82
74
83
- await GameApp . UI . OpenUIFormAsync < UIPlayerList > ( Utility . Asset . Path . GetUIPackagePath ( nameof ( UILogin ) ) , UIGroupConstants . Floor . Name , UserData , true ) ;
75
+ await GameApp . UI . OpenUIFormAsync < UIPlayerList > ( Utility . Asset . Path . GetUIPath ( nameof ( UILogin ) ) , UIGroupConstants . Floor . Name , UserData , true ) ;
84
76
GameApp . UI . CloseUIForm ( this ) ;
85
77
}
86
78
}
0 commit comments