Trade Menu Spreadsheet
Implemented generic spreadsheet component for the Trade menu with sortable and resizable data columns
This commit is contained in:
parent
e3de7158fd
commit
8036585ebc
46 changed files with 21429 additions and 17151 deletions
57
Assets/Scripts/TradeMenu.cs
Normal file
57
Assets/Scripts/TradeMenu.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class TradeMenu : MonoBehaviour
|
||||
{
|
||||
public ActionGameManager GameManager;
|
||||
public DropdownMenu Dropdown;
|
||||
public Button NewFilterButton;
|
||||
public SizeFilter MinimumSizeFilter;
|
||||
public SizeFilter MaximumSizeFilter;
|
||||
public RectTransform ItemList;
|
||||
public PropertiesPanel Properties;
|
||||
public Spreadsheet Spreadsheet;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
Properties.Context = GameManager.ItemManager;
|
||||
Spreadsheet.ShowData(
|
||||
new[] {"Name", "Mass"},
|
||||
new[] {2, 1},
|
||||
GameManager.ItemManager.ItemData.GetAll<ItemData>().Select(i => new SpreadsheetEntryRow
|
||||
{
|
||||
Columns = new[]
|
||||
{
|
||||
new SpreadsheetEntryColumn
|
||||
{
|
||||
Output = () => i.Name,
|
||||
SortKey = i.Name
|
||||
},
|
||||
new SpreadsheetEntryColumn
|
||||
{
|
||||
Output = () => i.Mass.SignificantDigits(3),
|
||||
SortKey = i.Mass
|
||||
},
|
||||
},
|
||||
OnClick = () =>
|
||||
{
|
||||
Properties.Clear();
|
||||
Properties.AddItemDataProperties(i);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue