DaoYouInfoPanel.cs 25 KB

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