本文整理汇总了C#中Gear类的典型用法代码示例。如果您正苦于以下问题:C# Gear类的具体用法?C# Gear怎么用?C# Gear使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Gear类属于命名空间,在下文中一共展示了Gear类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ConvertGearToRawPosition
private int ConvertGearToRawPosition(Gear gear)
{
switch (gear)
{
case Gear.parking:
return 0;
break;
case Gear.reverse:
return 1;
break;
case Gear.neutral:
return 2;
break;
case Gear.drive:
return 3;
break;
case Gear.two:
return 4;
break;
default:
throw new ApplicationException("Unhandled gear!");
break;
}
}
开发者ID:Spawek,项目名称:valeo,代码行数:29,代码来源:GearboxController.cs
示例2: Gearbox
// Constructor accepts mediator as an argument
public Gearbox(EngineManagementSystem mediator)
{
this.mediator = mediator;
enabled = false;
currentGear = Gear.Neutral;
mediator.RegisterGearbox(this);
}
开发者ID:phoenixproject,项目名称:csdpe,代码行数:8,代码来源:Gearbox.cs
示例3: setGear
//TODO: make some enum
/// <summary>
///
/// </summary>
/// <param name="gear">
/// p - parking
/// r - reverse
/// n - neutral
/// d - tylko 1 bieg
/// </param>
public void setGear(Gear gear)
{
switch(gear)
{
case Gear.parking:
setTarget(GEARBOX_CHANNEL, GEAR_P);
break;
case Gear.reverse:
setTarget(GEARBOX_CHANNEL, GEAR_R);
break;
case Gear.neutral:
setTarget(GEARBOX_CHANNEL, GEAR_N);
break;
case Gear.drive:
setTarget(GEARBOX_CHANNEL, GEAR_D);
break;
default:
Logger.Log(this, String.Format("trying to set not-existing gear", gear), 2);
break;
}
}
开发者ID:Spawek,项目名称:autonomiczny_samochod,代码行数:35,代码来源:ServoDriver.cs
示例4: ParameterAttribute
/// <summary>
///
/// </summary>
/// <param name="gear"></param>
/// <param name="attribute"></param>
public ParameterAttribute(Gear gear, String attribute)
{
_gear = gear;
_attribute = attribute;
//If we have FixedValues use that
//I wan't to create array with rating as index for future, but
//this is keept for backwards/laziness
if (_attribute.StartsWith("FixedValues"))
{
//Regex to extracxt anything between ( ) in Param
Match m = FixedExtract.Match(_attribute);
String vals = m.Groups[1].Value;
//Regex to extract anything inbetween [ ]
//Not sure why i don't just split by , and remove it durring
//next phase
MatchCollection m2 = Regex.Matches(vals, @"\[([^\]]*)\]");
double junk; //Not used, tryparse needs out
//LINQ magic to cast matchcollection to the double[]
fixedDoubles = (from val in m2.Cast<Match>()
where double.TryParse(val.Groups[1].Value, out junk)
select double.Parse(val.Groups[1].Value)).ToArray();
}
else
{
}
}
开发者ID:blackmage5242,项目名称:chummer5a-master,代码行数:36,代码来源:clsParameterAttribute.cs
示例5: GearSet
public GearSet(PictureBox gearBox, PictureBox doorBox)
{
this.door = new Door();
this.gear = new Gear();
this.gearSetState = 0;
this.gearBox = gearBox;
this.doorBox = doorBox;
}
开发者ID:VincentRoma,项目名称:Landing_Gears,代码行数:8,代码来源:GearSet.cs
示例6: Update
public void Update(Gear gear, string externalUserId)
{
var oldGear = _gearRepository.ById(gear.Id);
_gearRepository.Update(gear);
Task.Run(() => HandleGearUpdated(gear, oldGear, externalUserId));
}
开发者ID:loonison101,项目名称:PB,代码行数:8,代码来源:GearService.cs
示例7: Create
public void Create(Gear gear, string externalUserId)
{
gear.Id = gear.Id == Guid.Empty ? Guid.NewGuid() : gear.Id;
_gearRepository.Create(gear);
Task.Run(() => HandleGearCreated(gear, externalUserId));
}
开发者ID:loonison101,项目名称:PB,代码行数:8,代码来源:GearService.cs
示例8: Pose
public Pose(Vector2 position, float orientation, float wheelAngle, Gear gear)
{
Position = position;
while (orientation < 0f) orientation += MathHelper.TwoPi;
while (orientation >= MathHelper.TwoPi) orientation -= MathHelper.TwoPi;
Orientation = orientation;
WheelAngle = wheelAngle;
Gear = gear;
}
开发者ID:jgera,项目名称:AutonomousCar,代码行数:9,代码来源:Pose.cs
示例9: openTest
public void openTest()
{
GearController gc = new GearController();
gc.ShouldDeploy = true;
Gear gear = new Gear(gc);
gear.Deploy();
System.Threading.Thread.Sleep(15000);
Assert.AreEqual(GearState.LOCKDOWN,gear.GearState);
}
开发者ID:gbouchez,项目名称:LandingGearSystem,代码行数:9,代码来源:GearTest.cs
示例10: closeTest
public void closeTest()
{
GearController gc = new GearController();
gc.ShouldDeploy = true;
Gear gear = new Gear(gc);
gear.Retract();
System.Threading.Thread.Sleep(15000);
Assert.AreEqual(GearState.LOCKUP, gear.GearState);
}
开发者ID:gbouchez,项目名称:LandingGearSystem,代码行数:9,代码来源:GearTest.cs
示例11: frmSelectNexus
public frmSelectNexus(Character objCharacter, bool blnCareer = false)
{
InitializeComponent();
LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);
_objCharacter = objCharacter;
_objGear = new Gear(objCharacter);
chkFreeItem.Visible = blnCareer;
MoveControls();
}
开发者ID:Nitsuj83,项目名称:chummer5a,代码行数:9,代码来源:frmSelectNexus.cs
示例12: OnTriggerStay2D
public void OnTriggerStay2D(Collider2D coll)
{
Gear gear = coll.GetComponent<Gear>();
if (gear!=null && gear.isMovable && !isActive && (Vector3.Distance(transform.position, gear.transform.position)<minDistanceToTrigger || minDistanceToTrigger==0)) {
print("moving now");
gear.isMovable = false;
gear.Start();
this.gear = gear;
startPos = gear.transform.position;
isActive = true;
}
}
开发者ID:shadowseer99,项目名称:clockwork,代码行数:12,代码来源:GearLock2D.cs
示例13: GearController
public GearController()
{
frontGear = new Gear(this);
frontGearObserver.Subscribe(frontGear);
frontGearObserver.Controller = this;
rightGear = new Gear(this);
rightGearObserver.Subscribe(rightGear);
rightGearObserver.Controller = this;
leftGear = new Gear(this);
leftGearObserver.Subscribe(leftGear);
leftGearObserver.Controller = this;
}
开发者ID:gbouchez,项目名称:LandingGearSystem,代码行数:12,代码来源:GearController.cs
示例14: PlayerSelectionScreen
/// <summary>
/// Creates a new PlayerSelectionScreen object.
/// </summary>
public PlayerSelectionScreen(Gear gear)
{
// check the parameter
if (gear == null)
{
throw new ArgumentNullException("gear");
}
this.IsPopup = true;
this.usedGear = gear;
isGearUsed = false;
drawMaximum = 3;
selectedPlayers = new List<int>();
ResetValues();
Reset();
}
开发者ID:dunghand,项目名称:msrds,代码行数:21,代码来源:PlayerSelectionScreen.cs
示例15: BuildGearTree
/// <summary>
/// Build up the Tree for the current piece of Gear and all of its children.
/// </summary>
/// <param name="objGear">Gear to iterate through.</param>
/// <param name="objNode">TreeNode to append to.</param>
/// <param name="objMenu">ContextMenuStrip that the new TreeNodes should use.</param>
public void BuildGearTree(Gear objGear, TreeNode objNode, ContextMenuStrip objMenu)
{
foreach (Gear objChild in objGear.Children)
{
TreeNode objChildNode = new TreeNode();
objChildNode.Text = objChild.DisplayName;
objChildNode.Tag = objChild.InternalId;
objChildNode.ContextMenuStrip = objMenu;
if (objChild.Notes != string.Empty)
objChildNode.ForeColor = Color.SaddleBrown;
objChildNode.ToolTipText = objChild.Notes;
objNode.Nodes.Add(objChildNode);
objNode.Expand();
// Set the Gear's Parent.
objChild.Parent = objGear;
BuildGearTree(objChild, objChildNode, objMenu);
}
}
开发者ID:hollis21,项目名称:Chummer,代码行数:27,代码来源:clsCommon.cs
示例16: OnBeginDrag
public void OnBeginDrag(PointerEventData eventData)
{
Debug.Log("On Begin Drag");
if (this.transform.parent.name != "Gears")
{
Debug.Log("Doesn't belong to the field");
proceed = false;
return;
}
Debug.Log(this.transform.parent.name);
parentToReturnTo = gearPanel.transform;
//siblingIndex = this.transform.GetSiblingIndex();
GetComponent<CanvasGroup>().blocksRaycasts = false;
// Create a gear to replace the one that was just picked up
newGear = GameObject.Instantiate(gearPrefab, this.transform.position, Quaternion.identity) as Gear;
newGear.GetComponent<CanvasGroup>().alpha = 0;
newGear.transform.SetParent(parentToReturnTo);
newGear.GetComponent<CanvasGroup>().alpha = 1;
}
开发者ID:robofriven,项目名称:Sannemer,代码行数:21,代码来源:GearDrag.cs
示例17: FindGear
/// <summary>
/// Locate a piece of Gear.
/// </summary>
/// <param name="strGuid">InternalId of the Gear to find.</param>
/// <param name="lstGear">List of Gear to search.</param>
public Gear FindGear(string strGuid, List<Gear> lstGear)
{
Gear objReturn = new Gear(_objCharacter);
foreach (Gear objGear in lstGear)
{
if (objGear.InternalId == strGuid)
objReturn = objGear;
else
{
if (objGear.Children.Count > 0)
objReturn = FindGear(strGuid, objGear.Children);
}
if (objReturn != null)
{
if (objReturn.InternalId != Guid.Empty.ToString() && objReturn.Name != "")
return objReturn;
}
}
objReturn = null;
return objReturn;
}
开发者ID:rabbitslayer4,项目名称:chummer5a,代码行数:28,代码来源:clsCommon.cs
示例18: NextPose
public static Pose NextPose(Pose current, Steer steer, Gear gear, float speed, float dt, float turnRadius, out float length)
{
length = speed * dt;
float x, y, phi;
if (steer == Steer.Straight)
{
x = length;
y = 0;
phi = 0;
}
else
{
phi = length / turnRadius;
float phiover2 = phi / 2;
float sinPhi = (float)Math.Sin(phiover2);
float L = 2 * sinPhi * turnRadius;
x = L * (float)Math.Cos(phiover2);
y = L * sinPhi;
}
if (steer == Steer.Right)
{
y = -y;
phi = -phi;
}
if (gear == Gear.Backward)
{
x = -x;
phi = -phi;
}
Vector2 pos = new Vector2(x, y);
pos = Vector2.Transform(pos, Matrix.CreateRotationZ(current.Orientation));
return new Pose(current.Position + pos, current.Orientation + phi);
}
开发者ID:jgera,项目名称:AutonomousCar,代码行数:37,代码来源:VehicleModel.cs
示例19: cmdCreateStackedFocus_Click
private void cmdCreateStackedFocus_Click(object sender, EventArgs e)
{
int intFree = 0;
List<Gear> lstGear = new List<Gear>();
List<Gear> lstStack = new List<Gear>();
// Run through all of the Foci the character has and count the un-Bonded ones.
foreach (Gear objGear in _objCharacter.Gear)
{
if (objGear.Category == "Foci" || objGear.Category == "Metamagic Foci")
{
if (!objGear.Bonded)
{
intFree++;
lstGear.Add(objGear);
}
}
}
// If the character does not have at least 2 un-Bonded Foci, display an error and leave.
if (intFree < 2)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotStackFoci"), LanguageManager.Instance.GetString("MessageTitle_CannotStackFoci"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
frmSelectItem frmPickItem = new frmSelectItem();
// Let the character select the Foci they'd like to stack, stopping when they either click Cancel or there are no more items left in the list.
do
{
frmPickItem.Gear = lstGear;
frmPickItem.AllowAutoSelect = false;
frmPickItem.Description = LanguageManager.Instance.GetString("String_SelectItemFocus");
frmPickItem.ShowDialog(this);
if (frmPickItem.DialogResult == DialogResult.OK)
{
// Move the item from the Gear list to the Stack list.
foreach (Gear objGear in lstGear)
{
if (objGear.InternalId == frmPickItem.SelectedItem)
{
objGear.Bonded = true;
lstStack.Add(objGear);
lstGear.Remove(objGear);
break;
}
}
}
} while (lstGear.Count > 0 && frmPickItem.DialogResult != DialogResult.Cancel);
// Make sure at least 2 Foci were selected.
if (lstStack.Count < 2)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_StackedFocusMinimum"), LanguageManager.Instance.GetString("MessageTitle_CannotStackFoci"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
// Make sure the combined Force of the Foci do not exceed 6.
if (!_objOptions.AllowHigherStackedFoci)
{
int intCombined = 0;
foreach (Gear objGear in lstStack)
intCombined += objGear.Rating;
if (intCombined > 6)
{
foreach (Gear objGear in lstStack)
objGear.Bonded = false;
MessageBox.Show(LanguageManager.Instance.GetString("Message_StackedFocusForce"), LanguageManager.Instance.GetString("MessageTitle_CannotStackFoci"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
// Create the Stacked Focus.
StackedFocus objStack = new StackedFocus(_objCharacter);
objStack.Gear = lstStack;
_objCharacter.StackedFoci.Add(objStack);
// Remove the Gear from the character and replace it with a Stacked Focus item.
int intCost = 0;
foreach (Gear objGear in lstStack)
{
intCost += objGear.TotalCost;
_objCharacter.Gear.Remove(objGear);
// Remove the TreeNode from Gear.
foreach (TreeNode nodRoot in treGear.Nodes)
{
foreach (TreeNode nodItem in nodRoot.Nodes)
{
if (nodItem.Tag.ToString() == objGear.InternalId)
{
nodRoot.Nodes.Remove(nodItem);
break;
}
}
}
}
//.........这里部分代码省略.........
开发者ID:cormanater,项目名称:chummer5a,代码行数:101,代码来源:frmCreate.cs
示例20: cmdDeleteGear_Click
private void cmdDeleteGear_Click(object sender, EventArgs e)
{
// Delete the selected Gear.
try
{
if (treGear.SelectedNode.Level == 0)
{
if (treGear.SelectedNode.Text == LanguageManager.Instance.GetString("Node_SelectedGear"))
return;
if (!_objFunctions.ConfirmDelete(LanguageManager.Instance.GetString("Message_DeleteGearLocation")))
return;
// Move all of the child nodes in the current parent to the Selected Gear parent node.
foreach (TreeNode objNode in treGear.SelectedNode.Nodes)
{
Gear objGear = new Gear(_objCharacter);
objGear = _objFunctions.FindGear(objNode.Tag.ToString(), _objCharacter.Gear);
// Change the Location for the Gear.
objGear.Location = "";
}
List<TreeNode> lstMoveNodes = new List<TreeNode>();
foreach (TreeNode objNode in treGear.SelectedNode.Nodes)
lstMoveNodes.Add(objNode);
foreach (TreeNode objNode in lstMoveNodes)
{
treGear.SelectedNode.Nodes.Remove(objNode);
treGear.Nodes[0].Nodes.Add(objNode);
}
// Remove the Location from the character, then remove the selected node.
_objCharacter.Locations.Remove(treGear.SelectedNode.Text);
treGear.SelectedNode.Remove();
}
if (treGear.SelectedNode.Level > 0)
{
if (!_objFunctions.ConfirmDelete(LanguageManager.Instance.GetString("Message_DeleteGear")))
return;
Gear objGear = new Gear(_objCharacter);
objGear = _objFunctions.FindGear(treGear.SelectedNode.Tag.ToString(), _objCharacter.Gear);
Gear objParent = new Gear(_objCharacter);
objParent = _objFunctions.FindGear(treGear.SelectedNode.Parent.Tag.ToString(), _objCharacter.Gear);
_objFunctions.DeleteGear(objGear, treWeapons, _objImprovementManager);
_objCharacter.Gear.Remove(objGear);
treGear.SelectedNode.Remove();
// If the Parent is populated, remove the item from its Parent.
if (objParent != null)
objParent.Children.Remove(objGear);
}
_objController.PopulateFocusList(treFoci);
UpdateCharacterInfo();
RefreshSelectedGear();
_blnIsDirty = true;
UpdateWindowTitle();
}
catch
{
}
}
开发者ID:cormanater,项目名称:chummer5a,代码行数:67,代码来源:frmCreate.cs
注:本文中的Gear类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论