DaoYouInfoPanel.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Core.Audio;
  4. using Core.Language;
  5. using Excel2Json;
  6. using Fort23.Core;
  7. using Fort23.UTool;
  8. using GameLogic.Bag;
  9. using UnityEngine;
  10. namespace Fort23.Mono
  11. {
  12. [UIBinding(prefab = "DaoYouInfoPanel")]
  13. public partial class DaoYouInfoPanel : UIPanel
  14. {
  15. private AccountFileInfo.DaoYouData daoYouData;
  16. private DaoyouModelConfig _daoyouModelConfig;
  17. private ItemInfo currentSelectWidgetItem;
  18. List<WidgetItem> widgetItems = new List<WidgetItem>();
  19. List<WidgetItem> giveWidgetItems = new List<WidgetItem>();
  20. List<DaoYouLevelWidget> _daoYouLevelWidgets = new List<DaoYouLevelWidget>();
  21. List<DaoYouIdleEarningsWidget> _daoYouIdleEarningsWidgets = new List<DaoYouIdleEarningsWidget>();
  22. List<DaoYouaaFfixWidget> daoYouaaFfixWidgets = new List<DaoYouaaFfixWidget>();
  23. private TimerEntity _timerEntity = null;
  24. private DaoyouGiftConfig[] daoyouGiftConfigs;
  25. private void Init()
  26. {
  27. IsShowAppBar = true;
  28. isAddStack = true;
  29. }
  30. protected override void AddEvent()
  31. {
  32. }
  33. protected override void DelEvent()
  34. {
  35. }
  36. public override void AddButtonEvent()
  37. {
  38. Btn_CiZuiHelp.onClick.AddListener(() => { HelpTipPanel.OpenTipMessagePanel(10791); });
  39. Btn_SongLiHelp.onClick.AddListener(() => { HelpTipPanel.OpenTipMessagePanel(10790); });
  40. Btn_Emotion.onClick.AddListener((() => { ShowMessage(); }));
  41. Btn_Facorability.onClick.AddListener(() =>
  42. {
  43. Info.SetActive(false);
  44. Facorability.SetActive(true);
  45. });
  46. Btn_InfoMation.onClick.AddListener(() =>
  47. {
  48. Info.SetActive(true);
  49. Facorability.SetActive(false);
  50. });
  51. Btn_SendGift.onClick.AddListener(async () =>
  52. {
  53. if (daoYouData.favorabilityLv >= _daoYouLevelWidgets.Count)
  54. {
  55. TipMessagePanel.OpenTipMessagePanel("道友等级已到最高");
  56. return;
  57. }
  58. AppBarPanel.ClosePanel();
  59. await UpdateGiveGiftRoot();
  60. GiveGite.gameObject.SetActive(true);
  61. });
  62. Btn_Love.onClick.AddListener(() =>
  63. {
  64. ClosePoolGive();
  65. saiXuanType = 2;
  66. List<ItemInfo> showItems = SaiXuan(saiXuanType);
  67. CreatItem(showItems);
  68. });
  69. Btn_Tongyong.onClick.AddListener(() =>
  70. {
  71. ClosePoolGive();
  72. saiXuanType = 1;
  73. List<ItemInfo> showItems = SaiXuan(saiXuanType);
  74. CreatItem(showItems);
  75. });
  76. Btn_Eveent.onClick.AddListener(() =>
  77. {
  78. TipMessagePanel.OpenTipMessagePanel(LanguageManager.Instance.Text(10697, daoYouData.favorabilityLv));
  79. // if (daoYouData.favorabilityLv >= _daoyouModelConfig.EmotionLvforQuest
  80. // && !EventSystemManager.Instance.BagIsEvent(_daoyouModelConfig.QuestID)
  81. // && EventSystemManager.Instance.BagIsEvent(_daoyouModelConfig.EventCompleteforQuest)
  82. // && !EventSystemManager.Instance.IsEventCompleted(_daoyouModelConfig.QuestID))
  83. // {
  84. // AccountFileInfo.EventList eventList =
  85. // EventSystemManager.Instance.AddEvent(_daoyouModelConfig.QuestID);
  86. // AccountFileInfo.Instance.playerData.eventList.Add(eventList);
  87. // AccountFileInfo.Instance.SavePlayerData();
  88. // EventSystemManager.Instance.TriggerEvent(eventList);
  89. // Btn_Eveent.gameObject.SetActive(false);
  90. // }
  91. });
  92. Btn_Back.onClick.AddListener(() =>
  93. {
  94. ClosePoolGive();
  95. currentSelectWidgetItem = null;
  96. GiveGite.gameObject.SetActive(false);
  97. AppBarPanel.OpenPanel(this);
  98. });
  99. Btn_Add.onClick.AddListener(Add);
  100. Btn_Reduce.onClick.AddListener(Reduce);
  101. Btn_Max.onClick.AddListener(() =>
  102. {
  103. if (widgetItem1 == null)
  104. return;
  105. Slider_Give.value = (int)widgetItem1.itemInfo.count.Value;
  106. });
  107. Slider_Give.onValueChanged.AddListener((i) =>
  108. {
  109. count = (int)i;
  110. UpdateGiveItemCount();
  111. });
  112. Btn_Give.onClick.AddListener(() =>
  113. {
  114. if (widgetItem1 == null)
  115. {
  116. return;
  117. }
  118. if (!PlayerManager.Instance.BagController.DeductItem(daoyouGiftConfig.ItemID, count))
  119. {
  120. TipMessagePanel.OpenTipMessagePanel(10324);
  121. return;
  122. }
  123. //加好感
  124. if (widgetItem1 != null && daoyouGiftConfig.ID != 0)
  125. {
  126. //TODO 消耗:送礼给道友
  127. // bool isok =PlayerManager.Instance.BagController.DeductItem(daoyouGiftConfig.ItemID, count);
  128. emotionConfig emotionConfig = ConfigComponent.Instance.Get<emotionConfig>(daoYouData.emotion);
  129. if (_daoyouModelConfig.PreferGiftID.Contains(daoyouGiftConfig.ItemID) &&
  130. !daoYouData.loveIds.Contains(daoyouGiftConfig.ItemID))
  131. {
  132. daoYouData.loveIds.Add(daoyouGiftConfig.ItemID);
  133. }
  134. //加经验
  135. for (int i = 0; i < count; i++)
  136. {
  137. int bl = Random.Range(emotionConfig.hanganUpRate[0], emotionConfig.hanganUpRate[1] + 1);
  138. //喜好礼物翻倍
  139. if (_daoyouModelConfig.PreferGiftID.Contains(daoyouGiftConfig.ItemID))
  140. {
  141. daoYouData.exp += (daoyouGiftConfig.emotionValue * bl * 0.001f *
  142. PlayerManager.Instance.gameConstantConfig.daolvfavoratePara *
  143. 0.01f);
  144. }
  145. else
  146. {
  147. daoYouData.exp += (daoyouGiftConfig.emotionValue * bl * 0.001f);
  148. }
  149. }
  150. DaoyouLevelupConfig[] configs = ConfigComponent.Instance.GetAll<DaoyouLevelupConfig>();
  151. for (var i = daoYouData.favorabilityLv; i < configs.Length; i++)
  152. {
  153. if (daoYouData.exp >= configs[i - 1].exp)
  154. {
  155. daoYouData.exp -= configs[i - 1].exp;
  156. daoYouData.favorabilityLv++;
  157. }
  158. else
  159. {
  160. break;
  161. }
  162. }
  163. AudioManager.Instance.PlayAudio("ui_shiyonghuode");
  164. AccountFileInfo.Instance.SavePlayerData();
  165. }
  166. //加心情
  167. else
  168. {
  169. if (daoYouData.emotionValue >= 100)
  170. {
  171. TipMessagePanel.OpenTipMessagePanel("心情已经到最高");
  172. return;
  173. }
  174. //TODO 消耗:送礼给道友
  175. // PlayerManager.Instance.BagController.DeductItem(widgetItem1.itemInfo.itemID, count);
  176. daoYouData.emotionValue += widgetItem1.itemInfo.config.associateVlaue[0];
  177. int emotionId = 4 - (int)(daoYouData.emotionValue / (100 / (float)3));
  178. if (emotionId > 3)
  179. emotionId = 3;
  180. daoYouData.emotion = emotionId;
  181. emotionConfig emotionConfig = ConfigComponent.Instance.Get<emotionConfig>(daoYouData.emotion);
  182. Text_message.text = LanguageManager.Instance.Text(emotionConfig.des);
  183. AccountFileInfo.Instance.SavePlayerData();
  184. }
  185. UpdateUI();
  186. UpdateGiveGiftRoot();
  187. });
  188. }
  189. public async override CTask<bool> AsyncInit(object[] uiData)
  190. {
  191. daoYouData = uiData[0] as AccountFileInfo.DaoYouData;
  192. _daoyouModelConfig = ConfigComponent.Instance.Get<DaoyouModelConfig>(daoYouData.id);
  193. daoyouGiftConfigs = ConfigComponent.Instance.GetAll<DaoyouGiftConfig>();
  194. emotionConfig emotionConfig = ConfigComponent.Instance.Get<emotionConfig>(daoYouData.emotion);
  195. Text_message.text = LanguageManager.Instance.Text(emotionConfig.des);
  196. ShowMessage();
  197. Icon_bodyIcon.icon_name = _daoyouModelConfig.bodyIcon;
  198. Icon_bodyIcon.GetComponent<RectTransform>().anchoredPosition =
  199. new Vector2(_daoyouModelConfig.bodyPos[0], _daoyouModelConfig.bodyPos[1]);
  200. await UpdateUI();
  201. return await base.AsyncInit(uiData);
  202. }
  203. private void ShowMessage()
  204. {
  205. dotPoint.SetActive(true);
  206. _timerEntity?.Dispose();
  207. _timerEntity = null;
  208. _timerEntity = TimerComponent.Instance.AddTimer(5000, () =>
  209. {
  210. dotPoint.SetActive(false);
  211. _timerEntity?.Dispose();
  212. _timerEntity = null;
  213. });
  214. }
  215. public async CTask UpdateUI()
  216. {
  217. foreach (var widgetItem in widgetItems)
  218. {
  219. UIManager.Instance.DormancyGComponent(widgetItem);
  220. }
  221. widgetItems.Clear();
  222. foreach (var daoYouLevelWidget in _daoYouLevelWidgets)
  223. {
  224. UIManager.Instance.DormancyGComponent(daoYouLevelWidget);
  225. }
  226. _daoYouLevelWidgets.Clear();
  227. foreach (var daoYouIdleEarningsWidget in _daoYouIdleEarningsWidgets)
  228. {
  229. UIManager.Instance.DormancyGComponent(daoYouIdleEarningsWidget);
  230. }
  231. _daoYouIdleEarningsWidgets.Clear();
  232. foreach (var daoYouaaFfixWidget in daoYouaaFfixWidgets)
  233. {
  234. UIManager.Instance.DormancyGComponent(daoYouaaFfixWidget);
  235. }
  236. daoYouaaFfixWidgets.Clear();
  237. if (daoYouData.favorabilityLv != -1
  238. && !EventSystemManager.Instance.IsEventCompleted(_daoyouModelConfig.QuestID))
  239. {
  240. Btn_Eveent.gameObject.SetActive(true);
  241. }
  242. else
  243. {
  244. Btn_Eveent.gameObject.SetActive(false);
  245. }
  246. Slider_Emotion.fillAmount = daoYouData.emotionValue / 100f;
  247. HeroPowerUpConfig heroPowerUpConfig =
  248. ConfigComponent.Instance.Get<HeroPowerUpConfig>(PlayerManager.Instance.GetDaoYouLevel(daoYouData));
  249. Text_JingJie.text = LanguageManager.Instance.Text(heroPowerUpConfig.jingjieLanIDs[0]) +
  250. LanguageManager.Instance.Text(heroPowerUpConfig.jingjieLanIDs[1]) +
  251. LanguageManager.Instance.Text(heroPowerUpConfig.jingjieLanIDs[2]);
  252. Text_Name.text = LanguageManager.Instance.Text(_daoyouModelConfig.name);
  253. int index = 0;
  254. for (var i = 0; i < _daoyouModelConfig.desUnlockLv.Length; i++)
  255. {
  256. if (daoYouData.favorabilityLv >= _daoyouModelConfig.desUnlockLv[i])
  257. {
  258. index = i;
  259. }
  260. }
  261. Text_Desc.text = LanguageManager.Instance.Text(_daoyouModelConfig.des[index]);
  262. // guajibuff guajibuff = ConfigComponent.Instance.Get<guajibuff>(_daoyouModelConfig.guajiBuffID[0]);
  263. // DaoyouLevelupConfig daoyouLevelupConfig1 = ConfigComponent.Instance.Get<DaoyouLevelupConfig>(daoYouData.favorabilityLv);
  264. Text_GiftGailv.text = LanguageManager.Instance.Text(10278,
  265. PlayerManager.Instance.GetBl(daoYouData, _daoyouModelConfig.guajiBuffID[0]));
  266. // "送礼概率:" + PlayerManager.Instance.GetBl(daoYouData, _daoyouModelConfig.guajiBuffID[0]) + "%";
  267. for (var i = 1; i < _daoyouModelConfig.guajiBuffID.Length; i++)
  268. {
  269. DaoYouIdleEarningsWidget daoYouIdleEarningsWidget =
  270. await UIManager.Instance.CreateGComponent<DaoYouIdleEarningsWidget>(null, GuajiContent);
  271. daoYouIdleEarningsWidget.CustomInit(daoYouData, _daoyouModelConfig.guajiBuffID[i]);
  272. _daoYouIdleEarningsWidgets.Add(daoYouIdleEarningsWidget);
  273. }
  274. DaoyouLevelupConfig currentDaoyouLevelupConfig =
  275. ConfigComponent.Instance.Get<DaoyouLevelupConfig>(daoYouData.favorabilityLv);
  276. Text_CurrentName.text = LanguageManager.Instance.Text(currentDaoyouLevelupConfig.name);
  277. Text_CurrentLevel.text = daoYouData.favorabilityLv.ToString();
  278. Slider_LeveUp.maxValue = currentDaoyouLevelupConfig.exp;
  279. DaoyouLevelupConfig[] configs = ConfigComponent.Instance.GetAll<DaoyouLevelupConfig>();
  280. if (daoYouData.favorabilityLv >= configs.Length)
  281. {
  282. Text_Exp.text = $"{daoYouData.exp.ToString("0.0")}/MAX";
  283. }
  284. else
  285. {
  286. Text_Exp.text = $"{daoYouData.exp.ToString("0.0")}/{currentDaoyouLevelupConfig.exp}";
  287. }
  288. Slider_LeveUp.value = daoYouData.exp;
  289. CTaskAwaitBuffer taskAwaitBuffer = new CTaskAwaitBuffer();
  290. CTaskAwaitBuffer<WidgetItem> cts = null;
  291. if (_daoyouModelConfig.PreferGiftID != null)
  292. {
  293. cts = new CTaskAwaitBuffer<WidgetItem>();
  294. foreach (var i in _daoyouModelConfig.PreferGiftID)
  295. {
  296. cts.AddTask(UIManager.Instance.CreateGComponent<WidgetItem>(null, LoveItemContent));
  297. }
  298. taskAwaitBuffer.AddTask(cts.WaitAll());
  299. }
  300. CTaskAwaitBuffer<DaoYouaaFfixWidget> cts2 = null;
  301. if (_daoyouModelConfig.daolvSkillID != null)
  302. {
  303. cts2 = new CTaskAwaitBuffer<DaoYouaaFfixWidget>();
  304. for (var i = 0; i < _daoyouModelConfig.daolvSkillID.Length; i++)
  305. {
  306. cts2.AddTask(UIManager.Instance.CreateGComponent<DaoYouaaFfixWidget>(null, DaoLvContent));
  307. }
  308. taskAwaitBuffer.AddTask(cts2.WaitAll());
  309. Text_Desc3.gameObject.SetActive(true);
  310. }
  311. else
  312. {
  313. Text_Desc3.gameObject.SetActive(false);
  314. }
  315. CTaskAwaitBuffer<DaoYouLevelWidget> cts1 = new CTaskAwaitBuffer<DaoYouLevelWidget>();
  316. foreach (var daoyouLevelupConfig in configs)
  317. {
  318. cts1.AddTask(UIManager.Instance.CreateGComponent<DaoYouLevelWidget>(null, DaoYouLevelWidgetContent));
  319. }
  320. taskAwaitBuffer.AddTask(cts1.WaitAll());
  321. await taskAwaitBuffer.WaitAll();
  322. if (_daoyouModelConfig.PreferGiftID != null)
  323. {
  324. widgetItems = cts.GetResultsLists();
  325. for (var i = 0; i < _daoyouModelConfig.PreferGiftID.Length; i++)
  326. {
  327. if (_daoyouModelConfig.shownPreferGiftID.Contains(_daoyouModelConfig.PreferGiftID[i]) ||
  328. (daoYouData != null && daoYouData.loveIds.Contains(_daoyouModelConfig.PreferGiftID[i])))
  329. {
  330. widgetItems[i].InitWidget(new ItemInfo(_daoyouModelConfig.PreferGiftID[i], 0));
  331. }
  332. else
  333. {
  334. widgetItems[i].ShowWenhao();
  335. }
  336. }
  337. }
  338. if (_daoyouModelConfig.daolvSkillID != null)
  339. {
  340. daoYouaaFfixWidgets = cts2.GetResultsLists();
  341. for (var i = 0; i < _daoyouModelConfig.daolvSkillID.Length; i++)
  342. {
  343. daoYouaaFfixWidgets[i].CustomInit(_daoyouModelConfig.daolvSkillID[i]);
  344. }
  345. }
  346. _daoYouLevelWidgets = cts1.GetResultsLists();
  347. for (var i = 0; i < configs.Length; i++)
  348. {
  349. await _daoYouLevelWidgets[i].CustomInit(daoYouData, configs[i].ID);
  350. }
  351. taskAwaitBuffer?.Dispose();
  352. cts?.Dispose();
  353. cts1?.Dispose();
  354. cts2?.Dispose();
  355. }
  356. List<ItemInfo> allItems = new List<ItemInfo>();
  357. private int saiXuanType = 1;
  358. public async CTask UpdateGiveGiftRoot()
  359. {
  360. ClosePoolGive();
  361. allItems.Clear();
  362. foreach (var daoyouGiftConfig in daoyouGiftConfigs)
  363. {
  364. if (PlayerManager.Instance.BagController.GetItemCount(daoyouGiftConfig.ItemID) > 0)
  365. {
  366. ItemInfo itemInfo = PlayerManager.Instance.BagController.GetItemInfo(daoyouGiftConfig.ItemID);
  367. allItems.Add(itemInfo);
  368. }
  369. }
  370. foreach (var keyValuePair in PlayerManager.Instance.BagController.allBagDic)
  371. {
  372. if (keyValuePair.Value.config.itemTag == 7 && !allItems.Contains(keyValuePair.Value))
  373. {
  374. allItems.Add(keyValuePair.Value);
  375. }
  376. }
  377. List<ItemInfo> showItems = SaiXuan(saiXuanType);
  378. CreatItem(showItems);
  379. }
  380. private List<ItemInfo> SaiXuan(int type)
  381. {
  382. List<ItemInfo> shownItems = new List<ItemInfo>();
  383. //全部
  384. if (type == 1)
  385. {
  386. shownItems = allItems.ToList();
  387. }
  388. //喜欢
  389. else if (type == 2)
  390. {
  391. foreach (var itemInfo in allItems)
  392. {
  393. if (_daoyouModelConfig.shownPreferGiftID.Contains(itemInfo.itemID) ||
  394. (daoYouData != null && daoYouData.loveIds.Contains(itemInfo.itemID)))
  395. {
  396. shownItems.Add(itemInfo);
  397. }
  398. }
  399. }
  400. return shownItems;
  401. }
  402. private async CTask CreatItem(List<ItemInfo> shownItems)
  403. {
  404. using (CTaskAwaitBuffer<WidgetItem> cts = new CTaskAwaitBuffer<WidgetItem>())
  405. {
  406. foreach (var itemInfo in shownItems)
  407. {
  408. cts.AddTask(UIManager.Instance.CreateGComponent<WidgetItem>(null, GiveGiftContent));
  409. }
  410. giveWidgetItems = await cts.WaitAll();
  411. }
  412. for (var i = 0; i < shownItems.Count; i++)
  413. {
  414. giveWidgetItems[i].InitWidget(shownItems[i], false);
  415. giveWidgetItems[i].OnClick = OnClick;
  416. }
  417. if (giveWidgetItems.Count > 0)
  418. {
  419. if (currentSelectWidgetItem != null)
  420. {
  421. bool isHave = false;
  422. foreach (var giveWidgetItem in giveWidgetItems)
  423. {
  424. if (giveWidgetItem.itemInfo == currentSelectWidgetItem)
  425. {
  426. giveWidgetItem.OnPointerClick();
  427. isHave = true;
  428. break;
  429. }
  430. }
  431. if (!isHave)
  432. giveWidgetItems[0].OnPointerClick();
  433. }
  434. else
  435. {
  436. giveWidgetItems[0].OnPointerClick();
  437. }
  438. }
  439. }
  440. DaoyouGiftConfig daoyouGiftConfig = default;
  441. private int count = 1;
  442. private WidgetItem widgetItem1;
  443. private async void OnClick(ItemWidgetBasic obj)
  444. {
  445. WidgetItem widgetItem = obj as WidgetItem;
  446. currentSelectWidgetItem = widgetItem.itemInfo;
  447. if (widgetItem1 == null)
  448. {
  449. widgetItem1 = await UIManager.Instance.CreateGComponent<WidgetItem>(null, WidgetItemRoot);
  450. widgetItem1.transform.GetComponent<RectTransform>().anchoredPosition = Vector2.zero;
  451. }
  452. widgetItem1.InitWidget(widgetItem.itemInfo);
  453. Icon_Select.transform.SetParent(widgetItem.transform);
  454. Icon_Select.transform.SetAsFirstSibling();
  455. Icon_Select.transform.GetComponent<RectTransform>().anchoredPosition = Vector2.zero;
  456. Icon_Select.gameObject.SetActive(true);
  457. daoyouGiftConfig = default;
  458. foreach (var giftConfig in daoyouGiftConfigs)
  459. {
  460. if (giftConfig.ItemID == widgetItem.itemInfo.itemID)
  461. {
  462. daoyouGiftConfig = giftConfig;
  463. break;
  464. }
  465. }
  466. Slider_Give.maxValue = widgetItem.itemInfo.count.Value;
  467. Slider_Give.minValue = 1;
  468. UpdateGiveItemCount();
  469. }
  470. private void Reduce()
  471. {
  472. if (widgetItem1 == null)
  473. return;
  474. count--;
  475. if (count < 1)
  476. {
  477. count = 1;
  478. }
  479. Slider_Give.value = count;
  480. }
  481. private void Add()
  482. {
  483. if (widgetItem1 == null)
  484. return;
  485. count++;
  486. if (count > widgetItem1.itemInfo.count.Value)
  487. {
  488. count = (int)widgetItem1.itemInfo.count.Value;
  489. }
  490. Slider_Give.value = count;
  491. }
  492. private void UpdateGiveItemCount()
  493. {
  494. emotionConfig emotionConfig = ConfigComponent.Instance.Get<emotionConfig>(daoYouData.emotion);
  495. Text_Count.text = $"当前选择数量{count}";
  496. if (widgetItem1 != null && daoyouGiftConfig.ID != 0)
  497. {
  498. if (_daoyouModelConfig.PreferGiftID.Contains(daoyouGiftConfig.ItemID))
  499. {
  500. Text_GiveGiftDesc.text = LanguageManager.Instance.Text(10289, daoyouGiftConfig.emotionValue,
  501. (daoyouGiftConfig.emotionValue * emotionConfig.hanganUpRate[0] *
  502. PlayerManager.Instance.gameConstantConfig.daolvfavoratePara * 0.01f * 0.001).ToString("0.0"),
  503. (daoyouGiftConfig.emotionValue * emotionConfig.hanganUpRate[1] *
  504. PlayerManager.Instance.gameConstantConfig.daolvfavoratePara * 0.01f * 0.001).ToString("0.0"));
  505. }
  506. else
  507. {
  508. Text_GiveGiftDesc.text = LanguageManager.Instance.Text(10289, daoyouGiftConfig.emotionValue,
  509. (daoyouGiftConfig.emotionValue * emotionConfig.hanganUpRate[0] * 0.001).ToString("0.0"),
  510. (daoyouGiftConfig.emotionValue * emotionConfig.hanganUpRate[1] * 0.001).ToString("0.0"));
  511. }
  512. }
  513. else if (widgetItem1 != null && daoyouGiftConfig.ID == 0)
  514. {
  515. Text_GiveGiftDesc.text =
  516. LanguageManager.Instance.Text(10290, widgetItem1.itemInfo.config.associateVlaue[0]);
  517. }
  518. }
  519. public override CTask GetFocus()
  520. {
  521. AppBarPanel.OpenPanel(this);
  522. return base.GetFocus();
  523. }
  524. public static async CTask OpenPanel(AccountFileInfo.DaoYouData daoYouData)
  525. {
  526. await UIManager.Instance.LoadAndOpenPanel<DaoYouInfoPanel>(null, uiData: new[] { daoYouData });
  527. }
  528. private void ClosePoolGive()
  529. {
  530. count = 0;
  531. daoyouGiftConfig = default;
  532. Slider_Give.value = 0;
  533. Slider_Give.minValue = 0;
  534. Slider_Give.maxValue = 0;
  535. Icon_Select.transform.SetParent(GiveGite.transform);
  536. Icon_Select.gameObject.SetActive(false);
  537. foreach (var giveWidgetItem in giveWidgetItems)
  538. {
  539. UIManager.Instance.DormancyGComponent(giveWidgetItem);
  540. }
  541. giveWidgetItems.Clear();
  542. UIManager.Instance.DormancyGComponent(widgetItem1);
  543. widgetItem1 = null;
  544. }
  545. public async override CTask Close()
  546. {
  547. daoyouGiftConfigs = null;
  548. foreach (var widgetItem in widgetItems)
  549. {
  550. UIManager.Instance.DormancyGComponent(widgetItem);
  551. }
  552. widgetItems.Clear();
  553. foreach (var daoYouLevelWidget in _daoYouLevelWidgets)
  554. {
  555. UIManager.Instance.DormancyGComponent(daoYouLevelWidget);
  556. }
  557. _daoYouLevelWidgets.Clear();
  558. foreach (var daoYouaaFfixWidget in daoYouaaFfixWidgets)
  559. {
  560. UIManager.Instance.DormancyGComponent(daoYouaaFfixWidget);
  561. }
  562. daoYouaaFfixWidgets.Clear();
  563. foreach (var daoYouIdleEarningsWidget in _daoYouIdleEarningsWidgets)
  564. {
  565. UIManager.Instance.DormancyGComponent(daoYouIdleEarningsWidget);
  566. }
  567. _daoYouIdleEarningsWidgets.Clear();
  568. allItems.Clear();
  569. saiXuanType = 1;
  570. ClosePoolGive();
  571. await base.Close();
  572. }
  573. }
  574. }