protected override void LoadPreviousValues(params Selectable[] uiElements) { string prevLoadPath = PlayerPrefs.GetString(m_playerPrefsKeyRoot + "loadPath", default); if (string.IsNullOrEmpty(prevLoadPath)) { return; } // Load the previous Internal parameters. if (!File.Exists(prevLoadPath)) { return; } var bf = new BinaryFormatter(); var file = File.Open(prevLoadPath, FileMode.Open); m_externalData = bf.Deserialize(file) as DanbiCameraExternalData; if (m_externalData is null) { return; } (uiElements[1] as TMP_InputField).text = m_externalData.projectorPosition.x.ToString(); onProjectorPositionXUpdate?.Invoke(m_externalData.projectorPosition.x); (uiElements[2] as TMP_InputField).text = m_externalData.projectorPosition.y.ToString(); onProjectorPositionYUpdate?.Invoke(m_externalData.projectorPosition.y); (uiElements[3] as TMP_InputField).text = m_externalData.projectorPosition.z.ToString(); onProjectorPositionZUpdate?.Invoke(m_externalData.projectorPosition.z); (uiElements[4] as TMP_InputField).text = m_externalData.xAxis.x.ToString(); onProjectorXAxisXUpdate?.Invoke(m_externalData.xAxis.x); (uiElements[5] as TMP_InputField).text = m_externalData.xAxis.y.ToString(); onProjectorXAxisYUpdate?.Invoke(m_externalData.xAxis.y); (uiElements[6] as TMP_InputField).text = m_externalData.xAxis.z.ToString(); onProjectorXAxisZUpdate?.Invoke(m_externalData.xAxis.z); (uiElements[7] as TMP_InputField).text = m_externalData.yAxis.x.ToString(); onProjectorYAxisXUpdate?.Invoke(m_externalData.yAxis.x); (uiElements[8] as TMP_InputField).text = m_externalData.yAxis.y.ToString(); onProjectorYAxisYUpdate?.Invoke(m_externalData.yAxis.y); (uiElements[9] as TMP_InputField).text = m_externalData.yAxis.z.ToString(); onProjectorYAxisZUpdate?.Invoke(m_externalData.yAxis.z); (uiElements[10] as TMP_InputField).text = m_externalData.zAxis.x.ToString(); onProjectorZAxisXUpdate?.Invoke(m_externalData.zAxis.x); (uiElements[11] as TMP_InputField).text = m_externalData.zAxis.y.ToString(); onProjectorZAxisYUpdate?.Invoke(m_externalData.zAxis.y); (uiElements[12] as TMP_InputField).text = m_externalData.zAxis.z.ToString(); onProjectorZAxisZUpdate?.Invoke(m_externalData.zAxis.z); }
IEnumerator Coroutine_LoadProjectorExternalParameters(Transform panel, Dictionary <string, Selectable> elements) { var filters = new string[] { ".dat" }; string startingPath = default; #if UNITY_EDITOR startingPath = Application.dataPath + "/Resources/"; #else startingPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop); #endif yield return(DanbiFileSys.OpenLoadDialog(startingPath, filters, "Load Camera Externel Paramaters (Scriptable Object)", "Select")); DanbiFileSys.GetResourcePathIntact(out m_loadPath, out _); // Load the Internal parameters. if (!File.Exists(m_loadPath)) { yield break; } var bf = new BinaryFormatter(); DanbiCameraExternalData loaded = null; using (var file = File.Open(m_loadPath, FileMode.Open)) { loaded = bf.Deserialize(file) as DanbiCameraExternalData; } yield return(new WaitUntil(() => !(loaded is null))); m_externalData = loaded; m_selectProjectorExternalParameterText.text = m_loadPath; (elements["positionXInputField"] as TMP_InputField).text = m_externalData.projectorPosition.x.ToString(); onProjectorPositionXUpdate?.Invoke(m_externalData.projectorPosition.x); (elements["positionYInputField"] as TMP_InputField).text = m_externalData.projectorPosition.y.ToString(); onProjectorPositionYUpdate?.Invoke(m_externalData.projectorPosition.y); (elements["positionZInputField"] as TMP_InputField).text = m_externalData.projectorPosition.z.ToString(); onProjectorPositionZUpdate?.Invoke(m_externalData.projectorPosition.z); (elements["xOfxAxisInputField"] as TMP_InputField).text = m_externalData.xAxis.x.ToString(); onProjectorXAxisXUpdate?.Invoke(m_externalData.xAxis.x); (elements["yOfxAxisInputField"] as TMP_InputField).text = m_externalData.xAxis.y.ToString(); onProjectorXAxisYUpdate?.Invoke(m_externalData.xAxis.y); (elements["zOfxAxisInputField"] as TMP_InputField).text = m_externalData.xAxis.z.ToString(); onProjectorXAxisZUpdate?.Invoke(m_externalData.xAxis.z); (elements["xOfyAxisInputField"] as TMP_InputField).text = m_externalData.yAxis.x.ToString(); onProjectorYAxisXUpdate?.Invoke(m_externalData.yAxis.x); (elements["yOfyAxisInputField"] as TMP_InputField).text = m_externalData.yAxis.y.ToString(); onProjectorYAxisYUpdate?.Invoke(m_externalData.yAxis.y); (elements["zOfyAxisInputField"] as TMP_InputField).text = m_externalData.yAxis.z.ToString(); onProjectorYAxisZUpdate?.Invoke(m_externalData.yAxis.z); (elements["xOfzAxisInputField"] as TMP_InputField).text = m_externalData.zAxis.x.ToString(); onProjectorZAxisXUpdate?.Invoke(m_externalData.zAxis.x); (elements["yOfzAxisInputField"] as TMP_InputField).text = m_externalData.zAxis.y.ToString(); onProjectorZAxisYUpdate?.Invoke(m_externalData.zAxis.y); (elements["zOfzAxisInputField"] as TMP_InputField).text = m_externalData.zAxis.z.ToString(); onProjectorZAxisZUpdate?.Invoke(m_externalData.zAxis.z); }