public static bool SetStaticFlags(UnityEngine.Object[] targetObjects, int changedFlags, bool flagValue)
{
bool flag = changedFlags == -1;
StaticEditorFlags staticEditorFlags = (StaticEditorFlags)((!flag) ? ((int)Enum.Parse(typeof(StaticEditorFlags), changedFlags.ToString())) : 0);
GameObjectUtility.ShouldIncludeChildren shouldIncludeChildren = GameObjectUtility.DisplayUpdateChildrenDialogIfNeeded(targetObjects.OfType <GameObject>(), "Change Static Flags", (!flag) ? string.Concat(new string[]
{
"Do you want to ",
(!flagValue) ? "disable" : "enable",
" the ",
ObjectNames.NicifyVariableName(staticEditorFlags.ToString()),
" flag for all the child objects as well?"
}) : ("Do you want to " + ((!flagValue) ? "disable" : "enable") + " the static flags for all the child objects as well?"));
if (shouldIncludeChildren == GameObjectUtility.ShouldIncludeChildren.Cancel)
{
GUIUtility.ExitGUI();
return(false);
}
GameObject[] objects = SceneModeUtility.GetObjects(targetObjects, shouldIncludeChildren == GameObjectUtility.ShouldIncludeChildren.IncludeChildren);
Undo.RecordObjects(objects, "Change Static Flags");
GameObject[] array = objects;
for (int i = 0; i < array.Length; i++)
{
GameObject go = array[i];
int num = (int)GameObjectUtility.GetStaticEditorFlags(go);
num = ((!flagValue) ? (num & ~changedFlags) : (num | changedFlags));
GameObjectUtility.SetStaticEditorFlags(go, (StaticEditorFlags)num);
}
return(true);
}