Skip to content
Snippets Groups Projects
Commit 9f276ad1 authored by thielicke's avatar thielicke
Browse files

Einfärben richtig/falsch buttons, Datenschutzkonformes Verstauen

parent 7981839d
No related branches found
No related tags found
No related merge requests found
...@@ -18,14 +18,10 @@ public class CubeControlExample : MonoBehaviour ...@@ -18,14 +18,10 @@ public class CubeControlExample : MonoBehaviour
} }
public void OnOff()
{
this.gameObject.SetActive(!isOn);
isOn = !isOn;
}
public void ChangeColor() public void ChangeColor()
{ {
this.gameObject.GetComponent<Renderer>().material.color = Random.ColorHSV(); this.gameObject.GetComponent<Renderer>().material.color = Color.red;
} }
} }
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class Farbegruen : MonoBehaviour
{
public GameObject theButton;
private ColorBlock theColor;
void Awake()
{
}
public void ButtonTransitionColors()
{
theButton.gameObject.GetComponent<Renderer>().material.color = Color.green;
}
}
fileFormatVersion: 2
guid: 319277afd9816a34d851a0a2541c7732
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class Farberot : MonoBehaviour
{
public GameObject theButton;
private ColorBlock theColor;
void Awake()
{
}
public void ButtonTransitionColors()
{
theButton.gameObject.GetComponent<Renderer>().material.color = Color.red;
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 5888358b1597f0c43bdf9dfb5b1cfb68
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -9,6 +9,8 @@ public class Laptop : MonoBehaviour, IMixedRealityTouchHandler ...@@ -9,6 +9,8 @@ public class Laptop : MonoBehaviour, IMixedRealityTouchHandler
public List<GameObject> uiElements; // Liste fr alle bergeordneten UI-Elemente (TextMeshPro und Buttons) public List<GameObject> uiElements; // Liste fr alle bergeordneten UI-Elemente (TextMeshPro und Buttons)
public GameObject awtrue; public GameObject awtrue;
public GameObject awfalse; public GameObject awfalse;
public GameObject sperren;
public GameObject sperrbildschirm;
private Coroutine hideCoroutine; // Coroutine-Referenz zum Verwalten des Timers private Coroutine hideCoroutine; // Coroutine-Referenz zum Verwalten des Timers
// Neue Felder fr die E-Mail-Benachrichtigung und das Overlay // Neue Felder fr die E-Mail-Benachrichtigung und das Overlay
...@@ -22,6 +24,8 @@ public class Laptop : MonoBehaviour, IMixedRealityTouchHandler ...@@ -22,6 +24,8 @@ public class Laptop : MonoBehaviour, IMixedRealityTouchHandler
SetElementsVisibility(false); // Initial unsichtbar SetElementsVisibility(false); // Initial unsichtbar
awtrue.SetActive(false); awtrue.SetActive(false);
awfalse.SetActive(false); awfalse.SetActive(false);
sperrbildschirm.SetActive(false);
sperren.SetActive(false);
// Initialisierung der neuen Felder // Initialisierung der neuen Felder
emailNotification.SetActive(false); emailNotification.SetActive(false);
......
using Microsoft.MixedReality.Toolkit.Input;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class Locker : MonoBehaviour, IMixedRealityTouchHandler
{
public List<GameObject> uiElements; // Liste fr alle bergeordneten UI-Elemente (TextMeshPro und Buttons)
public GameObject labeleins;
public GameObject labelzwei;
public GameObject labeldrei;
private Coroutine hideCoroutine; // Coroutine-Referenz zum Verwalten des Timers
void Start()
{
SetElementsVisibility(false);
labeleins.active = false;
labelzwei.active = false;
labeldrei.active = false;
}
public void OnTouchStarted(HandTrackingInputEventData eventData)
{
// Sichtbar machen
SetElementsVisibility(true);
// Bestehende Coroutine stoppen, falls vorhanden
if (hideCoroutine != null)
{
StopCoroutine(hideCoroutine);
}
// Neue Coroutine starten
hideCoroutine = StartCoroutine(HideElementsAfterDelay(10f)); // 10 Sek Verzgerung
}
public void OnTouchCompleted(HandTrackingInputEventData eventData)
{
}
public void OnTouchUpdated(HandTrackingInputEventData eventData) { }
IEnumerator HideElementsAfterDelay(float delay)
{
yield return new WaitForSeconds(delay);
SetElementsVisibility(false);
}
void SetElementsVisibility(bool isVisible)
{
foreach (var element in uiElements)
{
SetVisibilityRecursive(element, isVisible);
}
}
void SetVisibilityRecursive(GameObject obj, bool isVisible)
{
// TextMeshPro-Komponente
TextMeshPro textMeshPro = obj.GetComponent<TextMeshPro>();
if (textMeshPro != null)
{
textMeshPro.color = new Color(textMeshPro.color.r, textMeshPro.color.g, textMeshPro.color.b, isVisible ? 1.0f : 0.0f);
}
// Renderer-Komponente (fr andere visuelle Elemente)
Renderer renderer = obj.GetComponent<Renderer>();
if (renderer != null)
{
renderer.enabled = isVisible;
}
// Weitere UI-Komponenten
var graphic = obj.GetComponent<UnityEngine.UI.Graphic>();
if (graphic != null)
{
graphic.color = new Color(graphic.color.r, graphic.color.g, graphic.color.b, isVisible ? 1.0f : 0.0f);
}
// Rekursiv fr alle Kinderobjekte
foreach (Transform child in obj.transform)
{
SetVisibilityRecursive(child.gameObject, isVisible);
}
}
}
fileFormatVersion: 2
guid: 794acf1a09b6e744c8ad1bd08300adaf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
File moved
File moved
...@@ -9,6 +9,8 @@ public class Whiteboard : MonoBehaviour, IMixedRealityTouchHandler ...@@ -9,6 +9,8 @@ public class Whiteboard : MonoBehaviour, IMixedRealityTouchHandler
public List<GameObject> uiElements; // Liste fr alle bergeordneten UI-Elemente (TextMeshPro und Buttons) public List<GameObject> uiElements; // Liste fr alle bergeordneten UI-Elemente (TextMeshPro und Buttons)
public GameObject awtrue; public GameObject awtrue;
public GameObject awfalse; public GameObject awfalse;
public GameObject square;
public GameObject wischen;
private Coroutine hideCoroutine; // Coroutine-Referenz zum Verwalten des Timers private Coroutine hideCoroutine; // Coroutine-Referenz zum Verwalten des Timers
void Start() void Start()
...@@ -16,6 +18,8 @@ public class Whiteboard : MonoBehaviour, IMixedRealityTouchHandler ...@@ -16,6 +18,8 @@ public class Whiteboard : MonoBehaviour, IMixedRealityTouchHandler
SetElementsVisibility(false); // Initial unsichtbar SetElementsVisibility(false); // Initial unsichtbar
awtrue.active = false; awtrue.active = false;
awfalse.active = false; awfalse.active = false;
square.active = false;
wischen.active = false;
} }
public void OnTouchStarted(HandTrackingInputEventData eventData) public void OnTouchStarted(HandTrackingInputEventData eventData)
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment