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);
        }
Esempio n. 2
0
        public static bool SetStaticFlags(UnityEngine.Object[] targetObjects, int changedFlags, bool flagValue)
        {
            bool flag = changedFlags == -1;
            StaticEditorFlags        staticEditorFlags1 = !flag ? (StaticEditorFlags)Enum.Parse(typeof(StaticEditorFlags), changedFlags.ToString()) : (StaticEditorFlags)0;
            IEnumerable <GameObject> gameObjects        = targetObjects.OfType <GameObject>();
            string title = "Change Static Flags";
            string message;

            if (flag)
            {
                message = "Do you want to " + (!flagValue ? "disable" : "enable") + " the static flags for all the child objects as well?";
            }
            else
            {
                message = "Do you want to " + (!flagValue ? "disable" : "enable") + " the " + ObjectNames.NicifyVariableName(staticEditorFlags1.ToString()) + " flag for all the child objects as well?";
            }
            GameObjectUtility.ShouldIncludeChildren shouldIncludeChildren = GameObjectUtility.DisplayUpdateChildrenDialogIfNeeded(gameObjects, title, message);
            if (shouldIncludeChildren == GameObjectUtility.ShouldIncludeChildren.Cancel)
            {
                GUIUtility.ExitGUI();
                return(false);
            }
            GameObject[] objects = SceneModeUtility.GetObjects(targetObjects, shouldIncludeChildren == GameObjectUtility.ShouldIncludeChildren.IncludeChildren);
            Undo.RecordObjects((UnityEngine.Object[])objects, "Change Static Flags");
            foreach (GameObject go in objects)
            {
                int staticEditorFlags2 = (int)GameObjectUtility.GetStaticEditorFlags(go);
                int num = !flagValue ? staticEditorFlags2 & ~changedFlags : staticEditorFlags2 | changedFlags;
                GameObjectUtility.SetStaticEditorFlags(go, (StaticEditorFlags)num);
            }
            return(true);
        }
 private UnityEngine.Object[] GetObjects(bool includeChildren) =>
 SceneModeUtility.GetObjects(base.targets, includeChildren);
 UnityObject[] GetObjects(bool includeChildren)
 {
     return(SceneModeUtility.GetObjects(targets, includeChildren));
 }
 private UnityEngine.Object[] GetObjects(bool includeChildren)
 {
     return((UnityEngine.Object[])SceneModeUtility.GetObjects(this.targets, includeChildren));
 }
 private Object[] GetObjects(bool includeChildren)
 {
     return(SceneModeUtility.GetObjects(base.targets, includeChildren));
 }