UICustom.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using UnityGameFramework.Runtime;
  6. using GameFramework;
  7. using GameFramework.DataTable;
  8. using GameFramework.Sound;
  9. using GameFramework.Download;
  10. using GameFramework.FileSystem;
  11. using GameFramework.ObjectPool;
  12. using GameFramework.Resource;
  13. using System;
  14. using DG.Tweening;
  15. namespace MetaClient
  16. {
  17. public class UICustom : UGuiForm
  18. {
  19. // Start is called before the first frame update
  20. [Header("初始界面")]
  21. public GameObject toolView;
  22. [Header("基础按钮界面")]
  23. public GameObject baseView;
  24. [Header("保存按钮")]
  25. public GameObject saveBtn;
  26. [Header("捏脸界面")]
  27. public GameObject nieLianView;
  28. [Header("身体界面")]
  29. public GameObject bodyView;
  30. [Header("自定义")]
  31. public GameObject ziDingYiBtn;
  32. [Header("衣服界面")]
  33. public GameObject clothView;
  34. [Header("左边界面")]
  35. public GameObject leftView;
  36. [Header("右边界面")]
  37. public GameObject rightView;
  38. //[Header("点击后生成的按钮列表")]
  39. //public GameObject buttonList;
  40. [Header("白底背景")]
  41. public GameObject whitebg;
  42. [Header("按钮预制体")]
  43. public GameObject buttonItem;
  44. [Header("滑块")]
  45. public Scrollbar scrollbar;
  46. [Header("颜色选择界面")]
  47. public GameObject colorView;
  48. [Header("调色版界面")]
  49. public GameObject tiaoSeBanView;
  50. // [Header("顺序")]
  51. private EButtonShunXu eButtonShunXu = EButtonShunXu.None;
  52. [Header("颜色演示预制体")]
  53. public GameObject colItem;
  54. public float tween_leftMax = 0;
  55. public float tween_leftMin = -250;
  56. public float tween_rightMin = 0;
  57. public float tween_rightMax = 223;
  58. private float tween_saveBtnMax = 119;
  59. private float tween_saveBtnMin = -108;
  60. private float tweenTime = 0.5f;
  61. //private float tweenTime = 10;
  62. //private float tweenLeastTime = 0;
  63. public bool isTween = false;
  64. [Header("选择界面分支")]
  65. [SerializeField]
  66. private ECustomStyple eCustomStyple = ECustomStyple.None;
  67. [Header("历史记录用于回退")]
  68. [SerializeField]
  69. private List<string> histroy;
  70. //用来判断是否是例如颜色框 调色板等额外的弹窗;
  71. private bool histroyextra;
  72. private int part = 0;
  73. private int id = -1;
  74. private GameObject nowPickOnImg=null;
  75. //[Header("接受到的数据")]
  76. //[SerializeField]
  77. private IDataTable<DRCustomBody> _bodydata;
  78. protected override void OnOpen(object userData)
  79. {
  80. base.OnOpen(userData);
  81. IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
  82. _bodydata = GameEntry.DataTable.GetDataTable<DRCustomBody>();
  83. }
  84. protected override void OnClose(bool isShutdown, object userData)
  85. {
  86. base.OnClose(isShutdown, userData);
  87. }
  88. public void ClickBotton(ECustomStyple eCustomStyple,int id,bool ziDingYi)
  89. {
  90. if (isTween)
  91. {
  92. return;
  93. }
  94. isTween = true;
  95. leftView.transform.DOLocalMoveX(tween_leftMin, tweenTime).SetEase(Ease.InOutBack).OnComplete(()=> {
  96. //whitebg.SetActive(bg);
  97. ClickBtnFun(eCustomStyple,id,ziDingYi);
  98. leftView.transform.DOLocalMoveX(0, tweenTime).SetEase(Ease.InOutBack).OnComplete(() => {
  99. isTween = false;
  100. Debug.Log("222");
  101. });
  102. });
  103. Debug.Log("333");
  104. rightView.transform.DOLocalMoveX(tween_rightMax, tweenTime).SetEase(Ease.InOutBack).OnComplete(() => {
  105. rightView.transform.DOLocalMoveX(0, tweenTime).SetEase(Ease.InOutBack).OnComplete(() => {
  106. });
  107. });
  108. }
  109. public void TiaoSeViewOpenFun() {
  110. rightView.SetActive(false);
  111. colorView.SetActive(true);
  112. }
  113. public void TiaoSeBanOpenStyple(bool _bo)
  114. {
  115. colorView.SetActive(_bo);
  116. tiaoSeBanView.SetActive(!_bo);
  117. }
  118. //private void
  119. /// <summary>
  120. /// 设置是否已在缓动
  121. /// </summary>
  122. public void SetTween(bool _bo) {
  123. isTween = _bo;
  124. }
  125. /// <summary>
  126. /// 获取是否缓动
  127. /// </summary>
  128. public bool GetTween()
  129. {
  130. return isTween;
  131. }
  132. public void HistoryAdd(string _str) {
  133. histroy.Add(_str);
  134. }
  135. /// <summary>
  136. /// 滑块改变
  137. /// </summary>
  138. public void ScrollValueChange()
  139. {
  140. //Debug.Log(scrollbar.value);
  141. GameEntry.Event.Fire(this, CustomRoleBodyEventArgs.Create(part, new Vector3(scrollbar.value, 0, 0)));
  142. }
  143. public void BackBtnFun()
  144. {
  145. if (histroyextra)
  146. {
  147. BackExtraFun();
  148. histroyextra = false;
  149. return;
  150. }
  151. switch (this.histroy.Count)
  152. {
  153. case 0:
  154. Debug.Log("返回上一层");
  155. break;
  156. case 1:
  157. Debug.Log("返回选择捏脸/身体/服装");
  158. histroy.RemoveAt(histroy.Count - 1);
  159. Back_OneFun();
  160. break;
  161. case 2:
  162. Debug.Log("进入选择界面");
  163. histroy.RemoveAt(histroy.Count - 1);
  164. Back_TwoFun(true);
  165. break;
  166. default:
  167. Debug.Log("进入自定义或颜色");
  168. // histroy.RemoveAt(histroy.Count - 1);
  169. Back_ThreeFun();
  170. histroy.RemoveAt(histroy.Count - 1);
  171. break;
  172. }
  173. }
  174. void Back_OneFun() {
  175. ViewSetFalse();
  176. toolView.SetActive(true);
  177. //toolView.SetActive(true);
  178. //bodyView.SetActive(false);
  179. //nieLianView.SetActive(false);
  180. //clothView.SetActive(false);
  181. }
  182. void BackExtraFun()
  183. {
  184. rightView.SetActive(true);
  185. scrollbar.gameObject.SetActive(false);
  186. }
  187. void ViewSetFalse()
  188. {
  189. toolView.SetActive(false);
  190. bodyView.SetActive(false);
  191. nieLianView.SetActive(false);
  192. clothView.SetActive(false);
  193. }
  194. void BackView_Extra(GameObject _obj,bool _bo) {
  195. ViewSetFalse();
  196. _obj.SetActive(_bo);
  197. ViewSetChildTrue(_obj,_bo);
  198. }
  199. void ViewSetChildTrue(GameObject _obj,bool _bo)
  200. {
  201. _obj.transform.GetChild(0).gameObject.SetActive(_bo);
  202. _obj.transform.GetChild(0).gameObject.SetActive(_bo);
  203. _obj.transform.GetChild(2).gameObject.SetActive(!_bo);
  204. }
  205. void Back_TwoFun(bool _bo)
  206. {
  207. // int _choose = int.Parse(histroy[1]);
  208. // switch ((ECustomStyple)_choose)
  209. switch(eCustomStyple)
  210. {
  211. case ECustomStyple.Body:
  212. BackView_Extra(bodyView,_bo);
  213. break;
  214. case ECustomStyple.Cloth:
  215. BackView_Extra(clothView, _bo);
  216. break;
  217. case ECustomStyple.None:
  218. break;
  219. case ECustomStyple.NieLian:
  220. BackView_Extra(nieLianView, _bo);
  221. break;
  222. }
  223. //toolView.SetActive(true);
  224. //bodyView.SetActive(false);
  225. //nieLianView.SetActive(false);
  226. //clothView.SetActive(false);
  227. }
  228. void Back_ThreeFun()
  229. {
  230. string[] _strArrary = histroy[histroy.Count - 1].Split(',');
  231. if (_strArrary[0] == "Color")
  232. {
  233. colorView.SetActive(false);
  234. rightView.SetActive(true);
  235. }
  236. else if (_strArrary[0] == "ziDingyi")
  237. {
  238. int _chooseId = int.Parse(_strArrary[1]);
  239. ClickBtnFun(eCustomStyple, _chooseId, false);
  240. }
  241. else
  242. {
  243. Debug.Log("缺少当前情况需要添加>>>>");
  244. }
  245. //toolView.SetActive(true);
  246. //bodyView.SetActive(false);
  247. //nieLianView.SetActive(false);
  248. //clothView.SetActive(false);
  249. }
  250. public void PickOnButton(GameObject _obj,int _id) {
  251. if (_obj.transform.childCount <= 0)
  252. {
  253. return;
  254. }
  255. GameObject _nowPickOnImg = _obj.transform.GetChild(0).gameObject;
  256. if (nowPickOnImg==null)
  257. {
  258. nowPickOnImg = _nowPickOnImg;
  259. nowPickOnImg.SetActive(true);
  260. }
  261. else
  262. {
  263. nowPickOnImg.SetActive(false);
  264. if (_id != id)
  265. {
  266. id = _id;
  267. nowPickOnImg = _nowPickOnImg;
  268. _nowPickOnImg.SetActive(true);
  269. }
  270. else
  271. {
  272. nowPickOnImg = _nowPickOnImg;
  273. _nowPickOnImg.SetActive(!_nowPickOnImg.activeSelf);
  274. }
  275. }
  276. scrollbar.gameObject.SetActive(nowPickOnImg.activeSelf);
  277. }
  278. /// <summary>
  279. /// 修改滑块
  280. /// </summary>
  281. public void SetValue(int _part,ECustomStyple eCustomStyple)
  282. {
  283. //scrollbar.value = _value;
  284. part = _part;
  285. scrollbar.value = CustomManager.Instance.GetBodyBoneValue(part);
  286. }
  287. /// <summary>
  288. /// 获得滑块值
  289. /// </summary>
  290. public float GetValue()
  291. {
  292. return scrollbar.value;
  293. }
  294. /// <summary>
  295. /// 按钮点击事件
  296. /// </summary>
  297. public void ClickBtnFun(ECustomStyple eCustomStyple,int id,bool zidingyi) {
  298. //if (isTween)
  299. //{
  300. // return;
  301. //}
  302. whitebg.SetActive(true);
  303. scrollbar.gameObject.SetActive(false);
  304. this.eCustomStyple = eCustomStyple;
  305. //ECustomStyple _eCustomStyple = (ECustomStyple)int.Parse(_objects[0].ToString());
  306. switch (eCustomStyple)
  307. {
  308. case ECustomStyple.None:
  309. break;
  310. case ECustomStyple.NieLian:
  311. GameObject _nieLianList = nieLianView.transform.GetChild(0).gameObject;
  312. _nieLianList.SetActive(false);
  313. GameObject _nieLianXX = nieLianView.transform.GetChild(2).gameObject;
  314. _nieLianXX.SetActive(true);
  315. //if (!zidingyi)
  316. //{
  317. // ZiDingYiNeiLian(eCustomStyple, id, _nieLianXX.transform.GetChild(0).gameObject);
  318. // return;
  319. //}
  320. CreateNieLianImg(id, zidingyi);
  321. break;
  322. case ECustomStyple.Body:
  323. GameObject _bodyList = bodyView.transform.GetChild(0).gameObject;
  324. _bodyList.SetActive(false);
  325. GameObject _bodyListXX =bodyView.transform.GetChild(2).gameObject;
  326. _bodyListXX.SetActive(true);
  327. //if (!zidingyi)
  328. //{
  329. // ZiDingYiBody(eCustomStyple, id, _bodyListXX.transform.GetChild(0).gameObject);
  330. // return;
  331. //}
  332. CreateBodyImg(id, zidingyi);
  333. break;
  334. case ECustomStyple.Cloth:
  335. GameObject _clothList = clothView.transform.GetChild(0).gameObject;
  336. _clothList.SetActive(false);
  337. GameObject _clothListXX = clothView.transform.GetChild(2).gameObject;
  338. _clothListXX.SetActive(true);
  339. //if (!zidingyi)
  340. //{
  341. // ZiDingYiCloth(eCustomStyple, id, _clothListXX.transform.GetChild(0).gameObject);
  342. // return;
  343. //}
  344. CreateClothImg(id, zidingyi);
  345. break;
  346. }
  347. }
  348. //public Action ActionFun() {
  349. // return null;
  350. //}
  351. private void RemoveAllChildren(GameObject parent)
  352. {
  353. Transform transform;
  354. for (int i = 0; i < parent.transform.childCount; i++)
  355. {
  356. transform = parent.transform.GetChild(i);
  357. GameObject.Destroy(transform.gameObject);
  358. }
  359. }
  360. //public void ZiDingYiNeiLian(ECustomStyple eCustomStyple, int id,GameObject _objPar) {
  361. // RemoveAllChildren(bodyView.transform.GetChild(2).GetChild(0).gameObject);
  362. // GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
  363. // _obj.transform.SetParent(_objPar.transform);
  364. // UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
  365. // _uICustomBtn.id = id;
  366. // _uICustomBtn.eCustomStyple = eCustomStyple;
  367. // _obj.SetActive(true);
  368. //}
  369. //public void ZiDingYiBody(ECustomStyple eCustomStyple, int id, GameObject _objPar)
  370. //{
  371. // RemoveAllChildren(bodyView.transform.GetChild(2).GetChild(0).gameObject);
  372. // GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
  373. // _obj.transform.SetParent(_objPar.transform);
  374. // UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
  375. // _uICustomBtn.id = id;
  376. // _uICustomBtn.eCustomStyple = eCustomStyple;
  377. // _obj.SetActive(true);
  378. //}
  379. //public void ZiDingYiCloth(ECustomStyple eCustomStyple, int id, GameObject _objPar)
  380. //{
  381. // RemoveAllChildren(bodyView.transform.GetChild(2).GetChild(0).gameObject);
  382. // GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
  383. // _obj.transform.SetParent(_objPar.transform);
  384. // UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
  385. // _uICustomBtn.id = id;
  386. // _uICustomBtn.eCustomStyple = eCustomStyple;
  387. // _obj.SetActive(true);
  388. //}
  389. public void CreateNieLianImg(int parentid, bool ziDingYi)
  390. {
  391. GameObject _objPar = bodyView.transform.GetChild(2).GetChild(0).gameObject;
  392. RemoveAllChildren(_objPar);
  393. //等有捏脸表时改为捏脸
  394. IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
  395. _bodydata = GameEntry.DataTable.GetDataTable<DRCustomBody>();
  396. int cengji = ziDingYi ?1:0;
  397. if (!ziDingYi)
  398. {
  399. CreateZDYFun(parentid, _objPar);
  400. //GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
  401. //_obj.transform.SetParent(_objPar.transform);
  402. //UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
  403. //ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
  404. //_uICustomBtn.id =parentid;
  405. //_uICustomBtn.eCustomStyple = eCustomStyple;
  406. //_obj.SetActive(true);
  407. }
  408. DRCustomBody[] dRCustomBodies = _bodydata.GetAllDataRows();
  409. for (int i = 0; i < dRCustomBodies.Length; i++)
  410. {
  411. Debug.Log(dRCustomBodies[i].Id);
  412. if (dRCustomBodies[i].ParentStyple == parentid&&dRCustomBodies[i].Cengji==cengji)
  413. {
  414. CreateButtonFun(dRCustomBodies[i].Icon, dRCustomBodies[i].Part, dRCustomBodies[i].Name, _objPar, dRCustomBodies[i].Id, dRCustomBodies[i].ButtonStyple, ECustomStyple.Body);
  415. }
  416. }
  417. ChangeListBotton(_objPar);
  418. }
  419. public void CreateClothImg(int parentid,bool ziDingYi)
  420. {
  421. GameObject _objPar = bodyView.transform.GetChild(2).GetChild(0).gameObject;
  422. RemoveAllChildren(_objPar);
  423. //等有服装时改为服装
  424. IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
  425. _bodydata = GameEntry.DataTable.GetDataTable<DRCustomBody>();
  426. int cengji = ziDingYi ?1:0;
  427. if (!ziDingYi)
  428. {
  429. CreateZDYFun(parentid, _objPar);
  430. //GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
  431. //_obj.transform.SetParent(_objPar.transform);
  432. //UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
  433. //ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
  434. //_uICustomBtn.id = parentid;
  435. //_uICustomBtn.eCustomStyple = eCustomStyple;
  436. //_obj.SetActive(true);
  437. }
  438. DRCustomBody[] dRCustomBodies = _bodydata.GetAllDataRows();
  439. for (int i = 0; i < dRCustomBodies.Length; i++)
  440. {
  441. Debug.Log(dRCustomBodies[i].Id);
  442. if (dRCustomBodies[i].ParentStyple == parentid && dRCustomBodies[i].Cengji == cengji)
  443. {
  444. CreateButtonFun(dRCustomBodies[i].Icon, dRCustomBodies[i].Part, dRCustomBodies[i].Name, _objPar, dRCustomBodies[i].Id, dRCustomBodies[i].ButtonStyple, ECustomStyple.Body);
  445. }
  446. }
  447. ChangeListBotton(_objPar);
  448. }
  449. private void CreateZDYFun(int parentid,GameObject _objPar)
  450. {
  451. GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
  452. _obj.transform.SetParent(_objPar.transform);
  453. UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
  454. ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
  455. }
  456. public void ChangeUICustom(UICustomBtn uICustomBtn,int id, ECustomStyple eCustomStyple)
  457. {
  458. uICustomBtn.id = id;
  459. uICustomBtn.eCustomStyple = eCustomStyple;
  460. uICustomBtn.gameObject.SetActive(true);
  461. }
  462. public void CreateBodyImg(int parentid,bool ziDingYi) {
  463. GameObject _objPar = bodyView.transform.GetChild(2).GetChild(0).gameObject;
  464. RemoveAllChildren(_objPar);
  465. IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
  466. _bodydata = GameEntry.DataTable.GetDataTable<DRCustomBody>();
  467. int cengji = ziDingYi ?1:0;
  468. if (!ziDingYi)
  469. {
  470. CreateZDYFun(parentid, _objPar);
  471. //GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
  472. //_obj.transform.SetParent(_objPar.transform);
  473. //UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
  474. //ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
  475. //_uICustomBtn.id = parentid;
  476. //_uICustomBtn.eCustomStyple = eCustomStyple;
  477. //_obj.SetActive(true);
  478. }
  479. DRCustomBody[] dRCustomBodies = _bodydata.GetAllDataRows();
  480. for (int i = 0; i < dRCustomBodies.Length; i++)
  481. {
  482. Debug.Log(dRCustomBodies[i].Id);
  483. if (dRCustomBodies[i].ParentStyple == parentid && dRCustomBodies[i].Cengji == cengji)
  484. {
  485. CreateButtonFun(dRCustomBodies[i].Icon, dRCustomBodies[i].Part, dRCustomBodies[i].Name, _objPar, dRCustomBodies[i].Id, dRCustomBodies[i].ButtonStyple, ECustomStyple.Body);
  486. }
  487. }
  488. ChangeListBotton(_objPar);
  489. }
  490. /// <summary>
  491. /// 改变列表长短
  492. /// </summary>
  493. public void ChangeListBotton(GameObject _obj) {
  494. //Debug.Log("改变列表"+ _obj.transform.childCount+"");
  495. float _x = _obj.GetComponent<RectTransform>().offsetMin.x;
  496. int _childNum = _obj.transform.childCount;
  497. float _y = _childNum > 7 ? -240 * (_childNum - 7) : 0;
  498. _obj.GetComponent<RectTransform>().offsetMax = new Vector2(_x, 0);
  499. _obj.GetComponent<RectTransform>().offsetMin = new Vector2(_x, _y);
  500. }
  501. //private IEnumerator Tween(Action _action) {
  502. // for (int i = 0; i < 100; i++)
  503. // {
  504. // float _value = i / 100;
  505. // float _right=Mathf.Lerp(tween_rightMax, tween_rightMin, _value);
  506. // float _left= Mathf.Lerp(tween_leftMix, tween_rightMax, _value);
  507. // clothView.GetComponent<RectTransform>().SetPositionX(_right);
  508. // toolView.GetComponent<RectTransform>().SetPositionX(_right);
  509. // bodyView.GetComponent<RectTransform>().SetPositionX(_right);
  510. // nieLianView.GetComponent<RectTransform>().SetPositionX(_right);
  511. // baseView.GetComponent<RectTransform>().SetPositionX(_left);
  512. // }
  513. // yield return null;
  514. //}
  515. protected override void OnUpdate(float elapseSeconds, float realElapseSeconds)
  516. {
  517. base.OnUpdate(elapseSeconds, realElapseSeconds);
  518. }
  519. //private void CreateNieLianFun(object[] _objects) {
  520. // ENieLianStyple _eNieLianStyple = (ENieLianStyple)int.Parse(_objects[1].ToString());
  521. // switch (_eNieLianStyple)
  522. // {
  523. // case ENieLianStyple.faxing:
  524. // break;
  525. // case ENieLianStyple.lianxing:
  526. // break;
  527. // case ENieLianStyple.yankuang:
  528. // break;
  529. // case ENieLianStyple.tongkong:
  530. // break;
  531. // case ENieLianStyple.meimao:
  532. // break;
  533. // case ENieLianStyple.bizi:
  534. // break;
  535. // case ENieLianStyple.erduo:
  536. // break;
  537. // case ENieLianStyple.zuiba:
  538. // break;
  539. // case ENieLianStyple.fuse:
  540. // break;
  541. // }
  542. // //switch()
  543. //}
  544. private void CreateButtonFun(string path,int _part,string _name, GameObject _parent,int _id,int buttonstyple,ECustomStyple eCustomStyple) {
  545. //Debug.Log(path);
  546. // Debug.Log(_parent);
  547. path = "CustomRole/" + path;
  548. GameEntry.Resource.LoadAsset(AssetUtility.GetUISpriteAsset(path), new LoadAssetCallbacks(
  549. (assetName, asset, duration, userData) =>
  550. {
  551. // Debug.Log(path);
  552. // Debug.Log(_parent);
  553. Texture2D tex = (Texture2D)asset;
  554. var sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero);
  555. GameObject _obj = GameObject.Instantiate(buttonItem);
  556. Image _objImg = _obj.transform.GetComponent<Image>();
  557. _obj.SetActive(true);
  558. _objImg.sprite = sprite;
  559. _obj.name = part+"";
  560. _obj.transform.SetParent(_parent.transform);
  561. UICustomBtn uICustomBtn = _obj.GetComponent<UICustomBtn>();
  562. uICustomBtn.id = _id;
  563. uICustomBtn.eButtonStyple = (EButtonStyple)buttonstyple;
  564. uICustomBtn.eCustomStyple = eCustomStyple;
  565. uICustomBtn.isCreate = false;
  566. uICustomBtn.part = _part;
  567. //GameObject
  568. //img.sprite = sprite;
  569. //if (nativeSize)
  570. //{
  571. // img.SetNativeSize();
  572. //}
  573. ChangeListBotton(_parent);
  574. }));
  575. }
  576. //public void NieLian() {
  577. //}
  578. public void ClickFaceChangeBtn()
  579. {
  580. GameEntry.Event.Fire(this, CustomRoleFaceEventArgs.Create(EditableFacePart.eye, new Vector3(1, 0, 0)));
  581. }
  582. }
  583. public enum ECustomStyple
  584. {
  585. None,
  586. NieLian,
  587. Body,
  588. Cloth
  589. }
  590. public enum EButtonStyple
  591. {
  592. Button,
  593. Scroll,
  594. TiaoSe,
  595. NorButton,
  596. Back
  597. }
  598. public enum ENieLianStyple {
  599. None,
  600. faxing,
  601. lianxing,
  602. yankuang,
  603. tongkong,
  604. meimao,
  605. bizi,
  606. erduo,
  607. zuiba,
  608. fuse
  609. }
  610. public enum EButtonShunXu {
  611. None,
  612. First,
  613. Second,
  614. Third
  615. }
  616. public enum ETSStyple {
  617. None,
  618. ViewOpen,
  619. Close,
  620. Sure,
  621. Open
  622. }
  623. }