You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.1 KiB
41 lines
1.1 KiB
using UnityEngine; |
|
using System.Collections.Generic; |
|
using AX.Network.Common; |
|
using AX.Network.Protocols; |
|
using AX.NetworkSystem; |
|
using Assets.Scripts.Login; |
|
|
|
public class CONNECTED : MonoBehaviour |
|
{ |
|
protected virtual void OnEnable() |
|
{ |
|
NetworkMessageDispatcher.AddConnectedListener(Execute); |
|
} |
|
|
|
protected virtual void OnDisable() |
|
{ |
|
NetworkMessageDispatcher.RemoveConnectedListener(Execute); |
|
} |
|
|
|
protected virtual void OnDestroy() |
|
{ |
|
NetworkMessageDispatcher.RemoveConnectedListener(Execute); |
|
} |
|
|
|
protected void Execute(IAppSession<BinaryProtocol, BinaryMessage> session) |
|
{ |
|
if ((string)session.Tag == "DEFAULT") |
|
{ |
|
var loginSetting = GameSetting.LoginSetting; |
|
|
|
if (!loginSetting.Contains(session.RemoteEndPoint)) |
|
{ |
|
LoginStruct login = new LoginStruct(); |
|
login.token = Token.token; |
|
login.UserId = MySelf.mySelf.ID; |
|
|
|
NetworkManager.Default.SendRequestAsync("LOGIN_GATEWAY_REQUEST", login); |
|
} |
|
} |
|
} |
|
}
|
|
|