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


C# pb_Object.SelectMany方法代码示例

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


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

示例1: MenuSetEntityType

	/**
	 * Set the pb_Entity entityType on selection.
	 */
	public static void MenuSetEntityType(pb_Object[] selection, EntityType entityType)
	{
		if(selection.Length < 1)
		{
			pb_Editor_Utility.ShowNotification("Nothing Selected");
			return;
		}
		
		Object[] undoObjects = selection.SelectMany(x => x.GetComponents<Component>()).ToArray();

		pbUndo.RecordObjects(undoObjects, "Set Entity Type");

		foreach(pb_Object pb in selection)
		{
			pb_Editor_Utility.SetEntityType(entityType, pb.gameObject);
			pb.ToMesh();
			pb.Refresh();
			pb.Optimize();
		}

		pb_Editor_Utility.ShowNotification("Set " + entityType);
	}
开发者ID:itubeasts,项目名称:I-eaT-U,代码行数:25,代码来源:pb_Menu_Commands.cs

示例2: UpdateDiffDictionary

		/**
		 * Sets the pb_UV list and diff tables.
		 */
		static void UpdateDiffDictionary(pb_Object[] selection)
		{
			uv_selection.Clear();
			
			if(selection == null || selection.Length < 1)
				return;

			uv_selection = selection.SelectMany(x => x.SelectedFaces).Where(x => !x.manualUV).Select(x => x.uv).ToList();

			// Clear values for each iteration
			foreach(string key in uv_diff.Keys.ToList())
				uv_diff[key] = false;

			if(uv_selection.Count < 1) return;
			
			uv_gui = new pb_UV(uv_selection[0]);

			foreach(pb_UV u in uv_selection)
			{
				// if(u.projectionAxis != uv_gui.projectionAxis)
				// 	uv_diff["projectionAxis"] = true;
				if(u.useWorldSpace != uv_gui.useWorldSpace)
					uv_diff["useWorldSpace"] = true;
				if(u.flipU != uv_gui.flipU)
					uv_diff["flipU"] = true;
				if(u.flipV != uv_gui.flipV)
					uv_diff["flipV"] = true;
				if(u.swapUV != uv_gui.swapUV)
					uv_diff["swapUV"] = true;
				if(u.fill != uv_gui.fill)
					uv_diff["fill"] = true;
				if(u.scale.x != uv_gui.scale.x)
					uv_diff["scalex"] = true;
				if(u.scale.y != uv_gui.scale.y)
					uv_diff["scaley"] = true;
				if(u.offset.x != uv_gui.offset.x)
					uv_diff["offsetx"] = true;
				if(u.offset.y != uv_gui.offset.y)
					uv_diff["offsety"] = true;
				if(u.rotation != uv_gui.rotation)
					uv_diff["rotation"] = true;
				if(u.justify != uv_gui.justify)
					uv_diff["justify"] = true;
			}

			foreach(pb_Object pb in selection)
			{
				if(uv_diff["manualUV"] && uv_diff["textureGroup"])
					break;
					
				pb_Face[] selFaces = pb.SelectedFaces;

				if(!uv_diff["manualUV"])
					uv_diff["manualUV"] = System.Array.Exists(selFaces, x => x.manualUV);

				List<int> texGroups = selFaces.Select(x => x.textureGroup).Distinct().ToList();
				textureGroup = texGroups.FirstOrDefault(x => x > -1);

				if(!uv_diff["textureGroup"])
					uv_diff["textureGroup"] = texGroups.Count() > 1;
			}
		}
开发者ID:itubeasts,项目名称:I-eaT-U,代码行数:65,代码来源:pb_AutoUV_Editor.cs


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