/**************************** summary: ****************************/ using System.Collections; using System.Collections.Generic; using UnityEngine; public class SettingSocketUrl : MonoBehaviour { public SCButton button; public TextMesh text; public GameObject settingUrl; private int clickNum =0; private void Start() { button.onClick.AddListener(OpenOnClick); if(PlayerPrefs.HasKey("SocketUrl")) { if(PlayerPrefs.GetInt("SocketUrl") ==1) { GameEnum.ServerHttpURL = "http://10.81.9.12:3437/server/"; // 本地 text.text = "当前版本为:本地"; } else { GameEnum.ServerHttpURL = "http://office.ghz-tech.com:3437/server/"; // 云端 text.text = "当前版本为:云端"; } } else { PlayerPrefs.SetInt("SocketUrl", 1); text.text = "当前版本为:本地"; } } private void OpenOnClick() { clickNum++; if(clickNum>5) { clickNum = 0; settingUrl.SetActive(true); Debug.Log("打开 Url设置"); } } public void SetUrl( int num) { if(num == 1) { GameEnum.ServerHttpURL = "http://10.81.9.12:3437/server/"; // 本地 text.text = "当前版本为:本地"; } else { GameEnum.ServerHttpURL = "http://office.ghz-tech.com:3437/server/"; // 云端 text.text = "当前版本为:云端"; } PlayerPrefs.SetInt("SocketUrl", num); } }