Ejemplo n.º 1
0
        public static void ShowRankDetail(GameObject go, byte rankGrade, uint rankClass, bool isGrey = false, bool isUseSmall = false)
        {
            DebugHelper.Assert(go != null, "GameObject is NULL!!!");
            DebugHelper.Assert(rankGrade > 0, "grade must be above 0!!!");
            Image image  = go.transform.Find("ImgRank") ? go.transform.Find("ImgRank").GetComponent <Image>() : null;
            Image image2 = go.transform.Find("ImgSubRank") ? go.transform.Find("ImgSubRank").GetComponent <Image>() : null;
            Text  text   = go.transform.Find("txtRankName") ? go.transform.Find("txtRankName").GetComponent <Text>() : null;

            if (image)
            {
                string rankIconPath = CLadderView.GetRankIconPath(rankGrade, rankClass);
                image.SetSprite((!isUseSmall) ? rankIconPath : string.Format("{0}_small", rankIconPath), null, true, false, false, false);
                image.gameObject.CustomSetActive(true);
                CUIUtility.SetImageGrey(image, isGrey);
            }
            if (image2)
            {
                image2.SetSprite(CLadderView.GetSubRankIconPath(rankGrade, rankClass), null, true, false, false, false);
                image2.gameObject.CustomSetActive(true);
                CUIUtility.SetImageGrey(image2, isGrey);
            }
            if (text)
            {
                text.set_text(CLadderView.GetRankName(rankGrade, rankClass));
                CUIUtility.SetImageGrey(text, isGrey);
            }
        }
Ejemplo n.º 2
0
        public static void ShowRankDetail(GameObject go, byte rankGrade, uint rankClass, uint score, bool bShowScore = true, bool useSmall = false, bool isLadderRewardForm = false, bool isUseSpecialColorWhenSuperKing = false, bool isImgSamll = true)
        {
            DebugHelper.Assert(go != null, "GameObject is NULL!!!");
            Image image       = go.transform.Find("ImgRank") ? go.transform.Find("ImgRank").GetComponent <Image>() : null;
            Image image2      = go.transform.Find("ImgSubRank") ? go.transform.Find("ImgSubRank").GetComponent <Image>() : null;
            Text  text        = go.transform.Find("txtRankName") ? go.transform.Find("txtRankName").GetComponent <Text>() : null;
            Text  text2       = go.transform.Find("txtTopGroupScore") ? go.transform.Find("txtTopGroupScore").GetComponent <Text>() : null;
            byte  bLogicGrade = CLadderSystem.GetGradeDataByShowGrade((int)rankGrade).bLogicGrade;

            if (image)
            {
                string rankIconPath = CLadderView.GetRankIconPath(rankGrade, rankClass);
                string text3        = "{0}";
                if (isImgSamll)
                {
                    text3 += "_small";
                }
                image.SetSprite((!useSmall) ? rankIconPath : string.Format(text3, rankIconPath), null, true, false, false, false);
                image.gameObject.CustomSetActive(true);
            }
            if (image2)
            {
                if (isLadderRewardForm && (int)bLogicGrade >= CLadderSystem.MAX_RANK_LEVEL)
                {
                    image2.gameObject.CustomSetActive(false);
                }
                else
                {
                    image2.SetSprite(CLadderView.GetSubRankIconPath(rankGrade, rankClass), null, true, false, false, false);
                    image2.gameObject.CustomSetActive(true);
                }
            }
            if (text)
            {
                text.set_text(CLadderView.GetRankName(rankGrade, rankClass));
                if (isUseSpecialColorWhenSuperKing && CLadderView.IsSuperKing(rankGrade, rankClass))
                {
                    text.set_text("<color=#feba29>" + text.get_text() + "</color>");
                }
            }
            if (text2)
            {
                if ((int)bLogicGrade >= CLadderSystem.MAX_RANK_LEVEL)
                {
                    text2.set_text(string.Format("x{0}", score));
                }
                text2.gameObject.CustomSetActive((int)bLogicGrade >= CLadderSystem.MAX_RANK_LEVEL);
            }
            Transform transform = go.transform.Find("ScoreCon");

            if (!transform)
            {
                return;
            }
            if ((int)bLogicGrade >= CLadderSystem.MAX_RANK_LEVEL || !bShowScore)
            {
                transform.gameObject.CustomSetActive(false);
            }
            else
            {
                transform.Find("Con3Star").gameObject.CustomSetActive(false);
                transform.Find("Con4Star").gameObject.CustomSetActive(false);
                transform.Find("Con5Star").gameObject.CustomSetActive(false);
                ResRankGradeConf gradeDataByShowGrade = CLadderSystem.GetGradeDataByShowGrade((int)rankGrade);
                if (gradeDataByShowGrade != null)
                {
                    Transform transform2 = transform.Find(string.Format("Con{0}Star", gradeDataByShowGrade.dwGradeUpNeedScore));
                    if (transform2)
                    {
                        transform2.gameObject.CustomSetActive(true);
                        int num = 1;
                        while ((long)num <= (long)((ulong)gradeDataByShowGrade.dwGradeUpNeedScore))
                        {
                            Image  component  = transform2.Find(string.Format("ImgScore{0}", num)).GetComponent <Image>();
                            string prefabPath = ((ulong)score >= (ulong)((long)num)) ? CLadderView.LADDER_IMG_STAR : CLadderView.LADDER_IMG_STAR_EMPTY;
                            if (component)
                            {
                                component.SetSprite(prefabPath, null, true, false, false, false);
                            }
                            num++;
                        }
                    }
                }
                transform.gameObject.CustomSetActive(true);
            }
        }
