Onclick opens according CMS
This commit is contained in:
@@ -12857,6 +12857,7 @@ MonoBehaviour:
|
|||||||
colliderSurface: {fileID: 163506087}
|
colliderSurface: {fileID: 163506087}
|
||||||
interactable: {fileID: 698127119}
|
interactable: {fileID: 698127119}
|
||||||
rayInteractable: {fileID: 698127110}
|
rayInteractable: {fileID: 698127110}
|
||||||
|
PortSelector: {fileID: 1494770816}
|
||||||
--- !u!1 &700047848
|
--- !u!1 &700047848
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -21748,6 +21749,7 @@ MonoBehaviour:
|
|||||||
colliderSurface: {fileID: 557957011}
|
colliderSurface: {fileID: 557957011}
|
||||||
interactable: {fileID: 1272917968}
|
interactable: {fileID: 1272917968}
|
||||||
rayInteractable: {fileID: 1272917969}
|
rayInteractable: {fileID: 1272917969}
|
||||||
|
PortSelector: {fileID: 1494770816}
|
||||||
--- !u!114 &1272917968
|
--- !u!114 &1272917968
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ public class ModelBehaviour : MonoBehaviour, IResettable
|
|||||||
public RayInteractable rayInteractable;
|
public RayInteractable rayInteractable;
|
||||||
|
|
||||||
bool lateInited = false;
|
bool lateInited = false;
|
||||||
|
|
||||||
|
public PortSelector PortSelector;
|
||||||
|
public int Index = -1;
|
||||||
|
|
||||||
Color _color = Color.black;
|
Color _color = Color.black;
|
||||||
Color Color
|
Color Color
|
||||||
@@ -171,6 +174,7 @@ public class ModelBehaviour : MonoBehaviour, IResettable
|
|||||||
child.SetActive(true);
|
child.SetActive(true);
|
||||||
ChildModelBehaviour cmb = child.GetComponent<ChildModelBehaviour>();
|
ChildModelBehaviour cmb = child.GetComponent<ChildModelBehaviour>();
|
||||||
_children.Add(child);
|
_children.Add(child);
|
||||||
|
cmb.Index = i;
|
||||||
|
|
||||||
var childModel = ModelManager.GetById(port.DefaultId);
|
var childModel = ModelManager.GetById(port.DefaultId);
|
||||||
if (childModel.Mesh == null)
|
if (childModel.Mesh == null)
|
||||||
@@ -180,7 +184,7 @@ public class ModelBehaviour : MonoBehaviour, IResettable
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"POS {child.transform.gameObject.name} pos {child.transform.localPosition} {child.transform.rotation} {child.transform.localScale}");
|
//Debug.Log($"POS {child.transform.gameObject.name} pos {child.transform.localPosition} {child.transform.rotation} {child.transform.localScale}");
|
||||||
cmb.Parent = this;
|
cmb.Parent = this;
|
||||||
cmb.ChildModel = childModel;
|
cmb.ChildModel = childModel;
|
||||||
port.Apply(child.transform); // move to correct position
|
port.Apply(child.transform); // move to correct position
|
||||||
@@ -267,8 +271,13 @@ public class ModelBehaviour : MonoBehaviour, IResettable
|
|||||||
//model clicked
|
//model clicked
|
||||||
void OnSelect()
|
void OnSelect()
|
||||||
{
|
{
|
||||||
Debug.Log($"Selected {name}");
|
Debug.Log($"Selected portIndex {Index}");
|
||||||
|
if (Index == -1)
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"Clicked on Initialized");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PortSelector.mapPSB[Index].OnClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetThis()
|
public void ResetThis()
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public class PortSelector : MonoBehaviour, IResettable
|
|||||||
|
|
||||||
public List<GameObject> portGOs = new List<GameObject>();
|
public List<GameObject> portGOs = new List<GameObject>();
|
||||||
public List<PortSelectorButton> listPSB = new List<PortSelectorButton>();
|
public List<PortSelectorButton> listPSB = new List<PortSelectorButton>();
|
||||||
|
public Dictionary<int, PortSelectorButton> mapPSB = new Dictionary<int, PortSelectorButton>();
|
||||||
|
|
||||||
//Gets called from BaseModelSelector
|
//Gets called from BaseModelSelector
|
||||||
public void GenerateButtons()
|
public void GenerateButtons()
|
||||||
@@ -34,7 +35,6 @@ public class PortSelector : MonoBehaviour, IResettable
|
|||||||
portGOs.Add(go);
|
portGOs.Add(go);
|
||||||
go.SetActive(true);
|
go.SetActive(true);
|
||||||
var text = go.GetComponentInChildren<TMPro.TextMeshProUGUI>();
|
var text = go.GetComponentInChildren<TMPro.TextMeshProUGUI>();
|
||||||
|
|
||||||
if (text == null)
|
if (text == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"No TextMeshProUGUI found in {go.name}, cannot set text.");
|
Debug.LogWarning($"No TextMeshProUGUI found in {go.name}, cannot set text.");
|
||||||
@@ -46,6 +46,7 @@ public class PortSelector : MonoBehaviour, IResettable
|
|||||||
psb.marker = go.GetComponentInChildren<Marker>(true).gameObject;
|
psb.marker = go.GetComponentInChildren<Marker>(true).gameObject;
|
||||||
psb.RemoveOtherMarkers = RemoveOtherMarkers;
|
psb.RemoveOtherMarkers = RemoveOtherMarkers;
|
||||||
listPSB.Add(psb);
|
listPSB.Add(psb);
|
||||||
|
mapPSB.Add(index, psb);
|
||||||
index++;
|
index++;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class PortSelectorButton : MonoBehaviour
|
|||||||
{
|
{
|
||||||
this.GetOrAddComponent<Button>().onClick.AddListener(OnClick);
|
this.GetOrAddComponent<Button>().onClick.AddListener(OnClick);
|
||||||
}
|
}
|
||||||
void OnClick()
|
public void OnClick()
|
||||||
{
|
{
|
||||||
Debug.Log($"Changing Port to {this}");
|
Debug.Log($"Changing Port to {this}");
|
||||||
ColorSelector.ResetThis();
|
ColorSelector.ResetThis();
|
||||||
|
|||||||
Reference in New Issue
Block a user