UICustom.cs 25 KB

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