Ejemplo n.º 1
0
 public static void ShowRank(CUIFormScript form, GameObject HisRankGo, byte RankGrade, uint RankClass)
 {
     if (form == null || HisRankGo == null)
     {
         return;
     }
     if (RankGrade == 0)
     {
         if (HisRankGo)
         {
             HisRankGo.CustomSetActive(false);
         }
     }
     else
     {
         HisRankGo.CustomSetActive(true);
         Image image  = null;
         Image image2 = null;
         if (HisRankGo != null)
         {
             image  = Utility.GetComponetInChild <Image>(HisRankGo, "ImgRank");
             image2 = Utility.GetComponetInChild <Image>(HisRankGo, "ImgRank/ImgSubRank");
         }
         if (image != null)
         {
             string rankSmallIconPath = CLadderView.GetRankSmallIconPath(RankGrade, RankClass);
             image.SetSprite(rankSmallIconPath, form, true, false, false, false);
         }
         if (image2 != null)
         {
             string subRankSmallIconPath = CLadderView.GetSubRankSmallIconPath(RankGrade, RankClass);
             image2.SetSprite(subRankSmallIconPath, form, true, false, false, false);
         }
     }
 }
Ejemplo n.º 2
0
        private void UpdateElement(GameObject element, string name, string headUrl, byte bGrade, uint subGrade, uint heroId, enOBTab curTab, int onlineNum, enStatus status = 0, long localTicks = 0, byte mapType = 0, uint mapId = 0)
        {
            CUIFormScript form = Singleton <CUIManager> .instance.GetForm(OB_FORM_PATH);

            if (form != null)
            {
                CUIHttpImageScript componetInChild = Utility.GetComponetInChild <CUIHttpImageScript>(element, "HeadImg");
                Image      image  = Utility.GetComponetInChild <Image>(element, "HeroImg");
                Image      image2 = Utility.GetComponetInChild <Image>(element, "RankImg");
                Image      image3 = Utility.GetComponetInChild <Image>(element, "RankImg/SubRankImg");
                Text       text   = Utility.GetComponetInChild <Text>(element, "PlayerName");
                Text       text2  = Utility.GetComponetInChild <Text>(element, "HeroName");
                GameObject obj2   = Utility.FindChild(element, "WatchImg");
                Text       text3  = Utility.GetComponetInChild <Text>(element, "LocalTime");
                Text       text4  = Utility.GetComponetInChild <Text>(element, "LocalMap");
                Text       text5  = Utility.GetComponetInChild <Text>(element, "WatchImg/OnlineCount");
                GameObject obj3   = Utility.FindChild(element, "DeleteBtn");
                componetInChild.SetImageUrl(headUrl);
                if (bGrade > 0)
                {
                    image2.gameObject.CustomSetActive(true);
                    image2.SetSprite(CLadderView.GetRankSmallIconPath(bGrade, subGrade), form, true, false, false);
                    image3.SetSprite(CLadderView.GetSubRankSmallIconPath(bGrade, subGrade), form, true, false, false);
                }
                else
                {
                    image2.gameObject.CustomSetActive(false);
                }
                text.text = name;
                ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(heroId);
                if (dataByKey != null)
                {
                    string prefabPath = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_BustHero_Dir, CSkinInfo.GetHeroSkinPic(heroId, 0));
                    image.SetSprite(prefabPath, form, false, true, true);
                    text2.text = dataByKey.szName;
                }
                else
                {
                    text2.text = string.Empty;
                    DebugHelper.Assert(false, string.Format("COBSystem UpdateElement hero cfg[{0}] can not be found!", heroId));
                }
                if (curTab != enOBTab.Local)
                {
                    obj2.CustomSetActive(true);
                    string[] args = new string[] { onlineNum.ToString() };
                    text5.text = Singleton <CTextManager> .instance.GetText("OB_Desc_3", args);

                    text3.gameObject.SetActive(false);
                    obj3.CustomSetActive(false);
                    text4.gameObject.CustomSetActive(false);
                }
                else
                {
                    obj2.CustomSetActive(false);
                    text3.gameObject.SetActive(true);
                    DateTime time       = new DateTime(localTicks);
                    string[] textArray2 = new string[] { time.Month.ToString(), time.Day.ToString(), time.Hour.ToString("D2"), time.Minute.ToString("D2") };
                    text3.text = Singleton <CTextManager> .instance.GetText("OB_Desc_12", textArray2);

                    obj3.CustomSetActive(status == enStatus.Editor);
                    text4.gameObject.CustomSetActive(true);
                    ResDT_LevelCommonInfo pvpMapCommonInfo = CLevelCfgLogicManager.GetPvpMapCommonInfo(mapType, mapId);
                    if (pvpMapCommonInfo != null)
                    {
                        text4.text = pvpMapCommonInfo.szName;
                    }
                    else
                    {
                        text4.text = string.Empty;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void UpdateElement(GameObject element, string name, string headUrl, byte bGrade, uint subGrade, uint heroId, COBSystem.enOBTab curTab, int onlineNum, COBSystem.enStatus status = COBSystem.enStatus.Normal, long localTicks = 0L, byte mapType = 0, uint mapId = 0u, string localName = "")
        {
            CUIFormScript form = Singleton <CUIManager> .get_instance().GetForm(COBSystem.OB_FORM_PATH);

            if (form == null)
            {
                return;
            }
            CUIHttpImageScript componetInChild = Utility.GetComponetInChild <CUIHttpImageScript>(element, "HeadImg");
            Image      componetInChild2        = Utility.GetComponetInChild <Image>(element, "HeroImg");
            Image      componetInChild3        = Utility.GetComponetInChild <Image>(element, "RankImg");
            Image      componetInChild4        = Utility.GetComponetInChild <Image>(element, "RankImg/SubRankImg");
            Text       componetInChild5        = Utility.GetComponetInChild <Text>(element, "PlayerName");
            Text       componetInChild6        = Utility.GetComponetInChild <Text>(element, "HeroName");
            GameObject obj = Utility.FindChild(element, "WatchImg");
            Text       componetInChild7 = Utility.GetComponetInChild <Text>(element, "LocalTime");
            Text       componetInChild8 = Utility.GetComponetInChild <Text>(element, "LocalMap");
            Text       componetInChild9 = Utility.GetComponetInChild <Text>(element, "WatchImg/OnlineCount");
            GameObject obj2             = Utility.FindChild(element, "DeleteBtn");

            componetInChild.SetImageUrl(headUrl);
            if (bGrade > 0)
            {
                componetInChild3.gameObject.CustomSetActive(true);
                componetInChild3.SetSprite(CLadderView.GetRankSmallIconPath(bGrade, subGrade), form, true, false, false, false);
                componetInChild4.SetSprite(CLadderView.GetSubRankSmallIconPath(bGrade, subGrade), form, true, false, false, false);
            }
            else
            {
                componetInChild3.gameObject.CustomSetActive(false);
            }
            componetInChild5.text = name;
            ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(heroId);

            if (dataByKey != null)
            {
                string prefabPath = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_BustHero_Dir, CSkinInfo.GetHeroSkinPic(heroId, 0u));
                componetInChild2.SetSprite(prefabPath, form, false, true, true, false);
                componetInChild6.text = dataByKey.szName;
            }
            else
            {
                componetInChild6.text = string.Empty;
                DebugHelper.Assert(false, string.Format("COBSystem UpdateElement hero cfg[{0}] can not be found!", heroId));
            }
            if (curTab != COBSystem.enOBTab.Local)
            {
                obj.CustomSetActive(true);
                componetInChild9.text = Singleton <CTextManager> .get_instance().GetText("OB_Desc_3", new string[]
                {
                    onlineNum.ToString()
                });

                componetInChild7.gameObject.SetActive(false);
                obj2.CustomSetActive(false);
                componetInChild8.gameObject.CustomSetActive(false);
            }
            else
            {
                obj.CustomSetActive(false);
                componetInChild7.gameObject.SetActive(true);
                DateTime dateTime = new DateTime(localTicks);
                componetInChild7.text = Singleton <CTextManager> .get_instance().GetText("OB_Desc_12", new string[]
                {
                    dateTime.get_Month().ToString(),
                    dateTime.get_Day().ToString(),
                    dateTime.get_Hour().ToString("D2"),
                    dateTime.get_Minute().ToString("D2")
                });

                obj2.CustomSetActive(status == COBSystem.enStatus.Editor);
                componetInChild8.gameObject.CustomSetActive(true);
                ResDT_LevelCommonInfo pvpMapCommonInfo = CLevelCfgLogicManager.GetPvpMapCommonInfo(mapType, mapId);
                if (pvpMapCommonInfo != null)
                {
                    componetInChild8.text = pvpMapCommonInfo.szName;
                }
                else
                {
                    componetInChild8.text = string.Empty;
                }
                componetInChild6.text = string.Empty;
            }
        }