public void OnPointerDown(PointerEventData eventData) { string even = eventData.pointerEnter.name.ToString(); switch (even) { case "BuildButton": element = ButtonList[0].GetComponent <ButtonElement>(); element.Showon("BuildButton"); break; case "SoilderButton": element = ButtonList[1].GetComponent <ButtonElement>(); element.Showon("SoilderButton"); break; case "UnitBuild1": UnitElement = UnitBuildList[0].GetComponent <UnitElement>(); UnitElement.InBuldUnitClick(1); break; case "UnitBuild2": UnitElement = UnitBuildList[1].GetComponent <UnitElement>(); UnitElement.InBuldUnitClick(2); break; case "UnitBuild3": UnitElement = UnitBuildList[2].GetComponent <UnitElement>(); UnitElement.InBuldUnitClick(3); break; case "UnitBuild4": UnitElement = UnitBuildList[3].GetComponent <UnitElement>(); UnitElement.InBuldUnitClick(4); break; case "UnitBuild5": UnitElement = UnitBuildList[4].GetComponent <UnitElement>(); UnitElement.InBuldUnitClick(5); break; case "UnitBuild6": UnitElement = UnitBuildList[5].GetComponent <UnitElement>(); UnitElement.InBuldUnitClick(6); break; case "UnitBuild7": UnitElement = UnitBuildList[6].GetComponent <UnitElement>(); UnitElement.InBuldUnitClick(7); break; case "UnitBuild8": UnitElement = UnitBuildList[7].GetComponent <UnitElement>(); UnitElement.InBuldUnitClick(8); break; case "UnitSoilder1": UnitElement = UnitSoilderList[0].GetComponent <UnitElement>(); UnitElement.InSoilderUnitClick(1); break; case "UnitSoilder2": UnitElement = UnitSoilderList[1].GetComponent <UnitElement>(); UnitElement.InSoilderUnitClick(2); break; case "UnitSoilder3": UnitElement = UnitSoilderList[2].GetComponent <UnitElement>(); UnitElement.InSoilderUnitClick(3); break; case "UnitSoilder4": UnitElement = UnitSoilderList[3].GetComponent <UnitElement>(); UnitElement.InSoilderUnitClick(4); break; case "UnitSoilder5": UnitElement = UnitSoilderList[4].GetComponent <UnitElement>(); UnitElement.InSoilderUnitClick(5); break; case "UnitSoilder6": UnitElement = UnitSoilderList[5].GetComponent <UnitElement>(); UnitElement.InSoilderUnitClick(6); break; case "UnitSoilder7": UnitElement = UnitSoilderList[6].GetComponent <UnitElement>(); UnitElement.InSoilderUnitClick(7); break; case "UnitSoilder8": UnitElement = UnitSoilderList[7].GetComponent <UnitElement>(); UnitElement.InSoilderUnitClick(8); break; } }