/// <summary> /// For meshes... /// </summary> /// <param name="assetLoaderContext"></param> public void OnModelLoaded(object sender, ImportedMeshEventArgs args) { if (args.Name != this.GetId()) { return; } bool outlineWasHighlighted = outlineOnClick.Highlighted; if (Model != null) { outlineOnClick.UnHighlight(); outlineOnClick.ClearRenderers(); Model.SetActive(false); Destroy(Model); } Model = args.RootGameObject; Model.gameObject.transform.parent = Visual.transform; Model.gameObject.transform.localPosition = Vector3.zero; Model.gameObject.transform.localRotation = Quaternion.identity; gameObject.GetComponent <BindParentToChild>().ChildToBind = Model; foreach (Renderer child in Model.GetComponentsInChildren <Renderer>(true)) { child.gameObject.AddComponent <OnClickCollider>().Target = gameObject; child.gameObject.AddComponent <MeshCollider>(); } aoRenderers.Clear(); Colliders.Clear(); aoRenderers.AddRange(Model.GetComponentsInChildren <Renderer>(true)); Colliders.AddRange(Model.GetComponentsInChildren <MeshCollider>(true)); outlineOnClick.InitRenderers(aoRenderers); outlineOnClick.InitMaterials(); //transparent = false; //needs to be set before 1st call of SetVisibility after model loading SetVisibility(visibility, forceShaderChange: true); if (outlineWasHighlighted) { outlineOnClick.Highlight(); if (SelectorMenu.Instance.ManuallySelected) { DisplayOffscreenIndicator(true); } } MeshImporter.Instance.OnMeshImported -= OnModelLoaded; }
public void OnActionPointsChanged(object sender, EventArgs eventArgs) { foreach (Transform t in ActionPointsList.transform) { Destroy(t.gameObject); } foreach (Base.ActionPoint actionPoint in Base.Scene.Instance.GetAllGlobalActionPoints()) { GameObject btnGO = Instantiate(Base.GameManager.Instance.ButtonPrefab, ActionPointsList.transform); btnGO.transform.localScale = new Vector3(1, 1, 1); Button btn = btnGO.GetComponent<Button>(); btn.GetComponentInChildren<TMPro.TMP_Text>().text = actionPoint.Data.Name; btn.onClick.AddListener(() => ShowActionPoint(actionPoint)); // Add EventTrigger OnPointerEnter and OnPointerExit - to be able to highlight corresponding AP when hovering over button OutlineOnClick APoutline = actionPoint.GetComponent<OutlineOnClick>(); EventTrigger eventTrigger = btnGO.AddComponent<EventTrigger>(); // Create OnPointerEnter entry EventTrigger.Entry OnPointerEnter = new EventTrigger.Entry { eventID = EventTriggerType.PointerEnter }; OnPointerEnter.callback.AddListener((eventData) => APoutline.Highlight()); eventTrigger.triggers.Add(OnPointerEnter); // Create OnPointerExit entry EventTrigger.Entry OnPointerExit = new EventTrigger.Entry { eventID = EventTriggerType.PointerExit }; OnPointerExit.callback.AddListener((eventData) => APoutline.UnHighlight()); eventTrigger.triggers.Add(OnPointerExit); } }
private void AddActionPointButton(Base.ActionPoint actionPoint) { ActionButton btn = Instantiate(Base.GameManager.Instance.ButtonPrefab, ActionPointsList.transform).GetComponent <ActionButton>(); btn.transform.localScale = new Vector3(1, 1, 1); btn.SetLabel(actionPoint.Data.Name); btn.Button.onClick.AddListener(() => ShowActionPoint(actionPoint)); btn.ObjectId = actionPoint.Data.Id; // Add EventTrigger OnPointerEnter and OnPointerExit - to be able to highlight corresponding AP when hovering over button OutlineOnClick APoutline = actionPoint.GetComponent <OutlineOnClick>(); EventTrigger eventTrigger = btn.gameObject.AddComponent <EventTrigger>(); // Create OnPointerEnter entry EventTrigger.Entry OnPointerEnter = new EventTrigger.Entry { eventID = EventTriggerType.PointerEnter }; OnPointerEnter.callback.AddListener((eventData) => APoutline.Highlight()); eventTrigger.triggers.Add(OnPointerEnter); // Create OnPointerExit entry EventTrigger.Entry OnPointerExit = new EventTrigger.Entry { eventID = EventTriggerType.PointerExit }; OnPointerExit.callback.AddListener((eventData) => APoutline.UnHighlight()); eventTrigger.triggers.Add(OnPointerExit); }
public void UpdateMenu() { objectName.text = CurrentObject.Data.Name; VisibilitySlider.value = CurrentObject.GetVisibility() * 100; foreach (Transform t in DynamicContent.transform) { Destroy(t.gameObject); } foreach (ActionPoint actionPoint in CurrentObject.GetActionPoints()) { Button button = GameManager.Instance.CreateButton(DynamicContent.transform, actionPoint.Data.Name); button.onClick.AddListener(() => ShowActionPoint(actionPoint)); // Add EventTrigger OnPointerEnter and OnPointerExit - to be able to highlight corresponding AP when hovering over button OutlineOnClick APoutline = actionPoint.GetComponent <OutlineOnClick>(); EventTrigger eventTrigger = button.gameObject.AddComponent <EventTrigger>(); // Create OnPointerEnter entry EventTrigger.Entry OnPointerEnter = new EventTrigger.Entry { eventID = EventTriggerType.PointerEnter }; OnPointerEnter.callback.AddListener((eventData) => APoutline.Highlight()); eventTrigger.triggers.Add(OnPointerEnter); // Create OnPointerExit entry EventTrigger.Entry OnPointerExit = new EventTrigger.Entry { eventID = EventTriggerType.PointerExit }; OnPointerExit.callback.AddListener((eventData) => APoutline.UnHighlight()); eventTrigger.triggers.Add(OnPointerExit); } }
public override void OnHoverEnd() { eeName.gameObject.SetActive(false); DisplayOffscreenIndicator(false); OutlineOnClick.UnHighlight(); if (IsSelected) { OutlineOnClick.Select(); } }
public override void OnHoverEnd() { outlineOnClick.UnHighlight(); Action.NameText.gameObject.SetActive(false); if (!ConnectionManagerArcoro.Instance.IsConnecting()) { return; } ConnectionManagerArcoro.Instance.EnableConnectionToMouse(); }
public override void HighlightAP(bool highlight) { if (highlight) { outlineOnClick.Highlight(); } else { outlineOnClick.UnHighlight(); } }
public void HighlightOrientation(bool highlight) { if (highlight) { outlineOnClick.Highlight(); } else { outlineOnClick.UnHighlight(); } }
public void HiglightAxis(Axis axis) { switch (axis) { case Axis.X: XAxisOutline.Highlight(); YAxisOutline.UnHighlight(); ZAxisOutline.UnHighlight(); break; case Axis.Y: YAxisOutline.Highlight(); XAxisOutline.UnHighlight(); ZAxisOutline.UnHighlight(); break; case Axis.Z: ZAxisOutline.Highlight(); YAxisOutline.UnHighlight(); XAxisOutline.UnHighlight(); break; } }
public override void UpdateMenu() { base.UpdateMenu(); overrides.Clear(); createAPBtn.SetInteractivity(CurrentObject.ActionObjectMetadata.HasPose); foreach (Parameter param in CurrentObject.ObjectParameters.Values.ToList()) { ActionObjectParameterOverride overrideParam = Instantiate(ParameterOverridePrefab, Parameters.transform).GetComponent <ActionObjectParameterOverride>(); overrideParam.transform.SetAsLastSibling(); overrideParam.Init(param.GetStringValue(), false, param.ParameterMetadata, CurrentObject.Data.Id); Debug.LogError(CurrentObject.Overrides.Count); if (CurrentObject.Overrides.TryGetValue(param.Name, out Parameter p)) { Debug.LogError(p); overrideParam.SetValue(p.GetStringValue(), true); } overrides[param.Name] = overrideParam; } foreach (ActionPoint actionPoint in CurrentObject.GetActionPoints()) { Button button = GameManager.Instance.CreateButton(ActionPointsList.transform, actionPoint.Data.Name); button.onClick.AddListener(() => ShowActionPoint(actionPoint)); // Add EventTrigger OnPointerEnter and OnPointerExit - to be able to highlight corresponding AP when hovering over button OutlineOnClick APoutline = actionPoint.GetComponent <OutlineOnClick>(); EventTrigger eventTrigger = button.gameObject.AddComponent <EventTrigger>(); // Create OnPointerEnter entry EventTrigger.Entry OnPointerEnter = new EventTrigger.Entry { eventID = EventTriggerType.PointerEnter }; OnPointerEnter.callback.AddListener((eventData) => APoutline.Highlight()); eventTrigger.triggers.Add(OnPointerEnter); // Create OnPointerExit entry EventTrigger.Entry OnPointerExit = new EventTrigger.Entry { eventID = EventTriggerType.PointerExit }; OnPointerExit.callback.AddListener((eventData) => APoutline.UnHighlight()); eventTrigger.triggers.Add(OnPointerExit); } }
/// <summary> /// Creates button in orientations dynamic list with orientation's arrow highlight on hover /// </summary> /// <param name="orientation"></param> private void CreateOrientationBtn(NamedOrientation orientation) { ActionButton orientationButton = CreateBtn(OrientationsDynamicList.transform, orientation.Id, orientation.Name, () => OpenDetailMenu(orientation)); // Add EventTrigger OnPointerEnter and OnPointerExit - to be able to highlight corresponding orientation when hovering over button OutlineOnClick orientationOutline = CurrentActionPoint.GetOrientationVisual(orientation.Id).GetComponent <OutlineOnClick>(); EventTrigger eventTrigger = orientationButton.gameObject.AddComponent <EventTrigger>(); // Create OnPointerEnter entry EventTrigger.Entry onPointerEnter = new EventTrigger.Entry { eventID = EventTriggerType.PointerEnter }; onPointerEnter.callback.AddListener((eventData) => orientationOutline.Highlight()); eventTrigger.triggers.Add(onPointerEnter); // Create OnPointerExit entry EventTrigger.Entry onPointerExit = new EventTrigger.Entry { eventID = EventTriggerType.PointerExit }; onPointerExit.callback.AddListener((eventData) => orientationOutline.UnHighlight()); eventTrigger.triggers.Add(onPointerExit); }
public override void OnHoverEnd() { outlineOnClick.UnHighlight(); NameText.gameObject.SetActive(false); }
public override void OnHoverEnd() { outlineOnClick.UnHighlight(); NameText.gameObject.SetActive(false); DisplayOffscreenIndicator(false); }
private async void RobotModelLoaded() { RobotModel.RobotModelGameObject.transform.parent = transform; RobotModel.RobotModelGameObject.transform.localPosition = Vector3.zero; RobotModel.RobotModelGameObject.transform.localRotation = Quaternion.identity; // retarget OnClickCollider target to receive OnClick events foreach (OnClickCollider onCLick in RobotModel.RobotModelGameObject.GetComponentsInChildren <OnClickCollider>(true)) { onCLick.Target = gameObject; } RobotModel.SetActiveAllVisuals(true); bool outlineWasHighlighted = outlineOnClick.Highlighted; outlineOnClick.UnHighlight(); outlineOnClick.ClearRenderers(); RobotPlaceholder.SetActive(false); Destroy(RobotPlaceholder); robotColliders.Clear(); robotRenderers.Clear(); robotRenderers.AddRange(RobotModel.RobotModelGameObject.GetComponentsInChildren <Renderer>(true)); robotColliders.AddRange(RobotModel.RobotModelGameObject.GetComponentsInChildren <Collider>(true)); outlineOnClick.InitRenderers(robotRenderers); outlineOnClick.OutlineShaderType = OutlineOnClick.OutlineType.TwoPassShader; outlineOnClick.InitMaterials(); SetOutlineSizeBasedOnScale(); SetVisibility(visibility, forceShaderChange: true); UpdateColor(); SetDefaultJoints(); Target target = GetComponent <Target>(); if (target != null) { target.ChangeTarget(RobotModel.RobotModelGameObject); } if (outlineWasHighlighted) { outlineOnClick.Highlight(); if (SelectorMenu.Instance.ManuallySelected) { DisplayOffscreenIndicator(true); } } // Show or hide the robot based on global settings of displaying ActionObjects. // Needs to be called additionally, because when global setting is called, robot model is not loaded and only its placeholder is active. /*if (robotVisible) { * Show(); * } else { * Hide(); * } */ if (GameManager.Instance.GetGameState() != GameManager.GameStateEnum.PackageRunning || GameManager.Instance.GetGameState() != GameManager.GameStateEnum.LoadingPackage) { await WebsocketManager.Instance.RegisterForRobotEvent(GetId(), true, RegisterForRobotEventRequestArgs.WhatEnum.Joints); } }
public override void OnHoverEnd() { ActionObjectName.gameObject.SetActive(false); outlineOnClick.UnHighlight(); }
public void UnHighlight() { outlineOnClick.UnHighlight(); }