public void ShowCampaignFacilityIcon() { this.campaignFacilityIconList = new List <CampaignFacilityIcon>(); CampaignFacilityIcon campaignFacilityIcon = CampaignFacilityIcon.Create(GameWebAPI.RespDataCP_Campaign.CampaignType.MedalTakeOverUp, base.gameObject); if (campaignFacilityIcon != null) { this.campaignFacilityIconList.Add(campaignFacilityIcon); } }
public static CampaignFacilityIcon Create(GameWebAPI.RespDataCP_Campaign.CampaignType cpmType, GameObject parent) { FarmRoot instance = FarmRoot.Instance; if (null == instance) { return(null); } if (DataMng.Instance().GetCampaignInfo(GameWebAPI.RespDataCP_Campaign.CampaignType.MedalTakeOverUp) == null) { return(null); } if (cpmType != GameWebAPI.RespDataCP_Campaign.CampaignType.MedalTakeOverUp) { return(null); } int num = 5; int facilityCount = instance.Scenery.GetFacilityCount(num); if (facilityCount <= 0) { return(null); } GameObject gameObject = GUIManager.LoadCommonGUI("Farm/CampaignBalloon", parent); CampaignFacilityIcon component = gameObject.GetComponent <CampaignFacilityIcon>(); component.setLocalizedPopTxtImg(); gameObject.SetActive(false); List <FarmObject> farmObjects = instance.Scenery.farmObjects; for (int i = 0; i < farmObjects.Count; i++) { if (farmObjects[i].facilityID == num) { gameObject.SetActive(true); component.farmObject = farmObjects[i]; break; } } return(component); }