예제 #1
0
 /// <summary>
 /// 设置
 /// </summary>
 /// <param name="component"></param>
 /// <param name="value"></param>
 /// <param name="costType"></param>
 /// <param name="format"></param>
 /// <param name="type"></param>
 /// <param name="defaultType"></param>
 /// <returns></returns>
 public static bool TrySetComponentValue(this YxBaseLabelAdapter component, long value, string costType = "", string format = "{0}", YxBaseLabelAdapter.YxELabelType defaultType = YxBaseLabelAdapter.YxELabelType.Normal, YxBaseLabelAdapter.YxELabelType type = YxBaseLabelAdapter.YxELabelType.ReduceNumberWithUnit)
 {
     if (component)
     {
         component.LabelType     = GetLabelTypeByCostType(costType, type, defaultType);
         component.ContentFormat = format;
         component.Text(value);
         return(true);
     }
     return(false);
 }
예제 #2
0
 /// <summary>
 /// 金币需要做显示特殊处理
 /// </summary>
 /// <param name="costType">coin_a或1时为金币</param>
 /// <param name="type"></param>
 /// <param name="defaultType"></param>
 /// <returns></returns>
 public static YxBaseLabelAdapter.YxELabelType GetLabelTypeByCostType(string costType, YxBaseLabelAdapter.YxELabelType type = YxBaseLabelAdapter.YxELabelType.ReduceNumberWithUnit, YxBaseLabelAdapter.YxELabelType defaultType = YxBaseLabelAdapter.YxELabelType.Normal)
 {
     switch (costType)
     {
     case "coin_a":
     case "1":
         return(type);
     }
     return(defaultType);
 }