当前位置: 首页>>代码示例>>C#>>正文


C# ClipType类代码示例

本文整理汇总了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);
    }
开发者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


注:本文中的ClipType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。