VRIKGeneralObjectSetter.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using Kasizuki;
  5. using UnityEngine;
  6. public class VRIKGeneralObjectSetter : MonoBehaviour
  7. {
  8. private NGUIWindow window
  9. {
  10. get
  11. {
  12. return this.m_Window = (this.m_Window ?? base.GetComponent<NGUIWindow>());
  13. }
  14. }
  15. private void Awake()
  16. {
  17. this.window.OnOpen = new Action(this.OnOpen);
  18. this.m_FullPathList = OvrIK.UpdateGeneralModelFileList();
  19. this.CreateList();
  20. UIButton component = UTY.GetChildObject(this.window.gameObject, "data list window/button reload", false).GetComponent<UIButton>();
  21. UIButton component2 = UTY.GetChildObject(this.window.gameObject, "data list window/button delete", false).GetComponent<UIButton>();
  22. EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.OnClickReload));
  23. EventDelegate.Add(component2.onClick, new EventDelegate.Callback(this.OnClickDelete));
  24. }
  25. private void OnOpen()
  26. {
  27. }
  28. private void CreateList()
  29. {
  30. List<string> fullPathList = this.m_FullPathList;
  31. this.m_WindowListData.Show<string, UIButton>(fullPathList, delegate(int index, string path, UIButton button)
  32. {
  33. UILabel componentInChildren = button.GetComponentInChildren<UILabel>();
  34. if (componentInChildren != null)
  35. {
  36. componentInChildren.text = Path.GetFileName(path);
  37. }
  38. EventDelegate.Add(button.onClick, delegate()
  39. {
  40. OvrIK.LoadGeneralModelFile(path);
  41. });
  42. });
  43. Debug.Log("[VRIK_GeneralObjectSetter] 一般オブジェクト一覧の読み込み完了\n要素数 : " + fullPathList.Count);
  44. }
  45. private void OnClickReload()
  46. {
  47. this.m_FullPathList = OvrIK.UpdateGeneralModelFileList();
  48. this.CreateList();
  49. }
  50. private void OnClickDelete()
  51. {
  52. OvrIK.DestroyGeneralModelAll();
  53. }
  54. [SerializeField]
  55. private ListViewerWindow m_WindowListData;
  56. private NGUIWindow m_Window;
  57. private List<string> m_FullPathList = new List<string>();
  58. }