本文整理汇总了C#中PlayerController.UnloadCurrentEvent方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerController.UnloadCurrentEvent方法的具体用法?C# PlayerController.UnloadCurrentEvent怎么用?C# PlayerController.UnloadCurrentEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerController
的用法示例。
在下文中一共展示了PlayerController.UnloadCurrentEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestROICamerasConfig
public void TestROICamerasConfig()
{
TimelineEvent evt1;
List<CameraConfig> cams;
Mock<IMultiPlayer> multiplayerMock = new Mock<IMultiPlayer> ();
mtkMock.Setup (m => m.GetMultiPlayer ()).Returns (multiplayerMock.Object);
player = new PlayerController (true);
PreparePlayer ();
/* ROI should be empty */
Assert.AreEqual (new Area (), player.CamerasConfig [0].RegionOfInterest);
/* Modify ROI */
cams = player.CamerasConfig;
cams [0].RegionOfInterest = new Area (10, 10, 20, 20);
/* And set */
player.CamerasConfig = cams;
/* Now create an event with current camera config */
evt1 = new TimelineEvent { Start = new Time (100), Stop = new Time (200),
CamerasConfig = player.CamerasConfig
};
/* Check that ROI was copied in event */
Assert.AreEqual (new Area (10, 10, 20, 20), evt1.CamerasConfig [0].RegionOfInterest);
/* Change ROI again */
cams [0].RegionOfInterest = new Area (20, 20, 40, 40);
player.CamerasConfig = cams;
/* Check event was not impacted */
Assert.AreEqual (new Area (10, 10, 20, 20), evt1.CamerasConfig [0].RegionOfInterest);
/* And load event */
player.LoadEvent (mfs, evt1, evt1.Start, true);
Assert.AreEqual (new Area (10, 10, 20, 20), player.CamerasConfig [0].RegionOfInterest);
/* Unload and check the original cams config is set back*/
player.UnloadCurrentEvent ();
Assert.AreEqual (new Area (20, 20, 40, 40), player.CamerasConfig [0].RegionOfInterest);
/* check the event was not impacted */
Assert.AreEqual (new Area (10, 10, 20, 20), evt1.CamerasConfig [0].RegionOfInterest);
}
示例2: TestMultiplayerCamerasConfig
public void TestMultiplayerCamerasConfig()
{
TimelineEvent evt1;
List<CameraConfig> cams1, cams2;
Mock<IMultiPlayer> multiplayerMock = new Mock<IMultiPlayer> ();
mtkMock.Setup (m => m.GetMultiPlayer ()).Returns (multiplayerMock.Object);
player = new PlayerController (true);
PreparePlayer ();
/* Only called internally in the openning */
cams1 = new List<CameraConfig> { new CameraConfig (0), new CameraConfig (1) };
cams2 = new List<CameraConfig> { new CameraConfig (1), new CameraConfig (0) };
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Never ());
Assert.AreEqual (cams1, player.CamerasConfig);
player.CamerasConfig = cams2;
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ());
Assert.AreEqual (cams2, player.CamerasConfig);
multiplayerMock.ResetCalls ();
/* Now load an event */
evt1 = new TimelineEvent { Start = new Time (100), Stop = new Time (200),
CamerasConfig = new List<CameraConfig> { new CameraConfig (1), new CameraConfig (1) }
};
player.LoadEvent (mfs, evt1, evt1.Start, true);
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ());
Assert.AreEqual (evt1.CamerasConfig, player.CamerasConfig);
multiplayerMock.ResetCalls ();
/* Change event cams config */
player.CamerasConfig = new List<CameraConfig> { new CameraConfig (0), new CameraConfig (0) };
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ());
Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0), new CameraConfig (0) }, evt1.CamerasConfig);
Assert.AreEqual (player.CamerasConfig, evt1.CamerasConfig);
multiplayerMock.ResetCalls ();
/* Unload and check the original cams config is set back*/
player.UnloadCurrentEvent ();
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ());
Assert.AreEqual (cams2, player.CamerasConfig);
Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0), new CameraConfig (0) }, evt1.CamerasConfig);
multiplayerMock.ResetCalls ();
/* And changing the config does not affects the unloaded event */
player.CamerasConfig = cams1;
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ());
Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0), new CameraConfig (0) }, evt1.CamerasConfig);
multiplayerMock.ResetCalls ();
/* Now load a playlist video */
PlaylistVideo plv = new PlaylistVideo (mfs [0]);
player.LoadPlaylistEvent (playlist, plv);
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Never ());
Assert.AreEqual (new List<CameraConfig> { new CameraConfig (0) }, player.CamerasConfig);
multiplayerMock.ResetCalls ();
player.UnloadCurrentEvent ();
/* Called by Open internally () */
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Never ());
Assert.AreEqual (cams2, player.CamerasConfig);
multiplayerMock.ResetCalls ();
/* Now load a playlist event and make sure its config is loaded
* and not the event's one */
PlaylistPlayElement ple = new PlaylistPlayElement (evt, mfs);
ple.CamerasConfig = cams2;
player.LoadPlaylistEvent (playlist, ple);
multiplayerMock.Verify (p => p.ApplyCamerasConfig (), Times.Once ());
Assert.AreEqual (cams2, player.CamerasConfig);
multiplayerMock.ResetCalls ();
}