示例#1
0
    private void OnRecvNewUser(ICD.stHeader _msg, string _info)
    {
        if (_msg.head.cmd != ICD.ICDDefines.CMD_NewUser)
        {
            return;
        }

        ICD.CMD_UserInfo msg = (ICD.CMD_UserInfo)_msg;
        mSetting.SetUserName(msg.body.username);
    }
示例#2
0
    // 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);
        }
    }
示例#3
0
    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();
        }
    }