本文整理汇总了C#中TargetMode类的典型用法代码示例。如果您正苦于以下问题:C# TargetMode类的具体用法?C# TargetMode怎么用?C# TargetMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TargetMode类属于命名空间,在下文中一共展示了TargetMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRelationship
internal override ZipPackageRelationship CreateRelationship(Uri targetUri, TargetMode targetMode, string relationshipType)
{
var rel = base.CreateRelationship(targetUri, targetMode, relationshipType);
rel.SourceUri = Uri;
return rel;
}
示例2: OnEnable
protected void OnEnable()
{
#if UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 || UNITY_5_0
this.title = "SP Reference Replacer";
#else
this.titleContent = new GUIContent("SP Reference Replacer");
#endif
if (EditorPrefs.HasKey(SPTools.Settings_SavedInstanceIDKey))
{
string instancePath = AssetDatabase.GetAssetPath(EditorPrefs.GetInt(SPTools.Settings_SavedInstanceIDKey, 0));
if (!string.IsNullOrEmpty(instancePath))
{
this.m_Instance = AssetDatabase.LoadAssetAtPath(instancePath, typeof(SPInstance)) as SPInstance;
}
}
// Default prefs
if (!EditorPrefs.HasKey(SPReferenceReplacerWindow.PrefsKey_TargetMode))
{
EditorPrefs.SetInt(SPReferenceReplacerWindow.PrefsKey_TargetMode, (int)this.m_TargetMode);
}
// Load target mode setting
this.m_TargetMode = (TargetMode)EditorPrefs.GetInt(SPReferenceReplacerWindow.PrefsKey_TargetMode);
}
示例3: BottomRight
private void BottomRight()
{
GUI.skin = leftRight;
GUI.BeginGroup(new Rect(Screen.width - 300, Screen.height - 300, 300, 300));
GUI.DrawTexture(new Rect(0, 0, 300, 300), bgImage, ScaleMode.StretchToFill);
if (GameVars.selectedTurret != null)
{
Tower selectedTower = GameVars.selectedTurret.GetComponent<Tower>();
targetMode = (TargetMode)GUI.SelectionGrid(new Rect(40, 40, 180, 50), (int)targetMode, selectionStrings, 2);
damage = GUI.HorizontalSlider(new Rect(30, 100, 130, 30), selectedTower.Damage, 1.0f, selectedTower.maxPoints);
speed = GUI.HorizontalSlider(new Rect(30, 130, 130, 30), selectedTower.Speed, 1.0f, selectedTower.maxPoints);
range = GUI.HorizontalSlider(new Rect(30, 160, 130, 30), selectedTower.Range, 1.0f, selectedTower.maxPoints);
GUI.Label(new Rect(170, 90, 200, 100), "Damage: " + (int)damage);
GUI.Label(new Rect(170, 120, 200, 100), "Speed: " + (int)speed);
GUI.Label(new Rect(170, 150, 200, 100), "Range: " + (int)range);
//if anything has changed, update it
if (damage != selectedTower.Damage) { GameVars.selectedTurret.GetComponent<Tower>().Damage = damage; }
if (speed != selectedTower.Speed) { GameVars.selectedTurret.GetComponent<Tower>().Speed = speed; }
if (range != selectedTower.Range) { GameVars.selectedTurret.GetComponent<Tower>().Range = range; }
if (targetMode != selectedTower.targetingMode) { GameVars.selectedTurret.GetComponent<Tower>().targetingMode = targetMode; }
}
GUI.EndGroup();
}
示例4: Fire
public void Fire(TargetMode mode, MagicSpawner magazine)
{
if (!isActive) return;
if (magazine.IsLoaded) {
magazine.Fire (GetTarget (mode));
}
}
示例5: GetTarget
public Transform GetTarget(TargetMode mode)
{
if (mode == TargetMode.Single) {
return primaryTarget;
} else {
return targetList.RandomOrDefault ();
}
}
示例6: CreateRelationship
internal virtual ZipPackageRelationship CreateRelationship(Uri targetUri, TargetMode targetMode, string relationshipType)
{
var rel = new ZipPackageRelationship();
rel.TargetUri = targetUri;
rel.TargetMode = targetMode;
rel.RelationshipType = relationshipType;
rel.Id = "rId" + (maxRId++).ToString();
_rels.Add(rel);
return rel;
}
示例7: Start
// Use this for initialization
void Start()
{
if(targetMode==TargetMode.Transform&&targetTransform==null)targetMode = TargetMode.Point;
trans = transform;
#if UNITY_EDITOR
curPosA = new Vector3[numPoints+1];
firstAxisA = new Vector3[numPoints+1];
secondAxisA = new Vector3[numPoints+1];
#endif
}
示例8: PackageRelationship
internal PackageRelationship(string id, Package package, string relationshipType,
Uri sourceUri, TargetMode targetMode, Uri targetUri)
{
Check.IdIsValid(id);
Check.Package(package);
Check.RelationshipTypeIsValid(relationshipType);
Check.SourceUri(sourceUri);
Check.TargetUri(targetUri);
Id = id;
Package = package;
RelationshipType = relationshipType;
SourceUri = sourceUri;
TargetMode = targetMode;
TargetUri = targetUri;
}
示例9: Slam
public void Slam(Vector3 target)
{
if (hasTarget) return;
targetMode = TargetMode.SLAM;
Vector3 start = transform.position;
start.x = Mathf.Clamp(start.x, transform.parent.position.x + minX, transform.parent.position.x + maxX);
Vector3 end = target;
end.x = Mathf.Clamp(end.x, transform.parent.position.x + minX, transform.parent.position.x + maxX);
end.y = start.y;
Vector3 b = new Vector3(start.x, start.y + maxHeight * 0.5f);
Vector3 c = new Vector3(end.x, start.y + maxHeight);
Vector3[] points = new Vector3[] { start, b, c, end };
bezier = new CubicBezier(points);
hasTarget = true;
progress = 0.01f;
}
示例10: PackageRelationship
/**
* Constructor.
*
* @param pkg
* @param sourcePart
* @param targetUri
* @param targetMode
* @param relationshipType
* @param id
*/
public PackageRelationship(OPCPackage pkg, PackagePart sourcePart,
Uri targetUri, TargetMode targetMode, String relationshipType,
String id)
{
if (pkg == null)
throw new ArgumentException("pkg");
if (targetUri == null)
throw new ArgumentException("targetUri");
if (relationshipType == null)
throw new ArgumentException("relationshipType");
if (id == null)
throw new ArgumentException("id");
this.container = pkg;
this.source = sourcePart;
this.targetUri = targetUri;
this.targetMode = targetMode;
this.relationshipType = relationshipType;
this.id = id;
}
示例11: CreateRelationship
/// <summary>
/// Adds a relationship to this PackagePart with the Target PackagePart specified as the Uri
/// Initial and trailing spaces in the name of the PackageRelationship are trimmed.
/// </summary>
/// <param name="targetUri"></param>
/// <param name="targetMode">Enumeration indicating the base uri for the target uri</param>
/// <param name="relationshipType">PackageRelationship type, having uri like syntax that is used to
/// uniquely identify the role of the relationship</param>
/// <param name="id">String that conforms to the xsd:ID datatype. Unique across the source's
/// relationships. Null is OK (ID will be generated). An empty string is an invalid XML ID.</param>
/// <returns></returns>
/// <exception cref="InvalidOperationException">If this part has been deleted</exception>
/// <exception cref="InvalidOperationException">If the parent package has been closed or disposed</exception>
/// <exception cref="IOException">If the package is readonly, it cannot be modified</exception>
/// <exception cref="ArgumentNullException">If parameter "targetUri" is null</exception>
/// <exception cref="ArgumentNullException">If parameter "relationshipType" is null</exception>
/// <exception cref="ArgumentOutOfRangeException">If parameter "targetMode" enumeration does not have a valid value</exception>
/// <exception cref="ArgumentException">If TargetMode is TargetMode.Internal and the targetUri is an absolute Uri </exception>
/// <exception cref="ArgumentException">If relationship is being targeted to a relationship part</exception>
/// <exception cref="System.Xml.XmlException">If parameter "id" is not a valid Xsd Id</exception>
/// <exception cref="System.Xml.XmlException">If an id is provided in the method, and its not unique</exception>
public PackageRelationship CreateRelationship(Uri targetUri, TargetMode targetMode, string relationshipType, String id)
{
CheckInvalidState();
_container.ThrowIfReadOnly();
EnsureRelationships();
//All parameter validation is done in the following method
return _relationships.Add(targetUri, targetMode, relationshipType, id);
}
示例12: RunProject
public void RunProject(TargetMode target)
{
MainForm mainForm = FindForm() as MainForm;
if (mainForm == null || mainForm.SettingsModel == null)
return;
Process.Start("http://localhost:" + mainForm.SettingsModel.RunnerHttpServerPort.ToString() + '/' + target.ToString());
}
示例13: AddRelationship
/**
* Add a relationship to a part (except relationships part).
* <p>
* Check rule M1.25: The Relationships part shall not have relationships to
* any other part. Package implementers shall enforce this requirement upon
* the attempt to create such a relationship and shall treat any such
* relationship as invalid.
* </p>
* @param targetURI
* URI of the target part. Must be relative to the source root
* directory of the part.
* @param targetMode
* Mode [Internal|External].
* @param relationshipType
* Type of relationship.
* @param id
* Relationship unique id.
* @return The newly created and added relationship
*
* @throws InvalidFormatException
* If the URI point to a relationship part URI.
* @see org.apache.poi.OpenXml4Net.opc.RelationshipSource#AddRelationship(org.apache.poi.OpenXml4Net.opc.PackagePartName,
* org.apache.poi.OpenXml4Net.opc.TargetMode, java.lang.String, java.lang.String)
*/
public PackageRelationship AddRelationship(Uri targetURI,
TargetMode targetMode, String relationshipType, String id)
{
container.ThrowExceptionIfReadOnly();
if (targetURI == null)
{
throw new ArgumentException("targetPartName");
}
//if (targetMode == null)
//{
// throw new ArgumentException("targetMode");
//}
if (relationshipType == null)
{
throw new ArgumentException("relationshipType");
}
// Try to retrieve the target part
if (this.IsRelationshipPart
|| PackagingUriHelper.IsRelationshipPartURI(targetURI))
{
throw new InvalidOperationException(
"Rule M1.25: The Relationships part shall not have relationships to any other part.");
}
if (relationships == null)
{
relationships = new PackageRelationshipCollection();
}
return relationships.AddRelationship(targetURI,
targetMode, relationshipType, id);
}
示例14: CreateRelationship
internal PackageRelationship CreateRelationship (Uri targetUri, TargetMode targetMode, string relationshipType, string id, bool loading)
{
if (!loading)
CheckIsReadOnly ();
Check.TargetUri (targetUri);
if (targetUri.IsAbsoluteUri && targetMode == TargetMode.Internal)
throw new ArgumentException ("TargetUri cannot be absolute for an internal relationship");
Check.RelationshipTypeIsValid (relationshipType);
Check.IdIsValid (id);
if (id == null)
id = NextId ();
PackageRelationship r = new PackageRelationship (id, this, relationshipType, Uri, targetMode, targetUri);
if (!PartExists (RelationshipUri))
CreatePartCore (RelationshipUri, RelationshipContentType, CompressionOption.NotCompressed).IsRelationship = true;
Relationships.Add (r.Id, r);
relationshipsCollection.Relationships.Add (r);
if (!loading) {
using (Stream s = GetPart (RelationshipUri).GetStream ())
WriteRelationships (relationships, s);
}
return r;
}
示例15: CreateRelationship
/// <summary>
/// Creates a relationship at the Package level with the Target PackagePart specified as the Uri
/// </summary>
/// <param name="targetUri">Target's URI</param>
/// <param name="targetMode">Enumeration indicating the base uri for the target uri</param>
/// <param name="relationshipType">PackageRelationship type, having uri like syntax that is used to
/// uniquely identify the role of the relationship</param>
/// <param name="id">String that conforms to the xsd:ID datatype. Unique across the source's
/// relationships. Null is OK (ID will be generated). An empty string is an invalid XML ID.</param>
/// <returns></returns>
/// <exception cref="ObjectDisposedException">If this Package object has been disposed</exception>
/// <exception cref="IOException">If the package is readonly, it cannot be modified</exception>
/// <exception cref="ArgumentNullException">If parameter "targetUri" is null</exception>
/// <exception cref="ArgumentNullException">If parameter "relationshipType" is null</exception>
/// <exception cref="ArgumentOutOfRangeException">If parameter "targetMode" enumeration does not have a valid value</exception>
/// <exception cref="ArgumentException">If TargetMode is TargetMode.Internal and the targetUri is an absolute Uri </exception>
/// <exception cref="ArgumentException">If relationship is being targeted to a relationship part</exception>
/// <exception cref="System.Xml.XmlException">If parameter "id" is not a valid Xsd Id</exception>
/// <exception cref="System.Xml.XmlException">If an id is provided in the method, and its not unique</exception>
public PackageRelationship CreateRelationship(Uri targetUri, TargetMode targetMode, string relationshipType, String id)
{
ThrowIfObjectDisposed();
ThrowIfReadOnly();
EnsureRelationships();
//All parameter validation is done in the following call
return _relationships.Add(targetUri, targetMode, relationshipType, id);
}