本文整理汇总了C#中Timeline类的典型用法代码示例。如果您正苦于以下问题:C# Timeline类的具体用法?C# Timeline怎么用?C# Timeline使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Timeline类属于命名空间,在下文中一共展示了Timeline类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
public void Awake()
{
Debug.Log(gameObject.name);
charPositionTimeline = TimelineManager.Default.Get<Vector3>(gameObject.name);
charPositionTimeline.AddSendFilter(TimelineUtils.BuildDeltaRateFilter <Vector3>((x,y) => Vector3.Distance(x,y), ()=>0.05f, ()=>2.0f));
}
示例2: Init
public void Init(ITimelineContext timelineContext)
{
this.timelineContext = timelineContext;
this.timeline = timelineContext.GetTimeline();
if (timeline == null || timeline.PropertyItem == null)
{
return;
}
string unit = (string)timeline.GetPropertyValue(Constants.TIME_UNIT_KEY);
if (Constants.TIME_UNIT_MS.Equals(unit))
{
period = 1;
}
else if (Constants.TIME_UNIT_S.Equals(unit))
{
period = 1000;
}
else if (Constants.TIME_UNIT_M.Equals(unit))
{
period = 60000;
}
max = long.Parse(timeline.GetPropertyValue(Constants.TIME_MAX_KEY));
// Init Timer
timer.Interval = period;
timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
timer.AutoReset = true;
}
示例3: Initialize
/// <summary>
/// Initialize the modify event.
/// </summary>
/// <param name="timeline">The timeline this event is part of.</param>
/// <param name="start">The start of the event.</param>
/// <param name="dependentOn">An optional event to be dependent upon, ie. wait for.</param>
/// <param name="move">The move to calculate impact from.</param>
protected virtual void Initialize(Timeline timeline, float start, TimelineEvent dependentOn, BattleMove move)
{
//Call the base method.
base.Initialize(timeline, start, dependentOn);
//Initialize the variables.
_Move = move;
}
示例4: GetNextChildren
public void GetNextChildren(int count, CancellationToken token)
{
this.InitListIfFirst(token);
this._NewestTimeline = this._NewestTimeline.GetNewer(count);
foreach(var status in this._NewestTimeline){
this._StatusList.Add(new StatusSystemEntry(this, status));
}
}
示例5: If_there_are_no_points_in_the_timeline_the_last_valid_change_set_is_null
public void If_there_are_no_points_in_the_timeline_the_last_valid_change_set_is_null()
{
var timeline = new Timeline("Timeline", new TestingReferenceValueType(), new Point[] {});
var lastValid = timeline.GetLastValidChangeSet(int.MaxValue);
Assert.IsNull(lastValid);
}
示例6: HandleCharacterCommandEntryInserted
void HandleCharacterCommandEntryInserted(Timeline<string> timeline, TimelineEntry<string> entry)
{
Debug.Log("Character command recieved");
// the various parts of the command are separated by commas
string[]tokens = entry.Value.Split(',');
string action = tokens[0];
}
示例7: It_adds_point_to_the_timeline
public void It_adds_point_to_the_timeline()
{
var timeline = new Timeline("Timeline", new TestingReferenceValueType(), new Point[] { });
timeline.AddPoint(new Point(ChangeSetId.NewUniqueId(), timeline.ReferenceType.GetCurrentValue()));
Assert.AreEqual(1, timeline.Points.Count());
}
示例8: If_throws_when_trying_to_add_point_with_incompatible_type
public void If_throws_when_trying_to_add_point_with_incompatible_type()
{
var timeline = new Timeline("Timeline", new TestingReferenceValueType(), new Point[] { });
TestDelegate act = () => timeline.AddPoint(new Point(ChangeSetId.NewUniqueId(), 100m));
Assert.Throws<InvalidOperationException>(act);
}
示例9: Build
public static List<ComposerEventViewModel> Build(IEnumerable<Composer> composers, IEnumerable<ComposerEraViewModel> musicEras, Timeline.Timeline timeline)
{
var eventList = new List<ComposerEventViewModel>();
foreach (var composer in composers)
{
var background = (Brush)null;
var composerEras = new List<ComposerEraViewModel>();
foreach (var era in composer.Eras)
{
foreach (var musicEra in musicEras)
{
if (era.Name == musicEra.Label)
{
composerEras.Add(musicEra);
}
}
}
var composerEraCount = composerEras.Count;
if (composerEraCount > 1)
{
var linearGradientBrush = new LinearGradientBrush();
linearGradientBrush.StartPoint = new Point(0, 0.5);
linearGradientBrush.EndPoint = new Point(1, 0.5);
for (int i = 0; i < composerEraCount; i++)
{
linearGradientBrush.GradientStops.Add(new GradientStop(((SolidColorBrush)composerEras[i].Background).Color, i / (composerEraCount - 1)));
}
background = linearGradientBrush;
}
else if (composerEraCount == 1)
{
background = composerEras[0].Background;
}
else
{
background = Brushes.Black;
}
var composerEvent = new ComposerEventViewModel(
NameUtility.ToFirstLast(composer.Name),
ExtendedDateTimeInterval.Parse(composer.Dates),
composer,
background,
Brushes.White,
composerEras,
GetCommand(composer.ComposerId, timeline));
eventList.Add(composerEvent);
}
return eventList.OrderBy(e => e.Dates.Earliest()).ToList();
}
示例10: CacheComponents
/// <summary>
/// The components used by the local clock are cached for performance optimization. If you add or remove the Timeline on the GameObject, you need to call this method to update the local clock accordingly.
/// </summary>
public virtual void CacheComponents()
{
timeline = GetComponent<Timeline>();
if (timeline == null)
{
throw new ChronosException(string.Format("Missing timeline for local clock."));
}
}
示例11: TurnToBack
public void TurnToBack()
{
Timeline = new Timeline (180);
Timeline.NewFrame += delegate (object o, NewFrameArgs args) {
SetRotation(RotateAxis.Y, args.FrameNum, 0, 0, 0);
if (args.FrameNum > 90)
BackSide (); };
Timeline.Start ();
}
示例12: Initialize
/// <summary>
/// Initialize the modify event.
/// </summary>
/// <param name="timeline">The timeline this event is part of.</param>
/// <param name="start">The start of the event.</param>
/// <param name="dependentOn">An optional event to be dependent upon, ie. wait for.</param>
/// <param name="character">The character whos energy will be modified.</param>
/// <param name="amount">The amount to add to the energy.</param>
protected virtual void Initialize(Timeline timeline, float start, TimelineEvent dependentOn, Creature character, float amount)
{
//Call the base method.
base.Initialize(timeline, start, dependentOn);
//Initialize the variables.
_Character = character;
_Amount = amount;
}
示例13: ChangeSet
/// <summary>
/// Initializes a new instance of the <see cref="ChangeSet"/> class.
/// </summary>
/// <param name="owner">The timeline that owns this change set.</param>
/// <param name="name">The name of the change set.</param>
/// <exception cref="ArgumentNullException">
/// Thrown if <paramref name="owner"/> is <see langword="null" />.
/// </exception>
public ChangeSet(Timeline owner, string name)
{
{
Lokad.Enforce.Argument(() => owner);
}
m_Owner = owner;
m_Name = name;
}
示例14: Initialize
/// <summary>
/// Initialize the modify event.
/// </summary>
/// <param name="timeline">The timeline this event is part of.</param>
/// <param name="start">The start of the event.</param>
/// <param name="dependentOn">An optional event to be dependent upon, ie. wait for.</param>
/// <param name="character">The character who health will be modified.</param>
/// <param name="state">The state to change into.</param>
protected virtual void Initialize(Timeline timeline, float start, TimelineEvent dependentOn, Creature character, BattleState state)
{
//Call the base method.
base.Initialize(timeline, start, dependentOn);
//Initialize the variables.
_Character = character;
_ChangeState = state;
}
示例15: Main
public static void Main(string[] args)
{
Application.Init ();
Stage stage = Stage.Default as Stage;
(stage as Stage).KeyPressEvent += delegate {
Clutter.Main.Quit();
};
// fixme: add constructor
Clutter.Color stage_color = new Clutter.Color (0xcc, 0xcc, 0xcc, 0xff);
stage.SetColor (stage_color);
Clutter.Group group = new Group();
stage.Add (group);
group.Show ();
// Make a hand
Clutter.Actor hand = new Texture ("redhand.png");
hand.SetPosition (0,0);
hand.Show ();
// Make a rect
Clutter.Rectangle rect = new Clutter.Rectangle();
rect.SetPosition (0,0);
rect.SetSize ((int)hand.Width, (int)hand.Height);
Clutter.Color rect_bg_color = new Clutter.Color (0x33, 0x22, 0x22, 0xff);
rect.SetColor (rect_bg_color);
rect.BorderWidth = 10;
rect.Show ();
group.Add (rect);
group.Add (hand);
// Make a timeline
Timeline timeline = new Timeline (100, 26);
timeline.Loop = true;
Alpha alpha = new Alpha (timeline, (a) => a.Value);
Behaviour o_behave = new BehaviourOpacity (alpha, 0x33, 0xff);
o_behave.Apply (group);
// Make a path behaviour and apply that too
Behaviour p_behave = new BehaviourPath(alpha, knots); // fixme: add custom constructor?
p_behave.Apply (group);
// start timeline
timeline.Start ();
stage.ShowAll();
// launch
Application.Run ();
}