| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 | 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)            {                Text_Level.text = _daoYouData.favorabilityLv.ToString();            }            else            {                Text_Level.text = 0 + "";            }            if (_daoYouData == null)            {                Slider_Emotion.fillAmount = 1;            }            else            {                Slider_Emotion.fillAmount = _daoYouData.emotionValue / 100;            }                       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.EventCompleteforQuest)                    && !EventSystemManager.Instance.BagIsEvent(_daoyouModelConfig.QuestID)                    && !EventSystemManager.Instance.IsEventTrigger(_daoyouModelConfig.QuestID))                {                    Btn_Event.gameObject.SetActive(true);                }                else                {                    Btn_Event.gameObject.SetActive(false);                }                transform.RecoverColor();            }        }    }}
 |