using Microsoft.MixedReality.Toolkit.UI; using System; using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; using TMPro; using Unity.XR.CoreUtils; public class AxisOptionWindow : BackButton { [SerializeField] GraphManager graphManager; [SerializeField] GameObject plotSpace; [SerializeField] GameObject axises; [SerializeField] GameObject whileScaleController; //[SerializeField] GameObject gradations;//目盛り....未実装 [SerializeField] GameObject axisDisplayTrigger; [SerializeField] float expansionRate; [SerializeField] TextMeshPro scaleText; [SerializeField] TextMeshPro axisDisplayText; [SerializeField] float defaultAxisesScaleFloat; public void OnValueUpdated(SliderEventData eventData) { float value = Mathf.Pow(5, eventData.NewValue)-1; plotSpace.transform.localScale = new Vector3(value ,value ,value); scaleText.text = (value).ToString("F4"); /*全体の大きさとして変えたくないもの * 平面の厚さの最大値 * 軸の太さの最大値 * 原点の大きさの最大値 */ //GraphObject foreach (GraphData data in graphManager.getAllGraphData()) { if (data != null) { if (data.getgraphObject() != null) { switch (data.getGraphNum()) { case 1: Vector3 u = data.getgraphObject().transform.localScale; if (value > defaultAxisesScaleFloat) { data.getgraphObject().transform.localScale = new Vector3(u.x, 0.001f/value, u.z); } break; case 2: break; default: break; } } } } //Axises,Origin for(int i = 0; i < 4; i++) { GameObject gameObject = axises.transform.GetChild(i).gameObject; Vector3 v = gameObject.transform.localScale; switch (i) { case 0: // XAxis if (value > defaultAxisesScaleFloat) { gameObject.transform.localScale = new Vector3(v.x, 0.5f/value, 0.5f/value); } break; case 1: //YAxis if (value > defaultAxisesScaleFloat) { gameObject.transform.localScale = new Vector3(0.5f / value, v.y, 0.5f / value); } break; case 2: //ZAxis if (value > defaultAxisesScaleFloat) { gameObject.transform.localScale = new Vector3(0.5f / value, 0.5f / value, v.z); } break; case 3: //OriginPoint if (value > defaultAxisesScaleFloat) { gameObject.transform.localScale = new Vector3(0.5f /value , 0.5f / value, 0.5f / value); } break; } } } public void axisesSetActive() { bool b = axisDisplayTrigger.GetComponent<Interactable>().IsToggled; axises.SetActive(b); if (b) { axisDisplayText.text = "表示"; } else { axisDisplayText.text = "非表示"; } } }