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


C# UnityEngine.Select方法代码示例

本文整理汇总了C#中UnityEngine.Select方法的典型用法代码示例。如果您正苦于以下问题:C# UnityEngine.Select方法的具体用法?C# UnityEngine.Select怎么用?C# UnityEngine.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine的用法示例。


在下文中一共展示了UnityEngine.Select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetAllReferences

	void GetAllReferences()
	{
		if(!Application.isPlaying || _gotReferences)	
		{
			return;	
		}
		_gotReferences =true;
		/*
		var types = new [] { "UnityEngine.AnimationClip", "UnityEngine.AudioClip", "UnityEngine.Mesh", "UnityEngine.Material",
			"UnityEngine.Texture", "UnityEngine.TextAsset", "UnityEngine.ScriptableObject", "UnityEngine.Renderer", "UnityEngine.Collider",
			"UnityEngine.Animator", "UnityEngine.Avatar", "UnityEngine.Cloth", "UnityEngine.Terrain", 
			"UnityEngine.LensFlare", "UnityEngine.Font", "UnityEngine.RenderTexture", "UnityEngine.LineRenderer", "UnityEngine.Renderer",
			"UnityEngine.ParticleRenderer", "UnityEngine.SkinnedMeshRenderer","UnityEngine.MeshFilter", "UnityEngine.MeshRenderer", 
			"UnityEngine.BoxCollider", "UnityEngine.SphereCollider", "UnityEngine.TerrainCollider", 
			"UnityEngine.MeshCollider", "UnityEngine.CapsuleCollider",
			"UnityEngine.GUISkin", "UnityEngine.PhysicMaterial", "UnityEngine.Font", "UnityEngine.CubeMap" };
		*/
		var types = new [] { "UnityEngine.Object" };
		var assets = types.Select(t=>UnitySerializer.GetTypeEx(t)).Where(t=>t!=null).SelectMany(t=>Resources.FindObjectsOfTypeAll(t))
			.Concat(Resources.FindObjectsOfTypeAll(typeof(GameObject)).Cast<GameObject>().SelectMany(g=>g.GetAllComponentsInChildren<Transform>().Select(t=>(UnityEngine.Object)t.gameObject)))
			.Where(g=>g!=null && !string.IsNullOrEmpty(g.name) && g.GetInstanceID()>0 )
			.Distinct()
			.ToList();
		
		
		_assetStore.Clear();
		foreach(var a in assets)
		{
			var allowAsset = true;
			FilterAssetReference(a, ref allowAsset);
			if(allowAsset)
				_assetStore[a.GetType().Name][a.name].Add(a);
		}
		
	}
开发者ID:Tsumik1,项目名称:SimClinic-UoH-,代码行数:35,代码来源:SaveGameManager.cs

示例2: GetUvList

		/// <summary>
		/// UVの取得
		/// </summary>
		/// <returns>UV配列</returns>
		/// <remarks>
		/// UVモーフにて改変される場合は未適応(0.0f)と全適応(1.0f)の2段階のみを扱い、中間適応は考慮しない。
		/// 複数のUVモーフが同一頂点に掛かる場合に多重適応すると単体では参照出来無い領域迄参照出来る様に為るが、これは考慮しない。
		/// 同様にグループモーフに依る1.0f超えも考慮しない。
		/// </remarks>
		Vector2[][] GetUvList()
		{
			uint[][] vertex_list = CreateMeshCreationInfoPacks().Select(x=>x.plane_indices).ToArray();
			
			Dictionary<uint, Vector4>[] uv_morphs = format_.morph_list.morph_data
															.Where(x=>PMXFormat.MorphData.MorphType.Uv==x.morph_type) //UVモーフなら
															.Select(x=>x.morph_offset.Select(y=>(PMXFormat.UVMorphOffset)y)
																					.ToDictionary(z=>z.vertex_index, z=>z.uv_offset) //頂点インデックスでディクショナリ化
																	) //UVモーフオフセット取得
															.ToArray();

			List<Vector2>[] result = vertex_list.Select(x=>x.Select(y=>format_.vertex_list.vertex[y].uv).ToList()).ToArray();
			
			//材質走査
			bool is_cancel = false;
			for (int material_index = 0, material_index_max = result.Length; material_index < material_index_max; ++material_index) {
				//UVモーフ走査
				for (int uv_morph_index = 0, uv_morph_index_max = uv_morphs.Length; uv_morph_index < uv_morph_index_max; ++uv_morph_index) {
					var uv_morph = uv_morphs[uv_morph_index];
					//ブログレスパー更新
					is_cancel = EditorUtility.DisplayCancelableProgressBar("Create UV Area Infomation"
																			, "Material:[" + material_index + "|" + material_index_max + "]"
																				+ format_.material_list.material[material_index].name
																				+ "\t"
																				+ "UV Morph:[" + uv_morph_index + "|" + uv_morph_index_max + "]"
																				+ format_.morph_list.morph_data.Where(x=>PMXFormat.MorphData.MorphType.Uv==x.morph_type).Skip(uv_morph_index).First().morph_name
																			, ((((float)uv_morph_index / (float)uv_morph_index_max) + (float)material_index) / (float)material_index_max)
																			);
					if (is_cancel) {
						break;
					}

					//先行UVモーフ対象確認(三角形構成を無視して全頂点をUVモーフ参照)
					var vertex_dictionary = vertex_list[material_index].Distinct().ToDictionary(x=>x, x=>true); //(UVモーフに設定されている頂点数依りも三角形構成頂点の方が多いと思うので、そちら側をlogNにする為に辞書作成)
					if (uv_morph.Keys.Any(x=>vertex_dictionary.ContainsKey(x))) {
						//UVモーフ対象なら
						//頂点走査(三角形構成頂点走査)
						for (int vertex_index = 0, vertex_index_max = vertex_list[material_index].Length; vertex_index < vertex_index_max; vertex_index+=3) {
							//三角形構成頂点インデックス取り出し
							uint[] tri_vertices = new []{vertex_list[material_index][vertex_index+0]
														, vertex_list[material_index][vertex_index+1]
														, vertex_list[material_index][vertex_index+2]
														};
							//UVモーフ対象確認
							if (tri_vertices.Any(x=>uv_morph.ContainsKey(x))) {
								//UVモーフ対象なら
								//適応したUV値を作成
								var tri_uv = tri_vertices.Select(x=>new{original_uv = format_.vertex_list.vertex[x].uv
																		, add_uv = ((uv_morph.ContainsKey(x))? uv_morph[x]: Vector4.zero)
																		}
																)
														.Select(x=>new Vector2(x.original_uv.x + x.add_uv.x, x.original_uv.y + x.add_uv.y));
								//追加
								result[material_index].AddRange(tri_uv);
							}
						}
					}
				}
				if (is_cancel) {
					break;
				}
			}
			EditorUtility.ClearProgressBar();

			return result.Select(x=>x.ToArray()).ToArray();
		}
开发者ID:leonpardlee,项目名称:mmd-for-unity,代码行数:75,代码来源:PMXConverter.cs


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