예제 #1
0
 public void ClickHandler(ExpeditionHeroButton btn)
 {
     if (onClickHandler != null)
     {
         onClickHandler(btn);
     }
 }
 public void ClickRoleButtonHandler(ExpeditionHeroButton btn)
 {
     if (btn.ExpeditionHeroInfo.IsDead)
     {
         CommonAutoDestroyTipsView.Open(Localization.Get("ui.expedition_formation_view.die_not_add_Team"));
         return;
     }
     _selectedCommonHeroIcon = btn;
     SelectRole(btn.ExpeditionHeroInfo.roleInfo);
 }
        public void OnResetItemHandler(GameObject go, int index)
        {
            ExpeditionHeroButton icon = go.GetComponent <ExpeditionHeroButton>();
            ExpeditionHeroInfo   info = _cachedExpeditionHeroInfoList[index];

            icon.SetExpeditionHeroInfo(info);
            RoleDesButton.Get(go).SetRoleInfo(info.roleInfo);
            icon.onClickHandler = ClickRoleButtonHandler;
            icon.SetInFormation(ExpeditionFormationProxy.instance.IsHeroInFormation(info.roleInfo.instanceID));
            bool selectedRole = _selectedRoleInfo != null && info.roleInfo.instanceID == _selectedRoleInfo.instanceID;

            icon.SetSelect(selectedRole);
        }
        private void SelectRole(RoleInfo roleInfo)
        {
            _selectedRoleInfo = roleInfo;
            if (_selectedRoleInfo != null)
            {
                ShowFormationPositionIndicators();
                if (ExpeditionFormationProxy.instance.IsHeroInFormation(roleInfo.instanceID))
                {
                    FormationPosition formationPosition           = ExpeditionFormationProxy.instance.GetHeroCurrentFormationPosition(roleInfo.instanceID);
                    Vector3           formationBaseButtonPosition = formationBaseButtons[(int)formationPosition - 1].transform.position;
                    removeRoleButton.transform.position = new Vector3(formationBaseButtonPosition.x, formationBaseButtonPosition.y, removeRoleButton.transform.position.z);
                    removeRoleButton.gameObject.SetActive(true);

                    Vector3 indicatorLocalPosition = selectedFormationPositionIndicatorImage.transform.parent.InverseTransformPoint(formationBaseButtons[(int)formationPosition - 1].transform.position);
                    indicatorLocalPosition = new Vector3(indicatorLocalPosition.x, indicatorLocalPosition.y + 230, -800);
                    selectedFormationPositionIndicatorImage.transform.localPosition = indicatorLocalPosition;
                    selectedFormationPositionIndicatorImage.gameObject.SetActive(true);
                    Vector3[] path = new Vector3[4];
                    path[0] = indicatorLocalPosition + new Vector3(0, 0, 0);
                    path[1] = indicatorLocalPosition + new Vector3(0, 30, 0);
                    path[2] = indicatorLocalPosition + new Vector3(0, 0, 0);
                    path[3] = indicatorLocalPosition + new Vector3(0, 0, 0);
                    LTDescr ltDescr = LeanTween.moveLocal(selectedFormationPositionIndicatorImage.gameObject, path, 0.6f);
                    ltDescr.setRepeat(-1);
                }
                else
                {
                    removeRoleButton.gameObject.SetActive(false);
                    selectedFormationPositionIndicatorImage.gameObject.SetActive(false);
                }
            }
            else
            {
                HideAllFormationPositionIndicators();
                removeRoleButton.gameObject.SetActive(false);
                selectedFormationPositionIndicatorImage.gameObject.SetActive(false);
                _selectedCommonHeroIcon = null;
            }
            scrollContent.RefreshAllContentItems();
        }
 public void ClickCancelSelectButton()
 {
     _selectedCommonHeroIcon = null;
     SelectRole(null);
 }