//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Tuesday, September 05, 2017
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI
|
{
|
|
public class SelectRoleWin : Window
|
{
|
[SerializeField] Text m_PlayerName;
|
[SerializeField] Text m_PlayerLevel;
|
|
[SerializeField] Button m_Begin;
|
[SerializeField] Button m_Back;
|
|
[SerializeField] Image m_Description;
|
[SerializeField] Image m_JobName;
|
[SerializeField] Image m_JobSign;
|
|
SelectRoleProcessor m_SelectRoleProcessor;
|
SelectRoleProcessor selectRoleProcessor {
|
get {
|
if (m_SelectRoleProcessor == null)
|
{
|
m_SelectRoleProcessor = GameObject.FindObjectOfType<SelectRoleProcessor>();
|
}
|
|
return m_SelectRoleProcessor;
|
}
|
}
|
|
LoginModel model { get { return ModelCenter.Instance.GetModel<LoginModel>(); } }
|
|
#region Built-in
|
protected override void BindController()
|
{
|
}
|
|
protected override void AddListeners()
|
{
|
m_Begin.onClick.AddListener(BeginBtn);
|
m_Back.onClick.AddListener(BackToLogin);
|
}
|
|
private void BackToLogin()
|
{
|
GameNetSystem.Instance.LoginOut();
|
}
|
|
protected override void OnPreOpen()
|
{
|
InitInfo();
|
}
|
|
protected override void OnAfterOpen()
|
{
|
}
|
|
protected override void OnPreClose()
|
{
|
}
|
|
protected override void OnAfterClose()
|
{
|
selectRoleProcessor.Dispose();
|
}
|
#endregion
|
|
private void BeginBtn()
|
{
|
if (GameNetSystem.Instance.netState == GameNetSystem.NetState.Connected)
|
{
|
return;
|
}
|
|
if (Application.internetReachability == NetworkReachability.NotReachable)
|
{
|
ConfirmCancel.ShowPopConfirm(
|
Language.Get("Mail101"),
|
Language.Get("L1116")
|
);
|
|
NetLinkWin.Hide();
|
return;
|
}
|
|
LoadingWin.targetMapResId = 2;
|
WindowCenter.Instance.Open<LoadingWin>();
|
model.EnterWorld(2);
|
}
|
|
private void InitInfo()
|
{
|
if (PlayerDatas.Instance.loginInfo == null)
|
{
|
return;
|
}
|
|
m_PlayerName.text = PlayerDatas.Instance.loginInfo.PlayerName.ToString();//玩家昵称
|
m_PlayerLevel.text = Language.Get("Z1024", PlayerDatas.Instance.loginInfo.LV);//玩家等级
|
var config = CreateRoleConfig.Get(PlayerDatas.Instance.loginInfo.Job);
|
m_Description.SetSprite(config.description);
|
m_JobName.SetSprite(config.jobName);
|
m_JobSign.SetSprite(config.jobSign);
|
|
selectRoleProcessor.Show(PlayerDatas.Instance.loginInfo.Job);
|
}
|
|
}
|
|
}
|
|
|
|
|