1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using System.Linq;
- using Core.Language;
- using Excel2Json;
- using Fort23.Core;
- using Fort23.UTool;
- using UnityEngine;
- namespace Fort23.Mono
- {
- [UIBinding(prefab = "DaoYouWidget")]
- public partial class DaoYouWidget : ItemWidgetBasic
- {
- private DaoyouModelConfig _daoyouModelConfig;
- public AccountFileInfo.DaoYouData _daoYouData;
- private void Init()
- {
- }
- public override void AddEvent()
- {
- }
- public override void DelEvent()
- {
- }
- public override void AddButtonEvent()
- {
- base.AddButtonEvent();
- }
- public void CustomInit(int configId)
- {
- _daoyouModelConfig = ConfigComponent.Instance.Get<DaoyouModelConfig>(configId);
- _daoYouData = AccountFileInfo.Instance.playerData.daoYouDatas.FirstOrDefault(dy => dy.id == configId);
- Text_Name.text = LanguageManager.Instance.Text(_daoyouModelConfig.name);
- if (_daoYouData == null)
- {
- transform.Gray();
- Btn_Event.gameObject.SetActive(false);
- Icon_Emotion.gameObject.SetActive(false);
- }
- else
- {
- if (TimeHelper.ClientNow() - _daoYouData.emotionTime >= 60 * 60 * 1000)
- {
- _daoYouData.emotion = Random.Range(1, 4);
- _daoYouData.emotionValue = (int)(100 / (float)_daoYouData.emotion);
- _daoYouData.emotionTime = TimeHelper.ClientNow();
- }
- emotionConfig emotionConfig = ConfigComponent.Instance.Get<emotionConfig>(_daoYouData.emotion);
- Icon_Emotion.gameObject.SetActive(false);
- DaoyouLevelupConfig daoyouLevelupConfig = ConfigComponent.Instance.Get<DaoyouLevelupConfig>(_daoYouData.favorabilityLv);
- Text_DaoyouLvName.text = LanguageManager.Instance.Text(daoyouLevelupConfig.name);
- if (_daoYouData.favorabilityLv >= _daoyouModelConfig.EmotionLvforQuest
- && !EventSystemManager.Instance.BagIsEvent(_daoyouModelConfig.QuestID)
- && !EventSystemManager.Instance.IsEventTrigger(_daoyouModelConfig.QuestID))
- {
- Btn_Event.gameObject.SetActive(true);
- }
- else
- {
- Btn_Event.gameObject.SetActive(false);
- }
- transform.RecoverColor();
- }
- }
- }
- }
|