/// <summary> /// Use this to create the UIFastList. /// Do NOT use AddUIComponent. /// I had to do that way because MonoBehaviors classes cannot be generic /// </summary> /// <typeparam name="T">The type of the row UI component</typeparam> /// <param name="parent"></param> /// <returns></returns> public static UIFastList Create <T>(UIComponent parent) where T : UIPanel, IUIFastListRow { UIFastList list = parent.AddUIComponent <UIFastList>(); list.m_rowType = typeof(T); return(list); }
public override void Start() { base.Start(); try { name = "CargoSpyPanel"; backgroundSprite = "UnlockingPanel2"; // or "MenuPanel2" isVisible = false; canFocus = true; isInteractive = true; width = 750f; height = 650f; relativePosition = new Vector3(Mathf.Floor((GetUIView().fixedWidth - width) / 2f), Mathf.Floor((GetUIView().fixedHeight - height) / 2f)); tp_dragHandle = CreateDragHandle(this); tp_title = CreateTitle(this, "Cargo Spy"); tp_close = CreateCloseButton(this); tp_dropCargo = CreateCargoDropDown(this); CreateTableHeader(this); tp_truckList = UIFastList.Create <CargoSpyTruckListItem>(this); tp_truckList.width = 700f; tp_truckList.rowHeight = 25f; tp_truckList.relativePosition = new Vector3(26f, 125f); tp_truckList.autoHideScrollbar = true; CargoSpyThreading.UpdateTruckTable(); RefreshTruckContainer(); } catch (Exception e) { Debug.Log("CargoSpy - Exception during CargoSpyPanel.Start():"); Debug.LogException(e); //Destroy(); } }