VRTouchButtonCtrl.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using MaidStatus;
  5. using UnityEngine;
  6. public class VRTouchButtonCtrl : MonoBehaviour
  7. {
  8. public void Init(GameObject goPresetButtonPanel, Maid maid)
  9. {
  10. this.m_goPresetButtonPanel = goPresetButtonPanel;
  11. this.m_maid = maid;
  12. this.m_goItemPresetsViewer = UTY.GetChildObject(this.m_goPresetButtonPanel, "ItemPresetsViewer", false);
  13. this.m_listPresetBtn = new Dictionary<string, VRTouchButtonCtrl.PresetButton>();
  14. this.m_listItemPresetBtn = new Dictionary<string, VRTouchButtonCtrl.PresetButton>();
  15. IEnumerator enumerator = Enum.GetValues(typeof(VRTouchButtonCtrl.LeftButtons)).GetEnumerator();
  16. try
  17. {
  18. while (enumerator.MoveNext())
  19. {
  20. object obj = enumerator.Current;
  21. this.initBtnList("LeftButtons", ((VRTouchButtonCtrl.LeftButtons)obj).ToString());
  22. }
  23. }
  24. finally
  25. {
  26. IDisposable disposable;
  27. if ((disposable = (enumerator as IDisposable)) != null)
  28. {
  29. disposable.Dispose();
  30. }
  31. }
  32. this.m_goParentItemBtn = UTY.GetChildObject(this.m_goItemPresetsViewer, "Scroll View/Grid", false);
  33. UIButton component = UTY.GetChildObject(this.m_goPresetButtonPanel, "PresetButtons/LeftButtons/BG", false).GetComponent<UIButton>();
  34. this.activeColor = new Color(component.defaultColor.r, component.defaultColor.g, component.defaultColor.b, 1f);
  35. this.inActiveColor = component.defaultColor;
  36. this.m_sbScrollBar = UTY.GetChildObject(this.m_goItemPresetsViewer, "Scroll Bar", false).GetComponent<UIScrollBar>();
  37. this.m_goItemScrollView = UTY.GetChildObject(this.m_goPresetButtonPanel, "ItemPresetsViewer/Scroll View", false);
  38. this.m_pItemScrollViewPanel = this.m_goItemScrollView.GetComponent<UIPanel>();
  39. GameObject childObject = UTY.GetChildObject(this.m_goPresetButtonPanel, "ItemPresetsViewer/BG", false);
  40. this.m_spScrollViewBG = childObject.GetComponent<UISprite>();
  41. this.m_maxScrollViewWidth = (int)this.m_pItemScrollViewPanel.baseClipRegion.z;
  42. this.m_scrollViewSize = new Vector4(0f, 0f, (float)this.m_maxScrollViewWidth, (float)((int)this.m_pItemScrollViewPanel.baseClipRegion.w));
  43. this.m_scrollViewSoftnessX = (int)this.m_pItemScrollViewPanel.clipSoftness.x;
  44. this.m_nguiContentWidth = GameObject.Find("UI Root").GetComponent<UIRoot>().manualWidth;
  45. this.m_ajustedNguiContentWidth = this.m_nguiContentWidth - 650;
  46. GameObject childObject2 = UTY.GetChildObject(this.m_goPresetButtonPanel, "PresetButtons", false);
  47. float x = UTY.GetChildObject(childObject2, "LeftButtons/Pose", false).transform.position.x;
  48. float x2 = UTY.GetChildObject(childObject2, "LeftButtons/Clothes", false).transform.position.x;
  49. float x3 = UTY.GetChildObject(childObject2, "LeftButtons/BG", false).transform.position.x;
  50. this.dicBtnPosX = new Dictionary<string, float>
  51. {
  52. {
  53. "Pose",
  54. x
  55. },
  56. {
  57. "Clothes",
  58. x2
  59. },
  60. {
  61. "BG",
  62. x3
  63. }
  64. };
  65. this.m_goItemSpriteBtn = (Resources.Load("SceneEdit/PresetButton/Prefabs/ItemSpritePresetButton") as GameObject);
  66. this.m_goItemTxtrBtn = (Resources.Load("SceneEdit/PresetButton/Prefabs/ItemTxtrPresetButton") as GameObject);
  67. this.m_spItemIcon = this.m_goItemSpriteBtn.GetComponent<UISprite>();
  68. if (this.m_goSceneVRTouch == null)
  69. {
  70. this.m_goSceneVRTouch = GameObject.Find("_SceneVRTouch_");
  71. }
  72. this.m_sceneVRTouch = this.m_goSceneVRTouch.GetComponent<SceneVRTouch>();
  73. this.m_goItemPresetsViewer.SetActive(false);
  74. }
  75. public void CreateItemPresetsViewer(string type, string clickBtnName, string prevActiveBtnName)
  76. {
  77. if (!string.IsNullOrEmpty(this.last_draw_type_))
  78. {
  79. if (this.last_draw_type_ == PresetButtonMgr.ItemTypes.Pose.ToString())
  80. {
  81. this.backup_pose_scroll_pos_ = this.m_sbScrollBar.value;
  82. }
  83. else if (this.last_draw_type_ == PresetButtonMgr.ItemTypes.BG.ToString())
  84. {
  85. this.backup_bg_scroll_pos_ = this.m_sbScrollBar.value;
  86. }
  87. }
  88. this.m_dicItem = new Dictionary<string, VRTouchButtonCtrl.ItemPreset>();
  89. if (type == "PresetButtons" && clickBtnName == PresetButtonMgr.ItemTypes.Pose.ToString())
  90. {
  91. this.m_dicItem = this.LoadItemData(clickBtnName);
  92. }
  93. else if (type == "PresetButtons" && clickBtnName == PresetButtonMgr.ItemTypes.Clothes.ToString())
  94. {
  95. this.m_dicItem = this.LoadClothesData();
  96. }
  97. else if (!(type == "PresetButtons") || !(clickBtnName == PresetButtonMgr.ItemTypes.PriSave.ToString()))
  98. {
  99. if (!(type == "PresetButtons") || !(clickBtnName == PresetButtonMgr.ItemTypes.Voice.ToString()))
  100. {
  101. if (type == "PresetButtons" && clickBtnName == PresetButtonMgr.ItemTypes.BG.ToString())
  102. {
  103. this.m_dicItem = this.LoadItemData(clickBtnName);
  104. }
  105. }
  106. }
  107. this.last_draw_type_ = clickBtnName;
  108. List<VRTouchButtonCtrl.ItemPreset> list = new List<VRTouchButtonCtrl.ItemPreset>();
  109. foreach (KeyValuePair<string, VRTouchButtonCtrl.ItemPreset> keyValuePair in this.m_dicItem)
  110. {
  111. if (keyValuePair.Key.StartsWith(clickBtnName))
  112. {
  113. list.Add(keyValuePair.Value);
  114. }
  115. }
  116. if (list.Count == 0 && clickBtnName != "View")
  117. {
  118. Debug.LogError(string.Format("アイテムビューワに表示するアイテムが存在しません。押下されたボタン={0}", clickBtnName));
  119. return;
  120. }
  121. this.LoadItemBtn(list, clickBtnName);
  122. this.initItemBtnList(list);
  123. this.AdjustItemPresets(type, clickBtnName, prevActiveBtnName);
  124. if (type == "PresetButtons" && clickBtnName == PresetButtonMgr.ItemTypes.Pose.ToString())
  125. {
  126. this.m_sbScrollBar.value = this.backup_pose_scroll_pos_;
  127. }
  128. else if (type == "PresetButtons" && clickBtnName == PresetButtonMgr.ItemTypes.BG.ToString())
  129. {
  130. this.m_sbScrollBar.value = this.backup_bg_scroll_pos_;
  131. }
  132. }
  133. private void initBtnList(string btnType, string btnName)
  134. {
  135. string text = null;
  136. bool flag = false;
  137. VRTouchButtonCtrl.PresetButton presetButton = new VRTouchButtonCtrl.PresetButton();
  138. if (btnType == "LeftButtons" || btnType == "RightButtons")
  139. {
  140. text = "PresetButtons/" + btnType + "/" + btnName;
  141. flag = true;
  142. }
  143. else if (btnType == "itemPresetButtons")
  144. {
  145. text = "ItemPresetsViewer/Scroll View/Grid/" + btnName;
  146. flag = false;
  147. }
  148. UIButton component = UTY.GetChildObject(this.m_goPresetButtonPanel, text, false).GetComponent<UIButton>();
  149. GameObject childObject = UTY.GetChildObject(this.m_goPresetButtonPanel, text + "/SelectCursor", false);
  150. childObject.SetActive(false);
  151. if (flag && btnName != "View")
  152. {
  153. GameObject childObject2 = UTY.GetChildObject(this.m_goPresetButtonPanel, text + "/WindowArrow", false);
  154. childObject2.SetActive(false);
  155. presetButton.m_goWindowArrow = childObject2;
  156. }
  157. presetButton.m_btnButton = component;
  158. presetButton.m_name = btnName;
  159. presetButton.m_goSelectCursor = childObject;
  160. if (btnType == "LeftButtons" || btnType == "RightButtons")
  161. {
  162. this.m_listPresetBtn.Add(presetButton.m_name, presetButton);
  163. }
  164. else if (btnType == "itemPresetButtons")
  165. {
  166. this.m_listItemPresetBtn[presetButton.m_name] = presetButton;
  167. }
  168. }
  169. private void LoadItemBtn(List<VRTouchButtonCtrl.ItemPreset> listItemPreset, string clickBtnName)
  170. {
  171. if (clickBtnName == PresetButtonMgr.ItemTypes.Pose.ToString() || clickBtnName == PresetButtonMgr.ItemTypes.Voice.ToString() || clickBtnName == PresetButtonMgr.ItemTypes.BG.ToString())
  172. {
  173. this.m_goItemBtn = this.m_goItemTxtrBtn;
  174. }
  175. else if (clickBtnName == PresetButtonMgr.ItemTypes.Clothes.ToString() || clickBtnName == PresetButtonMgr.ItemTypes.PriSave.ToString())
  176. {
  177. this.m_goItemBtn = this.m_goItemSpriteBtn;
  178. }
  179. IEnumerator enumerator = this.m_goParentItemBtn.transform.GetEnumerator();
  180. try
  181. {
  182. while (enumerator.MoveNext())
  183. {
  184. object obj = enumerator.Current;
  185. Transform transform = (Transform)obj;
  186. UnityEngine.Object.Destroy(transform.gameObject);
  187. }
  188. }
  189. finally
  190. {
  191. IDisposable disposable;
  192. if ((disposable = (enumerator as IDisposable)) != null)
  193. {
  194. disposable.Dispose();
  195. }
  196. }
  197. this.m_goParentItemBtn.transform.DetachChildren();
  198. this.m_listItemPresetBtn.Clear();
  199. foreach (VRTouchButtonCtrl.ItemPreset itemPreset in listItemPreset)
  200. {
  201. GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_goItemBtn);
  202. switch (itemPreset.m_itemType)
  203. {
  204. case PresetButtonMgr.ItemTypes.Pose:
  205. case PresetButtonMgr.ItemTypes.Voice:
  206. case PresetButtonMgr.ItemTypes.BG:
  207. {
  208. UITexture component = gameObject.GetComponent<UITexture>();
  209. component.mainTexture = itemPreset.m_txtItemIcon;
  210. this.m_currentItemIconWidth = component.width;
  211. break;
  212. }
  213. case PresetButtonMgr.ItemTypes.Clothes:
  214. case PresetButtonMgr.ItemTypes.PriSave:
  215. {
  216. UISprite component2 = gameObject.GetComponent<UISprite>();
  217. string b = null;
  218. if (itemPreset.m_atlasName != b)
  219. {
  220. component2.atlas = Resources.Load<UIAtlas>(itemPreset.m_atlasName);
  221. b = itemPreset.m_atlasName;
  222. }
  223. component2.spriteName = itemPreset.m_spriteName;
  224. this.m_currentItemIconWidth = component2.width;
  225. break;
  226. }
  227. }
  228. gameObject.transform.name = itemPreset.m_name;
  229. gameObject.transform.parent = this.m_goParentItemBtn.transform;
  230. gameObject.transform.localScale = Vector3.one;
  231. gameObject.transform.localPosition = Vector3.zero;
  232. gameObject.transform.rotation = Quaternion.identity;
  233. switch (itemPreset.m_itemType)
  234. {
  235. case PresetButtonMgr.ItemTypes.Pose:
  236. {
  237. UIButton component3 = gameObject.GetComponent<UIButton>();
  238. EventDelegate.Add(component3.onClick, new EventDelegate.Callback(this.ClickPose));
  239. break;
  240. }
  241. case PresetButtonMgr.ItemTypes.Clothes:
  242. {
  243. UIButton component3 = gameObject.GetComponent<UIButton>();
  244. EventDelegate.Add(component3.onClick, new EventDelegate.Callback(this.ClickClothes));
  245. break;
  246. }
  247. case PresetButtonMgr.ItemTypes.PriSave:
  248. {
  249. UIButton component3 = gameObject.GetComponent<UIButton>();
  250. EventDelegate.Add(component3.onClick, new EventDelegate.Callback(this.PresetSave));
  251. break;
  252. }
  253. case PresetButtonMgr.ItemTypes.Voice:
  254. {
  255. UIButton component3 = gameObject.GetComponent<UIButton>();
  256. EventDelegate.Add(component3.onClick, new EventDelegate.Callback(this.ClickVoice));
  257. break;
  258. }
  259. case PresetButtonMgr.ItemTypes.BG:
  260. {
  261. UIButton component3 = gameObject.GetComponent<UIButton>();
  262. EventDelegate.Add(component3.onClick, new EventDelegate.Callback(this.ClickBG));
  263. break;
  264. }
  265. }
  266. }
  267. }
  268. private void initItemBtnList(List<VRTouchButtonCtrl.ItemPreset> listItemPreset)
  269. {
  270. foreach (VRTouchButtonCtrl.ItemPreset itemPreset in listItemPreset)
  271. {
  272. this.initBtnList("itemPresetButtons", itemPreset.m_name);
  273. }
  274. }
  275. public void AdjustItemPresets(string type, string clickBtnName, string prevActiveBtnName)
  276. {
  277. VRTouchButtonCtrl.PresetButton btn = new VRTouchButtonCtrl.PresetButton();
  278. VRTouchButtonCtrl.PresetButton btn2 = new VRTouchButtonCtrl.PresetButton();
  279. if (type == "PresetButtons")
  280. {
  281. btn = this.m_listPresetBtn[clickBtnName];
  282. if (prevActiveBtnName != null)
  283. {
  284. btn2 = this.m_listPresetBtn[prevActiveBtnName];
  285. }
  286. }
  287. else if (type == "ItemPresetsViewer")
  288. {
  289. btn = this.m_listItemPresetBtn[clickBtnName];
  290. if (prevActiveBtnName != null)
  291. {
  292. btn2 = this.m_listItemPresetBtn[prevActiveBtnName];
  293. }
  294. }
  295. this.SetActiveBtn(btn, true);
  296. if (prevActiveBtnName != null)
  297. {
  298. this.SetActiveBtn(btn2, false);
  299. }
  300. if (type == "PresetButtons")
  301. {
  302. this.AdjustScrollViewWidth();
  303. this.m_goItemPresetsViewer.transform.position = new Vector2(this.dicBtnPosX[clickBtnName], this.m_goItemPresetsViewer.transform.position.y);
  304. float num = -this.m_goItemPresetsViewer.transform.localPosition.x + (float)(this.m_spScrollViewBG.width / 2) - (float)(this.m_nguiContentWidth / 2);
  305. if (num > 0f)
  306. {
  307. this.m_goItemPresetsViewer.transform.localPosition = new Vector2(this.m_goItemPresetsViewer.transform.localPosition.x + num, this.m_goItemPresetsViewer.transform.localPosition.y);
  308. }
  309. this.m_goItemPresetsViewer.SetActive(true);
  310. this.m_goParentItemBtn.GetComponent<UIGrid>().Reposition();
  311. this.AdjustScrollViewItemPos();
  312. if (this.m_scrollViewWidthOver)
  313. {
  314. this.m_sbScrollBar.value = 0f;
  315. }
  316. }
  317. }
  318. private void AdjustScrollViewItemPos()
  319. {
  320. UIScrollView component = this.m_goItemScrollView.GetComponent<UIScrollView>();
  321. component.ResetPosition();
  322. }
  323. public void SetDefaultScrollBarPos()
  324. {
  325. this.m_sbScrollBar.value = 0f;
  326. }
  327. private void AdjustScrollViewWidth()
  328. {
  329. this.m_scrollViewWidthOver = false;
  330. int num = (this.m_currentItemIconWidth + this.itemIconOffsetX) * this.m_listItemPresetBtn.Count + this.m_scrollViewSoftnessX;
  331. if (num > this.m_maxScrollViewWidth)
  332. {
  333. num = this.m_maxScrollViewWidth;
  334. this.m_scrollViewWidthOver = true;
  335. }
  336. this.m_scrollViewSize.z = (float)num;
  337. this.m_pItemScrollViewPanel.baseClipRegion = this.m_scrollViewSize;
  338. int num2 = this.m_currentItemIconWidth * 3;
  339. int num3 = num2 + num;
  340. if (num3 > this.m_ajustedNguiContentWidth)
  341. {
  342. num3 = this.m_ajustedNguiContentWidth;
  343. }
  344. this.m_spScrollViewBG.width = num3;
  345. UIGrid component = this.m_goParentItemBtn.GetComponent<UIGrid>();
  346. component.cellWidth = (float)(this.m_currentItemIconWidth + this.itemIconOffsetX);
  347. }
  348. private void SetActiveBtn(VRTouchButtonCtrl.PresetButton btn, bool active)
  349. {
  350. if (Enum.IsDefined(typeof(PresetButtonMgr.ItemTypes), btn.m_name))
  351. {
  352. btn.m_goSelectCursor.SetActive(active);
  353. if (btn.m_goWindowArrow != null)
  354. {
  355. btn.m_goWindowArrow.SetActive(active);
  356. }
  357. if (active)
  358. {
  359. btn.m_btnButton.defaultColor = this.activeColor;
  360. }
  361. else
  362. {
  363. btn.m_btnButton.defaultColor = this.inActiveColor;
  364. }
  365. }
  366. }
  367. public void SetActiveBtn(string btnName, bool active)
  368. {
  369. VRTouchButtonCtrl.PresetButton btn = this.m_listPresetBtn[btnName];
  370. this.SetActiveBtn(btn, active);
  371. }
  372. private Dictionary<string, VRTouchButtonCtrl.ItemPreset> LoadClothesData()
  373. {
  374. Dictionary<string, VRTouchButtonCtrl.ItemPreset> dictionary = new Dictionary<string, VRTouchButtonCtrl.ItemPreset>();
  375. VRTouchButtonCtrl.ItemPreset itemPreset = new VRTouchButtonCtrl.ItemPreset();
  376. itemPreset.m_name = VRTouchButtonCtrl.ClothesButton.Clothes_Dress.ToString();
  377. itemPreset.m_atlasName = "SceneEdit/Preset/Atlas/AtlasPreset";
  378. itemPreset.m_spriteName = "cm3d2_edit_clothesicon_dress";
  379. itemPreset.m_spItemIcon = this.m_spItemIcon;
  380. itemPreset.m_itemType = PresetButtonMgr.ItemTypes.Clothes;
  381. dictionary.Add(itemPreset.m_name, itemPreset);
  382. itemPreset = new VRTouchButtonCtrl.ItemPreset();
  383. itemPreset.m_name = VRTouchButtonCtrl.ClothesButton.Clothes_Lingerie.ToString();
  384. itemPreset.m_atlasName = "SceneEdit/Preset/Atlas/AtlasPreset";
  385. itemPreset.m_spriteName = "cm3d2_edit_clothesicon_lingerie";
  386. itemPreset.m_spItemIcon = this.m_spItemIcon;
  387. itemPreset.m_itemType = PresetButtonMgr.ItemTypes.Clothes;
  388. dictionary.Add(itemPreset.m_name, itemPreset);
  389. itemPreset = new VRTouchButtonCtrl.ItemPreset();
  390. itemPreset.m_name = VRTouchButtonCtrl.ClothesButton.Clothes_Nude.ToString();
  391. itemPreset.m_atlasName = "SceneEdit/Preset/Atlas/AtlasPreset";
  392. itemPreset.m_spriteName = "cm3d2_edit_clothesicon_nude";
  393. itemPreset.m_spItemIcon = this.m_spItemIcon;
  394. itemPreset.m_itemType = PresetButtonMgr.ItemTypes.Clothes;
  395. dictionary.Add(itemPreset.m_name, itemPreset);
  396. return dictionary;
  397. }
  398. private Dictionary<string, VRTouchButtonCtrl.ItemPreset> LoadItemData(string clickBtnName)
  399. {
  400. Dictionary<string, VRTouchButtonCtrl.ItemPreset> dictionary = new Dictionary<string, VRTouchButtonCtrl.ItemPreset>();
  401. Personal.Data personal = this.m_maid.status.personal;
  402. SceneEdit.PVBInfo[] array = null;
  403. if (clickBtnName == PresetButtonMgr.ItemTypes.Pose.ToString())
  404. {
  405. array = this.m_sceneVRTouch.m_listPose.ToArray();
  406. }
  407. else if (!(clickBtnName == PresetButtonMgr.ItemTypes.Voice.ToString()))
  408. {
  409. if (clickBtnName == PresetButtonMgr.ItemTypes.BG.ToString())
  410. {
  411. array = this.m_sceneVRTouch.m_listBg.ToArray();
  412. }
  413. }
  414. int num = 0;
  415. foreach (SceneEdit.PVBInfo pvbinfo in array)
  416. {
  417. VRTouchButtonCtrl.ItemPreset itemPreset = new VRTouchButtonCtrl.ItemPreset();
  418. itemPreset.m_name = clickBtnName + "_" + num;
  419. itemPreset.m_itemType = (PresetButtonMgr.ItemTypes)Enum.Parse(typeof(PresetButtonMgr.ItemTypes), clickBtnName);
  420. itemPreset.m_pvbInfo = pvbinfo;
  421. itemPreset.m_txtItemIcon = pvbinfo.texIcon;
  422. dictionary.Add(itemPreset.m_name, itemPreset);
  423. num++;
  424. }
  425. return dictionary;
  426. }
  427. private void PresetSave()
  428. {
  429. string name = UIButton.current.name;
  430. PresetMgr.Filter filter = PresetMgr.Filter.None;
  431. if (name == VRTouchButtonCtrl.PriSaveButton.PriSave_WearAndBody.ToString())
  432. {
  433. Debug.Log("「服/体」が押下されました");
  434. GameMain.Instance.CharacterMgr.PresetSave(this.m_maid, CharacterMgr.PresetType.All);
  435. filter = PresetMgr.Filter.All;
  436. }
  437. else if (name == VRTouchButtonCtrl.PriSaveButton.PriSave_Wear.ToString())
  438. {
  439. Debug.Log("「服」が押下されました");
  440. GameMain.Instance.CharacterMgr.PresetSave(this.m_maid, CharacterMgr.PresetType.Wear);
  441. filter = PresetMgr.Filter.Wear;
  442. }
  443. else if (name == VRTouchButtonCtrl.PriSaveButton.PriSave_Body.ToString())
  444. {
  445. Debug.Log("「体」が押下されました");
  446. GameMain.Instance.CharacterMgr.PresetSave(this.m_maid, CharacterMgr.PresetType.Body);
  447. filter = PresetMgr.Filter.Body;
  448. }
  449. else
  450. {
  451. Debug.LogError(string.Format("不適切なボタンが押下されました。ボタン名={0}", name));
  452. }
  453. if (this.isActivePresetPanel())
  454. {
  455. float scrollBarValue = BaseMgr<PresetMgr>.Instance.GetScrollBarValue();
  456. BaseMgr<PresetMgr>.Instance.UpdatePresetList();
  457. Debug.Log("Call UpdatePresetList");
  458. if (PresetMgr.m_currentActiveFilterBtnName != PresetMgr.Filter.None)
  459. {
  460. BaseMgr<PresetMgr>.Instance.UpdateFilterPreset(PresetMgr.m_currentActiveFilterBtnName);
  461. Debug.Log("Call UpdateFilterPreset");
  462. if (PresetMgr.m_currentActiveFilterBtnName != PresetMgr.Filter.NotFilter && PresetMgr.m_currentActiveFilterBtnName != filter)
  463. {
  464. BaseMgr<PresetMgr>.Instance.SetScrollBar(scrollBarValue);
  465. }
  466. }
  467. }
  468. }
  469. private bool isActivePresetPanel()
  470. {
  471. GameObject gameObject = GameObject.Find("/UI Root");
  472. GameObject gameObject2 = gameObject.transform.Find("PresetPanel").gameObject;
  473. return gameObject2.activeSelf;
  474. }
  475. private void ClickClothes()
  476. {
  477. string name = UIButton.current.name;
  478. this.ClickClothesByButtonName(name);
  479. }
  480. public void ClickClothesByButtonName(string clickBtnName)
  481. {
  482. if (clickBtnName == "Clothes_Nude")
  483. {
  484. this.m_sceneVRTouch.ClothesState(SceneEditInfo.ClothesState.Nude);
  485. }
  486. else if (clickBtnName == "Clothes_Dress")
  487. {
  488. this.m_sceneVRTouch.ClothesState(SceneEditInfo.ClothesState.Wear);
  489. }
  490. else if (clickBtnName == "Clothes_Lingerie")
  491. {
  492. this.m_sceneVRTouch.ClothesState(SceneEditInfo.ClothesState.Underwear);
  493. }
  494. Debug.Log(string.Format("{0}が押下(実行)されました。", clickBtnName));
  495. }
  496. private void ClickBG()
  497. {
  498. string name = UIButton.current.name;
  499. VRTouchButtonCtrl.ItemPreset itemPreset;
  500. if (this.m_dicItem.TryGetValue(name, out itemPreset))
  501. {
  502. this.m_sceneVRTouch.Bg(itemPreset.m_pvbInfo);
  503. Debug.Log(string.Format("{0}が押下されました。", name));
  504. }
  505. else
  506. {
  507. Debug.LogError(string.Format("不適切なボタンが押下されました。ボタン名={0}", name));
  508. }
  509. }
  510. private void ClickVoice()
  511. {
  512. string name = UIButton.current.name;
  513. VRTouchButtonCtrl.ItemPreset itemPreset;
  514. if (this.m_dicItem.TryGetValue(name, out itemPreset))
  515. {
  516. Debug.Log(string.Format("{0}が押下されました。", name));
  517. }
  518. else
  519. {
  520. Debug.LogError(string.Format("不適切なボタンが押下されました。ボタン名={0}", name));
  521. }
  522. }
  523. private void ClickPose()
  524. {
  525. string name = UIButton.current.name;
  526. VRTouchButtonCtrl.ItemPreset itemPreset;
  527. if (this.m_dicItem.TryGetValue(name, out itemPreset))
  528. {
  529. this.m_sceneVRTouch.Pose(itemPreset.m_pvbInfo);
  530. Debug.Log(string.Format("{0}が押下されました。", name));
  531. }
  532. else
  533. {
  534. Debug.LogError(string.Format("不適切なボタンが押下されました。ボタン名={0}", name));
  535. }
  536. }
  537. public GameObject m_goSceneVRTouch;
  538. [SerializeField]
  539. private int itemIconOffsetX = 15;
  540. private Maid m_maid;
  541. private SceneVRTouch m_sceneVRTouch;
  542. private Dictionary<string, VRTouchButtonCtrl.PresetButton> m_listPresetBtn;
  543. private Dictionary<string, VRTouchButtonCtrl.PresetButton> m_listItemPresetBtn;
  544. private Dictionary<string, VRTouchButtonCtrl.ItemPreset> m_dicItem;
  545. private GameObject m_goPresetButtonPanel;
  546. private GameObject m_goItemBtn;
  547. private GameObject m_goItemPresetsViewer;
  548. private GameObject m_goItemScrollView;
  549. private GameObject m_goParentItemBtn;
  550. private UISprite m_spItemIcon;
  551. private UISprite m_spScrollViewBG;
  552. private UIPanel m_pItemScrollViewPanel;
  553. private UIScrollBar m_sbScrollBar;
  554. private bool m_scrollViewWidthOver;
  555. private GameObject m_goItemSpriteBtn;
  556. private GameObject m_goItemTxtrBtn;
  557. private Color activeColor;
  558. private Color inActiveColor;
  559. private int m_currentItemIconWidth;
  560. private Vector4 m_scrollViewSize;
  561. private int m_maxScrollViewWidth;
  562. private int m_scrollViewSoftnessX;
  563. private int m_ajustedNguiContentWidth;
  564. private int m_nguiContentWidth;
  565. private Dictionary<string, float> dicBtnPosX;
  566. private const string ITEM_SPRITE_PRESET_BUTTON_PATH = "SceneEdit/PresetButton/Prefabs/ItemSpritePresetButton";
  567. private const string ITEM_TXTR_PRESET_BUTTON_PATH = "SceneEdit/PresetButton/Prefabs/ItemTxtrPresetButton";
  568. private const string ATLAS_PRESET = "SceneEdit/Preset/Atlas/AtlasPreset";
  569. private const string PRISAVE_CLOTHES_BODY_SPRITE_NAME = "cm3d2_edit_priset_buttom_clothes_body";
  570. private const string PRISAVE_CLOTHES_SPRITE_NAME = "cm3d2_edit_priset_buttom_clothes";
  571. private const string PRISAVE_BODY_SPRITE_NAME = "cm3d2_edit_preset_buttom_body";
  572. private const string CLOTHES_NUDE_SPRITE_NAME = "cm3d2_edit_clothesicon_nude";
  573. private const string CLOTHES_DRESS_SPRITE_NAME = "cm3d2_edit_clothesicon_dress";
  574. private const string CLOTHES_LINGERIE_SPRITE_NAME = "cm3d2_edit_clothesicon_lingerie";
  575. private const int RIGHT_OFFSET = 650;
  576. private string last_draw_type_;
  577. private float backup_pose_scroll_pos_;
  578. private float backup_bg_scroll_pos_;
  579. private enum LeftButtons
  580. {
  581. Pose,
  582. Clothes,
  583. BG
  584. }
  585. private enum PriSaveButton
  586. {
  587. PriSave_Wear,
  588. PriSave_Body,
  589. PriSave_WearAndBody
  590. }
  591. private enum ClothesButton
  592. {
  593. Clothes_Nude,
  594. Clothes_Dress,
  595. Clothes_Lingerie
  596. }
  597. private class ItemPreset
  598. {
  599. public string m_name { get; set; }
  600. public PresetButtonMgr.ItemTypes m_itemType { get; set; }
  601. public string m_atlasName { get; set; }
  602. public string m_spriteName { get; set; }
  603. public UISprite m_spItemIcon { get; set; }
  604. public SceneEdit.PVBInfo m_pvbInfo { get; set; }
  605. public Texture2D m_txtItemIcon { get; set; }
  606. }
  607. private class PresetButton
  608. {
  609. public string m_name { get; set; }
  610. public UIButton m_btnButton { get; set; }
  611. public GameObject m_goSelectCursor { get; set; }
  612. public GameObject m_goWindowArrow { get; set; }
  613. }
  614. }