| | |
| | | [SerializeField] ScrollerController m_Controller;
|
| | | [SerializeField] List<DogzSkillData> m_DogzSkills;
|
| | | [SerializeField] List<DogzEquip> m_DogzEquips;
|
| | | [SerializeField] List<Button> m_DogzUnEquipBtns;
|
| | | [SerializeField] List<DogzUnEquip> m_DogzUnEquipBtns;
|
| | | [SerializeField] List<Text> m_PropertyTypes;
|
| | | [SerializeField] List<Text> m_PropertyValues;
|
| | | [SerializeField] Image m_DogzHeadIcon;
|
| | |
| | | [SerializeField] Button m_TakeOffEquipBtn;
|
| | | [SerializeField] Button m_EquipPackBtn;
|
| | | [SerializeField] Button m_CallBackBtn;
|
| | | [SerializeField] RedpointBehaviour assistBtnRedBehav;
|
| | | [SerializeField] Text m_CallBackBtnTxt;
|
| | | [SerializeField] UIEffect alreadyAssistEffect;
|
| | | [SerializeField] UIEffect assistEffect;
|
| | | [SerializeField] UIEffect assistTextEffect;
|
| | | DogzModel m_Model;
|
| | | DogzModel model
|
| | | {
|
| | |
| | | for (int i = 0; i < m_DogzUnEquipBtns.Count; i++)
|
| | | {
|
| | | var _index = i;
|
| | | m_DogzUnEquipBtns[i].onClick.AddListener(() =>
|
| | | m_DogzUnEquipBtns[i].DogzUnEquipBtn.AddListener(() =>
|
| | | {
|
| | | OpenDogzEquip(_index);
|
| | | });
|
| | |
| | | model.UpdateSelectDogzEvent += UpdateSelectDogzEvent;
|
| | | model.UpdateAssistDogzEvent += UpdateDogzAssistCnt;
|
| | | model.RefreshDogzEquipAct += RefreshDogzEquipEvent;
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | |
| | | }
|
| | | m_Controller.Restart();
|
| | | }
|
| | | int jumpIndex = model.presentSelectDogz - 1 > 0 ? model.presentSelectDogz - 1 : 0;
|
| | | m_Controller.JumpIndex(jumpIndex);
|
| | | }
|
| | | private void UpdateSelectDogzEvent()
|
| | | {
|
| | |
| | | UpdateDogzEquip();
|
| | | UpdateDogzProperty();
|
| | | UpdateDogzBtn();
|
| | | assistBtnRedBehav.redpointId = model.GetDogzAssistRedpointById(model.presentSelectDogz).id;
|
| | | }
|
| | | private void UpdateDogzSkill()
|
| | | {
|
| | |
| | | private void RefreshDogzEquipEvent(int dogzId)
|
| | | {
|
| | | if (dogzId != model.presentSelectDogz) return;
|
| | |
|
| | | m_Controller.m_Scorller.RefreshActiveCellViews();
|
| | | UpdateDogzEquip();
|
| | | UpdateDogzProperty();
|
| | | UpdateDogzBtn();
|
| | |
|
| | | }
|
| | |
|
| | | private void UpdateDogzEquip()
|
| | |
| | | var _dogzCfg = Config.Instance.Get<DogzConfig>(model.presentSelectDogz);
|
| | | m_DogzHeadIcon.SetSprite(_dogzCfg.HeadIcon);
|
| | | m_DogzHeadIcon.SetNativeSize();
|
| | | var _dogzEquips = model.GetDogzEquips(model.presentSelectDogz);
|
| | | alreadyAssistEffect.Stop();
|
| | | if (_dogzEquips != null && _dogzEquips.Count == 5)
|
| | | {
|
| | | m_DogzHeadIcon.material = MaterialUtility.GetUIDefaultGraphicMaterial();
|
| | | if(model.TryGetAssistDogzState(model.presentSelectDogz))
|
| | | {
|
| | | if(!alreadyAssistEffect.IsPlaying)
|
| | | {
|
| | | alreadyAssistEffect.Play();
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | m_DogzHeadIcon.material = MaterialUtility.GetDefaultSpriteGrayMaterial();
|
| | | }
|
| | |
|
| | | for (int i = 0; i < m_DogzEquips.Count; i++)
|
| | | {
|
| | | ItemModel _data;
|
| | | bool _equiped = model.TryGetDogzEquip(model.presentSelectDogz, i+101, out _data);
|
| | | m_DogzUnEquipBtns[i].gameObject.SetActive(!_equiped);
|
| | | m_DogzUnEquipBtns[i].DogzUnEquipBtn.gameObject.SetActive(!_equiped);
|
| | | m_DogzUnEquipBtns[i].RedpointBeh.redpointId = model.GetDogzEquipPlaceRedpointById(model.presentSelectDogz,i).id;
|
| | | m_DogzEquips[i].gameObject.SetActive(_equiped);
|
| | | if (_equiped)
|
| | | {
|
| | |
| | | {
|
| | | m_PropertyTypes[i].gameObject.SetActive(i < _dogzCfg.BaseAttrTypes.Length);
|
| | | m_PropertyValues[i].gameObject.SetActive(i < _dogzCfg.BaseAttrTypes.Length);
|
| | | string addAttrStr = "";
|
| | | string baseAttrStr = "";
|
| | | if (i < _dogzCfg.BaseAttrTypes.Length)
|
| | | {
|
| | | var _propertyCfg = Config.Instance.Get<PlayerPropertyConfig>(_dogzCfg.BaseAttrTypes[i]);
|
| | | m_PropertyTypes[i].text = _propertyCfg.Name;
|
| | | int attrValue = _dogzCfg.BaseAttrValues[i];
|
| | |
|
| | | if (isAddAttr && model.m_DogzEquipAttrDict[_propertyCfg.ID] > 0)
|
| | | {
|
| | | m_PropertyValues[i].text = StringUtility.Contact(UIHelper.ReplacePercentage(_dogzCfg.BaseAttrValues[i], _propertyCfg.ISPercentage)
|
| | | , _propertyCfg.ISPercentage == 1 ? "%" : string.Empty,"+",UIHelper.ReplacePercentage(model.m_DogzEquipAttrDict[_propertyCfg.ID], _propertyCfg.ISPercentage)
|
| | | |
| | | baseAttrStr = StringUtility.Contact(UIHelper.ReplacePercentage(_dogzCfg.BaseAttrValues[i], _propertyCfg.ISPercentage)
|
| | | , _propertyCfg.ISPercentage == 1 ? "%" : string.Empty);
|
| | |
|
| | | addAttrStr = StringUtility.Contact("+", UIHelper.ReplacePercentage(model.m_DogzEquipAttrDict[_propertyCfg.ID], _propertyCfg.ISPercentage)
|
| | | , _propertyCfg.ISPercentage == 1 ? "%" : string.Empty);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_PropertyValues[i].text = StringUtility.Contact(UIHelper.ReplacePercentage(_dogzCfg.BaseAttrValues[i], _propertyCfg.ISPercentage)
|
| | | baseAttrStr = StringUtility.Contact(UIHelper.ReplacePercentage(_dogzCfg.BaseAttrValues[i], _propertyCfg.ISPercentage)
|
| | | , _propertyCfg.ISPercentage == 1 ? "%" : string.Empty);
|
| | | }
|
| | |
|
| | |
| | |
|
| | | if(model.TryGetAssistDogzState(model.presentSelectDogz))
|
| | | {
|
| | | m_PropertyTypes[i].material = MaterialUtility.GetUIDefaultGraphicMaterial();
|
| | | m_PropertyValues[i].material = MaterialUtility.GetUIDefaultGraphicMaterial();
|
| | | m_PropertyTypes[i].color = UIHelper.s_NavyBrown;
|
| | | if(addAttrStr != "")
|
| | | {
|
| | | m_PropertyValues[i].text = StringUtility.Contact("<color=#401c06>", baseAttrStr, "</color>", "<color=#109d06>", addAttrStr, "</color>");
|
| | | }
|
| | | else
|
| | | {
|
| | | m_PropertyValues[i].text = StringUtility.Contact("<color=#401c06>", baseAttrStr, "</color>");
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | m_PropertyTypes[i].material = MaterialUtility.GetDefaultSpriteGrayMaterial();
|
| | | m_PropertyValues[i].material = MaterialUtility.GetDefaultSpriteGrayMaterial();
|
| | | m_PropertyTypes[i].color = UIHelper.s_BrightWhiteColor;
|
| | | if (addAttrStr != "")
|
| | | {
|
| | | m_PropertyValues[i].text = StringUtility.Contact("<color=#686868>", baseAttrStr, "</color>", "<color=#109d06>", addAttrStr, "</color>");
|
| | | }
|
| | | else
|
| | | {
|
| | | m_PropertyValues[i].text = StringUtility.Contact("<color=#686868>", baseAttrStr, "</color>");
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateDogzAssistCnt()
|
| | | {
|
| | | m_Controller.m_Scorller.RefreshActiveCellViews();
|
| | | m_DogzAssistCnt.text = Language.Get("TreasurePrivilege_Dogz_1", StringUtility.Contact(model.GetAssistDogzCount(), "/", model.DogzAssistDefaultCnt));
|
| | | UpdateDogzBtn();
|
| | | UpdateDogzProperty();
|
| | | UpdateDogzEquip();
|
| | | }
|
| | |
|
| | | private void UpdateDogzBtn()
|
| | | {
|
| | | var _dogzEquips = model.GetDogzEquips(model.presentSelectDogz);
|
| | |
| | | {
|
| | | if(model.GetAssistDogzCount() < model.DogzAssistDefaultCnt)
|
| | | {
|
| | | assistEffect.Play();
|
| | | assistTextEffect.Play();
|
| | | model.SendChangeDogzAssist(1);
|
| | | }
|
| | | else
|
| | |
| | | [SerializeField] Button m_SkillBtn;
|
| | | public Button SkillBtn { get { return m_SkillBtn; } }
|
| | | }
|
| | |
|
| | | [Serializable]
|
| | | public class DogzUnEquip
|
| | | {
|
| | | [SerializeField] Button m_DogzUnEquipBtn;
|
| | | public Button DogzUnEquipBtn { get { return m_DogzUnEquipBtn; } }
|
| | | [SerializeField] RedpointBehaviour m_RedpointBeh;
|
| | | public RedpointBehaviour RedpointBeh { get { return m_RedpointBeh; } }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|