Пример #1
0
 protected override void OnBind(AbstractDataSource dataSource)
 {
     dataSource.GetData <V>(dataKey.Value, this, (val, e, isSuccess) =>
     {
         if (isSuccess)
         {
             if (target != null)
             {
                 try
                 {
                     if (val == null)
                     {
                         BindData(target, GetDefaultValue());
                     }
                     else
                     {
                         BindData(target, val);
                     }
                 }
                 catch (Exception e1)
                 {
                     BindDataException(e1);
                 }
             }
             else
             {
                 Debug.LogWarning("Target is null!");
             }
         }
         else
         {
             BindDataException(e);
         }
     });
 }
Пример #2
0
 protected override void OnApply(AbstractDataSource dataSource)
 {
     if (target != null)
     {
         SetValue(TargetData(target));
     }
     else
     {
         Debug.LogWarning("Target is null!");
     }
 }
Пример #3
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="dataSource"></param>
 protected abstract void OnApply(AbstractDataSource dataSource);
Пример #4
0
 /// <summary>
 /// 绑定数据
 /// </summary>
 /// <param name="dataSource"></param>
 protected abstract void OnBind(AbstractDataSource dataSource);