fix timing menu bug
This commit is contained in:
1 parent
7dc0a04856
commit
0c6dce0f1b
4 files changed
+29
-5
No files matched your search
@@ -978,6 +978,17 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &1705992922 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 5975136821837370545, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
|
||||
m_PrefabInstance: {fileID: 766862834}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 14d590d5e541e871cb4b472e9e009128, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1906469784
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1402,6 +1413,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Menu
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5313449993149091347, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
|
||||
propertyPath: shipUi
|
||||
value:
|
||||
objectReference: {fileID: 1705992922}
|
||||
- target: {fileID: 5313449993149091347, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
|
||||
propertyPath: timingDoc
|
||||
value:
|
||||
|
||||
@@ -13,6 +13,9 @@ public class MenuControls : MonoBehaviour, SpaceRaceInput.IMenuActions {
|
||||
|
||||
MenuUi menuUi;
|
||||
|
||||
[SerializeField]
|
||||
ShipUi shipUi;
|
||||
|
||||
SpaceRaceInput input;
|
||||
bool visible = false;
|
||||
|
||||
@@ -47,6 +50,7 @@ public class MenuControls : MonoBehaviour, SpaceRaceInput.IMenuActions {
|
||||
|
||||
// take control off the ship
|
||||
timingDoc.enabled = false;
|
||||
shipUi.enabled = false;
|
||||
shipControls.enabled = false;
|
||||
}
|
||||
|
||||
@@ -57,6 +61,7 @@ public class MenuControls : MonoBehaviour, SpaceRaceInput.IMenuActions {
|
||||
|
||||
// resume control of the ship
|
||||
timingDoc.enabled = true;
|
||||
shipUi.enabled = true;
|
||||
shipControls.enabled = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ public class MenuUi : MonoBehaviour {
|
||||
UIDocument uiDocument;
|
||||
VisualElement tracks;
|
||||
|
||||
void Start() {
|
||||
void OnEnable() {
|
||||
uiDocument = GetComponent<UIDocument>();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class ShipUi : MonoBehaviour {
|
||||
[SerializeField]
|
||||
UIDocument uiDocument = null;
|
||||
UIDocument uiDocument;
|
||||
|
||||
[SerializeField]
|
||||
ShipControls ship;
|
||||
@@ -20,7 +19,12 @@ public class ShipUi : MonoBehaviour {
|
||||
VisualElement sectors;
|
||||
VisualElement timeSheet;
|
||||
|
||||
void Awake() {
|
||||
void OnEnable() {
|
||||
Init();
|
||||
}
|
||||
|
||||
void Init() {
|
||||
uiDocument = GetComponent<UIDocument>();
|
||||
speed = uiDocument.rootVisualElement.Q<Label>("speed");
|
||||
timer = uiDocument.rootVisualElement.Q<Label>("timer");
|
||||
sectors = uiDocument.rootVisualElement.Q<VisualElement>("sectors");
|
||||
@@ -30,7 +34,7 @@ public class ShipUi : MonoBehaviour {
|
||||
void FixedUpdate() {
|
||||
if (timer == null || speed == null) {
|
||||
Debug.LogWarning("no speed or timer");
|
||||
Awake();
|
||||
Init();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user