public override void whenOpenThisPanel() { base.whenOpenThisPanel(); //initAllEquipsOwned(); initEquipsOwnedByPos(EquipPosition.Hand); EDP.whenOpenThisPanel(); AllPosBtns = PosBtnContent.GetComponentsInChildren <Button>(); // List <EquipPosition> list = new List <EquipPosition>() { EquipPosition.Hand , EquipPosition.Finger , EquipPosition.Leg , EquipPosition.Breast , EquipPosition.Head }; for (int i = 0; i < AllPosBtns.Length; i++) { EquipPosition pos = list[i]; AllPosBtns[i].GetComponentInChildren <Text>().text = pos.ToString().ToUpper(); Image img = AllPosBtns[i].transform.GetChild(0).GetComponent <Image>(); img.sprite = SDDataManager.Instance.equipPosIcon(pos); img.SetNativeSize(); AllPosBtns[i].onClick.AddListener(delegate() { this.BtnToChangePos(pos); }); } EDP.gameObject.SetActive(false); }
public void BtnToChangePos(EquipPosition pos) { //Debug.Log(go.name); Debug.Log("切换位置为" + pos.ToString()); CurrentPos = pos; }