public void OnFleetShipListEmpty(FleetAccordion accordion) { // remove the fleet accordion from the list _fleetAccordionList.Remove(accordion); // if this was the last fleet available, if (gameObject.transform.childCount == 1 && OnFleetDisplayEmpty != null) { OnFleetDisplayEmpty(); } }
public void OnFleetAccordionSelected(FleetAccordion fleetAccordion) { foreach (FleetAccordion accordion in _fleetAccordionList) { accordion.EnableShipList(accordion == fleetAccordion); } if (OnFleetSelected != null) { OnFleetSelected(fleetAccordion.Fleet); } LayoutRebuilder.ForceRebuildLayoutImmediate(_rectTransform); }
public void RemoveShipInfo(FleetAccordion fleetAccordion, ShipInfo shipInfo) { foreach (FleetAccordion accordion in _fleetAccordionList) { if (accordion == fleetAccordion) { accordion.RemoveShipInfo(shipInfo); break; } } LayoutRebuilder.ForceRebuildLayoutImmediate(_rectTransform); }
public void PopulateFleets(IEnumerable <Fleet> fleets) { _fleetAccordionList = new List <FleetAccordion>(); foreach (Fleet fleet in fleets) { if (fleet.Ships != null && fleet.Ships.Any()) { GameObject fleetAccordionObject = Instantiate(FleetAccordionPrefab); FleetAccordion fleetAccordion = fleetAccordionObject.GetComponent <FleetAccordion>(); _fleetAccordionList.Add(fleetAccordion); fleetAccordion.OnShipDragged += OnFleetShipInfoDragged; fleetAccordion.OnShipDragEnd += OnFleetShipInfoDragEnd; fleetAccordion.OnShipListEmpty += OnFleetShipListEmpty; fleetAccordion.OnFleetSelected += OnFleetAccordionSelected; fleetAccordion.transform.SetParent(transform, false); fleetAccordion.PopulateFleetData(fleet); } } }
public void OnFleetShipInfoDragEnd(PointerEventData eventData, IEnumerable <ShipInfo> shipInfo, FleetAccordion accordion) { if (OnShipInfoDragEnd != null) { OnShipInfoDragEnd(eventData, shipInfo, accordion); } }
public void OnFleetShipInfoDragged(PointerEventData eventData, ShipInfo shipInfo, FleetAccordion accordion) { if (OnShipInfoDragged != null) { OnShipInfoDragged(eventData, shipInfo, accordion); } }