本文整理汇总了C#中Motion类的典型用法代码示例。如果您正苦于以下问题:C# Motion类的具体用法?C# Motion怎么用?C# Motion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Motion类属于命名空间,在下文中一共展示了Motion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnNavigatedTo
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
// Check to see whether the Motion API is supported on the device.
if (!Motion.IsSupported)
{
MessageBox.Show("the Motion API is not supported on this device.");
return;
}
// If the Motion object is null, initialize it and add a CurrentValueChanged
// event handler.
if (motion == null)
{
motion = new Motion();
motion.TimeBetweenUpdates = TimeSpan.FromMilliseconds(20);
motion.CurrentValueChanged +=
new EventHandler<SensorReadingEventArgs<MotionReading>>(motion_CurrentValueChanged);
}
// Try to start the Motion API.
try
{
motion.Start();
}
catch (Exception ex)
{
MessageBox.Show("unable to start the Motion API.");
}
}
开发者ID:aelatgt,项目名称:embedded-win8-webapp-test,代码行数:29,代码来源:MainPage.xaml.cs
示例2: BvhWriter
BvhWriter(string filename, Motion motion)
{
this.filename = filename;
this.motion = motion;
writer = new StreamWriter(filename, false, Encoding.ASCII);
}
开发者ID:wuyuntao,项目名称:Mokap,代码行数:7,代码来源:BvhWriter.cs
示例3: Write
public static void Write(string filename, Motion motion)
{
using (var writer = new BvhWriter(filename, motion))
{
writer.Write();
}
}
开发者ID:wuyuntao,项目名称:Mokap,代码行数:7,代码来源:BvhWriter.cs
示例4: setupSensors
private void setupSensors()
{
// Initialize the combined orientation sensor
try
{
motion = new Motion();
motion.TimeBetweenUpdates = TimeSpan.FromMilliseconds(100);
motion.CurrentValueChanged += motion_CurrentValueChanged;
motion.Start();
}
catch
{
// Print out an error
MessageBox.Show("Could not initialize Motion API. This phone does not have the necessary sensors to run this code properly!");
// The kill the current application
Application.Current.Terminate();
}
// Setup sound output
sio = new SoundIO();
sio.audioOutEvent += sio_audioOutEvent;
sio.start();
at = new AudioTool(sio.getOutputNumChannels(), sio.getOutputSampleRate());
}
开发者ID:EE590-Spring2014,项目名称:Materials,代码行数:25,代码来源:MainPage.xaml.cs
示例5: GetBallots
public static BallotCollection GetBallots(Motion motion)
{
var result = new BallotCollection();
var sql = CreateCommand();
sql.CommandText = @"SELECT id,motionId,moderatorId,choice FROM ballots WHERE motionId = ?motionId";
var pId = sql.CreateParameter();
pId.ParameterName = "?motionId";
pId.Value = motion.Id;
sql.Parameters.Add(pId);
using (var db = CreateConnection())
{
db.Open();
sql.Connection = db;
sql.Prepare();
var rs = sql.ExecuteReader();
while (rs.Read())
{
result.Add(new Ballot
{
Id = rs.GetInt32(0),
Motion = GetMotion(rs.GetInt32(1)),
Moderator = GetModerator(rs.GetInt32(2)),
Choice = (Choice)rs.GetInt32(3)
});
}
db.Close();
}
return result;
}
开发者ID:pimanac,项目名称:ConsensusBot,代码行数:33,代码来源:Ballot.cs
示例6: GetEditObjectCharAction
public static Action<TextEditorData> GetEditObjectCharAction (char c, Motion motion)
{
if (motion == Motion.None) return GetEditObjectCharAction(c);
switch (c) {
case 'w':
return ViActions.InnerWord;
case ')':
case '}':
case ']':
case '>':
if (motion == Motion.Inner)
return ViActions.InnerSymbol (c);
else if (motion == Motion.Outer)
return ViActions.OuterSymbol (c);
else
return null;
case '"':
case '\'':
case '`':
if (motion == Motion.Inner)
return ViActions.InnerQuote (c);
else if (motion == Motion.Outer)
return ViActions.OuterQuote (c);
else
return null;
default:
return null;
}
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:30,代码来源:ViActionMaps.cs
示例7: GetSelectionMotion
protected override Motion GetSelectionMotion(int index)
{
Motion m = new Motion();
m.Axis = new Vector3D(0, 1, 0);
m.Z = Owner.PopoutDistance + Owner.ZOffset;
m.Y = Owner.YOffset;
m.X = Owner.XOffset;
ChangeStateForElement(index, Visibility.Visible);
Viewport2DVisual3D model = (Viewport2DVisual3D)Owner._modelContainer.Children[index];
LoginGrid loginGrid = (LoginGrid)model.Visual;
if (Owner._modelContainer.Children.Count <= 1)
{
loginGrid.imgMoveToRight.Visibility = Visibility.Collapsed;
loginGrid.imgMoveToLeft.Visibility = Visibility.Collapsed;
}
else
{
loginGrid.imgMoveToLeft.Visibility = Owner.SelectedIndex < Owner._modelContainer.Children.Count - 1
? Visibility.Visible
: Visibility.Collapsed;
loginGrid.imgMoveToRight.Visibility = Owner.SelectedIndex > 0
? Visibility.Visible
: Visibility.Collapsed;
}
return m;
}
开发者ID:CraigCary,项目名称:roduino,代码行数:30,代码来源:VForm.cs
示例8: GetMotion
public static Motion GetMotion(int id)
{
var result = new Motion();
using (var db = CreateConnection())
using (var sql = db.CreateCommand())
{
db.Open();
sql.CommandText = @"SELECT id,moderatorId,text,status,redditLink,isInOrder,createDt FROM motion WHERE id = @id LIMIT 1;";
var pId = sql.CreateParameter();
pId.ParameterName = "@id";
pId.Value = id;
sql.Parameters.Add(pId);
var rs = sql.ExecuteReader();
if (rs.Read())
{
result.Id = rs.GetInt32(0);
result.Sponsor = GetModerator(rs.GetInt32(1));
result.Text = rs.GetString(2);
result.Status = (MotionStatus)rs.GetInt32(3);
result.PostUrl = (string)rs.GetValue(4);
result.Created = DateTime.Parse(rs.GetString(6));
}
rs.Close();
db.Close();
}
return result;
}
开发者ID:pimanac,项目名称:ConsensusBot,代码行数:30,代码来源:Motion.cs
示例9: OnGUI
void OnGUI()
{
GUI.Label(new Rect(5, 4, 80, 18), "Enter a name:");
// Assign name from text field
name = EditorGUI.TextField(new Rect(85, 4, 125, 15), name);
if (!recording) {
// Begin Recording
if (GUI.Button(new Rect(5, 28, 50, 18), "Record")) {
motion = new Motion();
recording = true;
}
// Allow Submission of a Recording
if (motion.steps.Count > 0) {
if (GUI.Button(new Rect(60, 28, 50, 18), "Submit")) {
editor.motions.Add(name, motion);
editor.motionControl.animation = null;
this.Close();
}
}
}
else {
// End Recording
if (GUI.Button(new Rect(5, 28, 50, 18), "Stop")) {
recording = false;
editor.motionControl.animation = motion;
}
}
// Cancel Motion Creation
if (GUI.Button(new Rect(170, 28, 50, 18), "Cancel")) {
editor.motionControl.animation = null;
this.Close();
}
}
开发者ID:MarthMarthMarth,项目名称:CaveTracking,代码行数:35,代码来源:MotionControl.cs
示例10: Zoom
public void Zoom(float scale, float duration)
{
if (_currentMotion != null) {
_currentMotion.End();
}
_currentMotion = new ZoomMotion(Camera.transform, transform, _originalOffset, scale, duration);
_motions.Clear();
}
开发者ID:RolandMQuiros,项目名称:Lost-Generation,代码行数:8,代码来源:BoardCamera.cs
示例11: Rotate
public void Rotate(float angle, float duration)
{
if (_currentMotion != null && !(_currentMotion is RotateMotion)) {
_currentMotion.End();
}
_currentMotion = new RotateMotion(transform, angle, duration);
_motions.Clear();
}
开发者ID:RolandMQuiros,项目名称:Lost-Generation,代码行数:9,代码来源:BoardCamera.cs
示例12: Awake
private void Awake()
{
_targetModelObject = transform.FindChild("Target Model").gameObject;
_targetModelObject.SetActive(false);
_motionController = GetComponent<Motion>();
ResetLaunchTimer();
}
开发者ID:Ben-P-Leda,项目名称:Dogfighter,代码行数:9,代码来源:ActivityTimer.cs
示例13: MotionSensor
public MotionSensor(TimeSpan updateInterval)
{
if (this.IsSupported)
{
this.sensor = new Motion()
{
TimeBetweenUpdates = updateInterval
};
}
}
开发者ID:paul33868,项目名称:SimplyMobile,代码行数:10,代码来源:MotionSensor.cs
示例14: Pan
public void Pan(Point point, float duration)
{
Vector3 end = _theme.PointToVector3(point);
if (_currentMotion != null && !(_currentMotion is PanMotion)) {
_currentMotion.End();
}
_currentMotion = new PanMotion(transform, end, duration);
_motions.Clear();
}
开发者ID:RolandMQuiros,项目名称:Lost-Generation,代码行数:10,代码来源:BoardCamera.cs
示例15: SetPlayerCharaMotion
/// <summary>
/// 玩家腳色播放動作,傳入動作類型與是否錯開播放
/// </summary>
public static void SetPlayerCharaMotion(Motion _motion, bool _stagger)
{
for (int i = 0; i < PCharaList.Count; i++)
{
if (_stagger)
PCharaList[i].PlayMotion(_motion, ((float)i * 2f) / 10f);
else
PCharaList[i].PlayMotion(_motion, 0);
}
}
开发者ID:scozirge,项目名称:AVentureCapital,代码行数:13,代码来源:FightScene.cs
示例16: PlayerRenderContext
public PlayerRenderContext(PlayerContext playerContext, Motion motion)
{
this.Name = playerContext.Name;
this.Number = playerContext.Number;
this.Score = playerContext.Score;
this.Motion = motion;
this.LastPos = playerContext.LastPos;
this.Power = playerContext.Power;
this.Stun = playerContext.Stun;
}
开发者ID:elrha,项目名称:GoldMine,代码行数:11,代码来源:GameContext.cs
示例17: GetNextMotion
protected override Motion GetNextMotion(int index)
{
Motion m = new Motion();
m.Axis = new Vector3D(0, 1, 0);
m.X = Owner.FrontItemGap + Owner.ItemGap * (index - Owner.SelectedIndex) + Owner.XOffset;
m.Z = -1 * Owner.ItemGap * (index - Owner.SelectedIndex) + Owner.ZOffset;
m.Y = Owner.YOffset;
ChangeStateForElement(index, Visibility.Collapsed);
return m;
}
开发者ID:CraigCary,项目名称:roduino,代码行数:11,代码来源:VForm.cs
示例18: MainPage
// Constructor
public MainPage()
{
InitializeComponent();
if (Motion.IsSupported)
{
sensor = new Motion();
sensor.TimeBetweenUpdates = TimeSpan.FromMilliseconds(66);
sensor.CurrentValueChanged += sensor_CurrentValueChanged;
sensor.Calibrate += sensor_Calibrate;
}
}
开发者ID:shreedharcva,项目名称:Windows-Phone-7-In-Action,代码行数:13,代码来源:MainPage.xaml.cs
示例19: Awake
bool m_actionSoundEnable; //액션의 효과음이 유효하면 true. (대미지 시는 서로 OFF로 되어 있을 것).
void Awake() {
GetComponent<AudioSource>().clip = m_landingSE;
GetComponent<AudioSource>().PlayDelayed(0.2f); //착지음을 늦게 재생시킨다.
m_currentMotion = Motion.In;
m_anim = GetComponentInChildren<Animation>();
m_rps = RPSKind.None;
m_opponentRps = RPSKind.None;
m_damage = 0;
m_actionEffectEnable = false;
m_actionSoundEnable = false;
}
开发者ID:fotoco,项目名称:006772,代码行数:15,代码来源:Player.cs
示例20: Awake
private void Awake()
{
Transform planeTransform = transform.FindChild("Plane");
_modelTransform = planeTransform.FindChild("Plane Model");
_modelObject = _modelTransform.gameObject;
_motionController = planeTransform.GetComponent<Motion>();
_collisionController = planeTransform.GetComponent<Collisions>();
_chaseCameraController = transform.FindChild("Camera").GetComponent<ChaseCamera>();
_statusManager = transform.FindChild("Status Manager").GetComponent<StatusDisplayManager>();
}
开发者ID:Ben-P-Leda,项目名称:Dogfighter,代码行数:13,代码来源:LifeCycle.cs
注:本文中的Motion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论