//播放移动动画 void PlayMoveAnimation(FightRoleAllElement Allelement, FightRoleSelecteElement Selectelement, bool VtoHOrHtoV) { if (!moveCell.gameObject.activeSelf) { moveCell.gameObject.SetActive(true); } Vector3?startPos = null; Vector3?endPos = null; TMovealpaha.ResetToBeginning(); TMovepostion.ResetToBeginning(); if (VtoHOrHtoV) { startPos = GetPosAtMovePanel(Allelement.gameObject); endPos = GetPosAtMovePanel(Selectelement.gameObject); UISprite s = TMovealpaha.GetComponent <UISprite>(); if (s != null) { s.alpha = 0; } TMovealpaha.from = 0; TMovealpaha.to = 1f; TMovealpaha.PlayForward(); } else { startPos = GetPosAtMovePanel(Selectelement.gameObject); endPos = GetPosAtMovePanel(Allelement.gameObject); UISprite s = TMovealpaha.GetComponent <UISprite>(); if (s != null) { s.alpha = 1f; } TMovealpaha.from = 1f; TMovealpaha.to = 0; TMovealpaha.PlayForward(); } TMovepostion.transform.localPosition = (Vector3)startPos; TMovepostion.from = (Vector3)startPos; TMovepostion.to = (Vector3)endPos; TMovepostion.PlayForward(); StartCoroutine(OnPlayMoveAnimationFinished(Allelement, Selectelement, VtoHOrHtoV)); }
//播放位移动画结束 IEnumerator OnPlayMoveAnimationFinished(FightRoleAllElement Allelement, FightRoleSelecteElement Selectelement, bool VtoHOrHtoV) { yield return(new WaitForSeconds(0.25f)); if (VtoHOrHtoV) { RefreshSelectedPanel(); } else { Allelement.isSelected = false; } yield return(new WaitForSeconds(0.1f)); moveCell.gameObject.SetActive(false); }
void CreateElement2() { //Debug.LogError("list_SelectedRoles -> list_SelectedRoles.cout="+list_SelectedRoles.Count.ToString()); if (list_SelectedRoles.Count == 1) { // float x = -390; // float w = 130; for (int i = 0; i < 7; i++) { if (i > 0) { GameObject obj = Instantiate(list_SelectedRoles[0].gameObject) as GameObject; RED.AddChild(obj, uiGrid2.gameObject, new Vector3(uiGrid2.cellWidth * i, 14f, 0)); FightRoleSelecteElement element = obj.GetComponent <FightRoleSelecteElement>(); list_SelectedRoles.Add(element); } list_SelectedRoles[i].gameObject.name = "sel_" + i.ToString(); } //uiGrid2.repositionNow = true; } }