UICustom.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  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. nowPickOnImg = _nowPickOnImg;
  267. _nowPickOnImg.SetActive(true);
  268. }
  269. }
  270. scrollbar.gameObject.SetActive(nowPickOnImg.activeSelf);
  271. }
  272. /// <summary>
  273. /// 修改滑块
  274. /// </summary>
  275. public void SetValue(int _part,ECustomStyple eCustomStyple)
  276. {
  277. //scrollbar.value = _value;
  278. part = _part;
  279. scrollbar.value = CustomManager.Instance.GetBodyBoneValue(part);
  280. }
  281. /// <summary>
  282. /// 获得滑块值
  283. /// </summary>
  284. public float GetValue()
  285. {
  286. return scrollbar.value;
  287. }
  288. /// <summary>
  289. /// 按钮点击事件
  290. /// </summary>
  291. public void ClickBtnFun(ECustomStyple eCustomStyple,int id,bool zidingyi) {
  292. //if (isTween)
  293. //{
  294. // return;
  295. //}
  296. whitebg.SetActive(true);
  297. scrollbar.gameObject.SetActive(false);
  298. this.eCustomStyple = eCustomStyple;
  299. //ECustomStyple _eCustomStyple = (ECustomStyple)int.Parse(_objects[0].ToString());
  300. switch (eCustomStyple)
  301. {
  302. case ECustomStyple.None:
  303. break;
  304. case ECustomStyple.NieLian:
  305. GameObject _nieLianList = nieLianView.transform.GetChild(0).gameObject;
  306. _nieLianList.SetActive(false);
  307. GameObject _nieLianXX = nieLianView.transform.GetChild(2).gameObject;
  308. _nieLianXX.SetActive(true);
  309. //if (!zidingyi)
  310. //{
  311. // ZiDingYiNeiLian(eCustomStyple, id, _nieLianXX.transform.GetChild(0).gameObject);
  312. // return;
  313. //}
  314. CreateNieLianImg(id, zidingyi);
  315. break;
  316. case ECustomStyple.Body:
  317. GameObject _bodyList = bodyView.transform.GetChild(0).gameObject;
  318. _bodyList.SetActive(false);
  319. GameObject _bodyListXX =bodyView.transform.GetChild(2).gameObject;
  320. _bodyListXX.SetActive(true);
  321. //if (!zidingyi)
  322. //{
  323. // ZiDingYiBody(eCustomStyple, id, _bodyListXX.transform.GetChild(0).gameObject);
  324. // return;
  325. //}
  326. CreateBodyImg(id, zidingyi);
  327. break;
  328. case ECustomStyple.Cloth:
  329. GameObject _clothList = clothView.transform.GetChild(0).gameObject;
  330. _clothList.SetActive(false);
  331. GameObject _clothListXX = clothView.transform.GetChild(2).gameObject;
  332. _clothListXX.SetActive(true);
  333. //if (!zidingyi)
  334. //{
  335. // ZiDingYiCloth(eCustomStyple, id, _clothListXX.transform.GetChild(0).gameObject);
  336. // return;
  337. //}
  338. CreateClothImg(id, zidingyi);
  339. break;
  340. }
  341. }
  342. //public Action ActionFun() {
  343. // return null;
  344. //}
  345. private void RemoveAllChildren(GameObject parent)
  346. {
  347. Transform transform;
  348. for (int i = 0; i < parent.transform.childCount; i++)
  349. {
  350. transform = parent.transform.GetChild(i);
  351. GameObject.Destroy(transform.gameObject);
  352. }
  353. }
  354. //public void ZiDingYiNeiLian(ECustomStyple eCustomStyple, int id,GameObject _objPar) {
  355. // RemoveAllChildren(bodyView.transform.GetChild(2).GetChild(0).gameObject);
  356. // GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
  357. // _obj.transform.SetParent(_objPar.transform);
  358. // UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
  359. // _uICustomBtn.id = id;
  360. // _uICustomBtn.eCustomStyple = eCustomStyple;
  361. // _obj.SetActive(true);
  362. //}
  363. //public void ZiDingYiBody(ECustomStyple eCustomStyple, int id, GameObject _objPar)
  364. //{
  365. // RemoveAllChildren(bodyView.transform.GetChild(2).GetChild(0).gameObject);
  366. // GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
  367. // _obj.transform.SetParent(_objPar.transform);
  368. // UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
  369. // _uICustomBtn.id = id;
  370. // _uICustomBtn.eCustomStyple = eCustomStyple;
  371. // _obj.SetActive(true);
  372. //}
  373. //public void ZiDingYiCloth(ECustomStyple eCustomStyple, int id, GameObject _objPar)
  374. //{
  375. // RemoveAllChildren(bodyView.transform.GetChild(2).GetChild(0).gameObject);
  376. // GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
  377. // _obj.transform.SetParent(_objPar.transform);
  378. // UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
  379. // _uICustomBtn.id = id;
  380. // _uICustomBtn.eCustomStyple = eCustomStyple;
  381. // _obj.SetActive(true);
  382. //}
  383. public void CreateNieLianImg(int parentid, bool ziDingYi)
  384. {
  385. GameObject _objPar = bodyView.transform.GetChild(2).GetChild(0).gameObject;
  386. RemoveAllChildren(_objPar);
  387. //等有捏脸表时改为捏脸
  388. IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
  389. _bodydata = GameEntry.DataTable.GetDataTable<DRCustomBody>();
  390. int cengji = ziDingYi ?1:0;
  391. if (!ziDingYi)
  392. {
  393. CreateZDYFun(parentid, _objPar);
  394. //GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
  395. //_obj.transform.SetParent(_objPar.transform);
  396. //UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
  397. //ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
  398. //_uICustomBtn.id =parentid;
  399. //_uICustomBtn.eCustomStyple = eCustomStyple;
  400. //_obj.SetActive(true);
  401. }
  402. DRCustomBody[] dRCustomBodies = _bodydata.GetAllDataRows();
  403. for (int i = 0; i < dRCustomBodies.Length; i++)
  404. {
  405. Debug.Log(dRCustomBodies[i].Id);
  406. if (dRCustomBodies[i].ParentStyple == parentid&&dRCustomBodies[i].Cengji==cengji)
  407. {
  408. CreateButtonFun(dRCustomBodies[i].Icon, dRCustomBodies[i].Part, dRCustomBodies[i].Name, _objPar, dRCustomBodies[i].Id, dRCustomBodies[i].ButtonStyple, ECustomStyple.Body);
  409. }
  410. }
  411. ChangeListBotton(_objPar);
  412. }
  413. public void CreateClothImg(int parentid,bool ziDingYi)
  414. {
  415. GameObject _objPar = bodyView.transform.GetChild(2).GetChild(0).gameObject;
  416. RemoveAllChildren(_objPar);
  417. //等有服装时改为服装
  418. IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
  419. _bodydata = GameEntry.DataTable.GetDataTable<DRCustomBody>();
  420. int cengji = ziDingYi ?1:0;
  421. if (!ziDingYi)
  422. {
  423. CreateZDYFun(parentid, _objPar);
  424. //GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
  425. //_obj.transform.SetParent(_objPar.transform);
  426. //UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
  427. //ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
  428. //_uICustomBtn.id = parentid;
  429. //_uICustomBtn.eCustomStyple = eCustomStyple;
  430. //_obj.SetActive(true);
  431. }
  432. DRCustomBody[] dRCustomBodies = _bodydata.GetAllDataRows();
  433. for (int i = 0; i < dRCustomBodies.Length; i++)
  434. {
  435. Debug.Log(dRCustomBodies[i].Id);
  436. if (dRCustomBodies[i].ParentStyple == parentid && dRCustomBodies[i].Cengji == cengji)
  437. {
  438. CreateButtonFun(dRCustomBodies[i].Icon, dRCustomBodies[i].Part, dRCustomBodies[i].Name, _objPar, dRCustomBodies[i].Id, dRCustomBodies[i].ButtonStyple, ECustomStyple.Body);
  439. }
  440. }
  441. ChangeListBotton(_objPar);
  442. }
  443. private void CreateZDYFun(int parentid,GameObject _objPar)
  444. {
  445. GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
  446. _obj.transform.SetParent(_objPar.transform);
  447. UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
  448. ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
  449. }
  450. public void ChangeUICustom(UICustomBtn uICustomBtn,int id, ECustomStyple eCustomStyple)
  451. {
  452. uICustomBtn.id = id;
  453. uICustomBtn.eCustomStyple = eCustomStyple;
  454. uICustomBtn.gameObject.SetActive(true);
  455. }
  456. public void CreateBodyImg(int parentid,bool ziDingYi) {
  457. GameObject _objPar = bodyView.transform.GetChild(2).GetChild(0).gameObject;
  458. RemoveAllChildren(_objPar);
  459. IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
  460. _bodydata = GameEntry.DataTable.GetDataTable<DRCustomBody>();
  461. int cengji = ziDingYi ?1:0;
  462. if (!ziDingYi)
  463. {
  464. CreateZDYFun(parentid, _objPar);
  465. //GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
  466. //_obj.transform.SetParent(_objPar.transform);
  467. //UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
  468. //ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
  469. //_uICustomBtn.id = parentid;
  470. //_uICustomBtn.eCustomStyple = eCustomStyple;
  471. //_obj.SetActive(true);
  472. }
  473. DRCustomBody[] dRCustomBodies = _bodydata.GetAllDataRows();
  474. for (int i = 0; i < dRCustomBodies.Length; i++)
  475. {
  476. Debug.Log(dRCustomBodies[i].Id);
  477. if (dRCustomBodies[i].ParentStyple == parentid && dRCustomBodies[i].Cengji == cengji)
  478. {
  479. CreateButtonFun(dRCustomBodies[i].Icon, dRCustomBodies[i].Part, dRCustomBodies[i].Name, _objPar, dRCustomBodies[i].Id, dRCustomBodies[i].ButtonStyple, ECustomStyple.Body);
  480. }
  481. }
  482. ChangeListBotton(_objPar);
  483. }
  484. /// <summary>
  485. /// 改变列表长短
  486. /// </summary>
  487. public void ChangeListBotton(GameObject _obj) {
  488. //Debug.Log("改变列表"+ _obj.transform.childCount+"");
  489. float _x = _obj.GetComponent<RectTransform>().offsetMin.x;
  490. int _childNum = _obj.transform.childCount;
  491. float _y = _childNum > 7 ? -240 * (_childNum - 7) : 0;
  492. _obj.GetComponent<RectTransform>().offsetMax = new Vector2(_x, 0);
  493. _obj.GetComponent<RectTransform>().offsetMin = new Vector2(_x, _y);
  494. }
  495. //private IEnumerator Tween(Action _action) {
  496. // for (int i = 0; i < 100; i++)
  497. // {
  498. // float _value = i / 100;
  499. // float _right=Mathf.Lerp(tween_rightMax, tween_rightMin, _value);
  500. // float _left= Mathf.Lerp(tween_leftMix, tween_rightMax, _value);
  501. // clothView.GetComponent<RectTransform>().SetPositionX(_right);
  502. // toolView.GetComponent<RectTransform>().SetPositionX(_right);
  503. // bodyView.GetComponent<RectTransform>().SetPositionX(_right);
  504. // nieLianView.GetComponent<RectTransform>().SetPositionX(_right);
  505. // baseView.GetComponent<RectTransform>().SetPositionX(_left);
  506. // }
  507. // yield return null;
  508. //}
  509. protected override void OnUpdate(float elapseSeconds, float realElapseSeconds)
  510. {
  511. base.OnUpdate(elapseSeconds, realElapseSeconds);
  512. }
  513. //private void CreateNieLianFun(object[] _objects) {
  514. // ENieLianStyple _eNieLianStyple = (ENieLianStyple)int.Parse(_objects[1].ToString());
  515. // switch (_eNieLianStyple)
  516. // {
  517. // case ENieLianStyple.faxing:
  518. // break;
  519. // case ENieLianStyple.lianxing:
  520. // break;
  521. // case ENieLianStyple.yankuang:
  522. // break;
  523. // case ENieLianStyple.tongkong:
  524. // break;
  525. // case ENieLianStyple.meimao:
  526. // break;
  527. // case ENieLianStyple.bizi:
  528. // break;
  529. // case ENieLianStyple.erduo:
  530. // break;
  531. // case ENieLianStyple.zuiba:
  532. // break;
  533. // case ENieLianStyple.fuse:
  534. // break;
  535. // }
  536. // //switch()
  537. //}
  538. private void CreateButtonFun(string path,int _part,string _name, GameObject _parent,int _id,int buttonstyple,ECustomStyple eCustomStyple) {
  539. //Debug.Log(path);
  540. // Debug.Log(_parent);
  541. path = "CustomRole/" + path;
  542. GameEntry.Resource.LoadAsset(AssetUtility.GetUISpriteAsset(path), new LoadAssetCallbacks(
  543. (assetName, asset, duration, userData) =>
  544. {
  545. // Debug.Log(path);
  546. // Debug.Log(_parent);
  547. Texture2D tex = (Texture2D)asset;
  548. var sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero);
  549. GameObject _obj = GameObject.Instantiate(buttonItem);
  550. Image _objImg = _obj.transform.GetComponent<Image>();
  551. _obj.SetActive(true);
  552. _objImg.sprite = sprite;
  553. _obj.name = part+"";
  554. _obj.transform.SetParent(_parent.transform);
  555. UICustomBtn uICustomBtn = _obj.GetComponent<UICustomBtn>();
  556. uICustomBtn.id = _id;
  557. uICustomBtn.eButtonStyple = (EButtonStyple)buttonstyple;
  558. uICustomBtn.eCustomStyple = eCustomStyple;
  559. uICustomBtn.isCreate = false;
  560. uICustomBtn.part = _part;
  561. //GameObject
  562. //img.sprite = sprite;
  563. //if (nativeSize)
  564. //{
  565. // img.SetNativeSize();
  566. //}
  567. ChangeListBotton(_parent);
  568. }));
  569. }
  570. //public void NieLian() {
  571. //}
  572. public void ClickFaceChangeBtn()
  573. {
  574. GameEntry.Event.Fire(this, CustomRoleFaceEventArgs.Create(EditableFacePart.eye, new Vector3(1, 0, 0)));
  575. }
  576. }
  577. public enum ECustomStyple
  578. {
  579. None,
  580. NieLian,
  581. Body,
  582. Cloth
  583. }
  584. public enum EButtonStyple
  585. {
  586. Button,
  587. Scroll,
  588. TiaoSe,
  589. NorButton,
  590. Back
  591. }
  592. public enum ENieLianStyple {
  593. None,
  594. faxing,
  595. lianxing,
  596. yankuang,
  597. tongkong,
  598. meimao,
  599. bizi,
  600. erduo,
  601. zuiba,
  602. fuse
  603. }
  604. public enum EButtonShunXu {
  605. None,
  606. First,
  607. Second,
  608. Third
  609. }
  610. public enum ETSStyple {
  611. None,
  612. ViewOpen,
  613. Close,
  614. Sure,
  615. Open
  616. }
  617. }