Skip to content

Commit 6b0abce

Browse files
committed
[修复]1. 修复引用代码异常的问题
1 parent 387c280 commit 6b0abce

11 files changed

+267
-267
lines changed

Assets/Bundles/UI/UILogin/UILogin.prefab

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,17 +401,17 @@ MonoBehaviour:
401401
m_GameObject: {fileID: 3717230910800151908}
402402
m_Enabled: 1
403403
m_EditorHideFlags: 0
404-
m_Script: {fileID: 11500000, guid: 75cb7ee26b0e470f89486d78d2fbcf47, type: 3}
404+
m_Script: {fileID: 11500000, guid: 17506338c6696f34fb32a857b7483118, type: 3}
405405
m_Name:
406406
m_EditorClassIdentifier:
407-
mUserName: {fileID: 4555843164057052725}
408407
mUserName__Placeholder: {fileID: 5546185728079920783}
409408
mUserName__Text: {fileID: 2292713627810620296}
410-
mPassword: {fileID: 8573712159762856585}
409+
mUserName: {fileID: 4555843164057052725}
411410
mPassword__Placeholder: {fileID: 967379718805668231}
412411
mPassword__Text: {fileID: 9038635317787761321}
413-
menter: {fileID: 8766712165321420368}
412+
mPassword: {fileID: 8573712159762856585}
414413
menter__Text: {fileID: 1318175656029300258}
414+
menter: {fileID: 8766712165321420368}
415415
mErrorText: {fileID: 7984387176934010493}
416416
mTitleText: {fileID: 1529636909}
417417
--- !u!1 &5484277854968332070

Assets/Bundles/UI/UILogin/UIPlayerList.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ MonoBehaviour:
5757
m_GameObject: {fileID: 549651788788559724}
5858
m_Enabled: 1
5959
m_EditorHideFlags: 0
60-
m_Script: {fileID: 11500000, guid: b1db4c50cefe4443bb435a753c3ecebc, type: 3}
60+
m_Script: {fileID: 11500000, guid: be8f1c751178dd84b8584945bb5e43a1, type: 3}
6161
m_Name:
6262
m_EditorClassIdentifier:
6363
mleft_Panel__ScrollView__Viewport__Content: {fileID: 4719756363520927840}

