/// <summary> /// 根据选中单项的索引初始化其他单项的位置大小 /// </summary> /// <param name="eType"></param> /// <param name="nCurIndex"></param> public void InitStatus(EnumMoveCenterType eType, int nCurIndex) { this.InitMoveCenterInfo(eType, nCurIndex); if (eType == EnumMoveCenterType.eMoveCenterType_Increas) { if (this.m_uiPanel != null) { this.m_uiPanel.alpha = this.m_fFinishAlpha; } Vector3 localPosition = base.transform.position; localPosition.z = this.m_fFinishPosZ; base.transform.localPosition = localPosition; base.transform.localScale = this.m_vFinishScale; } }
/// <summary> /// 刷新所偶列表中的单项状态,比如大小位置等 /// </summary> private void RefreshAllItemStatus() { EnumMoveCenterType eMoveCenterType = this.m_eMoveCenterType; if (eMoveCenterType == EnumMoveCenterType.eMoveCenterType_Increas) { int index = this.GetSelectedIndex(); //表示当前没有选择一个单项 if (index < 0) { this.SetSelectedIndex(0); } index = 0; foreach (var current in this.m_listXUIListItem) { current.InitStatus(this.m_eMoveCenterType, index); } } }
/// <summary> /// 根据需要移中的索引初始化位置信息 /// </summary> /// <param name="eType"></param> /// <param name="nCurIndex"></param> public void InitMoveCenterInfo(EnumMoveCenterType eType, int nCurIndex) { //单项间隔多少距离 int dis = Mathf.Abs(this.m_nIndex - nCurIndex); this.m_bUpdateTransform = false; this.m_vFinishScale = base.transform.localScale; this.m_fFinishPosZ = base.transform.localPosition.z; if (eType == EnumMoveCenterType.eMoveCenterType_Increas) { this.m_fFinishAlpha = dis <= 2 ? 1 : 0; this.m_vFinishScale.x = 1f - dis * 0.1f; this.m_vFinishScale.y = 1f - dis * 0.1f; this.m_fFinishPosZ = 1f * dis; this.m_bUpdateTransform = true; if (this.m_nIndex == nCurIndex) { Vector3 localPosition = base.transform.localPosition; localPosition.z = -1; base.transform.localPosition = localPosition; } } }