- Joined
- Mar 29, 2012
- Messages
- 73
- Reaction score
- 6
I decompile apk of spirit glory hope i can help.
PHP:
// Decompile from assembly: Assembly-CSharp.dll
using BlGame.Ctrl;
using BlGame.GameData;
using GameDefine;
using JT.FWW.GameData;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Runtime.CompilerServices;
using UnityEngine;
namespace BlGame.View
{
public class LoginWindow : BaseWindow
{
private enum LOGINUI
{
None = -1,
Login,
SelectServer
}
private sealed class _LoadVersion_c__Iterator1A : IDisposable, IEnumerator, IEnumerator<object>
{
internal string _urlCheck___0;
internal HttpWebRequest _request___1;
internal HttpWebResponse _response___2;
internal string _cdnUrl___3;
internal WWW _w___4;
internal string[] _data___5;
internal int _lastedVersion___6;
internal int curVer;
internal int _PC;
internal object _current;
internal int ___curVer;
object IEnumerator<object>.Current
{
get
{
return this._current;
}
}
object IEnumerator.Current
{
get
{
return this._current;
}
}
public bool MoveNext()
{
uint num = (uint)this._PC;
this._PC = -1;
switch (num)
{
case 0u:
this._urlCheck___0 = "http://cdn.mobo.vn/sog/version.txt";
this._request___1 = (HttpWebRequest)WebRequest.Create(this._urlCheck___0);
this._response___2 = (HttpWebResponse)this._request___1.GetResponse();
this._cdnUrl___3 = this._response___2.ResponseUri.AbsoluteUri;
this._response___2.Close();
UnityEngine.Debug.Log("CDN Config File: " + this._cdnUrl___3);
this._w___4 = new WWW(this._cdnUrl___3);
this._current = this._w___4;
this._PC = 1;
return true;
case 1u:
if (this._w___4.error != null)
{
UnityEngine.Debug.Log("Error read version data " + this._w___4.error);
}
else
{
UnityEngine.Debug.Log("Found ... ==>" + this._w___4.text + "<==");
}
this._data___5 = this._w___4.text.Split(new char[]
{
','
});
this._lastedVersion___6 = int.Parse(this._data___5[0]);
Singleton<LoginCtrl>.Instance.AndroidURL = this._data___5[1];
Singleton<LoginCtrl>.Instance.iOSURL = this._data___5[2];
if (this._lastedVersion___6 > this.curVer)
{
UnityEngine.Debug.LogWarning(" can cap nhat");
EventCenter.Broadcast<EMessageType>(EGameEvent.eGameEvent_ShowMessage, EMessageType.EMT_UpdateClient);
}
this._PC = -1;
break;
}
return false;
}
public void Dispose()
{
this._PC = -1;
}
public void Reset()
{
throw new NotSupportedException();
}
}
private sealed class _ShakeLabel_c__Iterator1B : IDisposable, IEnumerator, IEnumerator<object>
{
internal int _PC;
internal object _current;
internal LoginWindow __f__this;
object IEnumerator<object>.Current
{
get
{
return this._current;
}
}
object IEnumerator.Current
{
get
{
return this._current;
}
}
public bool MoveNext()
{
uint num = (uint)this._PC;
this._PC = -1;
switch (num)
{
case 0u:
this.__f__this.mPlayEffect = GameMethod.CreateWindow(GameConstDefine.LoadGameLoginEffectPath, new Vector3(-5f, -270f, 0f), this.__f__this.mRoot.transform);
this.__f__this.mPlaySubmitBtn.gameObject.SetActive(false);
this._current = new WaitForSeconds(1.4f);
this._PC = 1;
return true;
case 1u:
this._PC = -1;
break;
}
return false;
}
public void Dispose()
{
this._PC = -1;
}
public void Reset()
{
throw new NotSupportedException();
}
}
public static string MoboToken = string.Empty;
private Transform mPlayParent;
private Transform mPlaySubmitBtn;
private Transform mPlayServerBtn;
private UILabel mPlayNameLabel;
private UILabel mPlayStateLabel;
private Animator mPlayAnimate;
private GameObject mPlayEffect;
private Transform mLoginParent;
private Transform mLoginInput;
private Transform mLoginSubmit;
private UIInput mLoginPassInput;
private UIInput mLoginAccountInput;
private Transform mChangeAccountBtn;
private UILabel mChangeAccountName;
private Transform mServerParent;
private Transform mReLoginParent;
private Transform mReLoginDevice;
private Transform mReLoginSubmit;
private Transform mReLoginDeviceSubmit;
private Transform mWaitingParent;
private UILabel mVersionLable;
private List<UIToggle> mServerList = new List<UIToggle>();
public LoginWindow()
{
this.mScenesType = EScenesType.EST_Login;
this.mResName = GameConstDefine.LoadGameLoginUI;
this.mResident = false;
}
public override void Init()
{
EventCenter.AddListener(EGameEvent.eGameEvent_LoginEnter, new Callback(base.Show));
EventCenter.AddListener(EGameEvent.eGameEvent_LoginExit, new Callback(base.Hide));
if (JxBlGame.AUTO_LOGIN)
{
this.OnLoginSubmit(null);
}
}
public override void Realse()
{
EventCenter.RemoveListener(EGameEvent.eGameEvent_LoginEnter, new Callback(base.Show));
EventCenter.RemoveListener(EGameEvent.eGameEvent_LoginExit, new Callback(base.Hide));
}
private IEnumerator LoadVersion(int curVer)
{
LoginWindow._LoadVersion_c__Iterator1A _LoadVersion_c__Iterator1A = new LoginWindow._LoadVersion_c__Iterator1A();
_LoadVersion_c__Iterator1A.curVer = curVer;
_LoadVersion_c__Iterator1A.___curVer = curVer;
return _LoadVersion_c__Iterator1A;
}
protected override void InitWidget()
{
TextAsset textAsset = Resources.Load<TextAsset>("version");
int num = int.Parse(textAsset.text);
UnityEngine.Debug.LogWarning(num);
BlGameUI.Instance.StartCoroutine(this.LoadVersion(num));
this.mLoginParent = this.mRoot.FindChild("Server_Choose");
this.mLoginInput = this.mRoot.FindChild("Server_Choose/Loginer");
this.mLoginSubmit = this.mRoot.FindChild("Server_Choose/Button");
this.mLoginAccountInput = this.mRoot.FindChild("Server_Choose/Loginer/AcountInput").GetComponent<UIInput>();
this.mLoginPassInput = this.mRoot.FindChild("Server_Choose/Loginer/PassInput").GetComponent<UIInput>();
this.mPlayParent = this.mRoot.Find("LoginBG");
this.mPlaySubmitBtn = this.mRoot.Find("LoginBG/LoginBtn");
this.mPlayServerBtn = this.mRoot.Find("LoginBG/CurrentSelection");
this.mPlayNameLabel = this.mRoot.FindChild("LoginBG/CurrentSelection/Label3").GetComponent<UILabel>();
this.mPlayStateLabel = this.mRoot.FindChild("LoginBG/CurrentSelection/Label4").GetComponent<UILabel>();
this.mPlayAnimate = this.mPlaySubmitBtn.GetComponent<Animator>();
this.mChangeAccountBtn = this.mRoot.FindChild("ChangeAccount");
this.mChangeAccountName = this.mRoot.FindChild("ChangeAccount/Position/Label1").GetComponent<UILabel>();
this.mServerParent = this.mRoot.FindChild("UIGameServer");
this.mReLoginParent = this.mRoot.FindChild("LogInAgain");
this.mReLoginDevice = this.mRoot.FindChild("LogInSameAccount");
this.mReLoginSubmit = this.mRoot.FindChild("LogInAgain/Status1/Button");
this.mReLoginDeviceSubmit = this.mRoot.FindChild("LogInSameAccount/Status1/Button");
this.mVersionLable = this.mRoot.FindChild("Label").GetComponent<UILabel>();
this.mWaitingParent = this.mRoot.FindChild("Connecting");
UIEventListener expr_215 = UIEventListener.Get(this.mPlaySubmitBtn.gameObject);
expr_215.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_215.onClick, new UIEventListener.VoidDelegate(this.OnPlaySubmit));
UIEventListener expr_246 = UIEventListener.Get(this.mPlayServerBtn.gameObject);
expr_246.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_246.onClick, new UIEventListener.VoidDelegate(this.OnPlayServer));
UIEventListener expr_277 = UIEventListener.Get(this.mChangeAccountBtn.gameObject);
expr_277.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_277.onClick, new UIEventListener.VoidDelegate(this.OnChangeAccount));
UIEventListener expr_2A8 = UIEventListener.Get(this.mReLoginSubmit.gameObject);
expr_2A8.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_2A8.onClick, new UIEventListener.VoidDelegate(this.OnReLoginSubmit));
UIEventListener expr_2D9 = UIEventListener.Get(this.mReLoginDeviceSubmit.gameObject);
expr_2D9.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_2D9.onClick, new UIEventListener.VoidDelegate(this.OnReLoginSubmit));
UIEventListener expr_30A = UIEventListener.Get(this.mLoginSubmit.gameObject);
expr_30A.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_30A.onClick, new UIEventListener.VoidDelegate(this.OnLoginSubmit));
this.mServerList.Clear();
for (int i = 0; i < 4; i++)
{
UIToggle component = this.mLoginParent.FindChild("Server" + (i + 1).ToString()).GetComponent<UIToggle>();
this.mServerList.Add(component);
}
for (int j = 0; j < this.mServerList.Count; j++)
{
EventDelegate.Add(this.mServerList.ElementAt(j).onChange, new EventDelegate.Callback(this.OnSelectIp));
}
LoginWindow.DestroyOtherUI();
}
public static void DestroyOtherUI()
{
Camera getUiCamera = GameMethod.GetUiCamera;
GameObject[] array = new GameObject[getUiCamera.transform.childCount];
int num = 0;
for (int i = 0; i < getUiCamera.transform.childCount; i++)
{
if (getUiCamera.transform.GetChild(i) != null && getUiCamera.transform.GetChild(i).gameObject != null)
{
GameObject gameObject = getUiCamera.transform.GetChild(i).gameObject;
if (gameObject.name != "UIGameLogin(Clone)")
{
array[num++] = gameObject;
}
}
}
for (int j = 0; j < array.Length; j++)
{
if (array[j] != null)
{
UnityEngine.Object.DestroyImmediate(array[j]);
}
}
}
protected override void RealseWidget()
{
}
protected override void OnAddListener()
{
EventCenter.AddListener<EErrorCode>(EGameEvent.eGameEvent_LoginError, new Callback<EErrorCode>(this.LoginFail));
EventCenter.AddListener(EGameEvent.eGameEvent_LoginSuccess, new Callback(this.LoginSuceess));
EventCenter.AddListener<string, string>(EGameEvent.eGameEvent_SdkRegisterSuccess, new Callback<string, string>(this.SdkRegisterSuccess));
EventCenter.AddListener(EGameEvent.eGameEvent_SdkServerCheckSuccess, new Callback(this.SdkServerCheckSuccess));
EventCenter.AddListener(EGameEvent.eGameEvent_SelectServer, new Callback(this.SelectServer));
EventCenter.AddListener(EGameEvent.eGameEvent_LoginFail, new Callback(this.ShowLoginFail));
EventCenter.AddListener(EGameEvent.eGameEvent_SdkLogOff, new Callback(this.SdkLogOff));
}
protected override void OnRemoveListener()
{
EventCenter.RemoveListener<EErrorCode>(EGameEvent.eGameEvent_LoginError, new Callback<EErrorCode>(this.LoginFail));
EventCenter.RemoveListener<string, string>(EGameEvent.eGameEvent_SdkRegisterSuccess, new Callback<string, string>(this.SdkRegisterSuccess));
EventCenter.RemoveListener(EGameEvent.eGameEvent_SdkServerCheckSuccess, new Callback(this.SdkServerCheckSuccess));
EventCenter.RemoveListener(EGameEvent.eGameEvent_SelectServer, new Callback(this.SelectServer));
EventCenter.RemoveListener(EGameEvent.eGameEvent_LoginFail, new Callback(this.ShowLoginFail));
EventCenter.RemoveListener(EGameEvent.eGameEvent_LoginSuccess, new Callback(this.LoginSuceess));
EventCenter.RemoveListener(EGameEvent.eGameEvent_SdkLogOff, new Callback(this.SdkLogOff));
}
public override void OnEnable()
{
this.mVersionLable.text = Application.version;
this.mPlayAnimate.enabled = true;
this.ShowServer(LoginWindow.LOGINUI.None);
this.mLoginInput.gameObject.SetActive(true);
UnityEngine.Debug.LogWarning("Init MOBO");
if (LoginWindow.MoboToken != string.Empty)
{
Singleton<LoginCtrl>.Instance.Login("a", LoginWindow.MoboToken);
}
else
{
MoboScripts.initSDK();
}
}
public override void OnDisable()
{
}
private void OnPlaySubmit(GameObject go)
{
this.mWaitingParent.gameObject.SetActive(true);
UIEventListener expr_21 = UIEventListener.Get(this.mPlaySubmitBtn.gameObject);
expr_21.onClick = (UIEventListener.VoidDelegate)Delegate.Remove(expr_21.onClick, new UIEventListener.VoidDelegate(this.OnPlaySubmit));
Singleton<LoginCtrl>.Instance.GamePlay();
}
private void OnPlayServer(GameObject go)
{
this.ShowServer(LoginWindow.LOGINUI.SelectServer);
}
private void OnChangeAccount(GameObject go)
{
Singleton<LoginCtrl>.Instance.SdkLogOff();
}
private void OnReLoginSubmit(GameObject go)
{
this.mReLoginParent.gameObject.SetActive(false);
this.mReLoginDevice.gameObject.SetActive(false);
Singleton<LoginCtrl>.Instance.SdkLogOff();
}
private void OnLoginSubmit(GameObject go)
{
if (JxBlGame.AUTO_LOGIN)
{
Singleton<LoginCtrl>.Instance.Login(JxBlGame.AUTO_LOGIN_NICK, JxBlGame.AUTO_LOGIN_PASS);
return;
}
if (string.IsNullOrEmpty(this.mLoginAccountInput.value) || string.IsNullOrEmpty(this.mLoginPassInput.value))
{
return;
}
this.mWaitingParent.gameObject.SetActive(true);
LoginWindow.MoboToken = this.mLoginAccountInput.value;
Singleton<LoginCtrl>.Instance.Login(this.mLoginAccountInput.value, this.mLoginPassInput.value);
}
private void OnSelectIp()
{
if (UIToggle.current == null || !UIToggle.current.value)
{
return;
}
for (int i = 0; i < this.mServerList.Count; i++)
{
if (this.mServerList.ElementAt(i) == UIToggle.current)
{
Singleton<LoginCtrl>.Instance.SelectLoginServer(i);
break;
}
}
}
private void LoginFail(EErrorCode errorCode)
{
this.mPlayAnimate.enabled = true;
this.mPlaySubmitBtn.gameObject.SetActive(true);
UnityEngine.Object.DestroyImmediate(this.mPlayEffect.gameObject);
}
private void ShowLoginFail()
{
this.mReLoginDevice.gameObject.SetActive(JxBlGame.Instance.SameAccount);
this.mReLoginParent.gameObject.SetActive(!JxBlGame.Instance.SameAccount);
JxBlGame.Instance.SameAccount = false;
this.mWaitingParent.gameObject.SetActive(false);
UIEventListener expr_63 = UIEventListener.Get(this.mPlaySubmitBtn.gameObject);
expr_63.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_63.onClick, new UIEventListener.VoidDelegate(this.OnPlaySubmit));
}
private void LoginSuceess()
{
UIEventListener expr_10 = UIEventListener.Get(this.mPlaySubmitBtn.gameObject);
expr_10.onClick = (UIEventListener.VoidDelegate)Delegate.Remove(expr_10.onClick, new UIEventListener.VoidDelegate(this.OnPlaySubmit));
}
private void SelectServer()
{
this.ShowSelectServerInfo();
this.ShowServer(LoginWindow.LOGINUI.Login);
}
private void ShowServer(LoginWindow.LOGINUI state)
{
bool flag = false;
bool active = false;
switch (state + 1)
{
case LoginWindow.LOGINUI.Login:
flag = false;
active = false;
break;
case LoginWindow.LOGINUI.SelectServer:
this.ShowSelectServerInfo();
flag = true;
active = false;
break;
case (LoginWindow.LOGINUI)2:
flag = false;
active = true;
break;
}
this.mPlayParent.gameObject.SetActive(flag);
this.mServerParent.gameObject.SetActive(active);
this.mLoginParent.gameObject.SetActive(false);
if (flag)
{
this.mChangeAccountName.text = this.mLoginAccountInput.value;
}
}
private void ShowSelectServerInfo()
{
SelectServerData.ServerInfo curSelectServer = Singleton<SelectServerData>.Instance.curSelectServer;
this.mPlayNameLabel.text = curSelectServer.name;
this.mPlayStateLabel.text = "(" + Singleton<SelectServerData>.Instance.StateString[(int)curSelectServer.state] + ")";
Singleton<SelectServerData>.Instance.SetLabelColor(this.mPlayStateLabel, curSelectServer.state);
if (JxBlGame.AUTO_LOGIN)
{
this.OnPlaySubmit(null);
}
}
private void SdkRegisterSuccess(string uid, string sessionId)
{
Singleton<LoginCtrl>.Instance.SdkRegisterSuccess(uid, sessionId);
this.mWaitingParent.gameObject.SetActive(true);
}
private void SdkServerCheckSuccess()
{
this.ShowServer(LoginWindow.LOGINUI.Login);
this.mWaitingParent.gameObject.SetActive(false);
}
private void SdkLogOff()
{
this.ShowServer(LoginWindow.LOGINUI.None);
this.mLoginPassInput.value = string.Empty;
this.mLoginAccountInput.value = string.Empty;
}
private IEnumerator ShakeLabel()
{
LoginWindow._ShakeLabel_c__Iterator1B _ShakeLabel_c__Iterator1B = new LoginWindow._ShakeLabel_c__Iterator1B();
_ShakeLabel_c__Iterator1B.__f__this = this;
return _ShakeLabel_c__Iterator1B;
}
}
}