当前位置: 首页>>代码示例>>C#>>正文


C# CallBack.Invoke方法代码示例

本文整理汇总了C#中CallBack.Invoke方法的典型用法代码示例。如果您正苦于以下问题:C# CallBack.Invoke方法的具体用法?C# CallBack.Invoke怎么用?C# CallBack.Invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CallBack的用法示例。


在下文中一共展示了CallBack.Invoke方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Change

 /// <summary>
 ///     Изменяет аттрибуты календарного дня
 /// </summary>
 /// <param name="calendarDayDescription">Расшифровка календарного дня</param>
 /// <param name="calendarWorkDayAttribute">Аттрибуты календарного дня</param>
 /// <param name="calendarDayComment">Комментарий</param>
 /// <param name="calendarDay">структура, календарный день, переданная по ссылке</param>
 /// <param name="callBackMetod">Метод, запускаемый при изменнени аттрибутов календарного дня</param>
 public static void Change(CalendarDayDescription calendarDayDescription,
     WorkDayAttribute calendarWorkDayAttribute,
     string calendarDayComment, ref CalendarDay calendarDay, CallBack callBackMetod)
 {
     calendarDay.ChangeCalendarDayAttribute(calendarWorkDayAttribute);
     calendarDay.ChangeCaledarDayDescription(calendarDayDescription);
     calendarDay.CalendarDayComment = calendarDayComment;
     // Если указан делегат, то выполняем его
     if (callBackMetod != null) callBackMetod.Invoke();
 }
开发者ID:pu1s,项目名称:WorkCalendar,代码行数:18,代码来源:CalendarDay.cs

示例2: EaseCoroutine


//.........这里部分代码省略.........
          Debug.LogError("Easing with incorrect parameters");
        }
        else
        {
          // Start the easing...
          float timeScale = 1.0f / easeTime;
          float time = 0;
          while (time < 1)
          {
        // Wait until the next frame
        yield return null;

        // Advance iterator and solve easing for this frame
        time += Time.deltaTime * timeScale;
        switch (property)
        {
          case EaseProperty.POSITION:
            {
              source.localPosition = VecEaseInOut((Vector3)orig, (Vector3)target, time, easeIn, easeOut);
              break;
            }
          case EaseProperty.ROTATION:
            {
              Vector3 a = ((Quaternion)orig).eulerAngles;
              Vector3 b = ((Quaternion)target).eulerAngles;
              while (Mathf.Abs(a.x - b.x) > 180)
              {
                if (a.x - b.x < 0)
                {
                  b.x -= 360;
                }
                else
                {
                  b.x += 360;
                }
              }
              while (Mathf.Abs(a.y - b.y) > 180)
              {
                if (a.z - b.z < 0)
                {
                  b.z -= 360;
                }
                else
                {
                  b.z += 360;
                }
              }
              while (Mathf.Abs(a.z - b.z) > 180)
              {
                if (a.z - b.z < 0)
                {
                  b.z -= 360;
                }
                else
                {
                  b.z += 360;
                }
              }
              source.localRotation = Quaternion.Euler(VecEaseInOut(a, b,
                      time, easeIn, easeOut));
              break;
            }
          case EaseProperty.SCALE:
            {
              source.localScale = VecEaseInOut((Vector3)orig, (Vector3)target, time, easeIn, easeOut);
              break;
            }
        }
          }

          // Once the time has elapsed set the property to the final value
          switch (property)
          {
        case EaseProperty.POSITION:
          {
            source.localPosition = (Vector3)target;
            break;
          }
        case EaseProperty.ROTATION:
          {
            source.localRotation = (Quaternion)target;
            break;
          }
        case EaseProperty.SCALE:
          {
            source.localScale = (Vector3)target;
            break;
          }
          }
        }

        // If we got a callback method, call it
        if (callback != null)
        {
          callback.Invoke();
        }

        // End the coroutine!
        yield break;
    }
开发者ID:hitchh1k3r,项目名称:LD33-Sweet-Dreams,代码行数:101,代码来源:Tween.cs


注:本文中的CallBack.Invoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。