本文整理汇总了C#中ClipType类的典型用法代码示例。如果您正苦于以下问题:C# ClipType类的具体用法?C# ClipType怎么用?C# ClipType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClipType类属于命名空间,在下文中一共展示了ClipType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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] );
}
}
示例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;
}
示例5: GetKey
public long GetKey(WindowBase window, ClipType clipType, int id) {
var key = (long)(((int)clipType << 16) | (id & 0xffff));
return key;
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
}
}
示例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;
}