|  |  |  | 
|---|
|  |  |  | [SerializeField] DragItem dragObj; | 
|---|
|  |  |  | [SerializeField] Transform objForfly;  //点击飞入的时候的显隐控制 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void Display(string guid, int index, bool isFly = false) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void Display(string guid, int index, bool isFly = false, bool showSuggest = false) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var hero = HeroManager.Instance.GetHero(guid); | 
|---|
|  |  |  | this.transform.localScale = Vector3.one; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | lvText.text = Language.Get("L1099", hero.heroLevel); | 
|---|
|  |  |  | var heroConfig = hero.heroConfig; | 
|---|
|  |  |  | countryImg.SetSprite("herocountry" + heroConfig.Country); | 
|---|
|  |  |  | heroModel.Create(heroConfig.SkinIDList[hero.SkinIndex]); | 
|---|
|  |  |  | countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(heroConfig.Country)); | 
|---|
|  |  |  | heroModel.Create(heroConfig.SkinIDList[hero.SkinIndex], heroConfig.UIScale); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | nameText.text = hero.breakLevel == 0 ? heroConfig.Name : Language.Get("herocardbreaklv", heroConfig.Name, hero.breakLevel); | 
|---|
|  |  |  | posCircleImg.SetSprite("heroposcircle" + heroConfig.Quality); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //不是推荐位则提示 | 
|---|
|  |  |  | if (heroConfig.AtkDistType == 1 && TeamConst.TeamPos2Array.Contains(index) || | 
|---|
|  |  |  | heroConfig.AtkDistType == 2 && TeamConst.TeamPos1Array.Contains(index)) | 
|---|
|  |  |  | //  if (heroConfig.Position == 1 && TeamConst.TeamPos2Array.Contains(index) || | 
|---|
|  |  |  | //     heroConfig.Position == 2 && TeamConst.TeamPos1Array.Contains(index)) | 
|---|
|  |  |  | if (showSuggest) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | suggestForm.SetActive(true); | 
|---|
|  |  |  | jobTip.text = Language.Get("heroClass" + heroConfig.Class); | 
|---|
|  |  |  | posTip.text = Language.Get("heroAtkDistType" + heroConfig.AtkDistType); | 
|---|
|  |  |  | jobTip.text = HeroUIManager.Instance.GetJobName(heroConfig.Class); | 
|---|
|  |  |  | posTip.text = Language.Get("heroAtkDistType" + heroConfig.Position); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | suggestForm.SetActive(false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dragObj.pos = index; | 
|---|
|  |  |  | dragObj.onEndDragEvent -= SwitchPos; | 
|---|
|  |  |  | dragObj.onEndDragEvent += SwitchPos; | 
|---|
|  |  |  | dragObj.canvas.sortingLayerID =  dragObj.parentCanvas.sortingLayerID; | 
|---|
|  |  |  | dragObj.canvas.sortingOrder = dragObj.parentCanvas.sortingOrder + index + 1; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | heroBtn.AddListener(() => | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | void SwitchPos(int pos1, int pos2) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Debug.Log("交换位置:" + pos1 + "   " + pos2); | 
|---|
|  |  |  | var team = TeamManager.Instance.GetTeam(HeroUIManager.Instance.selectTeamType); | 
|---|
|  |  |  | if (pos2 == -1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //下阵 | 
|---|
|  |  |  | team.RemoveHero(pos1); | 
|---|
|  |  |  | HeroUIManager.Instance.NotifyOnTeamPosChangeEvent(new List<int>() { pos1 }, -2, Vector3.zero); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (pos1 == pos2) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | HeroUIManager.Instance.NotifyOnTeamPosChangeEvent(new List<int>() { pos1 }, -2, Vector3.zero); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //通知刷新 | 
|---|
|  |  |  | team.SwapPosition(pos1, pos2); | 
|---|
|  |  |  | HeroUIManager.Instance.NotifyOnTeamPosChangeEvent(new List<int>() { pos1, pos2 }, -2, Vector3.zero); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | async UniTask DelayShow() | 
|---|