Added ChildModelSelector UI
This commit is contained in:
@@ -16,7 +16,8 @@ MonoBehaviour:
|
||||
keys:
|
||||
- Meta.XR.SDK.UsageSettings.UsesProjectSetupTool
|
||||
- Meta.XR.SDK.UsageSettings.UsesBuildingBlocks
|
||||
values: 0101
|
||||
- Meta.XR.SDK.UsageSettings.UsesXRSimulator
|
||||
values: 010101
|
||||
intProperties:
|
||||
keys: []
|
||||
values:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
// Data definition of BaseModel
|
||||
public class BaseModel : Model
|
||||
{
|
||||
private List<Port> ports;
|
||||
public BaseModel(string nameHuman, string nameId, Mesh mesh, Material material, Vector3 offset,
|
||||
Quaternion rotation, Vector3 scale, List<Port> ports)
|
||||
: base(nameHuman, nameId, mesh, material, offset, rotation, scale, ports)
|
||||
{
|
||||
|
||||
this.ports = ports;
|
||||
}
|
||||
public BaseModel(string nameHuman, string nameId, Mesh mesh, Material material, List<Port> ports)
|
||||
: base(nameHuman, nameId, mesh, material, ports)
|
||||
@@ -16,4 +18,10 @@ public class BaseModel : Model
|
||||
|
||||
}
|
||||
|
||||
public List<Port> GetPorts()
|
||||
{
|
||||
return ports;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ public class Definitions
|
||||
|
||||
// ERLCAR PORTS
|
||||
// TODO: rename all important ones
|
||||
// ERLCAR PORTS
|
||||
public const string PORT_ERLBACH_0 = "portErlbach0";
|
||||
public const string PORT_ERLBACH_1 = "portErlbach1";
|
||||
public const string PORT_ERLBACH_2 = "portErlbach2";
|
||||
@@ -89,24 +90,24 @@ public class Definitions
|
||||
public const string PORT_ERLBACH_71 = "portErlbach71";
|
||||
public const string PORT_ERLBACH_72 = "portErlbach72";
|
||||
public const string PORT_ERLBACH_73 = "portErlbach73";
|
||||
public const string PORT_ERLBACH_74 = "portErlbach74";
|
||||
public const string PORT_ERLBACH_75 = "portErlbach75";
|
||||
public const string PORT_ERLBACH_76 = "portErlbach76";
|
||||
public const string PORT_ERLBACH_BasePlate= "portErlbach74";
|
||||
public const string PORT_ERLBACH_FrontAxe = "portErlbach75";
|
||||
public const string PORT_ERLBACH_BatteriePack = "batteriePack";
|
||||
public const string PORT_ERLBACH_77 = "portErlbach77";
|
||||
public const string PORT_ERLBACH_78 = "portErlbach78";
|
||||
public const string PORT_ERLBACH_79 = "portErlbach79";
|
||||
public const string PORT_ERLBACH_80 = "portErlbach80";
|
||||
public const string PORT_ERLBACH_81 = "portErlbach81";
|
||||
public const string PORT_ERLBACH_82 = "portErlbach82";
|
||||
public const string PORT_ERLBACH_83 = "portErlbach83";
|
||||
public const string PORT_ERLBACH_84 = "portErlbach84";
|
||||
public const string PORT_ERLBACH_85 = "portErlbach85";
|
||||
public const string PORT_ERLBACH_86 = "portErlbach86";
|
||||
public const string PORT_ERLBACH_87 = "portErlbach87";
|
||||
public const string PORT_ERLBACH_88 = "portErlbach88";
|
||||
public const string PORT_ERLBACH_89 = "portErlbach89";
|
||||
public const string PORT_ERLBACH_90 = "portErlbach90";
|
||||
public const string PORT_ERLBACH_91 = "portErlbach91";
|
||||
public const string PORT_ERLBACH_92 = "portErlbach92";
|
||||
public const string PORT_ERLBACH_93 = "portErlbach93";
|
||||
public const string PORT_ERLBACH_Wheel = "wheel";
|
||||
public const string PORT_ERLBACH_Body = "body";
|
||||
public const string PORT_ERLBACH_Bumper = "portErlbach85";
|
||||
public const string PORT_ERLBACH_FrontBumper = "portErlbach86";
|
||||
public const string PORT_ERLBACH_Number = "portErlbach87";
|
||||
public const string PORT_ERLBACH_LicensePlate = "portErlbach88";
|
||||
public const string PORT_ERLBACH_LicensePlateContent = "portErlbach89";
|
||||
public const string PORT_ERLBACH_Grill = "portErlbach90";
|
||||
public const string PORT_ERLBACH_Refelctor_H = "portErlbach91";
|
||||
public const string PORT_ERLBACH_Headlight_V_Cover = "portErlbach92";
|
||||
public const string PORT_ERLBACH_Headlight_V = "portErlbach93";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -112,26 +112,26 @@ public class ModelList
|
||||
new Port(Definitions.PORT_ERLBACH_71, new Vector3(0f, 0f, 0f), "idErlbachPart71"),
|
||||
new Port(Definitions.PORT_ERLBACH_72, new Vector3(0f, 0f, 0f), "idErlbachPart72"),
|
||||
new Port(Definitions.PORT_ERLBACH_73, new Vector3(0f, 0f, 0f), "idErlbachPart73"),
|
||||
new Port(Definitions.PORT_ERLBACH_74, new Vector3(0f, 0f, 0f), "idErlbachPart74"),
|
||||
new Port(Definitions.PORT_ERLBACH_75, new Vector3(0f, 0f, 0f), "idErlbachPart75"),
|
||||
new Port(Definitions.PORT_ERLBACH_76, new Vector3(0f, 0f, 0f), "idErlbachPart76"),
|
||||
new Port(Definitions.PORT_ERLBACH_BasePlate, new Vector3(0f, 0f, 0f), "idErlbachPart74"),
|
||||
new Port(Definitions.PORT_ERLBACH_FrontAxe, new Vector3(0f, 0f, 0f), "idErlbachPart75"),
|
||||
new Port(Definitions.PORT_ERLBACH_BatteriePack, new Vector3(0f, 0f, 0f), "idErlbachPart76"),
|
||||
new Port(Definitions.PORT_ERLBACH_77, new Vector3(0f, 0f, 0f), "idErlbachPart77"),
|
||||
new Port(Definitions.PORT_ERLBACH_78, new Vector3(0f, 0f, 0f), "idErlbachPart78"),
|
||||
new Port(Definitions.PORT_ERLBACH_79, new Vector3(0f, 0f, 0f), "idErlbachPart79"),
|
||||
new Port(Definitions.PORT_ERLBACH_80, new Vector3(0f, 0f, 0f), "idErlbachPart80"),
|
||||
new Port(Definitions.PORT_ERLBACH_81, new Vector3(0f, 0f, 0f), "idErlbachPart81"),
|
||||
new Port(Definitions.PORT_ERLBACH_82, new Vector3(0f, 0f, 0f), "idErlbachPart82"),
|
||||
new Port(Definitions.PORT_ERLBACH_83, new Vector3(0f, 0f, 0f), "idErlbachPart83"),
|
||||
new Port(Definitions.PORT_ERLBACH_84, new Vector3(0f, 0f, 0f), "idErlbachPart84"),
|
||||
new Port(Definitions.PORT_ERLBACH_85, new Vector3(0f, 0f, 0f), "idErlbachPart85"),
|
||||
new Port(Definitions.PORT_ERLBACH_86, new Vector3(0f, 0f, 0f), "idErlbachPart86"),
|
||||
new Port(Definitions.PORT_ERLBACH_87, new Vector3(0f, 0f, 0f), "idErlbachPart87"),
|
||||
new Port(Definitions.PORT_ERLBACH_88, new Vector3(0f, 0f, 0f), "idErlbachPart88"),
|
||||
new Port(Definitions.PORT_ERLBACH_89, new Vector3(0f, 0f, 0f), "idErlbachPart89"),
|
||||
new Port(Definitions.PORT_ERLBACH_90, new Vector3(0f, 0f, 0f), "idErlbachPart90"),
|
||||
new Port(Definitions.PORT_ERLBACH_91, new Vector3(0f, 0f, 0f), "idErlbachPart91"),
|
||||
new Port(Definitions.PORT_ERLBACH_92, new Vector3(0f, 0f, 0f), "idErlbachPart92"),
|
||||
new Port(Definitions.PORT_ERLBACH_93, new Vector3(0f, 0f, 0f), "idErlbachPart93")
|
||||
new Port(Definitions.PORT_ERLBACH_Wheel, new Vector3(0f, 0f, 0f), "idErlbachWheel_LH"),
|
||||
new Port(Definitions.PORT_ERLBACH_Wheel, new Vector3(0f, 0f, 0f), "idErlbachWheel_LV"),
|
||||
new Port(Definitions.PORT_ERLBACH_Wheel, new Vector3(0f, 0f, 0f), "idErlbachWheel_RH"),
|
||||
new Port(Definitions.PORT_ERLBACH_Wheel, new Vector3(0f, 0f, 0f), "idErlbachWheel_RV"),
|
||||
new Port(Definitions.PORT_ERLBACH_Body, new Vector3(0f, 0f, 0f), "idErlbachPart84"),
|
||||
new Port(Definitions.PORT_ERLBACH_Bumper, new Vector3(0f, 0f, 0f), "idErlbachPart85"),
|
||||
new Port(Definitions.PORT_ERLBACH_FrontBumper, new Vector3(0f, 0f, 0f), "idErlbachPart86"),
|
||||
new Port(Definitions.PORT_ERLBACH_Number, new Vector3(0f, 0f, 0f), "idErlbachPart87"),
|
||||
new Port(Definitions.PORT_ERLBACH_LicensePlate, new Vector3(0f, 0f, 0f), "idErlbachPart88"),
|
||||
new Port(Definitions.PORT_ERLBACH_LicensePlateContent, new Vector3(0f, 0f, 0f), "idErlbachPart89"),
|
||||
new Port(Definitions.PORT_ERLBACH_Grill, new Vector3(0f, 0f, 0f), "idErlbachPart90"),
|
||||
new Port(Definitions.PORT_ERLBACH_Refelctor_H, new Vector3(0f, 0f, 0f), "idErlbachPart91"),
|
||||
new Port(Definitions.PORT_ERLBACH_Headlight_V_Cover, new Vector3(0f, 0f, 0f), "idErlbachPart92"),
|
||||
new Port(Definitions.PORT_ERLBACH_Headlight_V, new Vector3(0f, 0f, 0f), "idErlbachPart93")
|
||||
}
|
||||
)
|
||||
};
|
||||
@@ -328,26 +328,26 @@ public class ModelList
|
||||
Definitions.PORT_ERLBACH_71,
|
||||
Definitions.PORT_ERLBACH_72,
|
||||
Definitions.PORT_ERLBACH_73,
|
||||
Definitions.PORT_ERLBACH_74,
|
||||
Definitions.PORT_ERLBACH_75,
|
||||
Definitions.PORT_ERLBACH_76,
|
||||
Definitions.PORT_ERLBACH_BasePlate,
|
||||
Definitions.PORT_ERLBACH_FrontAxe,
|
||||
Definitions.PORT_ERLBACH_BatteriePack,
|
||||
Definitions.PORT_ERLBACH_77,
|
||||
Definitions.PORT_ERLBACH_78,
|
||||
Definitions.PORT_ERLBACH_79,
|
||||
Definitions.PORT_ERLBACH_80,
|
||||
Definitions.PORT_ERLBACH_81,
|
||||
Definitions.PORT_ERLBACH_82,
|
||||
Definitions.PORT_ERLBACH_83,
|
||||
Definitions.PORT_ERLBACH_84,
|
||||
Definitions.PORT_ERLBACH_85,
|
||||
Definitions.PORT_ERLBACH_86,
|
||||
Definitions.PORT_ERLBACH_87,
|
||||
Definitions.PORT_ERLBACH_88,
|
||||
Definitions.PORT_ERLBACH_89,
|
||||
Definitions.PORT_ERLBACH_90,
|
||||
Definitions.PORT_ERLBACH_91,
|
||||
Definitions.PORT_ERLBACH_92,
|
||||
Definitions.PORT_ERLBACH_93,
|
||||
Definitions.PORT_ERLBACH_Wheel,
|
||||
Definitions.PORT_ERLBACH_Wheel,
|
||||
Definitions.PORT_ERLBACH_Wheel,
|
||||
Definitions.PORT_ERLBACH_Wheel,
|
||||
Definitions.PORT_ERLBACH_Body,
|
||||
Definitions.PORT_ERLBACH_Bumper,
|
||||
Definitions.PORT_ERLBACH_FrontBumper,
|
||||
Definitions.PORT_ERLBACH_Number,
|
||||
Definitions.PORT_ERLBACH_LicensePlate,
|
||||
Definitions.PORT_ERLBACH_LicensePlateContent,
|
||||
Definitions.PORT_ERLBACH_Grill,
|
||||
Definitions.PORT_ERLBACH_Refelctor_H,
|
||||
Definitions.PORT_ERLBACH_Headlight_V_Cover,
|
||||
Definitions.PORT_ERLBACH_Headlight_V,
|
||||
},
|
||||
new string[94] //human name
|
||||
{
|
||||
@@ -425,26 +425,26 @@ public class ModelList
|
||||
"Erlbach Part 71",
|
||||
"Erlbach Part 72",
|
||||
"Erlbach Part 73",
|
||||
"Erlbach Part 74",
|
||||
"Erlbach Part 75",
|
||||
"Erlbach Part 76",
|
||||
"Erlbach Part BasePlate",
|
||||
"Erlbach Part FrontAxe",
|
||||
"Erlbach Part BatteriePack",
|
||||
"Erlbach Part 77",
|
||||
"Erlbach Part 78",
|
||||
"Erlbach Part 79",
|
||||
"Erlbach Part 80",
|
||||
"Erlbach Part 81",
|
||||
"Erlbach Part 82",
|
||||
"Erlbach Part 83",
|
||||
"Erlbach Part 84",
|
||||
"Erlbach Part 85",
|
||||
"Erlbach Part 86",
|
||||
"Erlbach Part 87",
|
||||
"Erlbach Part 88",
|
||||
"Erlbach Part 89",
|
||||
"Erlbach Part 90",
|
||||
"Erlbach Part 91",
|
||||
"Erlbach Part 92",
|
||||
"Erlbach Part 93",
|
||||
"Erlbach Part Wheel LH",
|
||||
"Erlbach Part Wheel LV",
|
||||
"Erlbach Part Wheel RH",
|
||||
"Erlbach Part Wheel RV",
|
||||
"Erlbach Part Body",
|
||||
"Erlbach Part Bumper",
|
||||
"Erlbach Part FrontBumper",
|
||||
"Erlbach Part Number",
|
||||
"Erlbach Part LicensePlate",
|
||||
"Erlbach Part LicensePlateContent",
|
||||
"Erlbach Part Grill",
|
||||
"Erlbach Part Refelctor_H",
|
||||
"Erlbach Part Headlight_V_Cover",
|
||||
"Erlbach Part Headlight_V",
|
||||
|
||||
},
|
||||
new string[94] //id
|
||||
@@ -529,10 +529,10 @@ public class ModelList
|
||||
"idErlbachPart77",
|
||||
"idErlbachPart78",
|
||||
"idErlbachPart79",
|
||||
"idErlbachPart80",
|
||||
"idErlbachPart81",
|
||||
"idErlbachPart82",
|
||||
"idErlbachPart83",
|
||||
"idErlbachWheel_LH",
|
||||
"idErlbachWheel_LV",
|
||||
"idErlbachWheel_RH",
|
||||
"idErlbachWheel_RV",
|
||||
"idErlbachPart84",
|
||||
"idErlbachPart85",
|
||||
"idErlbachPart86",
|
||||
|
||||
@@ -8,7 +8,8 @@ public class ModelManager : MonoBehaviour
|
||||
|
||||
private List<BaseModel> _baseModelList; //available BaseModels
|
||||
|
||||
public GameObject baseModel; //current baseModel
|
||||
public GameObject baseModel;
|
||||
public static BaseModel baseModelType;//current baseModel
|
||||
public BaseModelSelector baseModelSelector;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
@@ -51,7 +52,12 @@ public class ModelManager : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
_childModelDict[model.NameId] = model;
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(model.Port))
|
||||
{
|
||||
_portDict.Add("null", new HashSet<ChildModel>());
|
||||
return;
|
||||
}
|
||||
//portDict
|
||||
if (!_portDict.ContainsKey(model.Port))
|
||||
{
|
||||
@@ -110,8 +116,9 @@ public class ModelManager : MonoBehaviour
|
||||
this.baseModel.transform.position = new Vector3(0, 0, 1);
|
||||
this.baseModel.transform.rotation = Quaternion.Euler(0, 90, 0);
|
||||
this.baseModel.SetActive(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
baseModelType = baseModel;
|
||||
this.baseModel.GetComponent<BaseModelBehaviour>().BaseModel = baseModel;
|
||||
this.baseModel.SetActive(true);
|
||||
Debug.Log($"Model {baseModel.NameHuman} lock and loaded.");
|
||||
|
||||
@@ -8,8 +8,13 @@ public class BaseModelSelector : MonoBehaviour
|
||||
private Canvas _canvas;
|
||||
private GameObject _buttonPrefab;
|
||||
private Button[] _modelButtons;
|
||||
public VerticalColumn1 verticalColumn1;
|
||||
|
||||
|
||||
public ModelManager modelManager; // <-- to be put in inspector
|
||||
|
||||
|
||||
public GameObject ContentUi;
|
||||
|
||||
public ReturnButtonBehaviour returnButton;
|
||||
|
||||
@@ -30,7 +35,7 @@ public class BaseModelSelector : MonoBehaviour
|
||||
{
|
||||
GameObject eventSystemGo = new GameObject("EventSystem");
|
||||
eventSystemGo.AddComponent<EventSystem>();
|
||||
//var inputModule = eventSystemGO.AddComponent<UnityEngine.InputSystem.UI.InputSystemUIInputModule>(); //Put in for keyboard input. Must be commented out on quest
|
||||
//var inputModule = eventSystemGo.AddComponent<UnityEngine.InputSystem.UI.InputSystemUIInputModule>(); //Put in for keyboard input. Must be commented out on quest
|
||||
eventSystemGo.AddComponent<OVRInputModule>();
|
||||
|
||||
}
|
||||
@@ -95,13 +100,19 @@ public class BaseModelSelector : MonoBehaviour
|
||||
public void OnModelButtonClicked(BaseModel model)
|
||||
{
|
||||
Debug.Log($"Selected model: {model.NameHuman}");
|
||||
|
||||
|
||||
if (modelManager == null)
|
||||
{
|
||||
Debug.LogError("ModelManager is not assigned!");
|
||||
return;
|
||||
}
|
||||
modelManager.LoadSelectedModel(model);
|
||||
if (verticalColumn1 == null)
|
||||
{
|
||||
Debug.LogError("VerticalColumn1 is null!");
|
||||
return;
|
||||
}
|
||||
verticalColumn1.AssignButtons();
|
||||
|
||||
if (returnButton == null)
|
||||
{
|
||||
@@ -116,6 +127,16 @@ public class BaseModelSelector : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
gameObject.SetActive(false);
|
||||
|
||||
if (ContentUi == null)
|
||||
{
|
||||
Debug.LogError("ContentUi is null!");
|
||||
return;
|
||||
}
|
||||
ContentUi.SetActive(true);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static GameObject SetupPrefab(BaseModel model)
|
||||
|
||||
66
vr-configurator/Assets/Scripts/UI/ChildModelSelector.cs
Normal file
66
vr-configurator/Assets/Scripts/UI/ChildModelSelector.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Mime;
|
||||
using Meta.XR.ImmersiveDebugger.UserInterface.Generic;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using Unity.XR.CoreUtils;
|
||||
using UnityEngine.UI;
|
||||
using Toggle = UnityEngine.UI.Toggle;
|
||||
|
||||
public class ChildModelSelector : MonoBehaviour
|
||||
{
|
||||
public List<Transform> horizontalGroups;
|
||||
private string _port;
|
||||
public GameObject ports;
|
||||
public void setPort(string port)
|
||||
{
|
||||
_port = port;
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
|
||||
AssignButtons();
|
||||
}
|
||||
public void AssignButtons()
|
||||
{
|
||||
int i1 = 0;
|
||||
var childModels = ModelList.ChildModels.Where(m => m.Port == _port).ToList();
|
||||
Debug.Log("ChildModels: " + childModels.Count);
|
||||
int modelIndex = 0;
|
||||
foreach (Transform group in horizontalGroups)
|
||||
{
|
||||
Toggle[] toggles = group.GetComponentsInChildren<Toggle>(true);
|
||||
for (i1 = 0; i1 < toggles.Length; i1++)
|
||||
{
|
||||
if (modelIndex < childModels.Count)
|
||||
{
|
||||
var model = childModels[modelIndex];
|
||||
toggles[i1].gameObject.SetActive(true);
|
||||
TextMeshProUGUI[] label = toggles[i1].GetComponentsInChildren<TextMeshProUGUI>(true);
|
||||
if (label.Length > 0)
|
||||
{
|
||||
label[0].text = model.NameHuman;
|
||||
label[1].text = "Zweiter Text";
|
||||
}
|
||||
|
||||
modelIndex++;
|
||||
Debug.Log(i1);
|
||||
}
|
||||
else
|
||||
{
|
||||
toggles[i1].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (modelIndex > childModels.Count)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de35b02902605394a94770c562a037c9
|
||||
37
vr-configurator/Assets/Scripts/UI/PortAssigner.cs
Normal file
37
vr-configurator/Assets/Scripts/UI/PortAssigner.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PortAssigner : MonoBehaviour
|
||||
{
|
||||
public ChildModelSelector options;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
Toggle toggle = GetComponent<Toggle>();
|
||||
if (toggle != null)
|
||||
{
|
||||
toggle.onValueChanged.AddListener(OnToggleValueChanged);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Toggle component not found on GameObject.");
|
||||
}
|
||||
}
|
||||
private void OnToggleValueChanged(bool isOn)
|
||||
{
|
||||
var textmesh = GetComponentInChildren<TextMeshProUGUI>(true);
|
||||
if (textmesh != null)
|
||||
{
|
||||
string port = textmesh.text;
|
||||
options.setPort(port);
|
||||
options.AssignButtons();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("TextMeshProUGUI component not found in children.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
2
vr-configurator/Assets/Scripts/UI/PortAssigner.cs.meta
Normal file
2
vr-configurator/Assets/Scripts/UI/PortAssigner.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c488bedd8c9cbf4448fef2edf45f0788
|
||||
@@ -5,6 +5,7 @@ public class ReturnButtonBehaviour : MonoBehaviour
|
||||
{
|
||||
public BaseModelSelector bms;
|
||||
public ModelManager mm;
|
||||
public GameObject ContentUi;
|
||||
|
||||
void Start()
|
||||
{
|
||||
@@ -17,6 +18,7 @@ public class ReturnButtonBehaviour : MonoBehaviour
|
||||
Debug.Log("Return to Menu clicked");
|
||||
mm.OpenSelector();
|
||||
gameObject.SetActive(false);
|
||||
ContentUi.SetActive(false);
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
|
||||
49
vr-configurator/Assets/Scripts/UI/VerticalColumn1.cs
Normal file
49
vr-configurator/Assets/Scripts/UI/VerticalColumn1.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using Unity.XR.CoreUtils;
|
||||
|
||||
public class VerticalColumn1 : MonoBehaviour
|
||||
{
|
||||
public BaseModel baseModel;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
AssignButtons();
|
||||
}
|
||||
public void AssignButtons()
|
||||
{
|
||||
baseModel = ModelManager.baseModelType;
|
||||
List<Port> ports = baseModel.GetPorts();
|
||||
Toggle[] toggles = GetComponentsInChildren<Toggle>(true);
|
||||
List<String> portNames = new List<string>();
|
||||
int i1 = 0;
|
||||
foreach (var port in ports)
|
||||
{
|
||||
if (i1 < toggles.Length && Regex.IsMatch(port.port, @"^(?!portErlbach\d{1,2}$).+") && !portNames.Contains(port.port))
|
||||
{
|
||||
Debug.LogWarning(port.port);
|
||||
toggles[i1].gameObject.SetActive(true);
|
||||
TextMeshProUGUI label = toggles[i1].GetComponentInChildren<TextMeshProUGUI>(true);
|
||||
label.text = port.port;
|
||||
i1++;
|
||||
portNames.Add(port.port);
|
||||
}
|
||||
}
|
||||
for (int j = i1; j < toggles.Length; j++)
|
||||
{
|
||||
toggles[j].gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7937acbab703c0e458da8577457ccb35
|
||||
Reference in New Issue
Block a user