public Item(Transform parent) { IsLock = false; InputField[] inputFields = parent.GetComponentsInChildren <InputField>(); Position = new InputFieldVector3(inputFields[0], inputFields[1], inputFields[2]); Rotation = new InputFieldVector3(inputFields[3], inputFields[4], inputFields[5]); Scale = new InputFieldVector3(inputFields[6], inputFields[7], inputFields[8]); if (parent.Find("Button") == null) { return; } ButtonLock = parent.Find("Button").GetComponent <Button>(); ButtonText = parent.Find("Button/Text").GetComponent <Text>(); //listener ButtonLock.onClick.AddListener(delegate { Lock(!IsLock); if (!IsLock)//解锁时更新面板 { UpdatePosition(); UpdateRotation(); UpdateScale(); } }); }
private void Load() { InputField[] inputFields = this.GetComponentsInChildren <InputField>(); if (inputFields.Length != INPUT_FIELD_NUM) { throw new Exception("输入框数量不匹配:" + inputFields.Length); } objectName = inputFields[0]; for (int i = 1; i < INPUT_FIELD_NUM; i++) { inputFields[i].contentType = InputField.ContentType.DecimalNumber; } position = new InputFieldVector3(inputFields[1], inputFields[2], inputFields[3]); rotation = new InputFieldVector3(inputFields[4], inputFields[5], inputFields[6]); scale = new InputFieldVector3(inputFields[7], inputFields[8], inputFields[9]); Transform content = this.transform.Find("Content"); buttonClear = content.Find("ButtonClear").GetComponent <Button>(); buttonMaterialRecovery = content.Find("Material").Find("ButtonGroup").Find("ButtonRecovery").GetComponent <Button>(); buttonNormalAnim = content.Find("Anim/Content/Button").GetComponent <Button>(); buttonAppearanceAnim = content.Find("Anim/Content2/Button").GetComponent <Button>(); toggleAnim = content.Find("Anim/Content/Toggle").GetComponent <Toggle>(); }