In-game Inventory UI
Created InventoryPanel script which populates a grid with sprites representing the layout of an entity's hull
This commit is contained in:
parent
1debe67958
commit
02e85cb0e2
44 changed files with 2230 additions and 191 deletions
|
|
@ -90,15 +90,31 @@ public class Shape
|
|||
|
||||
private IEnumerable<int2> EnumerateShapeCoordinates()
|
||||
{
|
||||
for(int x = 0; x < Width; x++)
|
||||
for (int y = 0; y < Height; y++)
|
||||
{
|
||||
for (int y = 0; y < Height; y++)
|
||||
for(int x = 0; x < Width; x++)
|
||||
{
|
||||
if(Cells[x,y]) yield return int2(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int2[] _cachedAllShapeCoordinates;
|
||||
|
||||
[IgnoreMember]
|
||||
public int2[] AllCoordinates => _cachedAllShapeCoordinates ?? (_cachedAllShapeCoordinates = EnumerateAllShapeCoordinates().ToArray());
|
||||
|
||||
private IEnumerable<int2> EnumerateAllShapeCoordinates()
|
||||
{
|
||||
for (int y = 0; y < Height; y++)
|
||||
{
|
||||
for(int x = 0; x < Width; x++)
|
||||
{
|
||||
yield return int2(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool this[int2 pos] {
|
||||
get { return pos.x >= 0 && pos.y >= 0 && pos.x < Cells.GetLength(0) && pos.y < Cells.GetLength(1) && Cells[pos.x, pos.y]; }
|
||||
set
|
||||
|
|
@ -306,7 +322,7 @@ public class HardpointData : ITintInspector
|
|||
x => ColorMath.HsvToRgb(float3((float)(int)x/hardpointTypes.Length, 1, 1)));
|
||||
}
|
||||
|
||||
return _tintColors[Type];
|
||||
return _tintColors.ContainsKey(Type) ? _tintColors[Type] : _tintColors[HardpointType.Hull];
|
||||
}
|
||||
}
|
||||
private static Dictionary<HardpointType, float3> _tintColors;
|
||||
|
|
|
|||
Loading…
Reference in a new issue