Exemplo n.º 1
0
 public int Compare(UListTimeThresholdData x, UListTimeThresholdData y)
 {
     if (x == null)
     {
         if (y == null)
         {
             return(0);
         }
         else
         {
             return(-1);
         }
     }
     else
     {
         if (y == null)
         {
             return(1);
         }
         else
         {
             int value = x.nGoodThresholdTime.CompareTo(y.nGoodThresholdTime);
             if (value == 0)
             {
                 value = x.nGoodType.CompareTo(y.nGoodType);
             }
             return(value);
         }
     }
 }
        public virtual void SetData(UListTimeThresholdData item)
        {
            GoodIconImage.sprite = GetSprite(item.nGoodType, item.nGoodIconId, item.nParam);
            for (int i = 0; i < 2; ++i)
            {
                GoodNameText[i].text = item.sGoodName[i];
            }

            DateTime calcTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Unspecified).AddSeconds(item.nGoodThresholdTime);

            calcTime = calcTime.ToLocalTime();

            TimeSpan ts = calcTime.Subtract(DateTime.Now).Duration();

            GoodTimeThresholdText.text = ts.Days.ToString() + "天" + ts.Hours.ToString() + "小时" + ts.Minutes.ToString() + "分";

            if (item.nParam > 0 && !string.IsNullOrEmpty(item.szParam))
            {
                GoodParamDesc.gameObject.SetActive(true);
                GoodParamDesc.text = GetParamText(item.nGoodType, item.nParam);
            }
            else
            {
                GoodParamDesc.gameObject.SetActive(false);
            }

            GoodShadowObj.SetActive(this.Index % 2 == 0);
            Item = item;
        }