static public void AddCommonItems(GameObject[] targets) { if (targets == null || targets.Length <= 0) { AddItem("新建", false, UIEditorHelper.CreatNewLayoutForMenu, null); AddItem("打开界面", false, UIEditorHelper.LoadLayout, null); } if (targets != null && targets.Length > 0) { AddItem("保存", false, UIEditorHelper.SaveLayoutForMenu, null); AddItem("另存为", false, UIEditorHelper.SaveAnotherLayoutContextMenu, null); AddItem("重新加载", false, UIEditorHelper.ReLoadLayoutForMenu, null); AddSeparator("///"); AddItem("复制选中控件名", false, UIEditorHelper.CopySelectWidgetName, null); //如果选中超过1个节点的话 if (targets.Length > 1) { AddAlignMenu(); AddItem("同流合污", false, UILayoutTool.MakeGroup, null); } AddSeparator("///"); if (targets.Length == 1) { AddUIMenu(); AddUIComponentMenu(); AddPriorityMenu(); if (UIEditorHelper.IsNodeCanDivide(targets[0])) { AddItem("分道扬镖", false, UILayoutTool.UnGroup, null); } Decorate uiBase = targets[0].GetComponent <Decorate>(); if (uiBase != null) { if (uiBase.gameObject.hideFlags == HideFlags.NotEditable) { AddItem("解锁", false, UIEditorHelper.UnLockWidget, null); } else { AddItem("锁定", false, UIEditorHelper.LockWidget, null); } } } AddShowOrHideMenu(); AddSeparator("///"); AddItem("添加参考图", false, UIEditorHelper.CreateDecorate, null); } AddItem("排序所有界面", false, UILayoutTool.ResortAllLayout, null); AddItem("清空界面", false, UIEditorHelper.ClearAllCanvas, null); }