//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, November 20, 2017
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI
|
{
|
|
public class DisconnectHintWin : Window
|
{
|
[SerializeField] Text m_Content;
|
[SerializeField] Button m_Confirm;
|
[SerializeField] Button m_Cancel;
|
|
#region Built-in
|
protected override void BindController()
|
{
|
}
|
|
protected override void AddListeners()
|
{
|
m_Cancel.AddListener(Cancel);
|
m_Confirm.AddListener(Confirm);
|
}
|
|
protected override void OnPreOpen()
|
{
|
if (StageLoad.Instance.currentStage is LoginStage)
|
{
|
m_Content.text = Language.Get("Disconnected_2");
|
}
|
else
|
{
|
m_Content.text = Language.Get("Disconnected_1");
|
}
|
}
|
|
protected override void OnAfterOpen()
|
{
|
}
|
|
protected override void OnPreClose()
|
{
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
#endregion
|
|
private void Confirm()
|
{
|
switch (Application.internetReachability)
|
{
|
case NetworkReachability.NotReachable:
|
GameNetSystem.Instance.LoginOut();
|
ServerForceExitHintWin.reason = 111;
|
break;
|
case NetworkReachability.ReachableViaCarrierDataNetwork:
|
case NetworkReachability.ReachableViaLocalAreaNetwork:
|
if (StageLoad.Instance.currentStage is LoginStage)
|
{
|
var loginModel = ModelCenter.Instance.GetModel<LoginModel>();
|
loginModel.busy = false;
|
loginModel.AccountLogin(loginModel.accountBuf, loginModel.ipBuf, loginModel.portBuf, loginModel.gamePortBuf);
|
}
|
else
|
{
|
GameNetSystem.Instance.Reconnect();
|
}
|
break;
|
}
|
|
CloseClick();
|
}
|
|
private void Cancel()
|
{
|
if (!(StageLoad.Instance.currentStage is LoginStage))
|
{
|
GameNetSystem.Instance.LoginOut();
|
}
|
|
CloseClick();
|
}
|
|
}
|
|
}
|
|
|
|
|