예제 #1
0
 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();
     }
 }
예제 #2
0
 public void OnFleetAccordionSelected(FleetAccordion fleetAccordion)
 {
     foreach (FleetAccordion accordion in _fleetAccordionList)
     {
         accordion.EnableShipList(accordion == fleetAccordion);
     }
     if (OnFleetSelected != null)
     {
         OnFleetSelected(fleetAccordion.Fleet);
     }
     LayoutRebuilder.ForceRebuildLayoutImmediate(_rectTransform);
 }
예제 #3
0
 public void RemoveShipInfo(FleetAccordion fleetAccordion, ShipInfo shipInfo)
 {
     foreach (FleetAccordion accordion in _fleetAccordionList)
     {
         if (accordion == fleetAccordion)
         {
             accordion.RemoveShipInfo(shipInfo);
             break;
         }
     }
     LayoutRebuilder.ForceRebuildLayoutImmediate(_rectTransform);
 }
예제 #4
0
 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);
         }
     }
 }
예제 #5
0
 public void OnFleetShipInfoDragEnd(PointerEventData eventData, IEnumerable <ShipInfo> shipInfo, FleetAccordion accordion)
 {
     if (OnShipInfoDragEnd != null)
     {
         OnShipInfoDragEnd(eventData, shipInfo, accordion);
     }
 }
예제 #6
0
 public void OnFleetShipInfoDragged(PointerEventData eventData, ShipInfo shipInfo, FleetAccordion accordion)
 {
     if (OnShipInfoDragged != null)
     {
         OnShipInfoDragged(eventData, shipInfo, accordion);
     }
 }