//构建方法 public void maketheItem(attackLinkInformation theAttackLinkInformationIn) { if (string.IsNullOrEmpty(theAttackLinkInformationIn.attackLinkString) == false) { theAttackLinkContrtoller = theAttackLinkInformationIn.thePlayer.GetComponentInChildren <attackLinkController> (); theAttackLinkContrtoller.makeStart(); } else { //Destroy (theButtonFoirAttackLink.gameObject); theButtonFoirAttackLink.gameObject.SetActive(false); } theAttackLinkInformation = theAttackLinkInformationIn; SelfButtonShow = theEffectForSelfButton.GetComponent <informationMouseShow> (); EMYButtonShow = theEffectForEMYButton.GetComponent <informationMouseShow> (); informationMouseShow theAttackLinkShow = theButtonFoirAttackLink.GetComponent <informationMouseShow> (); theButtonFoirAttackLink.GetComponentInChildren <Text> ().text = theAttackLinkInformation.attackLinkName; theAttackLinkShow.showText = theAttackLinkInformation.attackLinkInformationText; theAttackLinkShow.showTitle = theAttackLinkInformation.attackLinkName; if (string.IsNullOrEmpty(theAttackLinkInformation.theEffectForSelfName)) { //Destroy (theEffectForSelfButton.gameObject); theEffectForSelfButton.gameObject.SetActive(false); } else { theEffectForSelfButton.GetComponentInChildren <Text> ().text = theAttackLinkInformation.theEffectForSelfName.Split('\n')[0]; SelfButtonShow.showText = theAttackLinkInformation.theEffectForSelfInformaion; SelfButtonShow.showTitle = theAttackLinkInformation.theEffectForSelfName; } if (string.IsNullOrEmpty(theAttackLinkInformation.theEffectForEMYName)) { //Destroy (theEffectForEMYButton.gameObject); theEffectForEMYButton.gameObject.SetActive(false); } else { theEffectForEMYButton.GetComponentInChildren <Text> ().text = theAttackLinkInformation.theEffectForEMYName.Split('\n')[0]; EMYButtonShow.showText = theAttackLinkInformation.theEffectForEMYInformaion; EMYButtonShow.showTitle = theAttackLinkInformation.theEffectForEMYName; } if (string.IsNullOrEmpty(theAttackLinkInformationIn.attackLinkString)) { //Destroy (theEffectForShow.gameObject); theEffectForShow.gameObject.SetActive(false); } }
//工具方法,更为复杂的方法 //用于连招的显示按钮等等信息的全部获取 public static List <attackLinkInformation> getEffectInformationsMore(GameObject thePlayer, bool withAttackLinkEffect = false) { List <attackLinkInformation> theAttackLinkInformaitons = new List <attackLinkInformation> (); List <effectBasic> buffer = new List <effectBasic> (); string showString = ""; string showExtra = ""; //被动没有连招,但是也应该显示 effectBasic [] efs = thePlayer.GetComponentsInChildren <effectBasic>(); for (int i = 0; i < efs.Length; i++) { buffer.Add(efs[i]); efs [i].Init(); if (efs [i].isBE() && efs[i].isShowing()) { attackLinkInformation theInformation = new attackLinkInformation(); theInformation.attackLinkName = ""; theInformation.attackLinkString = ""; theInformation.theEffectForSelfName = efs[i].getEffectName(false, false); theInformation.theEffectForSelfInformaion = efs[i].getInformation(false) + "\n" + efs[i].getExtraInformation(); theAttackLinkInformaitons.Add(theInformation); } } //展示连招中触发的各种效果 if (withAttackLinkEffect) { attackLink[] attacklinks = thePlayer.GetComponentsInChildren <attackLink> (); //因为有顺序和统一调用的问题,建议建立之后统一进行销毁,因此建立一个预存。 foreach (attackLink ak in attacklinks) { ak.makeStart(); attackLinkInformation theInformation = new attackLinkInformation(); theInformation.attackLinkName = ak.skillName; theInformation.attackLinkString = ak.attackLinkString.Split(';')[0]; theInformation.thePlayer = thePlayer.GetComponentInChildren <PlayerBasic>(); theInformation.attackLinkInformationText = ak.getInformation(false); //获取简略的信息就足够了 //if (string.IsNullOrEmpty (ak.conNameToEMY) == false) if (!isNullOrEmpty(ak.conNameToEMY)) { //初始化一下效果 System.Type theType = System.Type.GetType(ak.conNameToEMY); //thePlayer.gameObject.AddComponent (theType); //effectBasic theEffect = thePlayer.gameObject.GetComponent (theType) as effectBasic; effectBasic theEffect = thePlayer.gameObject.AddComponent(theType) as effectBasic; buffer.Add(theEffect); if (theEffect.isShowing()) { theEffect.Init(); theInformation.theEffectForEMYName = theEffect.getEffectName(true, true); showString = theEffect.getInformation(false); showExtra = theEffect.getExtraInformation(); if (isNullOrEmpty(showExtra) == false) { showString += "\n" + showExtra; } theInformation.theEffectForEMYInformaion = showString; } } //if (string.IsNullOrEmpty (ak.conNameToSELF) == false) if (!isNullOrEmpty(ak.conNameToSELF)) { //初始化一下效果 System.Type theType = System.Type.GetType(ak.conNameToSELF); //thePlayer.gameObject.AddComponent (theType); //effectBasic theEffect = thePlayer.gameObject.GetComponent (theType) as effectBasic; effectBasic theEffect = thePlayer.gameObject.AddComponent(theType) as effectBasic; buffer.Add(theEffect); if (theEffect.isShowing()) { theEffect.Init(); theInformation.theEffectForSelfName = theEffect.getEffectName(true, true); showString = theEffect.getInformation(false); showExtra = theEffect.getExtraInformation(); if (isNullOrEmpty(showExtra) == false) { showString += "\n" + showExtra; } theInformation.theEffectForSelfInformaion = showString; } } theAttackLinkInformaitons.Add(theInformation); } //清空预存 for (int i = 0; i < buffer.Count; i++) { DestroyImmediate(buffer [i]); } } return(theAttackLinkInformaitons); }