Add colored Button, remove unused stuff, add broken AR button
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,30 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class ARToggleButton: MonoBehaviour
|
||||
{
|
||||
public OVRPassthroughLayer passthroughLayer;
|
||||
private bool _isPassthroughOn = true;
|
||||
private bool pressed = false; //efix variable da button 2 mal pressed wird ??
|
||||
|
||||
void Start()
|
||||
{
|
||||
//gameObject.GetComponent<Button>().onClick.AddListener(TogglePassthrough);
|
||||
passthroughLayer.enabled = true;
|
||||
}
|
||||
|
||||
public void TogglePassthrough()
|
||||
{
|
||||
_isPassthroughOn = !_isPassthroughOn;
|
||||
passthroughLayer.enabled = _isPassthroughOn;
|
||||
Debug.Log("Passthrough is now: " + _isPassthroughOn);
|
||||
Debug.Log($"TogglePassthrough pr {pressed}");
|
||||
if (!pressed)
|
||||
{
|
||||
pressed = true;
|
||||
return;
|
||||
}
|
||||
passthroughLayer.enabled = !passthroughLayer.enabled;
|
||||
Debug.Log("Passthrough is now: " + passthroughLayer.enabled);
|
||||
pressed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ public class BaseModelSelector : MonoBehaviour
|
||||
public ModelManager modelManager;
|
||||
|
||||
public GameObject unexplodeButton;
|
||||
public GameObject contentUi;
|
||||
public GameObject uiButtonsCanvas;
|
||||
public GameObject cmsCanvas;
|
||||
|
||||
@@ -71,13 +70,6 @@ public class BaseModelSelector : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
gameObject.SetActive(false);
|
||||
|
||||
if (contentUi == null)
|
||||
{
|
||||
Debug.LogError("ContentUi is null!");
|
||||
return;
|
||||
}
|
||||
contentUi.SetActive(true);
|
||||
|
||||
if (unexplodeButton == null)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ChildModelSelector : MonoBehaviour
|
||||
|
||||
void Start()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
|
||||
}
|
||||
|
||||
public void AssignButtons()
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.UI;
|
||||
using Util;
|
||||
|
||||
public class PortSelector : MonoBehaviour
|
||||
{
|
||||
@@ -8,16 +10,22 @@ public class PortSelector : MonoBehaviour
|
||||
public GameObject prefab;
|
||||
public Vector3 offset = new Vector3(0,48,0);
|
||||
|
||||
public List<GameObject> ports = new List<GameObject>();
|
||||
public List<GameObject> portGOs = new List<GameObject>();
|
||||
public List<PortSelectorButton> listPSB = new List<PortSelectorButton>();
|
||||
|
||||
//Gets called from BaseModelSelector
|
||||
public void GenerateButtons()
|
||||
{
|
||||
foreach (var port in ports)
|
||||
foreach (var port in portGOs)
|
||||
{
|
||||
Debug.Log($"Destroying {port}");
|
||||
Destroy(port);
|
||||
}
|
||||
foreach (var psb in listPSB)
|
||||
{
|
||||
Debug.Log($"Destroying {psb}");
|
||||
Destroy(psb);
|
||||
}
|
||||
int i = 0;
|
||||
int index = 0;
|
||||
foreach (Port port in modelManager.BaseModel.Ports)
|
||||
@@ -31,7 +39,7 @@ public class PortSelector : MonoBehaviour
|
||||
Vector3 off = i * offset;
|
||||
Debug.Log($"Adding Port {port.PortName} : {port.PortID} to Selection with {off.x}, {off.y}, {off.z}");
|
||||
var go = Spawn.GO(prefab, transform, off, port.PortID + i);
|
||||
ports.Add(go);
|
||||
portGOs.Add(go);
|
||||
go.SetActive(true);
|
||||
var text = go.GetComponentInChildren<TMPro.TextMeshProUGUI>();
|
||||
|
||||
@@ -43,8 +51,19 @@ public class PortSelector : MonoBehaviour
|
||||
var psb = go.GetComponent<PortSelectorButton>();
|
||||
psb.PortID = port.PortID;
|
||||
psb.PortIndex = index;
|
||||
psb.marker = go.GetComponentInChildren<Marker>(true).gameObject;
|
||||
psb.ResetOtherButtons = ResetOtherButtons;
|
||||
listPSB.Add(psb);
|
||||
index++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetOtherButtons()
|
||||
{
|
||||
foreach (var psb in listPSB)
|
||||
{
|
||||
psb.marker.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,30 @@
|
||||
using System;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PortSelectorButton : MonoBehaviour
|
||||
{
|
||||
public ChildModelSelector options;
|
||||
public ChildModelSelector cms;
|
||||
public GameObject marker;
|
||||
public Action ResetOtherButtons;
|
||||
|
||||
private readonly Color _activeColor = new Color(30, 30, 200, 255);
|
||||
public string PortID { get; set; }
|
||||
public int PortIndex { set; get; }
|
||||
|
||||
void Start()
|
||||
{
|
||||
this.GetOrAddComponent<Button>().onClick.AddListener(OnToggleValueChanged);
|
||||
this.GetOrAddComponent<Button>().onClick.AddListener(OnClick);
|
||||
}
|
||||
void OnToggleValueChanged()
|
||||
void OnClick()
|
||||
{
|
||||
Debug.Log($"Opening CMS on {this}");
|
||||
options.PortID = PortID;
|
||||
options.PortIndex = PortIndex;
|
||||
options.AssignButtons(); // rebuilds GUI
|
||||
options.gameObject.SetActive(true);
|
||||
cms.PortID = PortID;
|
||||
cms.PortIndex = PortIndex;
|
||||
cms.AssignButtons(); // rebuilds GUI
|
||||
cms.gameObject.SetActive(true);
|
||||
ResetOtherButtons();
|
||||
marker.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ public class ReturnButtonBehaviour : MonoBehaviour
|
||||
{
|
||||
public BaseModelSelector bms;
|
||||
public ModelManager mm;
|
||||
public GameObject ContentUi;
|
||||
public GameObject buttonCanvas;
|
||||
public GameObject explodeButton;
|
||||
public GameObject unexplodeButton;
|
||||
@@ -24,7 +23,6 @@ public class ReturnButtonBehaviour : MonoBehaviour
|
||||
explodeButton.SetActive(true);
|
||||
unexplodeButton.SetActive(false);
|
||||
buttonCanvas.SetActive(false);
|
||||
ContentUi.SetActive(false);
|
||||
cmsCanvas.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
9
vr-configurator/Assets/Scripts/Util/Marker.cs
Normal file
9
vr-configurator/Assets/Scripts/Util/Marker.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Util
|
||||
{
|
||||
public class Marker : MonoBehaviour
|
||||
{
|
||||
//this script doesn't do anything else than allow for getcomponentsinchildren to find a targeted feature
|
||||
}
|
||||
}
|
||||
3
vr-configurator/Assets/Scripts/Util/Marker.cs.meta
Normal file
3
vr-configurator/Assets/Scripts/Util/Marker.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afda7b299fd84d59a921179166bf31b1
|
||||
timeCreated: 1751033993
|
||||
@@ -144,6 +144,8 @@ PlayerSettings:
|
||||
preloadedAssets:
|
||||
- {fileID: 11400000, guid: db83ceddd53a6184da3c0b605ababeba, type: 2}
|
||||
- {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3}
|
||||
- {fileID: 2679973408936177380, guid: 5b5db4a12362f584d852392db05b2ef9, type: 2}
|
||||
- {fileID: 205679594126988004, guid: 336ae9c31cedba340a3534199633e65a, type: 2}
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
m_HolographicPauseOnTrackingLoss: 1
|
||||
|
||||
Reference in New Issue
Block a user