//画线 private void setLine(GoddessAstrolabeStarCtrl _gas) { GoddessAstrolabeSample ss = _gas.getInfo(); if (ss.father == 0 || !GoddessAstrolabeManagerment.Instance.getFatherStarIsOpen(ss)) { return; } if (getFatherStar(ss.father) != null) { if (_gas.getInfo().mainType == 1) { LineRenderer renderActive = (Instantiate(lineActive) as GameObject).GetComponent <LineRenderer> (); renderActive.transform.parent = _gas.transform; renderActive.SetPosition(0, _gas.getPos()); renderActive.SetPosition(1, getFatherStar(ss.father).getPos()); renderActive.enabled = true; } else { LineRenderer renderNotActive = (Instantiate(lineNotActive) as GameObject).GetComponent <LineRenderer> (); renderNotActive.transform.parent = _gas.transform; renderNotActive.SetPosition(0, _gas.getPos()); renderNotActive.SetPosition(1, getFatherStar(ss.father).getPos()); renderNotActive.enabled = true; } } }
//激活指定星星 IEnumerator changeStarById(int id) { yield return(new WaitForSeconds(0.2f)); //先清理旧的 for (int i = 0; i < UIEffectRoot.childCount; i++) { Transform t = UIEffectRoot.GetChild(i); if (t.name == id.ToString()) { Destroy(t.gameObject); } } for (int i = 0; i < starParent.transform.childCount; i++) { Transform t = starParent.transform.GetChild(i); if (t.name == id.ToString()) { Destroy(t.gameObject); } } yield return(new WaitForSeconds(0.2f)); //可以开始创建了 for (int i = 0; i < infoByFront.Count; i++) { if (infoByFront[i].id == id) { GameObject a = instantiateStar(infoByFront[i]); if (GoddessAstrolabeManagerment.Instance.getLastStarIdById(nebulaId) == infoByFront[i].id) { GameObject last = Instantiate(starLast) as GameObject; last.transform.parent = a.transform; last.transform.localScale = Vector3.one; last.GetComponent <Animator>().Play(0); if (nebulaId == 6) { TextTipWindow.Show(LanguageConfigManager.Instance.getLanguage("astrolabe04")); } else { TextTipWindow.Show(LanguageConfigManager.Instance.getLanguage("astrolabe03")); } } GoddessAstrolabeStarCtrl b = a.AddComponent <GoddessAstrolabeStarCtrl>(); b.init(infoByFront[i], this); b.transform.parent = starParent.transform; b.transform.localScale = Vector3.one; b.transform.FindChild("star").gameObject.particleSystem.Play(); pos.localPosition = getTransform(infoByFront[i].position); b.transform.position = pos.position; b.name = infoByFront[i].id + ""; yield return(new WaitForSeconds(0.8f)); setLine(b); stars.Add(b); if (b.getInfo().awardType != 3) { UiManager.Instance.createMessageLintWindow(b.getInfo().awardDesc); } else { PrizeSample ps = new PrizeSample(b.getInfo().award.awardType, b.getInfo().award.awardSid, b.getInfo().award.awardNum); UiManager.Instance.createPrizeMessageLintWindow(ps); } yield return(new WaitForSeconds(0.5f)); //给可激活的星星画线 List <GoddessAstrolabeStarCtrl> next = getNextStar(b.getInfo().next); if (next != null) { for (int j = 0; j < next.Count; j++) { next[j].showUI(); setLine(next[j]); } } yield return(new WaitForSeconds(0.5f)); getStarPosByMainType(); // findStar(); // UiManager.Instance.createMessageWindowByOneButton(b.getInfo().awardDesc,(MessageHandle)=>{ // findStar(); // }); } } }