@@ -40,18 +40,14 @@ private async void OnCreateButtonClick()
4040
4141 #region 创建角色
4242
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 )
4646 {
47- Log . Error ( "登录失败,错误信息:" + respPlayerCreateHttpJsonResult . Message ) ;
47+ Log . Error ( "登录失败,错误信息:" + respPlayerCreate . ErrorCode ) ;
4848 return ;
4949 }
5050
51- Log . Info ( respPlayerCreateWebResult . Result ) ;
52- Log . Info ( respPlayerCreateHttpJsonResult . Data ) ;
53-
54- var respPlayerCreate = Utility . Json . ToObject < RespPlayerCreate > ( respPlayerCreateHttpJsonResult . Data ) ;
5551 if ( respPlayerCreate . PlayerInfo != null )
5652 {
5753 Log . Info ( "创建角色成功" ) ;
@@ -64,23 +60,19 @@ private async void OnCreateButtonClick()
6460 ReqPlayerList reqPlayerList = new ReqPlayerList ( ) ;
6561
6662 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 )
7066 {
71- Log . Error ( "登录失败,错误信息:" + respPlayerListHttpJsonResult . Message ) ;
67+ Log . Error ( "登录失败,错误信息:" + respPlayerList . ErrorCode ) ;
7268 return ;
7369 }
7470
75- Log . Info ( respPlayerListWebResult . Result ) ;
76- Log . Info ( respPlayerListHttpJsonResult . Data ) ;
77-
78- var respPlayerList = Utility . Json . ToObject < RespPlayerList > ( respPlayerListHttpJsonResult . Data ) ;
7971 AccountManager . Instance . PlayerList = respPlayerList . PlayerList ;
8072
8173 #endregion
8274
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 ) ;
8476 GameApp . UI . CloseUIForm ( this ) ;
8577 }
8678 }
0 commit comments