Example #1
0
        public void OnRecvAutoAccept()
        {
            GameLogic.cmd_kin_auto_accept cmdHead = LogicDataCenter.kinDataManager.AutoAccept;
            // 更新到显示
            Toggle     tAutoAccept = AutoAcceptTog.GetComponent <Toggle>();
            Toggle     tMaleTog    = MaleTog.GetComponent <Toggle>();
            Toggle     tFemleTog   = FemleTog.GetComponent <Toggle>();
            InputField tLevelTI    = LevelTI.GetComponent <InputField>();

            //设置可以编辑
            tAutoAccept.enabled = true;
            tLevelTI.enabled    = true;
            tFemleTog.enabled   = true;
            tMaleTog.enabled    = true;


            tLevelTI.placeholder.GetComponent <Text>().text = cmdHead.nAcceptLevel.ToString();
            tAutoAccept.isOn = cmdHead.bAutoAccept == 1 ? true : false;
            tMaleTog.isOn    = (((TKinAutoFlag)cmdHead.dwAcceptFlag & TKinAutoFlag.emKinAuto_Male) == TKinAutoFlag.emKinAuto_Male) ? true : false;
            tFemleTog.isOn   = (((TKinAutoFlag)cmdHead.dwAcceptFlag & TKinAutoFlag.emKinAuto_Female) == TKinAutoFlag.emKinAuto_Female) ? true : false;

            //设置可以编辑
            tAutoAccept.enabled = false;
            tLevelTI.enabled    = false;
            tFemleTog.enabled   = false;
            tMaleTog.enabled    = false;

            // 显示编辑按钮
            AcceptSaveBtn.GetComponent <Button>().gameObject.SetActive(false);
            AcceptEditBtn.GetComponent <Button>().gameObject.SetActive(true);

            setAcceptEditState(true);
        }
Example #2
0
        public void OnAcceptSaveClick()
        {
            GameLogic.cmd_kin_auto_accept cmdHead = new GameLogic.cmd_kin_auto_accept();
            // 更新到显示
            Toggle     tAutoAccept = AutoAcceptTog.GetComponent <Toggle>();
            Toggle     tMaleTog    = MaleTog.GetComponent <Toggle>();
            Toggle     tFemleTog   = FemleTog.GetComponent <Toggle>();
            InputField tLevelTI    = LevelTI.GetComponent <InputField>();

            if (tLevelTI.textComponent.text == string.Empty)
            {
                cmdHead.nAcceptLevel = int.Parse(tLevelTI.placeholder.GetComponent <Text>().text);
            }
            else
            {
                cmdHead.nAcceptLevel = int.Parse(tLevelTI.textComponent.text);
            }

            cmdHead.dwAcceptFlag |= (int)((tMaleTog.isOn == true) ? TKinAutoFlag.emKinAuto_Male : TKinAutoFlag.emKinAuto_None);
            cmdHead.dwAcceptFlag |= (int)((tFemleTog.isOn == true) ? TKinAutoFlag.emKinAuto_Female : TKinAutoFlag.emKinAuto_None);
            cmdHead.bAutoAccept   = (int)((tAutoAccept.isOn == true) ? 1 : 0);
            ViewEventHelper.Instance.SendCommand <cmd_kin_auto_accept>(GameLogicDef.GVIEWCMD_KIN_AUTOACCEPT_SAVE, ref cmdHead);


            //设置可以编辑
            tAutoAccept.enabled = false;
            tLevelTI.enabled    = false;
            tFemleTog.enabled   = false;
            tMaleTog.enabled    = false;

            // 显示编辑按钮
            AcceptSaveBtn.GetComponent <Button>().gameObject.SetActive(false);
            AcceptEditBtn.GetComponent <Button>().gameObject.SetActive(true);

            setAcceptEditState(true);
        }