// 点击事件 void buttonClick(Button button) { if (button == btnClose) // 关闭程序 { showDialog("提示", "确定要退出程序吗?", "确定", delegate(bool isClickOk) { Application.Quit(); }); } else if (button == btnPay) // 支付 { AsyncOperation loginOperation = SceneManager.LoadSceneAsync("PayScene", LoadSceneMode.Additive); loginOperation.allowSceneActivation = true; } else if (button == btnTracking) // 数据统计 { AsyncOperation loginOperation = SceneManager.LoadSceneAsync("TrackingScene", LoadSceneMode.Additive); loginOperation.allowSceneActivation = true; } else if (button == btnLogout) // 登出 { showDialog("提示", "确定要退出登录吗?", "确定", delegate(bool isClickOk) { if (isClickOk) { WAUserProxy.LogOut(); SceneManager.LoadScene(0); } }); } else if (button == btnLoginUserDetail) // 登录用户信息 { StringBuilder info = new StringBuilder(); info.AppendFormat("ClientId:{0}", WACoreProxy.GetClientId()); info.AppendFormat("\n{0}", PlayerPrefs.GetString("WALoginUserDetail")); showDialog("提示", info.ToString(), "确定", null); } }
// Use this for initialization void Start() { //// WACoreProxy.SetDebugMode (true); // WACoreProxy.Initialize (); // WACoreProxy.SetGameUserId ("123456"); // WACoreProxy.SetServerId ("China"); // WACoreProxy.SetLevel (11); txtTitle = GameObject.Find("TxtTitle").GetComponent <Text>(); txtTitle.text = "登录"; // 关闭程序按钮 btnClose = GameObject.Find("BtnClose").GetComponent <Button>(); btnClose.onClick.AddListener(delegate { buttonClick(btnClose); }); btnFacebookLogin = GameObject.Find("BtnFacebookLogin").GetComponent <Button>(); btnFacebookLogin.onClick.AddListener(delegate { buttonClick(btnFacebookLogin); }); GameObject.Find("TxtClientId").GetComponent <Text> ().text = "clientId: " + WACoreProxy.GetClientId(); }