Skip to content
Snippets Groups Projects
Commit c70c18d9 authored by Richard Marcus's avatar Richard Marcus
Browse files

ui scales with screensize, fixed fact insertion bug

parent 954a1cdf
Branches
Tags
No related merge requests found
......@@ -7,7 +7,7 @@
public class FactManager : MonoBehaviour
{
public GameObject SmartMenu;
private Stack<int> NextEmptyStack = new Stack<int>();
private List<int> NextEmpties= new List<int>();
//Variables for LineMode distinction
public bool lineModeIsFirstPointSelected = false;
......@@ -26,7 +26,7 @@ void Start()
//We dont want to have this here anymore...
//CommunicationEvents.RemoveFactEvent.AddListener(DeleteFact);
NextEmptyStack.Push(0);
NextEmpties.Add(0);
}
......@@ -38,7 +38,7 @@ void Update()
PointFact AddPointFact(RaycastHit hit, int id)
{
Facts.Insert(id, new PointFact
{
Id = id,
......@@ -77,7 +77,7 @@ AngleFact AddAngleFact(int pid1, int pid2, int pid3, int id)
public void DeleteFact(Fact fact)
{
if (Facts.Contains(fact)) {
NextEmptyStack.Push(fact.Id);
NextEmpties.Add(fact.Id);
//Facts.RemoveAt(fact.Id);
Facts.Remove(Facts.Find(x => x.Id == fact.Id));
CommunicationEvents.RemoveFactEvent.Invoke(fact);
......@@ -93,10 +93,12 @@ public int GetFirstEmptyID()
return i;
}
return Facts.Length - 1;*/
NextEmpties.Sort();
int id = NextEmptyStack.Pop();
if (NextEmptyStack.Count == 0)
NextEmptyStack.Push(id + 1);
int id = NextEmpties[0];
NextEmpties.RemoveAt(0);
if (NextEmpties.Count == 0)
NextEmpties.Add(id + 1);
Debug.Log("place fact at " + id);
......
......@@ -324,7 +324,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 442, y: 405.5}
m_AnchoredPosition: {x: 442, y: 209}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1001 &154206643
......@@ -1448,7 +1448,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 133, y: 0}
m_AnchoredPosition: {x: 133, y: -110}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1017737550
......@@ -1846,7 +1846,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -349}
m_AnchoredPosition: {x: 0, y: -459}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1351049952
......@@ -2220,10 +2220,10 @@ MonoBehaviour:
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ReferenceResolution: {x: 1920, y: 1080}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment