| | |
| | | { |
| | | if (m_StarRect == null) |
| | | { |
| | | m_StarRect = this.transform.Find("Container_HeroShow/layout/stars"); |
| | | m_StarRect = this.transform.Find("Container_HeroShow/layout/layout/stars"); |
| | | } |
| | | return m_StarRect; |
| | | } |
| | |
| | | m_StarsImg = new List<Image>(); |
| | | for (int i = 0; i < 5; i++) |
| | | { |
| | | var star = this.transform.GetComponent<Image>("Container_HeroShow/layout/stars/star" + i); |
| | | var star = this.transform.GetComponent<Image>("Container_HeroShow/layout/layout/stars/star" + i); |
| | | m_StarsImg.Add(star); |
| | | } |
| | | } |
| | |
| | | { |
| | | if (m_Name == null) |
| | | { |
| | | m_Name = this.transform.GetComponent<Text>("Container_HeroShow/name"); |
| | | m_Name = this.transform.GetComponent<Text>("Container_HeroShow/layout/name"); |
| | | } |
| | | return m_Name; |
| | | } |
| | |
| | | { |
| | | if (m_LvText == null) |
| | | { |
| | | m_LvText = this.transform.GetComponent<Text>("Container_HeroShow/layout/lv"); |
| | | m_LvText = this.transform.GetComponent<Text>("Container_HeroShow/layout/layout/lv"); |
| | | } |
| | | return m_LvText; |
| | | } |
| | |
| | | { |
| | | if (m_LvTextOutline == null) |
| | | { |
| | | m_LvTextOutline = this.transform.GetComponent<OutlineEx>("Container_HeroShow/layout/lv"); |
| | | m_LvTextOutline = this.transform.GetComponent<OutlineEx>("Container_HeroShow/layout/layout/lv"); |
| | | } |
| | | return m_LvTextOutline; |
| | | } |
| | | } |
| | | |
| | | Button m_StarBtn; |
| | | Button starBtn |
| | | { |
| | | get |
| | | { |
| | | if (m_StarBtn == null) |
| | | { |
| | | m_StarBtn = this.transform.GetComponent<Button>("Container_HeroShow/layout/layout/stars"); |
| | | } |
| | | return m_StarBtn; |
| | | } |
| | | } |
| | | |
| | | |
| | | void Awake() |
| | | { |
| | | LoadPrefab(); |
| | |
| | | // 武将模型站台显示 |
| | | public void Init(int heroID, int skinID, int breakLevel = 0, int star = 0, int awakelv = 0, int lv = 0, bool isShowLock = false) |
| | | { |
| | | LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | var heroConfig = HeroConfig.Get(heroID); |
| | | qualityBG.SetSprite("herodz" + heroConfig.Quality); |
| | | // int skinID = 0; |
| | |
| | | |
| | | nameText.text = breakLevel == 0 ? heroConfig.Name : Language.Get("herocardbreaklv", heroConfig.Name, breakLevel); |
| | | nameText.color = UIHelper.GetUIColorByFunc(heroConfig.Quality); |
| | | lvText.text = string.Format("{0}{1} {2}", Language.Get("L1094"), lv, awakelv == 0 ? Language.Get("herocard13") : Language.Get("herocard12", awakelv)); |
| | | heroLVOutline.colorType = awakelv == 0 ? QualityTextColType.None : QualityTextColType.red; |
| | | if (lv == 0) |
| | | { |
| | | lvText.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | lvText.SetActive(true); |
| | | if (awakelv == 0) |
| | | { |
| | | lvText.text = string.Format("{0}{1}", Language.Get("L1094"), lv); |
| | | } |
| | | else |
| | | { |
| | | lvText.text = string.Format("{0}{1} {2}", Language.Get("L1094"), lv, Language.Get("herocard12", awakelv)); |
| | | } |
| | | heroLVOutline.colorType = awakelv == 0 ? QualityTextColType.None : QualityTextColType.red; |
| | | } |
| | | |
| | | starBtn.AddListener(() => |
| | | { |
| | | SmallTipWin.showText = Language.Get("HeroGift14", star); |
| | | SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | }); |
| | | } |
| | | |
| | | GameObject cellContainer; |
| | |
| | | } |
| | | |
| | | //缩放到和父rect一样大 |
| | | var scale = 1f; |
| | | var rect = cellContainer.GetComponent<RectTransform>(); |
| | | var parentRect = transform.GetComponent<RectTransform>(); |
| | | float width = parentRect.sizeDelta.x; |
| | | if (width <= 0f) |
| | | { |
| | | //外部控制了尺寸获取为0 |
| | | GridLayoutGroup grid = GetComponentInParent<GridLayoutGroup>(); |
| | | if (grid != null) |
| | | { |
| | | width = grid.cellSize.x; |
| | | } |
| | | // var scale = 1f; |
| | | // var rect = cellContainer.GetComponent<RectTransform>(); |
| | | // var parentRect = transform.GetComponent<RectTransform>(); |
| | | // float width = parentRect.sizeDelta.x; |
| | | // if (width <= 0f) |
| | | // { |
| | | // //外部控制了尺寸获取为0 |
| | | // GridLayoutGroup grid = GetComponentInParent<GridLayoutGroup>(); |
| | | // if (grid != null) |
| | | // { |
| | | // width = grid.cellSize.x; |
| | | // } |
| | | |
| | | } |
| | | scale = width / rect.sizeDelta.x; |
| | | cellContainer.transform.localScale = cellContainer.transform.localScale * scale; |
| | | // } |
| | | // scale = width / rect.sizeDelta.x; |
| | | // cellContainer.transform.localScale = cellContainer.transform.localScale * scale; |
| | | } |
| | | } |
| | | |