HandSignShortcut.cs 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using I2.Loc;
  5. using UnityEngine;
  6. using UnityEngine.Events;
  7. using UnityEngine.UI;
  8. using wf;
  9. public class HandSignShortcut : MonoBehaviour
  10. {
  11. public static HandSignShortcut.Serializer config
  12. {
  13. get
  14. {
  15. HandSignShortcut.LoadDefault();
  16. return HandSignShortcut.m_Config;
  17. }
  18. }
  19. private static void LoadDefault()
  20. {
  21. if (HandSignShortcut.m_IsLoadedDefault)
  22. {
  23. return;
  24. }
  25. HandSignShortcut.m_IsLoadedDefault = true;
  26. HandSignShortcut.m_Config = HandSignShortcut.m_Config.ReadAndSet();
  27. }
  28. public bool IsLeftHand
  29. {
  30. get
  31. {
  32. return this.m_IsLeftHand;
  33. }
  34. set
  35. {
  36. this.m_IsLeftHand = value;
  37. }
  38. }
  39. public AVRController controller
  40. {
  41. get
  42. {
  43. return this.m_Controller;
  44. }
  45. private set
  46. {
  47. this.m_Controller = value;
  48. }
  49. }
  50. private CircleListSelectUI circleList
  51. {
  52. get
  53. {
  54. return this.m_CircleList;
  55. }
  56. set
  57. {
  58. this.m_CircleList = value;
  59. }
  60. }
  61. public bool isEnableHandUI
  62. {
  63. get
  64. {
  65. return this.circleList != null && this.circleList.gameObject.activeSelf;
  66. }
  67. set
  68. {
  69. if (this.circleList != null && this.circleList.gameObject.activeSelf != value)
  70. {
  71. this.circleList.gameObject.SetActive(value);
  72. }
  73. }
  74. }
  75. public void Init(bool isLeftHand)
  76. {
  77. this.IsLeftHand = isLeftHand;
  78. Debug.Log("初期化:ハンドサインのショートカットを実行するコンポーネント");
  79. this.controller = ((!isLeftHand) ? GameMain.Instance.OvrMgr.ovr_obj.right_controller.controller : GameMain.Instance.OvrMgr.ovr_obj.left_controller.controller);
  80. this.InitHand();
  81. this.InitCircleUI();
  82. }
  83. private void InitHand()
  84. {
  85. Maid maid = this.GetMaid();
  86. Transform t;
  87. string[] array;
  88. if (this.IsLeftHand)
  89. {
  90. t = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Hand", true);
  91. array = HandSignShortcut.strHandBoneNameL;
  92. }
  93. else
  94. {
  95. t = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Hand", true);
  96. array = HandSignShortcut.strHandBoneNameR;
  97. }
  98. this.m_TransformFingerArray = new Transform[array.Length];
  99. for (int i = 0; i < array.Length; i++)
  100. {
  101. this.m_TransformFingerArray[i] = CMT.SearchObjName(t, array[i], true);
  102. }
  103. }
  104. private void InitCircleUI()
  105. {
  106. string text = "OVR/CircleCommandUI/HandSignDataShortcut(Cotroller)";
  107. GameObject gameObject = Resources.Load<GameObject>(text);
  108. if (gameObject == null)
  109. {
  110. NDebug.Assert("[HandSignShortcut] " + text + "\nプレハブが見つかりません", false);
  111. }
  112. GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(gameObject);
  113. this.circleList = gameObject2.GetComponent<CircleListSelectUI>();
  114. this.CreateItemList(8);
  115. CircleCommandUI circleCommandUI = this.circleList.circleCommandUI;
  116. circleCommandUI.onSelect.AddListener(new UnityAction<GameObject>(this.OnSelectItem));
  117. circleCommandUI.onDeselect.AddListener(new UnityAction<GameObject>(this.OnDeselectItem));
  118. circleCommandUI.onDecide.AddListener(new UnityAction<GameObject>(this.OnDecide));
  119. this.circleList.controller = this.controller;
  120. Transform transform = gameObject2.transform;
  121. transform.SetParent(base.transform);
  122. transform.localPosition = Vector3.zero;
  123. transform.localRotation = Quaternion.identity;
  124. transform.localScale = Vector3.one;
  125. Vector3 b = new Vector3(0.03f, 0.15f, -0.05f);
  126. Vector3 localEulerAngles = new Vector3(35f, 15f, 0f);
  127. if (this.IsLeftHand)
  128. {
  129. b.Scale(new Vector3(-1f, 1f, 1f));
  130. localEulerAngles.Scale(new Vector3(1f, -1f, -1f));
  131. }
  132. transform.localPosition += b;
  133. transform.localEulerAngles = localEulerAngles;
  134. GameObject childObject = UTY.GetChildObject(this.circleList.gameObject, "CircleCommandUI/text right hand", false);
  135. childObject.GetComponent<Text>().text = ((!this.IsLeftHand) ? "右" : "左");
  136. Localize localize = childObject.AddComponent<Localize>();
  137. if (this.IsLeftHand)
  138. {
  139. Utility.SetLocalizeTerm(localize, "System/左", false);
  140. }
  141. else
  142. {
  143. Utility.SetLocalizeTerm(localize, "System/右", false);
  144. }
  145. }
  146. private void CreateItemList(int count)
  147. {
  148. List<HandSignShortcut.MaidFingerData> dataList = HandSignShortcut.config.maidFingerDataList;
  149. CircleCommandUI circleCommandUI = this.circleList.circleCommandUI;
  150. circleCommandUI.Show<Transform>(count, delegate(int index, Transform trans)
  151. {
  152. Text componentInChildren = trans.GetComponentInChildren<Text>();
  153. trans.localScale = Vector3.one * 0.5f;
  154. HandSignShortcut.ItemData itemData = trans.gameObject.AddComponent<HandSignShortcut.ItemData>();
  155. itemData.text = componentInChildren;
  156. itemData.SetLocalizeTerm("VAS/" + componentInChildren);
  157. if (index == 0)
  158. {
  159. itemData.data = null;
  160. return;
  161. }
  162. if (dataList.Count > index - 1)
  163. {
  164. itemData.data = dataList[index - 1];
  165. }
  166. else
  167. {
  168. itemData.data = null;
  169. }
  170. });
  171. }
  172. private void OnSelectItem(GameObject item)
  173. {
  174. if (item == null)
  175. {
  176. return;
  177. }
  178. Graphic component = item.GetComponent<Graphic>();
  179. if (component != null)
  180. {
  181. component.color = Color.red;
  182. }
  183. item.transform.localScale = Vector3.one;
  184. item.transform.SetAsLastSibling();
  185. if (ControllerShortcutSettingData.config.isDirectMode)
  186. {
  187. HandSignShortcut.ItemData component2 = item.GetComponent<HandSignShortcut.ItemData>();
  188. if (component2 != null)
  189. {
  190. this.m_NowTargetFingerData = component2.data;
  191. }
  192. else
  193. {
  194. this.m_NowTargetFingerData = null;
  195. }
  196. }
  197. }
  198. private void OnDeselectItem(GameObject item)
  199. {
  200. if (item == null)
  201. {
  202. return;
  203. }
  204. Graphic component = item.GetComponent<Graphic>();
  205. if (component != null)
  206. {
  207. Color white = Color.white;
  208. white.a = 0.5f;
  209. component.color = white;
  210. }
  211. item.transform.localScale = Vector3.one * 0.5f;
  212. }
  213. private void OnDecide(GameObject selectItem)
  214. {
  215. if (selectItem == null)
  216. {
  217. Debug.LogWarning("選択項目にnullが入った");
  218. return;
  219. }
  220. this.OnDeselectItem(selectItem);
  221. if (!ControllerShortcutSettingData.config.isEveryShowMode)
  222. {
  223. this.m_CircleList.SetActiveUI(false);
  224. }
  225. if (ControllerShortcutSettingData.config.isDirectMode)
  226. {
  227. return;
  228. }
  229. HandSignShortcut.ItemData component = selectItem.GetComponent<HandSignShortcut.ItemData>();
  230. if (component != null)
  231. {
  232. this.m_NowTargetFingerData = component.data;
  233. }
  234. else
  235. {
  236. this.m_NowTargetFingerData = null;
  237. }
  238. }
  239. private void Update()
  240. {
  241. if (this.m_NowTargetFingerData != null)
  242. {
  243. this.UpdateFinger(this.m_NowTargetFingerData);
  244. }
  245. else
  246. {
  247. this.UpdateHandSign();
  248. }
  249. }
  250. private void UpdateHandSign()
  251. {
  252. if (this.controller == null || !this.controller.HandEnable)
  253. {
  254. return;
  255. }
  256. AVRControllerButtons vrcontrollerButtons = this.controller.VRControllerButtons;
  257. if (vrcontrollerButtons != null)
  258. {
  259. if (GameMain.Instance.VRDeviceTypeID == GameMain.VRDeviceType.RIFT_TOUCH)
  260. {
  261. if (vrcontrollerButtons.GetTouch(AVRControllerButtons.TOUCH.REST) || vrcontrollerButtons.GetTouch(AVRControllerButtons.TOUCH.XA) || vrcontrollerButtons.GetTouch(AVRControllerButtons.TOUCH.YB))
  262. {
  263. this.FingerRateTarget(HandSignShortcut.Finger.Thumb, 1f);
  264. }
  265. else
  266. {
  267. this.FingerRateTarget(HandSignShortcut.Finger.Thumb, 0f);
  268. }
  269. if (vrcontrollerButtons.GetPress(AVRControllerButtons.BTN.TRIGGER))
  270. {
  271. this.FingerRateTarget(HandSignShortcut.Finger.Index, 1f);
  272. }
  273. else if (vrcontrollerButtons.GetTouch(AVRControllerButtons.TOUCH.TRIGGER))
  274. {
  275. this.FingerRateTarget(HandSignShortcut.Finger.Index, 0.5f);
  276. }
  277. else
  278. {
  279. this.FingerRateTarget(HandSignShortcut.Finger.Index, 0f);
  280. }
  281. if (vrcontrollerButtons.GetPress(AVRControllerButtons.BTN.GRIP))
  282. {
  283. this.FingerRateTarget(HandSignShortcut.Finger.Middle, 1f);
  284. this.FingerRateTarget(HandSignShortcut.Finger.Ring, 1f);
  285. this.FingerRateTarget(HandSignShortcut.Finger.Little, 1f);
  286. }
  287. else
  288. {
  289. this.FingerRateTarget(HandSignShortcut.Finger.Middle, 0f);
  290. this.FingerRateTarget(HandSignShortcut.Finger.Ring, 0f);
  291. this.FingerRateTarget(HandSignShortcut.Finger.Little, 0f);
  292. }
  293. }
  294. else if (GameMain.Instance.VRDeviceTypeID == GameMain.VRDeviceType.VIVE)
  295. {
  296. this.FingerRateTarget(HandSignShortcut.Finger.Thumb, vrcontrollerButtons.GetTriggerRate());
  297. this.FingerRateTarget(HandSignShortcut.Finger.Index, vrcontrollerButtons.GetTriggerRate());
  298. this.FingerRateTarget(HandSignShortcut.Finger.Middle, vrcontrollerButtons.GetTriggerRate());
  299. this.FingerRateTarget(HandSignShortcut.Finger.Ring, vrcontrollerButtons.GetTriggerRate());
  300. this.FingerRateTarget(HandSignShortcut.Finger.Little, vrcontrollerButtons.GetTriggerRate());
  301. }
  302. }
  303. for (int i = 0; i < 5; i++)
  304. {
  305. this.FingerRateUpdate((HandSignShortcut.Finger)i, this.m_fTargetRate[i]);
  306. }
  307. }
  308. private void FingerRateTarget(HandSignShortcut.Finger f_eFinger, float f_fRate)
  309. {
  310. this.m_fTargetRate[(int)f_eFinger] = f_fRate;
  311. }
  312. private void FingerRateUpdate(HandSignShortcut.Finger f_eFinger, float f_fRate)
  313. {
  314. int num = (int)(f_eFinger * HandSignShortcut.Finger.Ring);
  315. for (int i = num; i < num + 3; i++)
  316. {
  317. if (this.IsLeftHand)
  318. {
  319. this.m_TransformFingerArray[i].localRotation = Quaternion.Lerp(this.m_TransformFingerArray[i].localRotation, Quaternion.Lerp(HandSignShortcut.m_aryHandRot[0, i], HandSignShortcut.m_aryHandRot[1, i], f_fRate), 0.25f);
  320. }
  321. else
  322. {
  323. this.m_TransformFingerArray[i].localRotation = Quaternion.Lerp(this.m_TransformFingerArray[i].localRotation, Quaternion.Lerp(HandSignShortcut.m_aryHandRot[2, i], HandSignShortcut.m_aryHandRot[3, i], f_fRate), 0.25f);
  324. }
  325. }
  326. }
  327. private void UpdateFinger(HandSignShortcut.MaidFingerData data)
  328. {
  329. Quaternion[] array = (!this.IsLeftHand) ? data.rightFingerData : data.leftFingerData;
  330. for (int i = 0; i < this.m_TransformFingerArray.Length; i++)
  331. {
  332. this.m_TransformFingerArray[i].localRotation = Quaternion.Lerp(this.m_TransformFingerArray[i].localRotation, array[i], 0.25f);
  333. }
  334. }
  335. private Maid GetMaid()
  336. {
  337. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  338. return characterMgr.GetMaid(0);
  339. }
  340. private void OnApplicationQuit()
  341. {
  342. this.m_IsQuitting = true;
  343. }
  344. private void OnDestroy()
  345. {
  346. if (this.m_IsQuitting)
  347. {
  348. return;
  349. }
  350. if (this.circleList != null && this.circleList.gameObject != null)
  351. {
  352. UnityEngine.Object.Destroy(this.circleList.gameObject);
  353. Debug.Log("[HandSignShortcut] コントローラについているUIを破棄しました");
  354. }
  355. }
  356. // Note: this type is marked as 'beforefieldinit'.
  357. static HandSignShortcut()
  358. {
  359. Quaternion[,] array = new Quaternion[4, 15];
  360. array[0, 0] = new Quaternion(1.379457E-08f, -1.907173E-10f, -0.1001217f, 0.9949752f);
  361. array[0, 1] = new Quaternion(-3.348364E-08f, -2.288052E-09f, -0.05697599f, 0.9983756f);
  362. array[0, 2] = new Quaternion(0.4853954f, -0.1902075f, 0.1155978f, 0.8454878f);
  363. array[0, 3] = new Quaternion(-2.555888E-09f, 1.190041E-09f, -0.08838178f, 0.9960867f);
  364. array[0, 4] = new Quaternion(-3.708266E-09f, -4.232382E-11f, -0.1423017f, 0.9898233f);
  365. array[0, 5] = new Quaternion(0.005196964f, -0.009313619f, -0.07643344f, 0.9970177f);
  366. array[0, 6] = new Quaternion(1.469708E-09f, -2.337872E-09f, -0.08838177f, 0.9960867f);
  367. array[0, 7] = new Quaternion(-4.677417E-09f, -1.311283E-08f, -0.1086997f, 0.9940746f);
  368. array[0, 8] = new Quaternion(-0.001879324f, -0.005337666f, -0.0991221f, 0.9950592f);
  369. array[0, 9] = new Quaternion(-8.490085E-09f, -1.805363E-09f, -0.0796621f, 0.9968219f);
  370. array[0, 10] = new Quaternion(2.300491E-09f, 3.334659E-09f, -0.1239805f, 0.9922847f);
  371. array[0, 11] = new Quaternion(-0.006921342f, 0.001893361f, -0.09829046f, 0.9951319f);
  372. array[0, 12] = new Quaternion(-5.701029E-09f, -1.521331E-09f, -0.05449884f, 0.9985139f);
  373. array[0, 13] = new Quaternion(3.803335E-09f, -5.725684E-09f, -0.1423017f, 0.9898233f);
  374. array[0, 14] = new Quaternion(-0.01357147f, 0.02850812f, -0.08513741f, 0.9958689f);
  375. array[1, 0] = new Quaternion(6.932151E-09f, -2.730647E-09f, -0.3665012f, 0.9304176f);
  376. array[1, 1] = new Quaternion(-1.952852E-08f, -2.699741E-08f, -0.1618618f, 0.9868135f);
  377. array[1, 2] = new Quaternion(0.7708589f, -0.2672266f, 0.03713043f, 0.577051f);
  378. array[1, 3] = new Quaternion(9.870518E-10f, 1.579613E-09f, -0.5299194f, 0.8480481f);
  379. array[1, 4] = new Quaternion(-5.034789E-09f, -5.799267E-09f, -0.8191521f, 0.5735765f);
  380. array[1, 5] = new Quaternion(0.0478053f, -0.01974053f, -0.5880075f, 0.8072003f);
  381. array[1, 6] = new Quaternion(8.812074E-09f, -1.401741E-08f, -0.5299194f, 0.8480481f);
  382. array[1, 7] = new Quaternion(-1.043265E-08f, 1.477225E-09f, -0.7992581f, 0.6009881f);
  383. array[1, 8] = new Quaternion(-0.009090314f, -0.01649067f, -0.6061373f, 0.7951371f);
  384. array[1, 9] = new Quaternion(-2.784401E-08f, 1.160059E-08f, -0.5224781f, 0.8526527f);
  385. array[1, 10] = new Quaternion(1.204624E-08f, 8.771129E-09f, -0.8084095f, 0.5886205f);
  386. array[1, 11] = new Quaternion(-0.04368013f, 0.007996441f, -0.6048046f, 0.7951349f);
  387. array[1, 12] = new Quaternion(-3.325827E-08f, 2.027481E-09f, -0.5008097f, 0.8655574f);
  388. array[1, 13] = new Quaternion(4.887594E-09f, -3.295959E-08f, -0.8191521f, 0.5735765f);
  389. array[1, 14] = new Quaternion(-0.09800828f, 0.05454942f, -0.591058f, 0.7987924f);
  390. array[2, 0] = new Quaternion(-1.299039E-08f, 7.939377E-10f, -0.08632442f, 0.9962671f);
  391. array[2, 1] = new Quaternion(-1.412307E-08f, -4.882294E-09f, -0.05340298f, 0.9985731f);
  392. array[2, 2] = new Quaternion(-0.4710969f, 0.1764064f, 0.1206711f, 0.8557962f);
  393. array[2, 3] = new Quaternion(-1.785701E-09f, -1.246846E-08f, -0.06366991f, 0.9979711f);
  394. array[2, 4] = new Quaternion(-5.778726E-11f, -1.242248E-08f, -0.1014653f, 0.9948391f);
  395. array[2, 5] = new Quaternion(-0.002611603f, 0.001185287f, -0.04763259f, 0.9988608f);
  396. array[2, 6] = new Quaternion(1.790176E-09f, -1.245129E-08f, -0.0636699f, 0.9979711f);
  397. array[2, 7] = new Quaternion(5.652268E-09f, 1.780454E-09f, -0.06771687f, 0.9977046f);
  398. array[2, 8] = new Quaternion(0.001466242f, 0.004677885f, -0.07036161f, 0.9975095f);
  399. array[2, 9] = new Quaternion(7.64029E-09f, 7.058498E-09f, -0.05493468f, 0.99849f);
  400. array[2, 10] = new Quaternion(-2.104634E-09f, -7.598384E-09f, -0.08305829f, 0.9965447f);
  401. array[2, 11] = new Quaternion(0.004817214f, 0.003811401f, -0.0695642f, 0.9975586f);
  402. array[2, 12] = new Quaternion(2.864904E-09f, -1.440215E-08f, -0.02973721f, 0.9995578f);
  403. array[2, 13] = new Quaternion(-7.071282E-10f, -5.241497E-09f, -0.1014653f, 0.9948391f);
  404. array[2, 14] = new Quaternion(0.00861063f, -0.01516612f, -0.05657673f, 0.998246f);
  405. array[3, 0] = new Quaternion(7.66758E-09f, -1.102812E-08f, -0.3665012f, 0.9304176f);
  406. array[3, 1] = new Quaternion(-8.709043E-09f, -7.065411E-09f, -0.1618618f, 0.9868135f);
  407. array[3, 2] = new Quaternion(-0.7708589f, 0.2672265f, 0.03713048f, 0.577051f);
  408. array[3, 3] = new Quaternion(-8.292553E-09f, 7.889813E-10f, -0.5299194f, 0.8480481f);
  409. array[3, 4] = new Quaternion(6.103158E-09f, 4.273478E-09f, -0.8191521f, 0.5735765f);
  410. array[3, 5] = new Quaternion(-0.0478053f, 0.01974053f, -0.5880075f, 0.8072003f);
  411. array[3, 6] = new Quaternion(-1.288366E-08f, 7.501511E-09f, -0.5299194f, 0.8480481f);
  412. array[3, 7] = new Quaternion(1.786481E-08f, 1.343313E-08f, -0.7992581f, 0.6009881f);
  413. array[3, 8] = new Quaternion(0.009090304f, 0.01649068f, -0.6061373f, 0.7951371f);
  414. array[3, 9] = new Quaternion(1.513849E-08f, -3.815058E-09f, -0.5224782f, 0.8526527f);
  415. array[3, 10] = new Quaternion(-1.643181E-08f, -2.748009E-09f, -0.8084095f, 0.5886205f);
  416. array[3, 11] = new Quaternion(0.04368011f, -0.007996418f, -0.6048046f, 0.7951349f);
  417. array[3, 12] = new Quaternion(1.196498E-08f, -9.074872E-09f, -0.5008097f, 0.8655574f);
  418. array[3, 13] = new Quaternion(-4.887593E-09f, 3.295959E-08f, -0.8191521f, 0.5735765f);
  419. array[3, 14] = new Quaternion(0.09800829f, -0.0545494f, -0.5910579f, 0.7987924f);
  420. HandSignShortcut.m_aryHandRot = array;
  421. }
  422. [SerializeField]
  423. private CircleListSelectUI m_CircleList;
  424. private static HandSignShortcut.Serializer m_Config = new HandSignShortcut.Serializer();
  425. private static bool m_IsLoadedDefault = false;
  426. private Transform[] m_TransformFingerArray;
  427. private static readonly string[] strHandBoneNameL = new string[]
  428. {
  429. "Bip01 L Finger02",
  430. "Bip01 L Finger01",
  431. "Bip01 L Finger0",
  432. "Bip01 L Finger12",
  433. "Bip01 L Finger11",
  434. "Bip01 L Finger1",
  435. "Bip01 L Finger22",
  436. "Bip01 L Finger21",
  437. "Bip01 L Finger2",
  438. "Bip01 L Finger32",
  439. "Bip01 L Finger31",
  440. "Bip01 L Finger3",
  441. "Bip01 L Finger42",
  442. "Bip01 L Finger41",
  443. "Bip01 L Finger4"
  444. };
  445. private static readonly string[] strHandBoneNameR = new string[]
  446. {
  447. "Bip01 R Finger02",
  448. "Bip01 R Finger01",
  449. "Bip01 R Finger0",
  450. "Bip01 R Finger12",
  451. "Bip01 R Finger11",
  452. "Bip01 R Finger1",
  453. "Bip01 R Finger22",
  454. "Bip01 R Finger21",
  455. "Bip01 R Finger2",
  456. "Bip01 R Finger32",
  457. "Bip01 R Finger31",
  458. "Bip01 R Finger3",
  459. "Bip01 R Finger42",
  460. "Bip01 R Finger41",
  461. "Bip01 R Finger4"
  462. };
  463. private static readonly Quaternion[,] m_aryHandRot;
  464. private bool m_IsLeftHand;
  465. private AVRController m_Controller;
  466. private float[] m_fTargetRate = new float[5];
  467. private HandSignShortcut.MaidFingerData m_NowTargetFingerData;
  468. private bool m_IsQuitting;
  469. [Serializable]
  470. public class Serializer : ISerializationCallbackReceiver
  471. {
  472. public void OnBeforeSerialize()
  473. {
  474. this.m_nVersion = 1570;
  475. }
  476. public void OnAfterDeserialize()
  477. {
  478. }
  479. public bool Write()
  480. {
  481. string contents = JsonUtility.ToJson(this, true);
  482. string path = Path.Combine(GameMain.Instance.SerializeStorageManager.StoreDirectoryPath, "MaidFingerDataList.json");
  483. try
  484. {
  485. File.WriteAllText(path, contents);
  486. }
  487. catch
  488. {
  489. Debug.LogError("MaidFingerDataList.json の書き込みに失敗。");
  490. return false;
  491. }
  492. return true;
  493. }
  494. public HandSignShortcut.Serializer ReadAndSet()
  495. {
  496. string path = Path.Combine(GameMain.Instance.SerializeStorageManager.StoreDirectoryPath, "MaidFingerDataList.json");
  497. if (!File.Exists(path))
  498. {
  499. this.CreateDefaultData();
  500. this.Write();
  501. }
  502. string json;
  503. try
  504. {
  505. json = File.ReadAllText(path);
  506. }
  507. catch
  508. {
  509. Debug.LogError("MaidFingerDataList.json の読込に失敗。");
  510. return this;
  511. }
  512. return JsonUtility.FromJson<HandSignShortcut.Serializer>(json);
  513. }
  514. private void CreateDefaultData()
  515. {
  516. this.maidFingerDataList = new List<HandSignShortcut.MaidFingerData>();
  517. this.maidFingerDataList.Add(new HandSignShortcut.MaidFingerData("パー", new Quaternion[]
  518. {
  519. new Quaternion(1.467912E-08f, -6.667659E-09f, -0.04146498f, 0.99914f),
  520. new Quaternion(-1.327911E-08f, 7.618504E-09f, -0.006113322f, 0.9999813f),
  521. new Quaternion(0.3676831f, -0.3100421f, 0.1039245f, 0.8705646f),
  522. new Quaternion(-1.67299E-09f, 3.947202E-09f, -0.01237995f, 0.9999234f),
  523. new Quaternion(-1.825179E-09f, 3.798766E-09f, -0.01925841f, 0.9998146f),
  524. new Quaternion(0.0009547397f, -0.1243148f, 0.01200425f, 0.9921698f),
  525. new Quaternion(2.058673E-10f, -3.274742E-10f, -0.01237995f, 0.9999234f),
  526. new Quaternion(-3.4198E-09f, -1.477873E-08f, 0.01461135f, 0.9998932f),
  527. new Quaternion(-0.0006127622f, -0.003308513f, -0.01102171f, 0.9999336f),
  528. new Quaternion(-7.097293E-09f, -1.542719E-08f, -0.003629622f, 0.9999934f),
  529. new Quaternion(1.494679E-09f, -1.210031E-08f, -0.0007735032f, 0.9999997f),
  530. new Quaternion(-0.0008713655f, 0.08438367f, -0.010264f, 0.9963801f),
  531. new Quaternion(-1.4273E-09f, -7.799848E-09f, 0.02158942f, 0.9997669f),
  532. new Quaternion(2.313607E-09f, -7.748858E-10f, -0.01925842f, 0.9998146f),
  533. new Quaternion(-0.002091327f, 0.2073798f, 0.002760789f, 0.9782544f)
  534. }, new Quaternion[]
  535. {
  536. new Quaternion(-1.467912E-08f, 6.667659E-09f, -0.04146498f, 0.99914f),
  537. new Quaternion(1.327911E-08f, -7.618504E-09f, -0.006113322f, 0.9999813f),
  538. new Quaternion(-0.3676831f, 0.3100421f, 0.1039245f, 0.8705646f),
  539. new Quaternion(1.67299E-09f, -3.947202E-09f, -0.01237995f, 0.9999234f),
  540. new Quaternion(1.825179E-09f, -3.798766E-09f, -0.01925841f, 0.9998146f),
  541. new Quaternion(-0.0009547397f, 0.1243148f, 0.01200425f, 0.9921698f),
  542. new Quaternion(-2.058673E-10f, 3.274742E-10f, -0.01237995f, 0.9999234f),
  543. new Quaternion(3.4198E-09f, 1.477873E-08f, 0.01461135f, 0.9998932f),
  544. new Quaternion(0.0006127622f, 0.003308513f, -0.01102171f, 0.9999336f),
  545. new Quaternion(7.097293E-09f, 1.542719E-08f, -0.003629622f, 0.9999934f),
  546. new Quaternion(-1.494679E-09f, 1.210031E-08f, -0.0007735032f, 0.9999997f),
  547. new Quaternion(0.0008713655f, -0.08438367f, -0.010264f, 0.9963801f),
  548. new Quaternion(1.4273E-09f, 7.799848E-09f, 0.02158942f, 0.9997669f),
  549. new Quaternion(-2.313607E-09f, 7.748858E-10f, -0.01925842f, 0.9998146f),
  550. new Quaternion(0.002091327f, -0.2073798f, 0.002760789f, 0.9782544f)
  551. }));
  552. this.maidFingerDataList.Add(new HandSignShortcut.MaidFingerData("チョキ", new Quaternion[]
  553. {
  554. new Quaternion(6.932151E-09f, -2.730647E-09f, -0.3665012f, 0.9304176f),
  555. new Quaternion(-1.952852E-08f, -2.699741E-08f, -0.1618618f, 0.9868135f),
  556. new Quaternion(0.7708589f, -0.2672266f, 0.03713044f, 0.577051f),
  557. new Quaternion(-1.692222E-09f, 3.961451E-09f, -0.008243912f, 0.999966f),
  558. new Quaternion(-1.793476E-09f, 3.862969E-09f, -0.01279752f, 0.9999181f),
  559. new Quaternion(0.0005797216f, -0.1249451f, 0.01676745f, 0.9920218f),
  560. new Quaternion(1.370887E-10f, -2.180677E-10f, -0.008243906f, 0.999966f),
  561. new Quaternion(-3.352409E-09f, -1.485988E-08f, 0.02107204f, 0.999778f),
  562. new Quaternion(-0.0005442168f, -0.003198181f, -0.006260789f, 0.9999751f),
  563. new Quaternion(-2.784401E-08f, 1.160059E-08f, -0.5224781f, 0.8526527f),
  564. new Quaternion(1.204624E-08f, 8.771128E-09f, -0.8084095f, 0.5886205f),
  565. new Quaternion(-0.04368013f, 0.00799644f, -0.6048046f, 0.7951349f),
  566. new Quaternion(-3.325827E-08f, 2.027481E-09f, -0.5008098f, 0.8655574f),
  567. new Quaternion(4.887593E-09f, -3.295959E-08f, -0.819152f, 0.5735765f),
  568. new Quaternion(-0.09800828f, 0.05454942f, -0.591058f, 0.7987923f)
  569. }, new Quaternion[]
  570. {
  571. new Quaternion(-6.932151E-09f, 2.730647E-09f, -0.3665012f, 0.9304176f),
  572. new Quaternion(1.952852E-08f, 2.699741E-08f, -0.1618618f, 0.9868135f),
  573. new Quaternion(-0.7708589f, 0.2672266f, 0.03713044f, 0.577051f),
  574. new Quaternion(1.692222E-09f, -3.961451E-09f, -0.008243912f, 0.999966f),
  575. new Quaternion(1.793476E-09f, -3.862969E-09f, -0.01279752f, 0.9999181f),
  576. new Quaternion(-0.0005797216f, 0.1249451f, 0.01676745f, 0.9920218f),
  577. new Quaternion(-1.370887E-10f, 2.180677E-10f, -0.008243906f, 0.999966f),
  578. new Quaternion(3.352409E-09f, 1.485988E-08f, 0.02107204f, 0.999778f),
  579. new Quaternion(0.0005442168f, 0.003198181f, -0.006260789f, 0.9999751f),
  580. new Quaternion(2.784401E-08f, -1.160059E-08f, -0.5224781f, 0.8526527f),
  581. new Quaternion(-1.204624E-08f, -8.771128E-09f, -0.8084095f, 0.5886205f),
  582. new Quaternion(0.04368013f, -0.00799644f, -0.6048046f, 0.7951349f),
  583. new Quaternion(3.325827E-08f, -2.027481E-09f, -0.5008098f, 0.8655574f),
  584. new Quaternion(-4.887593E-09f, 3.295959E-08f, -0.819152f, 0.5735765f),
  585. new Quaternion(0.09800828f, -0.05454942f, -0.591058f, 0.7987923f)
  586. }));
  587. this.maidFingerDataList.Add(new HandSignShortcut.MaidFingerData("グー", new Quaternion[]
  588. {
  589. new Quaternion(6.932151E-09f, -2.730646E-09f, -0.3665012f, 0.9304176f),
  590. new Quaternion(-1.952852E-08f, -2.699741E-08f, -0.1618618f, 0.9868135f),
  591. new Quaternion(0.7708589f, -0.2672266f, 0.03713043f, 0.577051f),
  592. new Quaternion(9.870518E-10f, 1.579613E-09f, -0.5299194f, 0.8480481f),
  593. new Quaternion(-5.034789E-09f, -5.799266E-09f, -0.819152f, 0.5735765f),
  594. new Quaternion(0.04780529f, -0.01974053f, -0.5880075f, 0.8072002f),
  595. new Quaternion(8.812074E-09f, -1.401741E-08f, -0.5299194f, 0.8480481f),
  596. new Quaternion(-1.043265E-08f, 1.477225E-09f, -0.7992581f, 0.6009881f),
  597. new Quaternion(-0.009090314f, -0.01649067f, -0.6061373f, 0.7951371f),
  598. new Quaternion(-2.784401E-08f, 1.160059E-08f, -0.5224781f, 0.8526527f),
  599. new Quaternion(1.204624E-08f, 8.771128E-09f, -0.8084095f, 0.5886205f),
  600. new Quaternion(-0.04368013f, 0.00799644f, -0.6048046f, 0.7951349f),
  601. new Quaternion(-3.325827E-08f, 2.027481E-09f, -0.5008098f, 0.8655574f),
  602. new Quaternion(4.887593E-09f, -3.295959E-08f, -0.819152f, 0.5735765f),
  603. new Quaternion(-0.09800828f, 0.05454942f, -0.591058f, 0.7987923f)
  604. }, new Quaternion[]
  605. {
  606. new Quaternion(-6.932151E-09f, 2.730646E-09f, -0.3665012f, 0.9304176f),
  607. new Quaternion(1.952852E-08f, 2.699741E-08f, -0.1618618f, 0.9868135f),
  608. new Quaternion(-0.7708589f, 0.2672266f, 0.03713043f, 0.577051f),
  609. new Quaternion(-9.870518E-10f, -1.579613E-09f, -0.5299194f, 0.8480481f),
  610. new Quaternion(5.034789E-09f, 5.799266E-09f, -0.819152f, 0.5735765f),
  611. new Quaternion(-0.04780529f, 0.01974053f, -0.5880075f, 0.8072002f),
  612. new Quaternion(-8.812074E-09f, 1.401741E-08f, -0.5299194f, 0.8480481f),
  613. new Quaternion(1.043265E-08f, -1.477225E-09f, -0.7992581f, 0.6009881f),
  614. new Quaternion(0.009090314f, 0.01649067f, -0.6061373f, 0.7951371f),
  615. new Quaternion(2.784401E-08f, -1.160059E-08f, -0.5224781f, 0.8526527f),
  616. new Quaternion(-1.204624E-08f, -8.771128E-09f, -0.8084095f, 0.5886205f),
  617. new Quaternion(0.04368013f, -0.00799644f, -0.6048046f, 0.7951349f),
  618. new Quaternion(3.325827E-08f, -2.027481E-09f, -0.5008098f, 0.8655574f),
  619. new Quaternion(-4.887593E-09f, 3.295959E-08f, -0.819152f, 0.5735765f),
  620. new Quaternion(0.09800828f, -0.05454942f, -0.591058f, 0.7987923f)
  621. }));
  622. this.maidFingerDataList.Add(new HandSignShortcut.MaidFingerData("指差し", new Quaternion[]
  623. {
  624. new Quaternion(6.932151E-09f, -2.730647E-09f, -0.3665012f, 0.9304176f),
  625. new Quaternion(-1.952852E-08f, -2.699741E-08f, -0.1618618f, 0.9868135f),
  626. new Quaternion(0.7708589f, -0.2672266f, 0.03713044f, 0.577051f),
  627. new Quaternion(-1.730466E-09f, 3.989648E-09f, 1.928734E-09f, 1f),
  628. new Quaternion(-1.730466E-09f, 3.989648E-09f, 1.928734E-09f, 1f),
  629. new Quaternion(-0.0001667258f, -0.1261909f, 0.02624661f, 0.9916587f),
  630. new Quaternion(8.812074E-09f, -1.401741E-08f, -0.5299194f, 0.8480481f),
  631. new Quaternion(-1.043265E-08f, 1.477225E-09f, -0.7992581f, 0.6009881f),
  632. new Quaternion(-0.009090314f, -0.01649067f, -0.6061373f, 0.7951371f),
  633. new Quaternion(-2.784401E-08f, 1.160059E-08f, -0.5224781f, 0.8526527f),
  634. new Quaternion(1.204624E-08f, 8.771128E-09f, -0.8084095f, 0.5886205f),
  635. new Quaternion(-0.04368013f, 0.00799644f, -0.6048046f, 0.7951349f),
  636. new Quaternion(-3.325827E-08f, 2.027481E-09f, -0.5008098f, 0.8655574f),
  637. new Quaternion(4.887593E-09f, -3.295959E-08f, -0.819152f, 0.5735765f),
  638. new Quaternion(-0.09800828f, 0.05454942f, -0.591058f, 0.7987923f)
  639. }, new Quaternion[]
  640. {
  641. new Quaternion(-6.932151E-09f, 2.730647E-09f, -0.3665012f, 0.9304176f),
  642. new Quaternion(1.952852E-08f, 2.699741E-08f, -0.1618618f, 0.9868135f),
  643. new Quaternion(-0.7708589f, 0.2672266f, 0.03713044f, 0.577051f),
  644. new Quaternion(1.730466E-09f, -3.989648E-09f, 1.928734E-09f, 1f),
  645. new Quaternion(1.730466E-09f, -3.989648E-09f, 1.928734E-09f, 1f),
  646. new Quaternion(0.0001667258f, 0.1261909f, 0.02624661f, 0.9916587f),
  647. new Quaternion(-8.812074E-09f, 1.401741E-08f, -0.5299194f, 0.8480481f),
  648. new Quaternion(1.043265E-08f, -1.477225E-09f, -0.7992581f, 0.6009881f),
  649. new Quaternion(0.009090314f, 0.01649067f, -0.6061373f, 0.7951371f),
  650. new Quaternion(2.784401E-08f, -1.160059E-08f, -0.5224781f, 0.8526527f),
  651. new Quaternion(-1.204624E-08f, -8.771128E-09f, -0.8084095f, 0.5886205f),
  652. new Quaternion(0.04368013f, -0.00799644f, -0.6048046f, 0.7951349f),
  653. new Quaternion(3.325827E-08f, -2.027481E-09f, -0.5008098f, 0.8655574f),
  654. new Quaternion(-4.887593E-09f, 3.295959E-08f, -0.819152f, 0.5735765f),
  655. new Quaternion(0.09800828f, -0.05454942f, -0.591058f, 0.7987923f)
  656. }));
  657. this.maidFingerDataList.Add(new HandSignShortcut.MaidFingerData("サムズアップ", new Quaternion[]
  658. {
  659. new Quaternion(1.472499E-08f, -1.164853E-08f, -0.0242227f, 0.9997066f),
  660. new Quaternion(2.864741E-09f, 1.253174E-08f, 0.02121386f, 0.999775f),
  661. new Quaternion(0.3078066f, -0.4021123f, 0.08737727f, 0.8578613f),
  662. new Quaternion(9.870518E-10f, 1.579613E-09f, -0.5299194f, 0.8480481f),
  663. new Quaternion(-5.034789E-09f, -5.799266E-09f, -0.819152f, 0.5735765f),
  664. new Quaternion(0.04780529f, -0.01974053f, -0.5880075f, 0.8072002f),
  665. new Quaternion(8.812074E-09f, -1.401741E-08f, -0.5299194f, 0.8480481f),
  666. new Quaternion(-1.043265E-08f, 1.477225E-09f, -0.7992581f, 0.6009881f),
  667. new Quaternion(-0.009090314f, -0.01649067f, -0.6061373f, 0.7951371f),
  668. new Quaternion(-2.784401E-08f, 1.160059E-08f, -0.5224781f, 0.8526527f),
  669. new Quaternion(1.204624E-08f, 8.771129E-09f, -0.8084095f, 0.5886205f),
  670. new Quaternion(-0.04368013f, 0.007996442f, -0.6048046f, 0.7951349f),
  671. new Quaternion(-3.325827E-08f, 2.027481E-09f, -0.5008098f, 0.8655574f),
  672. new Quaternion(4.887593E-09f, -3.295959E-08f, -0.819152f, 0.5735765f),
  673. new Quaternion(-0.09800828f, 0.05454941f, -0.591058f, 0.7987923f)
  674. }, new Quaternion[]
  675. {
  676. new Quaternion(-1.472499E-08f, 1.164853E-08f, -0.0242227f, 0.9997066f),
  677. new Quaternion(-2.864741E-09f, -1.253174E-08f, 0.02121386f, 0.999775f),
  678. new Quaternion(-0.3078066f, 0.4021123f, 0.08737727f, 0.8578613f),
  679. new Quaternion(-9.870518E-10f, -1.579613E-09f, -0.5299194f, 0.8480481f),
  680. new Quaternion(5.034789E-09f, 5.799266E-09f, -0.819152f, 0.5735765f),
  681. new Quaternion(-0.04780529f, 0.01974053f, -0.5880075f, 0.8072002f),
  682. new Quaternion(-8.812074E-09f, 1.401741E-08f, -0.5299194f, 0.8480481f),
  683. new Quaternion(1.043265E-08f, -1.477225E-09f, -0.7992581f, 0.6009881f),
  684. new Quaternion(0.009090314f, 0.01649067f, -0.6061373f, 0.7951371f),
  685. new Quaternion(2.784401E-08f, -1.160059E-08f, -0.5224781f, 0.8526527f),
  686. new Quaternion(-1.204624E-08f, -8.771129E-09f, -0.8084095f, 0.5886205f),
  687. new Quaternion(0.04368013f, -0.007996442f, -0.6048046f, 0.7951349f),
  688. new Quaternion(3.325827E-08f, -2.027481E-09f, -0.5008098f, 0.8655574f),
  689. new Quaternion(-4.887593E-09f, 3.295959E-08f, -0.819152f, 0.5735765f),
  690. new Quaternion(0.09800828f, -0.05454941f, -0.591058f, 0.7987923f)
  691. }));
  692. this.maidFingerDataList.Add(new HandSignShortcut.MaidFingerData("電話サイン", new Quaternion[]
  693. {
  694. new Quaternion(1.479486E-08f, -8.781127E-09f, -0.02975121f, 0.9995574f),
  695. new Quaternion(-6.50015E-09f, 1.013705E-08f, 0.007386392f, 0.9999728f),
  696. new Quaternion(0.3369619f, -0.3488706f, 0.09791746f, 0.8689983f),
  697. new Quaternion(9.870518E-10f, 1.579613E-09f, -0.5299194f, 0.8480481f),
  698. new Quaternion(-5.034789E-09f, -5.799266E-09f, -0.819152f, 0.5735765f),
  699. new Quaternion(0.04780529f, -0.01974053f, -0.5880075f, 0.8072002f),
  700. new Quaternion(8.812074E-09f, -1.401741E-08f, -0.5299194f, 0.8480481f),
  701. new Quaternion(-1.043265E-08f, 1.477225E-09f, -0.7992581f, 0.6009881f),
  702. new Quaternion(-0.009090314f, -0.01649067f, -0.6061373f, 0.7951371f),
  703. new Quaternion(-2.784401E-08f, 1.160059E-08f, -0.5224781f, 0.8526527f),
  704. new Quaternion(1.204624E-08f, 8.771129E-09f, -0.8084095f, 0.5886205f),
  705. new Quaternion(-0.04368013f, 0.007996442f, -0.6048046f, 0.7951349f),
  706. new Quaternion(-8.023863E-10f, -9.682119E-09f, 0.03396483f, 0.999423f),
  707. new Quaternion(1.91605E-09f, -7.848716E-18f, -3.011494E-09f, 1f),
  708. new Quaternion(-0.0007191578f, 0.2631239f, 0.01688699f, 0.964614f)
  709. }, new Quaternion[]
  710. {
  711. new Quaternion(-1.479486E-08f, 8.781127E-09f, -0.02975121f, 0.9995574f),
  712. new Quaternion(6.50015E-09f, -1.013705E-08f, 0.007386392f, 0.9999728f),
  713. new Quaternion(-0.3369619f, 0.3488706f, 0.09791746f, 0.8689983f),
  714. new Quaternion(-9.870518E-10f, -1.579613E-09f, -0.5299194f, 0.8480481f),
  715. new Quaternion(5.034789E-09f, 5.799266E-09f, -0.819152f, 0.5735765f),
  716. new Quaternion(-0.04780529f, 0.01974053f, -0.5880075f, 0.8072002f),
  717. new Quaternion(-8.812074E-09f, 1.401741E-08f, -0.5299194f, 0.8480481f),
  718. new Quaternion(1.043265E-08f, -1.477225E-09f, -0.7992581f, 0.6009881f),
  719. new Quaternion(0.009090314f, 0.01649067f, -0.6061373f, 0.7951371f),
  720. new Quaternion(2.784401E-08f, -1.160059E-08f, -0.5224781f, 0.8526527f),
  721. new Quaternion(-1.204624E-08f, -8.771129E-09f, -0.8084095f, 0.5886205f),
  722. new Quaternion(0.04368013f, -0.007996442f, -0.6048046f, 0.7951349f),
  723. new Quaternion(8.023863E-10f, 9.682119E-09f, 0.03396483f, 0.999423f),
  724. new Quaternion(-1.91605E-09f, 7.848716E-18f, -3.011494E-09f, 1f),
  725. new Quaternion(0.0007191578f, -0.2631239f, 0.01688699f, 0.964614f)
  726. }));
  727. this.maidFingerDataList.Add(new HandSignShortcut.MaidFingerData("狐コンコン", new Quaternion[]
  728. {
  729. new Quaternion(0f, 0f, 0f, 1f),
  730. new Quaternion(-1.192093E-07f, 1.788139E-07f, -0.1335995f, 0.9910354f),
  731. new Quaternion(0.8534603f, -0.2756786f, -0.1541951f, 0.4145248f),
  732. new Quaternion(-1.490116E-09f, 4.470349E-09f, 2.048909E-09f, 1f),
  733. new Quaternion(-1.490116E-09f, 4.470349E-09f, 2.048909E-09f, 1f),
  734. new Quaternion(0.0003543059f, -0.1458506f, 0.02624475f, 0.9889584f),
  735. new Quaternion(1.291415E-08f, 1.295253E-07f, 0.01154917f, 0.9999333f),
  736. new Quaternion(1.487787E-07f, -4.237517E-08f, -0.5324296f, 0.8464743f),
  737. new Quaternion(-0.01350924f, -0.01311721f, -0.3475225f, 0.9374825f),
  738. new Quaternion(7.117304E-07f, -7.226793E-07f, -0.00915247f, 0.9999582f),
  739. new Quaternion(2.980232E-08f, 1.061708E-06f, -0.4032317f, 0.9150979f),
  740. new Quaternion(-0.1480011f, 0.04210641f, -0.4022999f, 0.9024841f),
  741. new Quaternion(-7.434641E-10f, -8.971124E-09f, 0.03396483f, 0.999423f),
  742. new Quaternion(2.048909E-09f, -8.673617E-18f, -3.166497E-09f, 1f),
  743. new Quaternion(-0.0003274615f, 0.2406898f, 0.01689912f, 0.9704549f)
  744. }, new Quaternion[]
  745. {
  746. new Quaternion(0f, 0f, 0f, 1f),
  747. new Quaternion(1.192093E-07f, -1.788139E-07f, -0.1335995f, 0.9910354f),
  748. new Quaternion(-0.8534603f, 0.2756786f, -0.1541951f, 0.4145248f),
  749. new Quaternion(1.490116E-09f, -4.470349E-09f, 2.048909E-09f, 1f),
  750. new Quaternion(1.490116E-09f, -4.470349E-09f, 2.048909E-09f, 1f),
  751. new Quaternion(-0.0003543059f, 0.1458506f, 0.02624475f, 0.9889584f),
  752. new Quaternion(-1.291415E-08f, -1.295253E-07f, 0.01154917f, 0.9999333f),
  753. new Quaternion(-1.487787E-07f, 4.237517E-08f, -0.5324296f, 0.8464743f),
  754. new Quaternion(0.01350924f, 0.01311721f, -0.3475225f, 0.9374825f),
  755. new Quaternion(-7.117304E-07f, 7.226793E-07f, -0.00915247f, 0.9999582f),
  756. new Quaternion(-2.980232E-08f, -1.061708E-06f, -0.4032317f, 0.9150979f),
  757. new Quaternion(0.1480011f, -0.04210641f, -0.4022999f, 0.9024841f),
  758. new Quaternion(7.434641E-10f, 8.971124E-09f, 0.03396483f, 0.999423f),
  759. new Quaternion(-2.048909E-09f, 8.673617E-18f, -3.166497E-09f, 1f),
  760. new Quaternion(0.0003274615f, -0.2406898f, 0.01689912f, 0.9704549f)
  761. }));
  762. }
  763. public List<HandSignShortcut.MaidFingerData> maidFingerDataList
  764. {
  765. get
  766. {
  767. return this.MaidFingerDataList;
  768. }
  769. set
  770. {
  771. this.MaidFingerDataList = value;
  772. }
  773. }
  774. private const string CONF_NAME = "MaidFingerDataList.json";
  775. [SerializeField]
  776. private int m_nVersion = 1570;
  777. [SerializeField]
  778. private List<HandSignShortcut.MaidFingerData> MaidFingerDataList = new List<HandSignShortcut.MaidFingerData>();
  779. }
  780. [Serializable]
  781. public class MaidFingerData
  782. {
  783. public MaidFingerData(string name, Quaternion[] leftFingerData, Quaternion[] rightFingerData)
  784. {
  785. if (leftFingerData.Length != 15)
  786. {
  787. string message = "[HandSignShortcut.MaidFingerData] 項目「" + name + "」の左手指データ数が不正です";
  788. Debug.LogError(message);
  789. NDebug.Assert(message, false);
  790. }
  791. if (rightFingerData.Length != 15)
  792. {
  793. string message2 = "[HandSignShortcut.MaidFingerData] 項目「" + name + "」の右手指データ数が不正です";
  794. Debug.LogError(message2);
  795. NDebug.Assert(message2, false);
  796. }
  797. this.name = name;
  798. this.leftFingerData = leftFingerData;
  799. this.rightFingerData = rightFingerData;
  800. }
  801. public MaidFingerData()
  802. {
  803. }
  804. public string name
  805. {
  806. get
  807. {
  808. return this.m_Name;
  809. }
  810. set
  811. {
  812. this.m_Name = value;
  813. }
  814. }
  815. public Quaternion[] leftFingerData
  816. {
  817. get
  818. {
  819. return this.m_LeftFingerRotArray;
  820. }
  821. set
  822. {
  823. this.m_LeftFingerRotArray = value;
  824. }
  825. }
  826. public Quaternion[] rightFingerData
  827. {
  828. get
  829. {
  830. return this.m_RightFingerRotArray;
  831. }
  832. set
  833. {
  834. this.m_RightFingerRotArray = value;
  835. }
  836. }
  837. public void GetMaidFingerData(Maid maid)
  838. {
  839. this.leftFingerData = new Quaternion[HandSignShortcut.strHandBoneNameL.Length];
  840. this.rightFingerData = new Quaternion[HandSignShortcut.strHandBoneNameR.Length];
  841. Transform t = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Hand", true);
  842. string[] array = HandSignShortcut.strHandBoneNameL;
  843. for (int i = 0; i < array.Length; i++)
  844. {
  845. this.leftFingerData[i] = CMT.SearchObjName(t, array[i], true).localRotation;
  846. }
  847. t = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Hand", true);
  848. array = HandSignShortcut.strHandBoneNameR;
  849. for (int j = 0; j < array.Length; j++)
  850. {
  851. this.rightFingerData[j] = CMT.SearchObjName(t, array[j], true).localRotation;
  852. }
  853. }
  854. public void ApplyMaidFingerData(Maid maid)
  855. {
  856. Transform transform = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Hand", true);
  857. string[] array = HandSignShortcut.strHandBoneNameL;
  858. for (int i = 0; i < array.Length; i++)
  859. {
  860. CMT.SearchObjName(maid.body0.m_Bones.transform, array[i], true).localRotation = this.leftFingerData[i];
  861. }
  862. transform = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Hand", true);
  863. array = HandSignShortcut.strHandBoneNameR;
  864. for (int j = 0; j < array.Length; j++)
  865. {
  866. CMT.SearchObjName(maid.body0.m_Bones.transform, array[j], true).localRotation = this.rightFingerData[j];
  867. }
  868. }
  869. public static HandSignShortcut.MaidFingerData Get(string name)
  870. {
  871. HandSignShortcut.MaidFingerData.CreateDataDic();
  872. HandSignShortcut.MaidFingerData result;
  873. HandSignShortcut.MaidFingerData.m_DataDic.TryGetValue(name, out result);
  874. return result;
  875. }
  876. public static void Add(HandSignShortcut.MaidFingerData data)
  877. {
  878. HandSignShortcut.MaidFingerData.CreateDataDic();
  879. if (data == null)
  880. {
  881. Debug.Log("[HandSignShortcut.MaidFingerData] 登録するデータが null でした");
  882. return;
  883. }
  884. if (HandSignShortcut.MaidFingerData.m_DataDic.ContainsKey(data.name))
  885. {
  886. Debug.Log("[HandSignShortcut.MaidFingerData] 既に「" + data.name + "」が登録されています");
  887. return;
  888. }
  889. HandSignShortcut.MaidFingerData.m_DataDic.Add(data.name, data);
  890. HandSignShortcut.config.maidFingerDataList.Add(data);
  891. }
  892. private static void CreateDataDic()
  893. {
  894. if (HandSignShortcut.MaidFingerData.m_DataDic != null)
  895. {
  896. return;
  897. }
  898. HandSignShortcut.MaidFingerData.m_DataDic = new Dictionary<string, HandSignShortcut.MaidFingerData>();
  899. foreach (HandSignShortcut.MaidFingerData maidFingerData in HandSignShortcut.config.maidFingerDataList)
  900. {
  901. HandSignShortcut.MaidFingerData.m_DataDic.Add(maidFingerData.name, maidFingerData);
  902. }
  903. }
  904. [SerializeField]
  905. private string m_Name;
  906. [SerializeField]
  907. private Quaternion[] m_LeftFingerRotArray;
  908. [SerializeField]
  909. private Quaternion[] m_RightFingerRotArray;
  910. private static Dictionary<string, HandSignShortcut.MaidFingerData> m_DataDic;
  911. }
  912. private class ItemData : MonoBehaviour
  913. {
  914. public HandSignShortcut.MaidFingerData data
  915. {
  916. get
  917. {
  918. return this.m_Data;
  919. }
  920. set
  921. {
  922. this.m_Data = value;
  923. this.UpdateText();
  924. }
  925. }
  926. public Text text { get; set; }
  927. private Localize localize { get; set; }
  928. public void SetLocalizeTerm(string key)
  929. {
  930. Localize localize2;
  931. if (this.localize == null)
  932. {
  933. Localize localize = this.text.gameObject.AddComponent<Localize>();
  934. this.localize = localize;
  935. localize2 = localize;
  936. }
  937. else
  938. {
  939. localize2 = this.localize;
  940. }
  941. Utility.SetLocalizeTerm(localize2, key, false);
  942. }
  943. private void UpdateText()
  944. {
  945. if (this.text == null)
  946. {
  947. return;
  948. }
  949. if (this.m_Data == null)
  950. {
  951. this.text.text = "自由モード";
  952. this.SetLocalizeTerm("VAS/自由モード");
  953. }
  954. else
  955. {
  956. this.text.text = this.m_Data.name;
  957. this.SetLocalizeTerm("VAS/" + this.m_Data.name);
  958. }
  959. }
  960. private HandSignShortcut.MaidFingerData m_Data;
  961. }
  962. private enum Finger
  963. {
  964. Thumb,
  965. Index,
  966. Middle,
  967. Ring,
  968. Little,
  969. Max
  970. }
  971. }