public void Show(VCPArmorPivot part) { if (gameObject.activeSelf) { return; } if (part.armorType != ArmorType.Decoration) { _part = part; transform.parent.gameObject.SetActive(true); gameObject.SetActive(true); _maleUI.SetActive(_part.isMale); _femaleUI.SetActive(!_part.isMale); for (int i = 0; i < 4; i++) { _maleButtons[i].disabled = (int)part.armorType != i; _femaleButtons[i].disabled = (int)part.armorType != i; } _maleButtons[(int)part.armorType].SetColor(_part.showIndex, _hilightColor); _femaleButtons[(int)part.armorType].SetColor(_part.showIndex, _hilightColor); } }
// 销毁 GameObject. 在需要删除 view 时调用 (实际上父级已被直接删除, 所以不需调用). ArmorPartObject 销毁时, 如果 view 已经存在则调用 public void DestroyModel() { if (_armor) { RemoveFromCharacterModel(); Destroy(_armor.gameObject); _armor = null; _pivot = null; } }
// 创建 GameObject. 在收到 view build 消息时调用. ArmorPartObject 创建时, 如果 view 已经存在则调用 public void CreateModel() { if (!_armor) { _armor = item.GetCmpt <Instantiate>().CreateViewGameObj(null).transform; _pivot = _armor.GetComponentInChildren <VCPArmorPivot>(); _pivot.DestroyModels(); SyncModelPivot(); AddToCharacterModel(); SyncModelFirstPersonMode(); } }
public override void Set(VCComponentData data) { data.Validate(); m_Data = data.Copy() as VCGeneralPartData; m_PositionInput.Vector = m_Data.m_Position; m_RotationInput.Vector = m_Data.m_Rotation; m_ArmorPartIndex = m_Data.m_ExtendData; if (m_VisibleCheck) { m_VisibleCheck.isChecked = m_Data.m_Visible; } WhiteCat.VCPArmorPivot m_VCPArmorPivot = m_SelectBrush.GetVCPArmorPivotByIndex(m_Data.m_ExtendData); if (m_VCPArmorPivot) { VCEditor.Instance.m_UI.bonePanel.Show(m_VCPArmorPivot); } }