/// <summary> /// Crear los botones para cambiar de modelos. /// </summary> /// <param name="modelControl">Objeto que contiene los modelos y su informacion</param> public void FillBttnsTracket(ModelARControl modelControl) { bttnResetRotation.onClick.RemoveAllListeners(); bttnResetRotation.onClick.AddListener(() => modelControl.ResetRotation()); /* * foreach (Transform child in ContentBttns) * { * Destroy(child.gameObject); * } * * ModelTarget[] modelsTarget = modelControl.modelsTarget; * * // Obtener largo de acuerdo a la cantidad de botones * float bttWidth = getButtonWidth(modelsTarget.Length); * * foreach (ModelTarget m in modelsTarget) * { * ButtonTarget bttnTarget = Instantiate(prefBttonSelect, ContentBttns).GetComponent<ButtonTarget>(); * bttnTarget.setListenerButton(modelControl, m); * * bttnTarget.GetComponent<LayoutElement>().preferredWidth = bttWidth; * } */ }
protected virtual void Start() { mTrackableBehaviour = GetComponent <TrackableBehaviour>(); if (mTrackableBehaviour) { mTrackableBehaviour.RegisterTrackableEventHandler(this); } initialScale = ChildTransform.localScale; _mARControl = GetComponent <ModelARControl>(); _touchRotation = GetComponent <TouchRotation>(); }
/// <summary> /// Modificar la informacion y listener del boton /// </summary> /// <param name="mControl"></param> /// <param name="mTarget"></param> public void setListenerButton(ModelARControl mControl, ModelTarget mTarget) { if (bttnTarget == null) { bttnTarget = GetComponent <Button>(); } setId(mTarget.Id); // Cambiar nombre boton bttnTarget.GetComponentInChildren <TextMeshProUGUI>().text = mTarget.Name; bttnTarget.onClick.AddListener(() => mControl.setActiveModel(mTarget.Id)); bttnTarget.onClick.AddListener(() => ARManager.Instance.ChangeModelTarget(mControl)); bool isInteractable = (mTarget.isOverlap) ? true : !mTarget.IsActive; bttnTarget.interactable = true; }
public void ChangeModelTarget(ModelARControl mARControl) { //_ARMenu.SetInteractableBttnsTracket(mARControl.modelsTarget); }