本文整理汇总了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);
}
示例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;
}
}