// Start is called before the first frame update void Start() { panelMainCategory.SetActive(false); panelMusicList.SetActive(false); panelEditView.SetActive(false); panelSetting.SetActive(false); float height = panelMainCategory.GetComponent <RectTransform>().rect.height; panelMusicList.transform.position = new Vector3(0, height, 0); panelEditView.transform.position = new Vector3(0, height, 0); panelSetting.transform.position = new Vector3(0, height, 0); mSetting = panelSetting.GetComponentInChildren <Setting>(); if (mSetting.IsFirst()) { mSetting.SetInitalized(); sound = GetComponent <AudioSource>(); slider = GetComponentInChildren <Slider>(); bar = transform.Find("imgBar").gameObject; syncRef = transform.Find("imgSync").gameObject; if (NetworkClient.Inst().IsConnected()) { ICD.CMD_UserInfo info = new ICD.CMD_UserInfo(); info.body.devicename = SystemInfo.deviceUniqueIdentifier; info.FillHeader(ICD.ICDDefines.CMD_NewUser); NetworkClient.Inst().mOnRecv.AddListener(OnRecvNewUser); NetworkClient.Inst().SendMsgToServer(info); } } else { ICD.CMD_UserInfo info = new ICD.CMD_UserInfo(); info.body.username = mSetting.UserName; info.body.reserve = 1; //LOGIN info.FillHeader(ICD.ICDDefines.CMD_LoggingUser); NetworkClient.Inst().SendMsgToServer(info); MainCategory.PreviousView = panelMusicList; panelMusicList.SetActive(true); panelMainCategory.SetActive(true); Destroy(gameObject); } }
void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { ClickCount++; if (!IsInvoking("ResetDoubleClick")) { Invoke("ResetDoubleClick", 1.0f); } } else if (ClickCount >= 2) { ICD.CMD_UserInfo info = new ICD.CMD_UserInfo(); info.body.username = Setting.Inst().UserName; info.body.reserve = 0; //LOGOUT info.FillHeader(ICD.ICDDefines.CMD_LoggingUser); NetworkClient.Inst().SendMsgToServer(info); CancelInvoke("ResetDoubleClick"); Application.Quit(); } }