//因为背包的东西可能会经常换,所以暂时还真需要适时刷新 //等待后面的事件机制完全了或许就好了 void Start() { //if (Started || !systemValues.thePlayer) // return; theEquipPackage = systemValues.thePlayer.GetComponent <equipPackage> (); theTextForStatic = theEquipMinusShowText; staticHeadButton = theHeadButton; staticBodyButton = theBodyButton; staticWeaponButton = theWeaponButton; staticShoeButton = theShowButton; staticExtraButton1 = theExtraButton1; staticExtraButton2 = theExtraButton2; staticgodButton = godButton; staticHeadButtonText = theHeadButton.GetComponentInChildren <Text>(); staticBodyButtonText = staticBodyButton.GetComponentInChildren <Text>(); staticWeaponButtonText = staticWeaponButton.GetComponentInChildren <Text>(); staticShoeButtonText = staticShoeButton.GetComponentInChildren <Text>(); staticExtraButton1Text = staticExtraButton1.GetComponentInChildren <Text>(); staticExtraButton2Text = staticExtraButton2.GetComponentInChildren <Text>(); makeFlash(); //Started = true; }
void makeEquipShowingButton(equipShowingButton theButtonEQ, equipBasics theEquip) { //equipShowingButton theButtonEQ = theButton.GetComponent <equipShowingButton> (); theButtonEQ.makeStart(); theButtonEQ.theEquip = theEquip; if (theButtonEQ is equipShopSelectButton) { (theButtonEQ as equipShopSelectButton).theValueText.text = theEquip.theSoulForThisEquip.ToString(); } theButtonEQ.theEquipImage.sprite = systemValues.makeLoadSprite("equipPicture/" + theEquip.theEquipType + "/" + theEquip.equipPictureName); }
//------------------------------------------------------------------------------------------------------------------- private void makeShow(List <equipBasics> eqs) { //因为所有的显示都是针对本机角色的 if (!systemValues.thePlayer) { return; } //前期清理工作 equipShowingButton [] es = theViewFather.GetComponentsInChildren <equipShowingButton>(); //直接用lambda表达式查询吧还是 systemValues.makeFather(eqs.Count, theViewFather); if (eqs.Count > es.Length) { int i = 0; for (; i < es.Length; i++) { makeEquipShowingButton(es[i], eqs[i]); } for (; i < eqs.Count; i++) { equipShowingButton theButton = GameObject.Instantiate <GameObject> (theShowingButtonProfab).GetComponent <equipShowingButton>(); theButton.transform.SetParent(theViewFather.transform); makeEquipShowingButton(theButton, eqs[i]); //因为有grid控件,所以这些都没有必要使用了 } //print ("重建次数:"+( i- es.Length)); } else { //print ("deletes343434"); int i = 0; for (; i < eqs.Count; i++) { makeEquipShowingButton(es[i], eqs[i]); } for (; i >= 0 && i < es.Length; i++) { Destroy(es [i].gameObject); } } }