Scenes_YiLiao.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. using CCS.App;
  2. using DG.Tweening;
  3. using SC.XR.Unity;
  4. using System;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Timers;
  9. using TMPro;
  10. using UnityEngine;
  11. public class Scenes_YiLiao : MonoBehaviour
  12. {
  13. // Start is called before the first frame update
  14. public string SeverString;
  15. public GameObject bodyRol;
  16. public GameObject muscle;
  17. /// <summary>
  18. /// 初始效果出现隐藏变量
  19. /// </summary>
  20. public MeshRenderer startRentiRenderer;
  21. private float initStartRentiRendererFloat;
  22. private float maxStartRentiRendererFloat;
  23. private float minStartRentiRendererFloat;
  24. private bool _isStartShow;
  25. public GameObject[] topTextsList;
  26. public GameObject[] topSlidesList;
  27. private float initTopTxtsTxtColorA;
  28. private float maxTopTxtsTxtColorA;
  29. private float minTopTxtsTxtColorA;
  30. private float inittopSlidesColorRGB;
  31. private float maxtopSlidesColorRGB;
  32. private float mintopSlidesColorRGB;
  33. /// <summary>
  34. /// 头部变量
  35. /// </summary>
  36. public MeshRenderer babyTopRenderer;
  37. public SCSlider3D babyTopSlider;
  38. //头部滑块变量
  39. public MeshRenderer babyTopSaoMaoFXRenderer;
  40. private Color initBabyTopSaoMaoFXRendererColor;
  41. private Animator anim_babyTopSaoMaoFX;
  42. private bool isbabyTopSaoMaoFXShowOrHeid;
  43. private bool IsOneOpenBabyTopSaoMaoFXShowOrHeid;
  44. /// <summary>
  45. /// 身体躯干变量
  46. /// </summary>
  47. public MeshRenderer babyTrunkRenderer;
  48. public SCSlider3D babyTrunkSlider;
  49. //头部ct变量
  50. public MeshRenderer ct1Renderer;
  51. private float initBabyTrunRongjie;
  52. private float MaxBabyTrunRongjie;
  53. private float minBabyTrunRongjie;
  54. private bool isUserDownBabyTrunkSlider;
  55. public GameObject[] babyTrunkGamesUIList;
  56. private FunctionInfo _headFunction;
  57. private FunctionInfo _bodyFunction;
  58. private float _waitTime = 3;
  59. public bool IsStartShow
  60. {
  61. set
  62. {
  63. _isStartShow = value;
  64. StartCoroutine(Ro3Show(_isStartShow));
  65. if (value)
  66. {
  67. }
  68. else
  69. {
  70. // ShowOrHeidBbabyTrunkUI(-1, babyTrunkGamesUIList, "r1");
  71. babyTopSlider.value = _headFunction == null ? 0 : _headFunction.defaultValue / 1.0f;
  72. babyTrunkSlider.value = _bodyFunction == null ? 0 : _bodyFunction.defaultValue / 1.0f;
  73. //scannerSlider.value=
  74. babyTopRenderer.material.SetFloat("_Ani", 0);
  75. }
  76. }
  77. }
  78. #region 新的整体滑动条逻辑
  79. /// <summary>
  80. /// 新的整体滑动条
  81. /// </summary>
  82. public SCSlider3D scannerSlider;
  83. public GameObject hintHandGo; //小手
  84. public float fixedpoint_startvalue;//固定的头和身体的中间值开始变量
  85. public float fixedpoint_endvalue;//固定的头和身体的中间值结束变量
  86. private float now_value; //当前value
  87. private float top_value; //滑到头部时value
  88. private float baby_value;//滑到身体时的value
  89. public GameObject RayLiget;
  90. /// <summary>
  91. /// 扫描仪拖动事件
  92. /// </summary>
  93. public void ScannerSliderValueChaged()
  94. {
  95. now_value = scannerSlider.value;
  96. Debug.Log("ScannerSliderValueChaged====>"+ now_value);
  97. if (now_value <= fixedpoint_startvalue)
  98. {
  99. isTop = true;
  100. babyTrunkGamesUIList[0].SetActive(false);
  101. babyTrunkRenderer.material.SetFloat("_rongjie", 1);
  102. top_value = now_value / fixedpoint_startvalue;
  103. Debug.Log("ScannerSliderValueChaged==top_value==>" + top_value);
  104. babyTopRenderer.material.SetFloat("_Ani", top_value);
  105. ct1Renderer.material.SetFloat("_Ani", top_value);
  106. }
  107. else if(now_value >= fixedpoint_endvalue)
  108. {
  109. isTop = false;
  110. babyTrunkGamesUIList[0].SetActive(true);
  111. baby_value = (now_value- fixedpoint_endvalue) / (1 - fixedpoint_endvalue);
  112. if(baby_value>=1)
  113. {
  114. baby_value = 1;
  115. }
  116. babyTrunkRenderer.material.SetFloat("_rongjie", 0);
  117. Debug.Log("ScannerSliderValueChaged==baby_value==>" + baby_value);
  118. babyTrunkRenderer.material.SetFloat("_Ani", baby_value);
  119. if (baby_value <= 0.1f)
  120. {
  121. ShowOrHeidBbabyTrunkUI(0, babyTrunkGamesUIList, "r4");
  122. }
  123. else if (baby_value >= 0.1f && baby_value < 0.3f)
  124. {
  125. ShowOrHeidBbabyTrunkUI(1, babyTrunkGamesUIList, "r3");
  126. }
  127. else if (baby_value >= 0.3f && baby_value < 0.5f)
  128. {
  129. ShowOrHeidBbabyTrunkUI(2, babyTrunkGamesUIList, "r2");
  130. }
  131. else if (baby_value >= 0.5f && baby_value < 1f)
  132. {
  133. ShowOrHeidBbabyTrunkUI(3, babyTrunkGamesUIList, "r1");
  134. }
  135. }
  136. }
  137. public bool isTop = true; //是否扫描的头部
  138. /// <summary>
  139. /// 进入或者滑出滑动条进行的操作
  140. /// </summary>
  141. /// <param name="str"></param>
  142. public void Show_ScannerSliderFX(string str)
  143. {
  144. if (str == "Down")
  145. {
  146. RayLiget.SetActive(true);
  147. if (isTop)
  148. {
  149. babyTopSaoMaoFXRenderer.gameObject.SetActive(true);
  150. anim_babyTopSaoMaoFX.Play("startSaoMiao");
  151. // SendTopFenctionInfo2S(top_value);
  152. }
  153. else
  154. {
  155. isUserDownBabyTrunkSlider = true;
  156. // SendBabyFenctionInfo2S(baby_value);
  157. }
  158. muscle.SetActive(true);
  159. }
  160. if (str == "Up")
  161. {
  162. RayLiget.SetActive(false);
  163. if (isTop)
  164. {
  165. anim_babyTopSaoMaoFX.Play("retrunSaoMiao");
  166. // SendTopFenctionInfo2S(top_value);
  167. }
  168. else
  169. {
  170. isUserDownBabyTrunkSlider = false;
  171. // SendBabyFenctionInfo2S(baby_value);
  172. }
  173. }
  174. ShowOrHeidTextsColorA("ChangeTextMeshPro", topTextsList, initTopTxtsTxtColorA, true);
  175. }
  176. /// <summary>
  177. /// 焦点进入事件
  178. /// </summary>
  179. public void PointEnterEvent()
  180. {
  181. Debug.Log("PointEnterEvent");
  182. hintHandGo.SetActive(true);
  183. }
  184. /// <summary>
  185. /// 焦点移出事件
  186. /// </summary>
  187. public void PointExitEvent()
  188. {
  189. Debug.Log("PointExitEvent");
  190. hintHandGo.SetActive(false);
  191. }
  192. /// <summary>
  193. /// 发送头当前数据给中控
  194. /// </summary>
  195. /// <param name="value">当前value</param>
  196. private void SendTopFenctionInfo2S(float value)
  197. {
  198. // _headFunction.functionValues[0].value = (int)(value * 100);
  199. // GameManager.Instance.SendFunctionInfo2S(_headFunction);
  200. }
  201. /// <summary>
  202. /// 发送身体当前数据给中控
  203. /// </summary>
  204. /// <param name="value">当前value</param>
  205. private void SendBabyFenctionInfo2S(float value)
  206. {
  207. // _bodyFunction.functionValues[0].value = (int)(value * 100);
  208. // GameManager.Instance.SendFunctionInfo2S(_bodyFunction);
  209. }
  210. /// <summary>
  211. /// 获取头或者身体当前滑动条的值
  212. /// </summary>
  213. /// <param name="value">中控发送的值</param>
  214. /// <param name="type">0 为头部, 1为身体</param>
  215. /// <returns>换算后的滑动条值</returns>
  216. private float ConvertsTheurrentSliderPosition(float value,int type)
  217. {
  218. if (type == 0)//扫描的头部
  219. {
  220. return (value * fixedpoint_startvalue);
  221. }
  222. else if (type == 1) //扫描的身体
  223. {
  224. return (value * (1 - fixedpoint_endvalue)+ fixedpoint_endvalue);
  225. }
  226. return 0;
  227. }
  228. #endregion
  229. private void Awake()
  230. {
  231. // GameManager.Instance.functionChangleAction += MedicalFunctionChangleHandler;
  232. // _headFunction = AppManager.Instance.functionInfos.FirstOrDefault(f => f.moduleID == 2 && f.functionID == 3);
  233. // _bodyFunction = AppManager.Instance.functionInfos.FirstOrDefault(f => f.moduleID == 2 && f.functionID == 4);
  234. }
  235. private void OnDestroy()
  236. {
  237. // GameManager.Instance.functionChangleAction -= MedicalFunctionChangleHandler;
  238. }
  239. private void MedicalFunctionChangleHandler(int moduleID, int functionID, FunctionType functionType, List<FunctionValue> functionValues)
  240. {
  241. //当前是医疗
  242. if (moduleID == 2 && functionID == 1 && functionType == FunctionType.Switch)
  243. {
  244. switch ((FunctionState)functionValues[0].value)
  245. {
  246. case FunctionState.None:
  247. break;
  248. case FunctionState.Open:
  249. StartOrOpenRenTiObj(true);
  250. break;
  251. case FunctionState.Close:
  252. StartOrOpenRenTiObj(false);
  253. break;
  254. case FunctionState.Wait:
  255. break;
  256. default:
  257. break;
  258. }
  259. }
  260. else if (moduleID == 2 && functionID == 3 && functionType == FunctionType.RangeValue)
  261. {
  262. babyTopSlider.value = functionValues[0].value / 100.0f;
  263. //metoo
  264. ; scannerSlider.value = ConvertsTheurrentSliderPosition(functionValues[0].value / 100.0f,0);
  265. }
  266. else if (moduleID == 2 && functionID == 4 && functionType == FunctionType.RangeValue)
  267. {
  268. if (!muscle.activeSelf)
  269. {
  270. muscle.SetActive(true);
  271. isUserDownBabyTrunkSlider = true;
  272. }
  273. babyTrunkSlider.value = functionValues[0].value / 100.0f;
  274. //metoo
  275. scannerSlider.value = ConvertsTheurrentSliderPosition(functionValues[0].value / 100.0f, 1);
  276. ScannerSliderValueChaged();
  277. BabyTrunkSliderValueChaged();
  278. _waitTime = 0;
  279. }
  280. }
  281. void Start()
  282. {
  283. Init();
  284. StartOrOpenRenTiObj(true);
  285. StartCoroutine(DeleEffectsTrue());
  286. }
  287. IEnumerator DeleEffectsTrue()
  288. {
  289. yield return new WaitForSeconds(0.1f);
  290. // GameManager.Instance.LoadingGameObj(false);
  291. }
  292. WaitForEndOfFrame wfs = new WaitForEndOfFrame();
  293. IEnumerator Ro3Show(bool isShow)
  294. {
  295. startRentiRenderer.gameObject.SetActive(true);
  296. if (isShow)
  297. {
  298. bodyRol.SetActive(true);
  299. }
  300. startRentiRenderer.material.SetFloat("_Float1", isShow ? maxStartRentiRendererFloat : minStartRentiRendererFloat);
  301. bool isStart = true;
  302. while (isStart)
  303. {
  304. yield return wfs;
  305. if (isShow)
  306. {
  307. if (initStartRentiRendererFloat < minStartRentiRendererFloat)
  308. {
  309. isStart = false;
  310. }
  311. }
  312. else
  313. {
  314. if (initStartRentiRendererFloat > maxStartRentiRendererFloat)
  315. {
  316. isStart = false;
  317. bodyRol.SetActive(false);
  318. }
  319. }
  320. }
  321. startRentiRenderer.gameObject.SetActive(false);
  322. }
  323. private void Init()
  324. {
  325. InitStartBabyAll();
  326. InitBabyTop();
  327. InitBabyTrunk();
  328. }
  329. /// <summary>
  330. /// 整体效果初始化
  331. /// </summary>
  332. private void InitStartBabyAll()
  333. {
  334. muscle.SetActive(false);
  335. initStartRentiRendererFloat = 1.2f;
  336. maxStartRentiRendererFloat = initStartRentiRendererFloat;
  337. minStartRentiRendererFloat = 0;
  338. startRentiRenderer.material.SetFloat("_Float1", initStartRentiRendererFloat);
  339. IsStartShow = false;
  340. initTopTxtsTxtColorA = 0;
  341. maxTopTxtsTxtColorA = 1;
  342. minTopTxtsTxtColorA = initTopTxtsTxtColorA;
  343. inittopSlidesColorRGB = 0;
  344. maxtopSlidesColorRGB = 1;
  345. mintopSlidesColorRGB = inittopSlidesColorRGB;
  346. }
  347. /// <summary>
  348. /// 脑部初始
  349. /// </summary>
  350. private void InitBabyTop()
  351. {
  352. babyTopRenderer.material.SetFloat("_Ani", 0);
  353. ct1Renderer.material.SetFloat("_Ani", 0);
  354. anim_babyTopSaoMaoFX = babyTopSaoMaoFXRenderer.gameObject.GetComponent<Animator>();
  355. initBabyTopSaoMaoFXRendererColor = new Color(0, 0, 0);
  356. babyTopSaoMaoFXRenderer.material.SetColor("_yanse", initBabyTopSaoMaoFXRendererColor);
  357. babyTopSaoMaoFXRenderer.material.SetColor("_node_2070", initBabyTopSaoMaoFXRendererColor);
  358. babyTopSaoMaoFXRenderer.material.SetColor("_node_3228", initBabyTopSaoMaoFXRendererColor);
  359. babyTopSaoMaoFXRenderer.gameObject.SetActive(false);
  360. IsOneOpenBabyTopSaoMaoFXShowOrHeid = true;
  361. }
  362. private void InitBabyTrunk()
  363. {
  364. babyTrunkRenderer.material.SetFloat("_Ani", 0);
  365. initBabyTrunRongjie = 1;
  366. MaxBabyTrunRongjie = 1;
  367. minBabyTrunRongjie = 0;
  368. babyTrunkRenderer.material.SetFloat("_rongjie", 1);
  369. isUserDownBabyTrunkSlider = false;
  370. }
  371. /// <summary>
  372. /// 滑动头部滑块
  373. /// </summary>
  374. public void BabyTopSliderValueChaged()
  375. {
  376. babyTopRenderer.material.SetFloat("_Ani", babyTopSlider.value);
  377. ct1Renderer.material.SetFloat("_Ani", babyTopSlider.value);
  378. }
  379. /// <summary>
  380. /// 滑动身体滑块
  381. /// </summary>
  382. public void BabyTrunkSliderValueChaged()
  383. {
  384. babyTrunkRenderer.material.SetFloat("_Ani", babyTrunkSlider.value);
  385. // Debug.Log(babyTrunkSlider.value + "=>babyTrunkSlider.value");
  386. if (babyTrunkSlider.value <= 0.1f)
  387. {
  388. ShowOrHeidBbabyTrunkUI(0, babyTrunkGamesUIList, "r4");
  389. }
  390. else if (babyTrunkSlider.value >= 0.1f && babyTrunkSlider.value < 0.3f)
  391. {
  392. ShowOrHeidBbabyTrunkUI(1, babyTrunkGamesUIList, "r3");
  393. }
  394. else if (babyTrunkSlider.value >= 0.3f && babyTrunkSlider.value < 0.5f)
  395. {
  396. ShowOrHeidBbabyTrunkUI(2, babyTrunkGamesUIList, "r2");
  397. }
  398. else if (babyTrunkSlider.value >= 0.5f && babyTrunkSlider.value < 1f)
  399. {
  400. ShowOrHeidBbabyTrunkUI(3, babyTrunkGamesUIList, "r1");
  401. }
  402. }
  403. // Update is called once per frame
  404. void Update()
  405. {
  406. if (_waitTime <= 2)
  407. {
  408. _waitTime += Time.deltaTime;
  409. if (_waitTime > 2)
  410. {
  411. isUserDownBabyTrunkSlider = false;
  412. }
  413. }
  414. //根据bool 显示或关闭 整体模型
  415. if (_isStartShow)
  416. {
  417. // Debug.Log("++++++++++++++++++++++++++++++++++");
  418. if (initStartRentiRendererFloat >= minStartRentiRendererFloat)
  419. {
  420. initStartRentiRendererFloat -= Time.deltaTime * 0.3f;
  421. startRentiRenderer.material.SetFloat("_Float1", initStartRentiRendererFloat);
  422. }
  423. //if (initTopTxtsTxtColorA <= maxTopTxtsTxtColorA)
  424. //{
  425. // Debug.Log("22222222222222222222222222");
  426. // initTopTxtsTxtColorA += Time.deltaTime * 0.3f;
  427. // ShowOrHeidTextsColorA("ChangeTextMeshPro", topTextsList, initTopTxtsTxtColorA, false);
  428. //}
  429. //if (inittopSlidesColorRGB <= maxtopSlidesColorRGB)
  430. //{
  431. // Debug.Log("111111111111111111111111111111111");
  432. // inittopSlidesColorRGB += Time.deltaTime * 0.3f;
  433. // ShowOrHeidTextsColorA("ChangeMeshRenderer", topSlidesList, inittopSlidesColorRGB, true);
  434. //}
  435. if (isUserDownBabyTrunkSlider)
  436. {
  437. if (initBabyTrunRongjie >= minBabyTrunRongjie)
  438. {
  439. initBabyTrunRongjie -= Time.deltaTime * 1f;
  440. babyTrunkRenderer.material.SetFloat("_rongjie", initBabyTrunRongjie);
  441. }
  442. }
  443. //else
  444. //{
  445. // if (initBabyTrunRongjie <= MaxBabyTrunRongjie)
  446. // {
  447. // Debug.Log("444444444444444444444444");
  448. // initBabyTrunRongjie += Time.deltaTime * 0.04f;
  449. // babyTrunkRenderer.material.SetFloat("_rongjie", initBabyTrunRongjie);
  450. // }
  451. // else
  452. // {
  453. // muscle.SetActive(false);
  454. // }
  455. //}
  456. }
  457. //else
  458. //{
  459. // // Debug.Log("-----------------------------------");
  460. // if (initStartRentiRendererFloat <= maxStartRentiRendererFloat)
  461. // {
  462. // initStartRentiRendererFloat += Time.deltaTime * 0.3f;
  463. // startRentiRenderer.material.SetFloat("_Float1", initStartRentiRendererFloat);
  464. // }
  465. // if (initTopTxtsTxtColorA >= minTopTxtsTxtColorA)
  466. // {
  467. // initTopTxtsTxtColorA -= Time.deltaTime * 0.3f;
  468. // ShowOrHeidTextsColorA("ChangeTextMeshPro", topTextsList, initTopTxtsTxtColorA, false);
  469. // }
  470. // if (inittopSlidesColorRGB >= mintopSlidesColorRGB)
  471. // {
  472. // inittopSlidesColorRGB -= Time.deltaTime * 0.3f;
  473. // ShowOrHeidTextsColorA("ChangeMeshRenderer", topSlidesList, inittopSlidesColorRGB, false);
  474. // }
  475. // if (initBabyTrunRongjie <= MaxBabyTrunRongjie)
  476. // {
  477. // initBabyTrunRongjie += Time.deltaTime * 0.3f;
  478. // babyTrunkRenderer.material.SetFloat("_rongjie", initBabyTrunRongjie);
  479. // }
  480. //}
  481. #if UNITY_EDITOR
  482. if (Input.GetKey(KeyCode.J))
  483. {
  484. StartOrOpenRenTiObj(true);
  485. }
  486. else if (Input.GetKey(KeyCode.K))
  487. {
  488. StartOrOpenRenTiObj(false);
  489. }
  490. #endif
  491. }
  492. public void ShowOrHeidTextsColorA(string str, GameObject[] games, float colorA, bool isOpenBoxCollider)
  493. {
  494. if (str == "ChangeTextMeshPro")
  495. {
  496. if (isOpenBoxCollider)//这里用关闭 “手势捏住下方滑块滑动条”
  497. {
  498. games[1].GetComponent<TextMeshPro>().color = new Color(1, 1, 1, 0);
  499. }
  500. else
  501. {
  502. for (int i = 0; i < games.Length; i++)
  503. {
  504. games[i].GetComponent<TextMeshPro>().color = new Color(1, 1, 1, colorA);
  505. }
  506. }
  507. }
  508. else if (str == "ChangeMeshRenderer")
  509. {
  510. for (int i = 0; i < games.Length; i++)
  511. {
  512. games[i].GetComponent<BoxCollider>().enabled = isOpenBoxCollider;
  513. games[i].GetComponent<MeshRenderer>().material.color = new Color(colorA, colorA, colorA);
  514. }
  515. }
  516. }
  517. /// <summary>
  518. /// 开启或关闭人体
  519. /// </summary>
  520. /// <param name="isOpen"></param>
  521. public void StartOrOpenRenTiObj(bool isOpen)
  522. {
  523. IsStartShow = isOpen;
  524. }
  525. /// <summary>
  526. /// 关闭或显示人体脑部特效
  527. /// </summary>
  528. /// <param name="isOpen"></param>
  529. public void Show_BabyTopSaoMaoFX(string str)
  530. {
  531. if (str == "ShowBobyTopSaoMiaoFX")
  532. {
  533. babyTopSaoMaoFXRenderer.gameObject.SetActive(true);
  534. anim_babyTopSaoMaoFX.Play("startSaoMiao");
  535. }
  536. else if (str == "HeidBobyTopSaoMiaoFX")
  537. {
  538. anim_babyTopSaoMaoFX.Play("retrunSaoMiao");
  539. }
  540. _headFunction.functionValues[0].value = (int)(babyTopSlider.value * 100);
  541. // GameManager.Instance.SendFunctionInfo2S(_headFunction);
  542. ShowOrHeidTextsColorA("ChangeTextMeshPro", topTextsList, initTopTxtsTxtColorA, true);
  543. }
  544. /// <summary>
  545. /// 关闭或现实人体躯干特效
  546. /// </summary>
  547. /// <param name="str"></param>
  548. public void Show_BabyTrunkFX(string str)
  549. {
  550. if (str == "ShowBobyTrunkFX")
  551. {
  552. muscle.SetActive(true);
  553. isUserDownBabyTrunkSlider = true;
  554. }
  555. else if (str == "HeidBobyTrunkFX")
  556. {
  557. isUserDownBabyTrunkSlider = false;
  558. }
  559. _bodyFunction.functionValues[0].value = (int)(babyTrunkSlider.value * 100);
  560. // GameManager.Instance.SendFunctionInfo2S(_bodyFunction);
  561. // Debug.LogError(str + "=>str");
  562. ShowOrHeidTextsColorA("ChangeTextMeshPro", topTextsList, initTopTxtsTxtColorA, true);
  563. }
  564. // int lastgamesNum=-1;
  565. private void ShowOrHeidBbabyTrunkUI(int index, GameObject[] games, string animName)
  566. {
  567. if (index==-1)
  568. {
  569. return;
  570. }
  571. // Debug.Log(index + "=>index");
  572. for (int i = 0; i < games.Length; i++)
  573. {
  574. if (i != index)
  575. {
  576. // games[i].SetActive(true);
  577. // Debug.Log(i + "=>+++++back");
  578. games[i].gameObject.GetComponent<Animator>().SetBool("Open", true);
  579. games[i].gameObject.transform.localPosition = new Vector3(999f, 999f, 999f);
  580. }
  581. else
  582. {
  583. switch (index)
  584. {
  585. case 0:
  586. games[i].GetComponent<Animator>().SetBool("Open", false);
  587. games[0].gameObject.transform.localPosition = new Vector3(-0.0353f, 0.131f, 0.0618f);
  588. break;
  589. case 1:
  590. games[i].GetComponent<Animator>().SetBool("Open", false);
  591. // games[1].gameObject.GetComponent<Animator>().Play(animName);
  592. games[1].gameObject.transform.localPosition = new Vector3(-0.0077f, 0.1765f, 0.06325f);
  593. break;
  594. case 2:
  595. games[i].GetComponent<Animator>().SetBool("Open", false);
  596. // games[2].gameObject.GetComponent<Animator>().Play(animName);
  597. games[2].gameObject.transform.localPosition = new Vector3(-0.0124f, 0.2897f, 0.0449f);
  598. break;
  599. case 3:
  600. games[i].GetComponent<Animator>().SetBool("Open", false);
  601. // games[3].gameObject.GetComponent<Animator>().Play(animName);
  602. games[3].gameObject.transform.localPosition = new Vector3(-0.0206f, 0.3177f, 0.063f);
  603. break;
  604. }
  605. }
  606. }
  607. }
  608. private IEnumerator waitOfAnimEndHeidGameObj(float timer, GameObject obj, bool isB)
  609. {
  610. yield return new WaitForSeconds(timer);
  611. obj.SetActive(isB);
  612. }
  613. private IEnumerator waitOfInit(float timer)
  614. {
  615. yield return new WaitForSeconds(timer);
  616. Init();
  617. }
  618. }