Assets/Bundles/UI/UIMain/UIMain.prefab

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,12 @@ MonoBehaviour:
486486
m_GameObject: {fileID: 1184977374874224108}
487487
m_Enabled: 1
488488
m_EditorHideFlags: 0
489-
m_Script: {fileID: 11500000, guid: cafa38f61d9d4d40abfbc25ba3ab6a46, type: 3}
489+
m_Script: {fileID: 11500000, guid: 6d7207ee58c654f439fd0477b79046d0, type: 3}
490490
m_Name:
491491
m_EditorClassIdentifier:
492492
mBgImage: {fileID: 7785376669766979963}
493-
mbag_button: {fileID: 1678343360}
494493
mbag_button__Text: {fileID: 1214814195}
494+
mbag_button: {fileID: 1678343360}
495495
mplayer_icon: {fileID: 346919067406639900}
496496
mplayer_name: {fileID: 1887894341}
497497
mplayer_level: {fileID: 2091764510}
Lines changed: 105 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,106 @@
1-
using System.Net;
2-
using GameFrameX;
3-
using GameFrameX.Event.Runtime;
4-
#if ENABLE_UI_FAIRYGUI
5-
using GameFrameX.UI.FairyGUI.Runtime;
6-
#endif
7-
using GameFrameX.Network.Runtime;
8-
using GameFrameX.Runtime;
9-
using GameFrameX.UI.Runtime;
10-
#if ENABLE_UI_UGUI
11-
using GameFrameX.UI.UGUI.Runtime;
12-
#endif
13-
using Hotfix.Config.item;
14-
using Hotfix.Network;
15-
using Hotfix.Proto;
16-
using UnityEngine;
17-
18-
namespace Hotfix.UI
19-
{
20-
public partial class UILogin
21-
{
22-
private static INetworkChannel networkChannel;
23-
public static string serverIp = "127.0.0.1";
24-
public static int serverPort = 29100;
25-
26-
public override void OnOpen(object userData)
27-
{
28-
m_enter.onClick.Set(OnLoginClick);
29-
base.OnOpen(userData);
30-
}
31-
32-
private void OnLoginClick()
33-
{
34-
if (networkChannel != null && networkChannel.Connected)
35-
{
36-
Login();
37-
return;
38-
}
39-
40-
if (networkChannel != null && GameApp.Network.HasNetworkChannel("network") && !networkChannel.Connected)
41-
{
42-
GameApp.Network.DestroyNetworkChannel("network");
43-
}
44-
45-
networkChannel = GameApp.Network.CreateNetworkChannel("network", new DefaultNetworkChannelHelper());
46-
// 注册心跳消息
47-
DefaultPacketHeartBeatHandler packetSendHeaderHandler = new DefaultPacketHeartBeatHandler();
48-
networkChannel.RegisterHeartBeatHandler(packetSendHeaderHandler);
49-
networkChannel.Connect(IPAddress.Parse(serverIp), serverPort);
50-
GameApp.Event.CheckSubscribe(NetworkConnectedEventArgs.EventId, OnNetworkConnected);
51-
GameApp.Event.CheckSubscribe(NetworkClosedEventArgs.EventId, OnNetworkClosed);
52-
}
53-
54-
private async void Login()
55-
{
56-
var item = GameApp.Config.GetConfig<TbItem>().Get(1);
57-
Log.Info(item);
58-
if (m_UserName.text.IsNullOrWhiteSpace() || m_Password.text.IsNullOrWhiteSpace())
59-
{
60-
m_ErrorText.text = "用户名或密码不能为空";
61-
return;
62-
}
63-
64-
65-
var req = new ReqLogin
66-
{
67-
SdkType = 0,
68-
SdkToken = "",
69-
UserName = m_UserName.text,
70-
Password = m_Password.text,
71-
Device = SystemInfo.deviceUniqueIdentifier
72-
};
73-
req.Platform = PathHelper.GetPlatformName;
74-
75-
RespLogin respLogin = await networkChannel.Call<RespLogin>(req);
76-
Log.Info(respLogin);
77-
ReqPlayerList reqPlayerList = new ReqPlayerList();
78-
79-
reqPlayerList.Id = respLogin.Id;
80-
81-
var respPlayerList = await networkChannel.Call<RespPlayerList>(reqPlayerList);
82-
if (respPlayerList.PlayerList.Count > 0)
83-
{
84-
await GameApp.UI.OpenUIFormAsync<UIPlayerList>(Utility.Asset.Path.GetUIPath(nameof(UILogin)), UIGroupConstants.Floor.Name, respLogin, true);
85-
}
86-
else
87-
{
88-
await GameApp.UI.OpenUIFormAsync<UIPlayerCreate>(Utility.Asset.Path.GetUIPath(nameof(UILogin)), UIGroupConstants.Floor.Name, respLogin, true);
89-
}
90-
91-
// await GameApp.UI.OpenUIFormAsync<UIMain>(Utility.Asset.Path.GetUIPath(nameof(UIMain)), UIGroupConstants.Floor.Name);
92-
GameApp.UI.CloseUIForm(this);
93-
}
94-
95-
private static void OnNetworkClosed(object sender, GameEventArgs e)
96-
{
97-
Log.Info(nameof(OnNetworkClosed));
98-
}
99-
100-
private void OnNetworkConnected(object sender, GameEventArgs e)
101-
{
102-
Login();
103-
Log.Info(nameof(OnNetworkConnected));
104-
}
105-
}
1+
using System.Net;
2+
using GameFrameX;
3+
using GameFrameX.Event.Runtime;
4+
#if ENABLE_UI_FAIRYGUI
5+
using GameFrameX.UI.FairyGUI.Runtime;
6+
#endif
7+
using GameFrameX.Network.Runtime;
8+
using GameFrameX.Runtime;
9+
using GameFrameX.UI.Runtime;
10+
#if ENABLE_UI_UGUI
11+
using GameFrameX.UI.UGUI.Runtime;
12+
#endif
13+
using Hotfix.Config.item;
14+
using Hotfix.Network;
15+
using Hotfix.Proto;
16+
using UnityEngine;
17+
18+
namespace Hotfix.UI
19+
{
20+
public partial class UILogin
21+
{
22+
private static INetworkChannel networkChannel;
23+
public static string serverIp = "127.0.0.1";
24+
public static int serverPort = 29100;
25+
26+
public override void OnOpen(object userData)
27+
{
28+
m_enter.onClick.Set(OnLoginClick);
29+
base.OnOpen(userData);
30+
}
31+
32+
private void OnLoginClick()
33+
{
34+
if (networkChannel != null && networkChannel.Connected)
35+
{
36+
Login();
37+
return;
38+
}
39+
40+
if (networkChannel != null && GameApp.Network.HasNetworkChannel("network") && !networkChannel.Connected)
41+
{
42+
GameApp.Network.DestroyNetworkChannel("network");
43+
}
44+
45+
networkChannel = GameApp.Network.CreateNetworkChannel("network", new DefaultNetworkChannelHelper());
46+
// 注册心跳消息
47+
DefaultPacketHeartBeatHandler packetSendHeaderHandler = new DefaultPacketHeartBeatHandler();
48+
networkChannel.RegisterHeartBeatHandler(packetSendHeaderHandler);
49+
networkChannel.Connect(IPAddress.Parse(serverIp), serverPort);
50+
GameApp.Event.CheckSubscribe(NetworkConnectedEventArgs.EventId, OnNetworkConnected);
51+
GameApp.Event.CheckSubscribe(NetworkClosedEventArgs.EventId, OnNetworkClosed);
52+
}
53+
54+
private async void Login()
55+
{
56+
var item = GameApp.Config.GetConfig<TbItem>().Get(1);
57+
Log.Info(item);
58+
if (m_UserName.text.IsNullOrWhiteSpace() || m_Password.text.IsNullOrWhiteSpace())
59+
{
60+
m_ErrorText.text = "用户名或密码不能为空";
61+
return;
62+
}
63+
64+
65+
var req = new ReqLogin
66+
{
67+
SdkType = 0,
68+
SdkToken = "",
69+
UserName = m_UserName.text,
70+
Password = m_Password.text,
71+
Device = SystemInfo.deviceUniqueIdentifier
72+
};
73+
req.Platform = PathHelper.GetPlatformName;
74+
75+
RespLogin respLogin = await networkChannel.Call<RespLogin>(req);
76+
Log.Info(respLogin);
77+
ReqPlayerList reqPlayerList = new ReqPlayerList();
78+
79+
reqPlayerList.Id = respLogin.Id;
80+
81+
var respPlayerList = await networkChannel.Call<RespPlayerList>(reqPlayerList);
82+
if (respPlayerList.PlayerList.Count > 0)
83+
{
84+
await GameApp.UI.OpenUIFormAsync<UIPlayerList>(Utility.Asset.Path.GetUIPath(nameof(UILogin)), UIGroupConstants.Floor.Name, respLogin, true);
85+
}
86+
else
87+
{
88+
await GameApp.UI.OpenUIFormAsync<UIPlayerCreate>(Utility.Asset.Path.GetUIPath(nameof(UILogin)), UIGroupConstants.Floor.Name, respLogin, true);
89+
}
90+
91+
// await GameApp.UI.OpenUIFormAsync<UIMain>(Utility.Asset.Path.GetUIPath(nameof(UIMain)), UIGroupConstants.Floor.Name);
92+
GameApp.UI.CloseUIForm(this);
93+
}
94+
95+
private static void OnNetworkClosed(object sender, GameEventArgs e)
96+
{
97+
Log.Info(nameof(OnNetworkClosed));
98+
}
99+
100+
private void OnNetworkConnected(object sender, GameEventArgs e)
101+
{
102+
Login();
103+
Log.Info(nameof(OnNetworkConnected));
104+
}
105+
}
106106
}
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
1-
using GameFrameX;
2-
#if ENABLE_UI_FAIRYGUI
3-
using GameFrameX.UI.FairyGUI.Runtime;
4-
#endif
5-
using GameFrameX.Runtime;
6-
using GameFrameX.UI.Runtime;
7-
#if ENABLE_UI_UGUI
8-
using GameFrameX.UI.UGUI.Runtime;
9-
#endif
10-
using Hotfix.Proto;
11-
12-
namespace Hotfix.UI
13-
{
14-
public partial class UIPlayerCreate
15-
{
16-
ReqPlayerCreate req;
17-
18-
public override void OnOpen(object userData)
19-
{
20-
req = new ReqPlayerCreate();
21-
base.OnOpen(userData);
22-
23-
RespLogin respLogin = userData as RespLogin;
24-
this.m_enter.onClick.Set(OnCreateButtonClick);
25-
req.Id = respLogin.Id;
26-
}
27-
28-
private async void OnCreateButtonClick()
29-
{
30-
if (m_UserName.text.IsNullOrWhiteSpace())
31-
{
32-
m_ErrorText.text = "角色名不能为空";
33-
return;
34-
}
35-
36-
req.Name = m_UserName.text;
37-
var resp = await GameApp.Network.GetNetworkChannel("network").Call<RespPlayerCreate>(req);
38-
if (resp.PlayerInfo != null)
39-
{
40-
Log.Info("创建角色成功");
41-
}
42-
43-
await GameApp.UI.OpenUIFormAsync<UIPlayerList>(Utility.Asset.Path.GetUIPackagePath(nameof(UILogin)), UIGroupConstants.Floor.Name, UserData, true);
44-
GameApp.UI.CloseUIForm(this);
45-
}
46-
}
1+
using GameFrameX;
2+
#if ENABLE_UI_FAIRYGUI
3+
using GameFrameX.UI.FairyGUI.Runtime;
4+
#endif
5+
using GameFrameX.Runtime;
6+
using GameFrameX.UI.Runtime;
7+
#if ENABLE_UI_UGUI
8+
using GameFrameX.UI.UGUI.Runtime;
9+
#endif
10+
using Hotfix.Proto;
11+
12+
namespace Hotfix.UI
13+
{
14+
public partial class UIPlayerCreate
15+
{
16+
ReqPlayerCreate req;
17+
18+
public override void OnOpen(object userData)
19+
{
20+
req = new ReqPlayerCreate();
21+
base.OnOpen(userData);
22+
23+
RespLogin respLogin = userData as RespLogin;
24+
this.m_enter.onClick.Set(OnCreateButtonClick);
25+
req.Id = respLogin.Id;
26+
}
27+
28+
private async void OnCreateButtonClick()
29+
{
30+
if (m_UserName.text.IsNullOrWhiteSpace())
31+
{
32+
m_ErrorText.text = "角色名不能为空";
33+
return;
34+
}
35+
36+
req.Name = m_UserName.text;
37+
var resp = await GameApp.Network.GetNetworkChannel("network").Call<RespPlayerCreate>(req);
38+
if (resp.PlayerInfo != null)
39+
{
40+
Log.Info("创建角色成功");
41+
}
42+
43+
await GameApp.UI.OpenUIFormAsync<UIPlayerList>(Utility.Asset.Path.GetUIPackagePath(nameof(UILogin)), UIGroupConstants.Floor.Name, UserData, true);
44+
GameApp.UI.CloseUIForm(this);
45+
}
46+
}
4747
}

0 commit comments

Comments
 (0)