Esempio n. 1
0
    public string GetHonorImagePath(int id, int level)
    {
        ResHonor dataByKey = GameDataMgr.resHonor.GetDataByKey((long)id);

        if (dataByKey == null)
        {
            return(string.Format("{0}{1}{2}", CUIUtility.s_Sprite_System_Honor_Dir, "Img_Honor_", 0));
        }
        if (level < 0 || level > dataByKey.astHonorLevel.Length)
        {
            return(null);
        }
        if (level == 0)
        {
            return(string.Format("{0}{1}{2}", CUIUtility.s_Sprite_System_Honor_Dir, "Img_Honor_", 0));
        }
        return(string.Format("{0}{1}{2}{3}{4}", new object[]
        {
            CUIUtility.s_Sprite_System_Honor_Dir,
            "Img_Honor_",
            id,
            "_",
            level
        }));
    }
Esempio n. 2
0
    private string GetHonorProgress(int point, ResHonor honorCfg)
    {
        string result = string.Empty;

        if (honorCfg == null)
        {
            return(result);
        }
        for (int i = honorCfg.astHonorLevel.Length - 1; i >= 0; i--)
        {
            if (point < honorCfg.astHonorLevel[i].iMaxPoint)
            {
                result = string.Format("{0}/{1}", point, honorCfg.astHonorLevel[i].iMaxPoint);
            }
            else
            {
                if (i != honorCfg.astHonorLevel.Length - 1)
                {
                    return(result);
                }
                result = string.Format("{0}", point);
            }
        }
        return(result);
    }
Esempio n. 3
0
    private void OnHonorItemEnable(CUIEvent uiEvent)
    {
        int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;

        if (srcWidgetIndexInBelongedList < 0 || srcWidgetIndexInBelongedList >= this.m_honorInfoList.get_Count())
        {
            return;
        }
        COMDT_HONORINFO cOMDT_HONORINFO = this.m_honorInfoList.get_Item(srcWidgetIndexInBelongedList);

        if (cOMDT_HONORINFO == null)
        {
            return;
        }
        ResHonor dataByKey = GameDataMgr.resHonor.GetDataByKey((long)cOMDT_HONORINFO.iHonorID);

        if (dataByKey == null)
        {
            return;
        }
        if (cOMDT_HONORINFO.iHonorLevel < 0 || cOMDT_HONORINFO.iHonorLevel > dataByKey.astHonorLevel.Length)
        {
            return;
        }
        CUIListElementScript cUIListElementScript = uiEvent.m_srcWidgetScript as CUIListElementScript;

        if (cUIListElementScript == null)
        {
            return;
        }
        GameObject widget  = cUIListElementScript.GetWidget(0);
        GameObject widget2 = cUIListElementScript.GetWidget(1);
        GameObject widget3 = cUIListElementScript.GetWidget(2);
        GameObject widget4 = cUIListElementScript.GetWidget(3);
        GameObject widget5 = cUIListElementScript.GetWidget(4);

        if (widget != null)
        {
            this.SetHonorImage(widget.transform, cOMDT_HONORINFO);
        }
        if (widget2 != null)
        {
            this.SetHonorAssitImage(widget2.transform, cOMDT_HONORINFO, uiEvent.m_srcFormScript);
        }
        if (widget3 != null)
        {
            this.SetHonorPoint(widget3.transform, cOMDT_HONORINFO);
        }
        this.SetHonorStatus(widget5, cOMDT_HONORINFO);
        widget4.CustomSetActive(false);
    }
Esempio n. 4
0
 private void SetHonorDesc(Transform descTransform, COMDT_HONORINFO honorInfo)
 {
     if (descTransform != null)
     {
         Text component = descTransform.GetComponent <Text>();
         if (component != null)
         {
             ResHonor dataByKey = GameDataMgr.resHonor.GetDataByKey((long)honorInfo.iHonorID);
             if (dataByKey == null)
             {
                 component.set_text(string.Empty);
             }
             else
             {
                 component.set_text(dataByKey.szDesc);
             }
         }
     }
 }
Esempio n. 5
0
 private void SetHonorPoint(Transform cntTransform, COMDT_HONORINFO honorInfo)
 {
     if (cntTransform != null)
     {
         Text component = cntTransform.GetComponent <Text>();
         if (component != null)
         {
             ResHonor dataByKey = GameDataMgr.resHonor.GetDataByKey((long)honorInfo.iHonorID);
             if (dataByKey == null)
             {
                 component.set_text(string.Empty);
             }
             else
             {
                 component.set_text(this.GetHonorProgress(honorInfo.iHonorPoint, dataByKey));
             }
         }
     }
 }
Esempio n. 6
0
        private void JudgeHonorLevelUp(COMDT_HONORINFO honorInfo)
        {
            int      iHonorID    = honorInfo.iHonorID;
            int      iHonorPoint = honorInfo.iHonorPoint;
            int      num3        = -1;
            ResHonor dataByKey   = GameDataMgr.resHonor.GetDataByKey((long)iHonorID);

            if (dataByKey != null)
            {
                for (int i = 0; i < dataByKey.astHonorLevel.Length; i++)
                {
                    if (iHonorPoint < dataByKey.astHonorLevel[i].iMaxPoint)
                    {
                        break;
                    }
                    num3++;
                }
                if (num3 >= dataByKey.astHonorLevel.Length)
                {
                    num3--;
                }
            }
            honorInfo.iHonorLevel = num3;
        }