Ejemplo n.º 3
0
        public static void ShowRankDetail(GameObject go, byte rankGrade, uint rankClass, uint score, bool bShowScore = true, bool useSmall = false, bool isLadderRewardForm = false, bool isUseSpecialColorWhenSuperKing = false, bool isImgSamll = true)
        {
            DebugHelper.Assert(go != null, "GameObject is NULL!!!");
            DebugHelper.Assert(rankGrade > 0, "grade must be above 0!!!");
            Image image  = (!go.transform.Find("ImgRank")) ? null : go.transform.Find("ImgRank").GetComponent <Image>();
            Image image2 = (!go.transform.Find("ImgSubRank")) ? null : go.transform.Find("ImgSubRank").GetComponent <Image>();
            Text  text   = (!go.transform.Find("txtRankName")) ? null : go.transform.Find("txtRankName").GetComponent <Text>();
            Text  text2  = (!go.transform.Find("txtTopGroupScore")) ? null : go.transform.Find("txtTopGroupScore").GetComponent <Text>();

            if (image)
            {
                string rankIconPath = CLadderView.GetRankIconPath(rankGrade, rankClass);
                string text3        = "{0}";
                if (isImgSamll)
                {
                    text3 += "_small";
                }
                image.SetSprite(useSmall ? string.Format(text3, rankIconPath) : rankIconPath, null, true, false, false, false);
                image.gameObject.CustomSetActive(true);
            }
            if (image2)
            {
                if (isLadderRewardForm && (int)rankGrade >= CLadderSystem.MAX_RANK_LEVEL)
                {
                    image2.gameObject.CustomSetActive(false);
                }
                else
                {
                    image2.SetSprite(CLadderView.GetSubRankIconPath(rankGrade, rankClass), null, true, false, false, false);
                    image2.gameObject.CustomSetActive(true);
                }
            }
            if (text)
            {
                text.text = CLadderView.GetRankName(rankGrade, rankClass);
                if (isUseSpecialColorWhenSuperKing && CLadderView.IsSuperKing(rankGrade, rankClass))
                {
                    text.text = "<color=#feba29>" + text.text + "</color>";
                }
            }
            if (text2)
            {
                if ((int)rankGrade >= CLadderSystem.MAX_RANK_LEVEL)
                {
                    text2.text = string.Format("x{0}", score);
                }
                text2.gameObject.CustomSetActive((int)rankGrade >= CLadderSystem.MAX_RANK_LEVEL);
            }
            Transform transform = go.transform.Find("ScoreCon");

            if (!transform)
            {
                return;
            }
            if ((int)rankGrade >= CLadderSystem.MAX_RANK_LEVEL || !bShowScore)
            {
                transform.gameObject.CustomSetActive(false);
            }
            else
            {
                transform.Find("Con3Star").gameObject.CustomSetActive(false);
                transform.Find("Con4Star").gameObject.CustomSetActive(false);
                transform.Find("Con5Star").gameObject.CustomSetActive(false);
                ResRankGradeConf dataByKey = GameDataMgr.rankGradeDatabin.GetDataByKey((uint)rankGrade);
                if (dataByKey != null)
                {
                    Transform transform2 = transform.Find(string.Format("Con{0}Star", dataByKey.dwGradeUpNeedScore));
                    if (transform2)
                    {
                        transform2.gameObject.CustomSetActive(true);
                        int num = 1;
                        while ((long)num <= (long)((ulong)dataByKey.dwGradeUpNeedScore))
                        {
                            Image  component  = transform2.Find(string.Format("ImgScore{0}", num)).GetComponent <Image>();
                            string prefabPath = ((ulong)score < (ulong)((long)num)) ? CLadderView.LADDER_IMG_STAR_EMPTY : CLadderView.LADDER_IMG_STAR;
                            if (component)
                            {
                                component.SetSprite(prefabPath, null, true, false, false, false);
                            }
                            num++;
                        }
                    }
                }
                transform.gameObject.CustomSetActive(true);
            }
        }