本文整理汇总了C#中ClipType类的典型用法代码示例。如果您正苦于以下问题:C# ClipType类的具体用法?C# ClipType怎么用?C# ClipType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClipType类属于命名空间,在下文中一共展示了ClipType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ClipPoly
//Apply a polygon clipper operation on subject vertices using cut vertices
public static List<Vector2[]> ClipPoly(Vector2[] subject, Vector2[] cut, ClipType operation)
{
List<Vector2[]> cutPolygons = new List<Vector2[]>();
Paths subj = new Paths(1);
subj.Add(Vector2ToIntList(subject));
Paths clip = new Paths(1);
clip.Add(Vector2ToIntList(cut));
Paths solution = new Paths();
Clipper c = new Clipper();
c.AddPaths(subj, PolyType.ptSubject, true);
c.AddPaths(clip, PolyType.ptClip, true);
c.Execute(operation,solution,
PolyFillType.pftEvenOdd, PolyFillType.pftEvenOdd);
/*
for(int i = 0; i<solution.Count; i++){
if( Mathf.Abs((float)Clipper.Area(solution[i])) > ignoreArea){
cutPolygons.Add( IntListToVector2( solution[i] ));
}
}
*/
return IntListsToVector2(solution);
}
开发者ID:fjnoyp,项目名称:2dMultiplayerGame-150-hours,代码行数:29,代码来源:PolyClipper.cs
示例2: GetState
public State GetState(ClipType clipType, int key) {
#if UNITY_EDITOR
if (Application.isPlaying == false) {
if (clipType == ClipType.Music) {
return this.music.FirstOrDefault(item => item.key == key);
} else if (clipType == ClipType.SFX) {
return this.fx.FirstOrDefault(item => item.key == key);
}
}
#endif
if (clipType == ClipType.Music) {
return this.musicCache.GetValue(key);
} else if (clipType == ClipType.SFX) {
return this.fxCache.GetValue(key);
}
return null;
}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:30,代码来源:AudioData.cs
示例3: ExplosionCut
//Assuming explosionPoints centered on 0,0
public void ExplosionCut(Vector2[] cutVertices, Vector2 worldHitPoint, ClipType clipType = ClipType.ctDifference)
{
Transform ourTransform = gameObject.transform;
PolyClipper.OffsetVertices( cutVertices,
PolyClipper.GetOffset((Vector2)ourTransform.position,
worldHitPoint));
//IF YOU MAKE NON KINEMATIC, PROBLEM:
//Moved Relative to PARENT, NOT ROTATED RELATIVE TO PARENT
//Polygon points are all moved relative to parent GO's transform
Vector2[] ourVertices = ourPolygon.points;
IntoLocalSpace(ourVertices);
// public enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor };
List<Vector2[]> cutPolygons = PolyClipper.ClipPoly(ourVertices,cutVertices,clipType);
if(cutPolygons.Count == 0){
Destroy(this.gameObject);
return;
}
OutLocalSpace(cutPolygons[0]);
UpdateShape( cutPolygons[0] );
for(int i = 1; i<cutPolygons.Count; i++){
//OutLocalSpace(cutPolygons[i]);
CreateCopy( cutPolygons[i] );
}
}
开发者ID:fjnoyp,项目名称:2dMultiplayerGame-150-hours,代码行数:31,代码来源:SDestructable.cs
示例4: GetSource
public AudioSource GetSource(WindowBase window, ClipType clipType, int id) {
#if UNITY_EDITOR
if (Application.isPlaying == false) {
return null;
}
#endif
var key = (window != null) ? (long)window.GetInstanceID() : (long)(((int)clipType << 16) | (id & 0xffff));
AudioSource value;
if (this.instances.TryGetValue(key, out value) == false) {
value = this.source.Spawn();
this.instances.Add(key, value);
}
List<AudioSource> valuesByType;
if (this.instancesByType.TryGetValue(clipType, out valuesByType) == false) {
this.instancesByType.Add(clipType, new List<AudioSource>() { value });
} else {
valuesByType.Add(value);
}
return value;
}
开发者ID:MJunak,项目名称:Unity3d.UI.Windows,代码行数:35,代码来源:AudioSource.cs
示例5: GetKey
public long GetKey(WindowBase window, ClipType clipType, int id) {
var key = (long)(((int)clipType << 16) | (id & 0xffff));
return key;
}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:7,代码来源:Source.cs
示例6: Play
public static void Play(WindowBase window, Source sourceInfo, ClipType clipType, int id) {
var source = sourceInfo.GetSource(window, clipType, id);
if (source == null) return;
if (id == 0) {
// Stop
Manager.Stop(window, sourceInfo, clipType, id);
return;
}
var state = Manager.currentData.GetState(clipType, id);
if (state == null) {
Manager.Stop(window, sourceInfo, clipType, id);
return;
}
Manager.Reset(source);
if (clipType == ClipType.Music) {
source.clip = state.clip;
source.Play();
} else if (clipType == ClipType.SFX) {
source.PlayOneShot(state.clip);
}
}
开发者ID:MJunak,项目名称:Unity3d.UI.Windows,代码行数:35,代码来源:AudioManager.cs
示例7: Play
public static void Play(WindowBase window, Source sourceInfo, ClipType clipType, int id, bool replaceOnEquals) {
if (clipType == ClipType.Music) {
var currentMusicId = sourceInfo.GetCurrentMusicId();
if (currentMusicId > 0) {
var equals = (currentMusicId == id);
if (equals == false || replaceOnEquals == true) {
// Stop
Manager.Stop(window, sourceInfo, clipType, currentMusicId);
} else if (equals == true) {
// Don't play anything
return;
}
}
}
var source = sourceInfo.GetSource(window, clipType, id);
if (source == null) return;
if (id == 0) {
// Stop
Manager.Stop(window, sourceInfo, clipType, id);
return;
}
var state = Manager.currentData.GetState(clipType, id);
if (state == null) {
Manager.Stop(window, sourceInfo, clipType, id);
return;
}
Manager.Reset(source);
sourceInfo.ApplyVolume(clipType, source);
if (clipType == ClipType.Music) {
source.clip = state.clip;
source.Play();
} else if (clipType == ClipType.SFX) {
source.PlayOneShot(state.clip);
}
}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:59,代码来源:Manager.cs
示例8: GetStates
public List<State> GetStates(ClipType clipType) {
if (clipType == ClipType.Music) {
return this.music;
} else if (clipType == ClipType.SFX) {
return this.fx;
}
return null;
}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:15,代码来源:AudioData.cs
示例9: GetVolume
public float GetVolume(ClipType clipType) {
var volume = 0f;
if (clipType == ClipType.Music) {
volume = this.musicVolume;
} else if (clipType == ClipType.SFX) {
volume = this.sfxVolume;
}
return volume;
}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:17,代码来源:Source.cs
示例10: Change
public static void Change(WindowBase window, Source sourceInfo, ClipType clipType, int id, Audio.Window audioSettings) {
var source = sourceInfo.GetSource(window, clipType, id);
if (source == null) return;
source.bypassEffects = audioSettings.bypassEffect;
source.bypassListenerEffects = audioSettings.bypassListenerEffect;
source.bypassReverbZones = audioSettings.bypassReverbEffect;
source.loop = audioSettings.loop;
source.priority = audioSettings.priority;
source.volume = audioSettings.volume;
source.pitch = audioSettings.pitch;
source.panStereo = audioSettings.panStereo;
source.spatialBlend = audioSettings.spatialBlend;
source.reverbZoneMix = audioSettings.reverbZoneMix;
}
开发者ID:MJunak,项目名称:Unity3d.UI.Windows,代码行数:18,代码来源:AudioManager.cs
示例11: CombinePaths
private PathStorage CombinePaths(IVertexSource a, IVertexSource b, ClipType clipType)
{
List<List<IntPoint>> aPolys = VertexSourceToClipperPolygons.CreatePolygons(a);
List<List<IntPoint>> bPolys = VertexSourceToClipperPolygons.CreatePolygons(b);
Clipper clipper = new Clipper();
clipper.AddPaths(aPolys, PolyType.ptSubject, true);
clipper.AddPaths(bPolys, PolyType.ptClip, true);
List<List<IntPoint>> intersectedPolys = new List<List<IntPoint>>();
clipper.Execute(clipType, intersectedPolys);
PathStorage output = VertexSourceToClipperPolygons.CreatePathStorage(intersectedPolys);
output.Add(0, 0, ShapePath.FlagsAndCommand.CommandStop);
return output;
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:19,代码来源:PolygonClipping.cs
示例12: GetSources
public List<AudioSource> GetSources(WindowBase window, ClipType clipType) {
#if UNITY_EDITOR
if (Application.isPlaying == false) {
return null;
}
#endif
List<AudioSource> valuesByType;
if (this.instancesByType.TryGetValue(clipType, out valuesByType) == false) {
return null;
} else {
return valuesByType;
}
}
开发者ID:MJunak,项目名称:Unity3d.UI.Windows,代码行数:22,代码来源:AudioSource.cs
示例13: CombinePaths
private PathStorage CombinePaths(IVertexSource a, IVertexSource b, ClipType clipType)
{
List<List<IntPoint>> aPolys = CreatePolygons(a);
List<List<IntPoint>> bPolys = CreatePolygons(b);
Clipper clipper = new Clipper();
clipper.AddPaths(aPolys, PolyType.ptSubject, true);
clipper.AddPaths(bPolys, PolyType.ptClip, true);
List<List<IntPoint>> intersectedPolys = new List<List<IntPoint>>();
clipper.Execute(clipType, intersectedPolys);
PathStorage output = new PathStorage();
foreach (List<IntPoint> polygon in intersectedPolys)
{
bool first = true;
foreach (IntPoint point in polygon)
{
if (first)
{
output.Add(point.X / 1000.0, point.Y / 1000.0, ShapePath.FlagsAndCommand.CommandMoveTo);
first = false;
}
else
{
output.Add(point.X / 1000.0, point.Y / 1000.0, ShapePath.FlagsAndCommand.CommandLineTo);
}
}
output.ClosePolygon();
}
output.Add(0, 0, ShapePath.FlagsAndCommand.CommandStop);
return output;
}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:38,代码来源:PolygonClipping.cs
示例14: SetVolume
public void SetVolume(ClipType clipType, float value) {
if (clipType == ClipType.Music) {
this.musicVolume = value;
} else if (clipType == ClipType.SFX) {
this.sfxVolume = value;
}
var sources = this.GetPlayingSources(null, clipType);
if (sources != null) {
foreach (var source in sources) {
this.ApplyVolume(clipType, source);
}
}
}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:24,代码来源:Source.cs
示例15: Execute
//------------------------------------------------------------------------------
public bool Execute(ClipType clipType, PolyTree polytree,
PolyFillType subjFillType, PolyFillType clipFillType)
{
if (m_ExecuteLocked) return false;
m_ExecuteLocked = true;
m_SubjFillType = subjFillType;
m_ClipFillType = clipFillType;
m_ClipType = clipType;
m_UsingPolyTree = true;
bool succeeded = ExecuteInternal();
//build the return polygons ...
if (succeeded) BuildResult2(polytree);
m_ExecuteLocked = false;
return succeeded;
}
开发者ID:caomw,项目名称:elementdiscovery,代码行数:17,代码来源:clipper.cs
示例16: ELJoinPolygons
/// <summary>
/// Joins all the polygones.
/// ClipType: http://www.angusj.com/delphi/clipper/documentation/Docs/Units/ClipperLib/Types/ClipType.htm
/// PolyFillType: http://www.angusj.com/delphi/clipper/documentation/Docs/Units/ClipperLib/Types/PolyFillType.htm
/// </summary>
/// <param name="sList">The s list.</param>
/// <param name="cType">Type of the c.</param>
/// <param name="pType">Type of the p.</param>
/// <param name="pFType1">The p f type1.</param>
/// <param name="pFType2">The p f type2.</param>
/// <returns></returns>
public static List<Polygon> ELJoinPolygons(this List<Polygon> sList, ClipType cType,
PolyType pType = PolyType.ptClip, PolyFillType pFType1 = PolyFillType.pftNonZero,
PolyFillType pFType2 = PolyFillType.pftNonZero)
{
var p = ELClipPolygons(sList);
var tList = new List<List<IntPoint>>();
var c = new Clipper();
c.AddPaths(p, pType, true);
c.Execute(cType, tList, pFType1, pFType2);
return ToPolygons(tList);
}
开发者ID:yashine59fr,项目名称:PortAIO-1,代码行数:24,代码来源:Geometry.cs
示例17: Clip
//public static void
public static List<List<Vertex>> Clip(Vertex subject, Vertex clip, ClipType clipType)
{
bool isIntersect = false;
//phase 1
for (var si = subject; si != null; si = si.Next == subject ? null : si.Next)
{
if (si.IsIntersect)
continue;
for (var cj = clip; cj != null; cj = cj.Next == clip ? null : cj.Next)
{
if (cj.IsIntersect)
continue;
var cross = Segment.Intersect (si.ToPoint(), si.NonIntersectionNext.ToPoint(),
cj.ToPoint(), cj.NonIntersectionNext.ToPoint());
if (cross.HasValue)
{
double a = cross.Value.DistanceBetween (si.ToPoint ()) /
si.ToPoint ().DistanceBetween (si.NonIntersectionNext.ToPoint ());
double b = cross.Value.DistanceBetween (cj.ToPoint ()) /
cj.ToPoint ().DistanceBetween (cj.NonIntersectionNext.ToPoint ());
Vertex i1 = new Vertex () {
X = cross.Value.X,
Y = cross.Value.Y,
IsIntersect = true,
Alpha = a,
};
Vertex i2 = new Vertex () {
X = cross.Value.X,
Y = cross.Value.Y,
IsIntersect = true,
Alpha = b,
};
i1.Neibour = i2;
i2.Neibour = i1;
i1.InsertTo (si, si.NonIntersectionNext);
i2.InsertTo (cj, cj.NonIntersectionNext);
isIntersect = true;
}
}
}
if(!isIntersect)
{
List<List<Vertex>> result = new List<List<Vertex>>();
if (subject.Contains(clip))
{
result.Add(clip.ToVertexList());
}
else if (clip.Contains(subject))
{
result.Add(subject.ToVertexList());
}
return result;
}
//phase 2
bool status = clip.Contains(subject);
if (clipType == ClipType.Union || clipType == ClipType.Difference)
status = !status;
for (var si = subject; si != null; si = si.Next == subject ? null : si.Next)
{
if (si.IsIntersect)
{
si.IsExit = status;
status = !status;
}
}
status = subject.Contains(clip);
if (clipType == ClipType.Union)
status = !status;
for (var cj = clip; cj != null; cj = cj.Next == clip ? null : cj.Next)
{
if (cj.IsIntersect)
{
cj.IsExit = status;
status = !status;
}
}
//phase 3
Vertex current;
List<List<Vertex>> polygonList = new List<List<Vertex>>();
for (var si = subject; si != null; si = si.Next == subject ? null : si.Next)
{
if (si.IsIntersect && !si.IsVisit)
{
current = si;
var polygon = new List<Vertex>();
polygonList.Add(polygon);
polygon.Add(current);
do
//.........这里部分代码省略.........
开发者ID:magerate,项目名称:Geometries,代码行数:101,代码来源:Clipper.cs
示例18: GetSource
public AudioSource GetSource(WindowBase window, ClipType clipType, int id) {
#if UNITY_EDITOR
if (Application.isPlaying == false) {
return null;
}
#endif
if (clipType == ClipType.Music) {
this.currentMusicId = id;
}
var key = this.GetKey(window, clipType, id);
AudioSource value;
if (this.instances.TryGetValue(key, out value) == false) {
value = this.source.Spawn();
#if UNITY_EDITOR
value.gameObject.name = string.Format("[ AudioSource ] {0} {1} {2}", (window != null ? window.name : string.Empty), clipType, id);
#endif
this.instances.Add(key, value);
}
List<AudioSource> valuesByType;
if (this.instancesByType.TryGetValue(clipType, out valuesByType) == false) {
this.instancesByType.Add(clipType, new List<AudioSource>() { value });
} else {
valuesByType.Add(value);
}
this.ApplyVolume(clipType, value);
return value;
}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:45,代码来源:Source.cs
示例19: ApplyVolume
public void ApplyVolume(ClipType clipType, AudioSource source) {
if (source != null) source.volume = this.GetVolume(clipType);
}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:5,代码来源:Source.cs
示例20: AddAudioItem
public void AddAudioItem(ClipType clipType, Audio.Data.State state) {
state.key = this.GetNextAudioItemId(clipType);
this.audio.Add(clipType, state);
}
开发者ID:MJunak,项目名称:Unity3d.UI.Windows,代码行数:6,代码来源:FlowData.cs
注:本文中的ClipType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论