Exemplo n.º 1
0
    /// <summary>
    /// Display the popup menu for this row
    /// </summary>
    /// <param name="parent">The parent control</param>
    /// <param name="x">X coordinate of menu</param>
    /// <param name="y">Y coordinate of menu</param>
    public void PopupMenu( System.Windows.Forms.Control parent , int x , int y )
    {
        // Use reflection to get the list of popup menu commands
        MemberInfo[]  members = this.GetType().FindMembers ( MemberTypes.Method ,
          BindingFlags.Public | BindingFlags.Instance ,
          new System.Reflection.MemberFilter ( Filter ) ,
          null ) ;

        if ( members.Length > 0 )
        {
          // Create a context menu
          ContextMenu   menu = new ContextMenu ( ) ;

          // Now loop through those members and generate the popup menu
          // Note the cast to MethodInfo in the foreach
          foreach ( MethodInfo meth in members )
          {
        // Get the caption for the operation from the ContextMenuAttribute
        ContextMenuAttribute[]  ctx = (ContextMenuAttribute[]) meth.GetCustomAttributes ( typeof ( ContextMenuAttribute ) , true ) ;

        MenuCommand  callback = new MenuCommand ( this , meth ) ;
        MenuItem      item = new MenuItem ( ctx[0].Caption , new EventHandler ( callback.Execute ) ) ;

        item.DefaultItem = ctx[0].Default ;

        menu.MenuItems.Add ( item ) ;
          }

          System.Drawing.Point  pt = new System.Drawing.Point ( x , y ) ;
          menu.Show ( parent , pt ) ;
        }
    }
    public static void ExtractCubemap(MenuCommand mc)
    {
        var path = AssetDatabase.GetAssetPath(mc.context);

        if (string.IsNullOrEmpty(path) == false)
        {
            var assets = AssetDatabase.LoadAllAssetsAtPath(path);

            if (RemoveExtension(ref path) == true)
            {
                foreach (var asset in assets)
                {
                    var cubemap = asset as Cubemap;

                    if (cubemap != null)
                    {
                        SaveCubemapFace(cubemap, CubemapFace.NegativeX, path);
                        SaveCubemapFace(cubemap, CubemapFace.NegativeY, path);
                        SaveCubemapFace(cubemap, CubemapFace.NegativeZ, path);
                        SaveCubemapFace(cubemap, CubemapFace.PositiveX, path);
                        SaveCubemapFace(cubemap, CubemapFace.PositiveY, path);
                        SaveCubemapFace(cubemap, CubemapFace.PositiveZ, path);
                    }
                }
            }
        }
    }
    private static void AddGNStringText(MenuCommand menuCommand)
    {
        GameObject go = new GameObject("Text");
        GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject);
        if(go.GetComponentInParent<Canvas>()== null)
        {
            var canvas = Object.FindObjectOfType<Canvas>();
            if(canvas == null)
            {
                var goCanvas = new GameObject("Canvas");
                canvas = goCanvas.AddComponent<Canvas>();
                canvas.renderMode = RenderMode.ScreenSpaceOverlay;
                goCanvas.AddComponent<UnityEngine.UI.CanvasScaler>();
                goCanvas.AddComponent<UnityEngine.UI.GraphicRaycaster>();
            }

            go.transform.SetParent(canvas.transform);
            go.transform.localPosition = Vector3.zero;
        }

        go.AddComponent<GNText>();
        Undo.RegisterCreatedObjectUndo(go, "Create " + go.name);
        Selection.activeObject = go;

        if(GNStringManager.instance == null)
        {
            var sm = new GameObject("StringManager");
            sm.AddComponent<GNStringManager>();
        }

        
    }
    public static bool ValidateSliceUsingXML(MenuCommand command) {
        var textureImporter = command.context as TextureImporter;

        //valid only if the texture type is 'sprite' or 'advanced'.
        return textureImporter && textureImporter.textureType == TextureImporterType.Sprite ||
               textureImporter.textureType == TextureImporterType.Advanced;
    }
    public static bool ValidateSliceUsingXML(MenuCommand cmd)
    {
        TextureImporter importer = cmd.context as TextureImporter;

        return importer != null &&
            (importer.textureType == TextureImporterType.Sprite || importer.textureType == TextureImporterType.Advanced);
    }
		void AddRenameCommand(IClass c, List<ToolStripItem> resultItems)
		{
			var cmd = new MenuCommand("${res:SharpDevelop.Refactoring.RenameCommand}", Rename);
			cmd.ShortcutKeys = MenuCommand.ParseShortcut("Control|R");
			cmd.Tag = c;
			resultItems.Add(cmd);
		}
Exemplo n.º 7
0
 static void DoSomethingAll(MenuCommand theCommand)
 {
     List<Object> aList = new List<Object>();
     aList.Add(((Component)theCommand.context).gameObject);
     aList.AddRange(((Component)theCommand.context).GetComponents<Component>());
     Search(aList.ToArray());
 }
Exemplo n.º 8
0
        public static void AddButton(MenuCommand menuCommand)
        {
            GameObject buttonRoot = CreateUIElementRoot("Button", menuCommand, s_ThickGUIElementSize);

            GameObject childText = new GameObject("Text");
            GameObjectUtility.SetParentAndAlign(childText, buttonRoot);

            Image image = buttonRoot.AddComponent<Image>();
            image.sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>(kStandardSpritePath);
            image.type = Image.Type.Sliced;
            image.color = s_DefaultSelectableColor;

            Button bt = buttonRoot.AddComponent<Button>();
            SetDefaultColorTransitionValues(bt);

            Text text = childText.AddComponent<Text>();
            text.text = "Button";
            text.alignment = TextAnchor.MiddleCenter;
            SetDefaultTextValues(text);

            RectTransform textRectTransform = childText.GetComponent<RectTransform>();
            textRectTransform.anchorMin = Vector2.zero;
            textRectTransform.anchorMax = Vector2.one;
            textRectTransform.sizeDelta = Vector2.zero;
        }
 public static void AddAccordionElement(MenuCommand menuCommand)
 {
     GameObject go = CreateUIElementRoot("Accordion Element", menuCommand, s_ThickGUIElementSize);
     go.AddComponent<LayoutElement>();
     go.AddComponent<AccordionElement>();
     Selection.activeGameObject = go;
 }
    public static void SaveMeshInPlace(MenuCommand menuCommand)
    {
        VoxelMesh vm = menuCommand.context as VoxelMesh;

        SaveVoxelStruct(vm);

    }
 static void CreatePipLight(MenuCommand menuCommand)
 {
     GameObject go = new GameObject ("Pip Light");
     go.AddComponent<PipLight> ();
     GameObjectUtility.SetParentAndAlign (go, menuCommand.context as GameObject);
     Undo.RegisterCreatedObjectUndo (go, "Create " + go.name);
     Selection.activeObject = go;
 }
Exemplo n.º 12
0
 private static void Create_DialogueCanvas(MenuCommand menuCommand)
 {
     GameObject go = Instantiate(Resources.Load("VN Engine/DialogueCanvas", typeof(GameObject))) as GameObject;     // Create new object
     go.name = "DialogueCanvas";
     GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); // Parent the new object
     Undo.RegisterCreatedObjectUndo(go, "Create " + go.name);    // Register the creation in the undo system
     Selection.activeObject = go;
 }
Exemplo n.º 13
0
    public static void SliceUsingXML(MenuCommand cmd)
    {
        TextureImporter importer = cmd.context as TextureImporter;

        XMLSpriteSlicer window = ScriptableObject.CreateInstance<XMLSpriteSlicer>();
        window._textureImporter = importer;
        window.ShowUtility();
    }
Exemplo n.º 14
0
		ToolStripItem[] BuildMenuByFile(ICollection<INavigationPoint> points, int additionalItems)
		{
			Dictionary<string, List<INavigationPoint>> files =
				new Dictionary<string, List<INavigationPoint>>();
			List<string> fileNames = new List<string>();
			
			foreach (INavigationPoint p in points) {
				if (p.FileName==null) {
					throw new ApplicationException("should not get here!");
				}
				if (!fileNames.Contains(p.FileName)) {
					fileNames.Add(p.FileName);
					files.Add(p.FileName, new List<INavigationPoint>());
				}
				if (!files[p.FileName].Contains(p)) {
					files[p.FileName].Add(p);
				}
			}
			
			fileNames.Sort();
			
			ToolStripItem[] items =
				new ToolStripItem[fileNames.Count + additionalItems];
			ToolStripMenuItem containerItem = null;
			MenuCommand cmd = null;
			int i = 0;
			
			foreach (string fname in fileNames) {
				
				// create a menu bucket
				containerItem = new ToolStripMenuItem();
				containerItem.Text = System.IO.Path.GetFileName(fname);
				containerItem.ToolTipText = fname;
				
				// sort and populate the bucket's contents
//				files[fname].Sort();
				foreach(INavigationPoint p in files[fname]) {
					cmd = new MenuCommand(p.Description, new EventHandler(NavigateTo));
					cmd.Tag = p;
					containerItem.DropDownItems.Add(cmd);
				}
				
				// if there's only one nested item, add it
				// to the result directly, ignoring the bucket
//				if (containerItem.DropDownItems.Count==1) {
//					items[i] = containerItem.DropDownItems[0];
//					items[i].Text = ((INavigationPoint)items[i].Tag).FullDescription;
//					i++;
//				} else {
//					// add the bucket to the result
//					items[i++] = containerItem;
//				}
				// add the bucket to the result
				items[i++] = containerItem;
			}
			
			return items;
		}
Exemplo n.º 15
0
 private void splitButton1_ButtonClick(object sender, EventArgs e)
 {
     var cmd = new MenuCommand()
     {
         Name = this.presenter.Validators[0],
         presenter = this.presenter
     };
     cmd.SplitHandler(this, e);
 }
Exemplo n.º 16
0
    public static void SliceUsingXML(MenuCommand command) {
        var textureImporter = command.context as TextureImporter;

        var window = CreateInstance<TextureAtlasSlicer>();

        window.importer = textureImporter;

        window.ShowUtility();
    }
 public static void AddAccordionGroup(MenuCommand menuCommand)
 {
     GameObject go = CreateUIElementRoot("Accordion Group", menuCommand, s_ThickGUIElementSize);
     go.AddComponent<VerticalLayoutGroup>();
     go.AddComponent<ContentSizeFitter>();
     go.AddComponent<ToggleGroup>();
     go.AddComponent<Accordion>();
     Selection.activeGameObject = go;
 }
Exemplo n.º 18
0
    private static void Exit_All_Actors(MenuCommand menuCommand)
    {
        GameObject go = new GameObject("Exit All Actors");     // Create new object
        GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); // Parent the new object
        Undo.RegisterCreatedObjectUndo(go, "Create " + go.name);    // Register the creation in the undo system
        Selection.activeObject = go;

        go.AddComponent<ExitAllActorsNode>();
    }
Exemplo n.º 19
0
    private static void Change_Conversation(MenuCommand menuCommand)
    {
        GameObject go = new GameObject("Change Conversation");     // Create new object
        GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); // Parent the new object
        Undo.RegisterCreatedObjectUndo(go, "Create " + go.name);    // Register the creation in the undo system
        Selection.activeObject = go;

        go.AddComponent<ChangeConversationNode>();
    }
Exemplo n.º 20
0
	public static void SliceUsingXML(MenuCommand command)
	{
		TextureImporter textureImporter = command.context as TextureImporter;

		TextureAtlasSlicer window = ScriptableObject.CreateInstance<TextureAtlasSlicer>();

		window.importer = textureImporter;

		window.ShowUtility();
	}
Exemplo n.º 21
0
    public static void LoadMeshInPlace(MenuCommand menuCommand)
    {
        PrototypeTranslator mt = menuCommand.context as PrototypeTranslator;

        GameObject go = mt.gameObject;
        VoxelMesh vm2 = go.AddComponent<VoxelMesh>();
        vm2.Mesh= LoadVoxelStruct();

        mt.VoxelMesh = vm2;
    }
Exemplo n.º 22
0
        public void CheckAfterConstruct()
        {
            const string name = "name";
            const string description = "desc";

            this.command = new MenuCommand (name, description);
            Assert.AreEqual (name, this.command.Name);
            Assert.AreEqual (description, this.command.Description);
            Assert.AreEqual (0, this.command.Parameters.Count);
        }
Exemplo n.º 23
0
        public void CheckAddCommandToTwoContexts()
        {
            var ctx1 = new MenuContext (string.Empty, string.Empty);
            var ctx2 = new MenuContext (string.Empty, string.Empty);

            var cmd = new MenuCommand (string.Empty, string.Empty);

            ctx1.AddCommand (cmd);
            ctx2.AddCommand (cmd);
        }
 static void PushScript(MenuCommand command)
 {
     Object selectedObject = Selection.activeObject;
     if (selectedObject != null)
     {
         string assetPath = AssetDatabase.GetAssetPath(selectedObject);
     //	Debug.Log(assetPath.ToString());
         string fileName = assetPath.Substring(assetPath.LastIndexOf("/")+1);
         saveFile(repoPath, assetPath, fileName);
     }
 }
Exemplo n.º 25
0
    private static void Add_Dialogue(MenuCommand menuCommand)
    {
        GameObject go = new GameObject("Dialogue");     // Create new object
        GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); // Parent the new object
        Undo.RegisterCreatedObjectUndo(go, "Create " + go.name);    // Register the creation in the undo system
        Selection.activeObject = go;

        go.AddComponent<DialogueNode>();
        go.AddComponent<AudioSource>();
        go.GetComponent<AudioSource>().playOnAwake = false;
    }
Exemplo n.º 26
0
        /// <summary>
        /// Create a new button.
        /// </summary>
        /// <param name="position">Screen coordinates of the button.</param>
        /// <param name="dimensions">Screen dimensions of the button.</param>
        /// <param name="texture">Texture to display on the button.</param>
        /// <param name="text">Text to display on the button.</param>
        /// <param name="font">Font to use for the button text.</param>
        /// <param name="defaultColor">The default colour to render text as on this button.</param>
        /// <param name="hoverColor">The colour to render text as when the user moves the mouse over this button.</param>
        /// <param name="command">The command triggered by this button when clicked.</param>
        public Button(Vector2 position, Vector2 dimensions, Texture2D texture, string text, SpriteFont font, Color defaultColor, Color hoverColor, MenuCommand command)
            : base(position, dimensions, texture, text, font)
        {
            // Set parameters
            this.defaultColor   = defaultColor;
            this.hoverColor     = hoverColor;
            this.currentColor   = defaultColor;
            this.command        = command;

            pressed = false;
        }
    private static void OutsideFloor(MenuCommand mCommand)
    {
        var goTransform = mCommand.context as Transform;
        var grassGO = GameObject.Find("Grass");

        GameObject outsideFloor = GameObject.Instantiate(Resources.Load("OutsideFloor") as GameObject, Vector3.zero, Quaternion.identity) as GameObject;
        outsideFloor.transform.parent = grassGO.transform;

        outsideFloor.transform.position = goTransform.transform.position;
        outsideFloor.transform.eulerAngles = goTransform.transform.eulerAngles;
        outsideFloor.transform.localScale = goTransform.transform.localScale;
    }
Exemplo n.º 28
0
	public static void SelectAllChildrenWithWrongScale(MenuCommand command) {
		Transform xForm = command.context as Transform;
		List<GameObject> selection = new List<GameObject>();
		
		foreach (var child in xForm.GetComponentsInChildren<Transform>()) {
			if (child.localScale != Vector3.one) {
				selection.Add(child.gameObject);
			}
		}
		
		Selection.objects = selection.ToArray();
	}
Exemplo n.º 29
0
	static void AddPanelSwitcher (MenuCommand command) 
	{
		GameObject go = Selection.activeGameObject;
		if (go != null)
		{
			go.AddComponent<uGUIPanelSwitcher>();
		}
		else
		{
			Debug.LogError("Select a Button first!");
		}
		
	}
Exemplo n.º 30
0
 public static void AddCanvas(MenuCommand menuCommand)
 {
     var go = CreateNewUI();
     GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject);
     if (go.transform.parent as RectTransform)
     {
         RectTransform rect = go.transform as RectTransform;
         rect.anchorMin = Vector2.zero;
         rect.anchorMax = Vector2.one;
         rect.anchoredPosition = Vector2.zero;
         rect.sizeDelta = Vector2.zero;
     }
     Selection.activeGameObject = go;
 }
Exemplo n.º 31
0
 private static bool MenuItemCopyCompleteGameObjectValidate(MenuCommand command)
 {
     return(Selection.GetFiltered <GameObject>(SelectionMode.TopLevel | SelectionMode.ExcludePrefab | SelectionMode.Editable).Length > 0);
 }
Exemplo n.º 32
0
 private static bool MenuItemPasteAssetFilesValidate(MenuCommand command)
 {
     return(PasteBinWindow.ActiveClipboard != null && PasteBinWindow.ActiveClipboard.CanPasteAssetFiles(GetSelectedAssetPaths(true, false)));
 }
Exemplo n.º 33
0
 private static bool MenuItemPasteCompleteGameObjectFromBinValidate(MenuCommand command)
 {
     return(!(command.context as GameObject) || !AssetDatabase.Contains(command.context));
 }
Exemplo n.º 34
0
 private static void ContextMenuItemNewWindow(MenuCommand command)
 {
     InspectPlusWindow.Inspect(command.context, true);
 }
Exemplo n.º 35
0
 private static bool GameObjectMenuValidate(MenuCommand command)
 {
     return(Selection.objects.Length > 0);
 }
Exemplo n.º 36
0
 public static void AddComp(MenuCommand command)
 {
     (command.context as Component).gameObject.AddComponent(typeof(FunnelModifier));
 }
        static bool AddSkeletonGraphicCustomMaterials_Validate(MenuCommand menuCommand)
        {
            var skeletonGraphic = (SkeletonGraphic)menuCommand.context;

            return(skeletonGraphic.GetComponent <SkeletonGraphicCustomMaterials>() == null);
        }
Exemplo n.º 38
0
        static void AddVerticalTableView(MenuCommand menuCommand)
        {
            GameObject verticalTableViewRoot = CreateUIElementRoot("vertical_tableview", menuCommand, s_ThickGUIElementSize);

            GameObject childTableRect = CreateUIObject("tablerect", verticalTableViewRoot);

            GameObject childContent = CreateUIObject("content", childTableRect);

            // Set RectTransform to stretch
            RectTransform rectTransformScrollSnapRoot = verticalTableViewRoot.GetComponent <RectTransform>();

            rectTransformScrollSnapRoot.anchorMin        = new Vector2(0.5f, 0.5f);
            rectTransformScrollSnapRoot.anchorMax        = new Vector2(0.5f, 0.5f);
            rectTransformScrollSnapRoot.pivot            = new Vector2(0.5f, 0.5f);
            rectTransformScrollSnapRoot.anchoredPosition = Vector2.zero;
            rectTransformScrollSnapRoot.sizeDelta        = new Vector2(300f, 600f);

            Image image = verticalTableViewRoot.AddComponent <Image>();

            image.sprite = AssetDatabase.GetBuiltinExtraResource <Sprite>(kStandardSpritePath);
            image.type   = Image.Type.Sliced;
            image.color  = new Color(1f, 1f, 1f, 0.392f);

            verticalTableViewRoot.AddComponent <RectMask2D>();

            ScrollRect sr = verticalTableViewRoot.AddComponent <ScrollRect>();

            sr.vertical   = true;
            sr.horizontal = false;

            RectTransform rectTransformRect = childTableRect.GetComponent <RectTransform>();

            rectTransformRect.anchorMin = Vector2.zero;
            rectTransformRect.anchorMax = new Vector2(1f, 1f);
            rectTransformRect.pivot     = new Vector2(0.5f, 0.5f);
            rectTransformRect.sizeDelta = Vector2.zero;

            sr.viewport = rectTransformRect;

            //Setup Content container
            RectTransform rectTransformContent = childContent.GetComponent <RectTransform>();

            rectTransformContent.anchorMin = new Vector2(0.5f, 1f);
            rectTransformContent.anchorMax = new Vector2(0.5f, 1f);
            rectTransformContent.pivot     = new Vector2(0.5f, 1f);
            rectTransformContent.sizeDelta = new Vector2(300f, 600f);

            GridLayoutGroup group = childContent.AddComponent <GridLayoutGroup>();

            group.cellSize        = new Vector2(300, 100);
            group.spacing         = new Vector2(0, 5);
            group.startCorner     = GridLayoutGroup.Corner.UpperLeft;
            group.startAxis       = GridLayoutGroup.Axis.Vertical;
            group.childAlignment  = TextAnchor.UpperCenter;
            group.constraint      = GridLayoutGroup.Constraint.FixedColumnCount;
            group.constraintCount = 1;
            group.enabled         = false;

            sr.content = rectTransformContent;

            //Need to add example child components like in the Asset (SJ)
            Selection.activeGameObject = verticalTableViewRoot;
        }
Exemplo n.º 39
0
 private static void BrowseDocs(MenuCommand command)
 {
     Help.ShowHelpPage(_docsURL);
 }
Exemplo n.º 40
0
        static public void AddButton(MenuCommand menuCommand)
        {
            GameObject go = DefaultControlsEx.CreateButtonEx(GetStandardResources());

            PlaceUIElementRoot(go, menuCommand);
        }
 private static bool SearchSelectedAssetReferencesValidate(MenuCommand command)
 {
     return(Selection.objects.Length > 0);
 }
Exemplo n.º 42
0
        static bool MenuOptionValidation(MenuCommand menuCommand)
        {
            RuleOverrideTile tile = menuCommand.context as RuleOverrideTile;

            return(tile.m_Tile);
        }
Exemplo n.º 43
0
 private static void CreateComponent(MenuCommand menuCommand)
 {
     DoozyUtils.AddToScene <ProgressTargetTextMeshPro>(MenuUtils.ProgressTargetTextMeshPro_GameObject_Name, false, true);
 }
 static bool ValidateClipboard(MenuCommand command)
 {
     return(clipboard.clipboardSet);
 }
Exemplo n.º 45
0
 public static CSGModel CreateModelInstanceInScene(MenuCommand command)
 {
     return(CreateModelInstanceInScene(GetTransformForMenu(command)));
 }
    private static void PasteScaledSettings(MenuCommand command, int scale)
    {
        //Grab current Texture Importer
        TextureImporter currentTexture = command.context as TextureImporter;

        // change names to match current texture
        // String newName = GetFileName(currentTexture);
        // clipboard.spriteData = UpdateSpriteNames(newName, clipboard);

        // scale
        clipboard.spriteData = ScaleSprites(clipboard, scale);

        //Copy over platform specific settings
        switch (clipboard.copyType)
        {
        //***************************************
        case "AllData":
            //Copy over sprites
            currentTexture.spritesheet = clipboard.spriteData.ToArray();

            //Copy over settings
            currentTexture.SetTextureSettings(clipboard.spriteSettings);

            //Copy over overrides
            foreach (string tempString in availablePlatforms)
            {
                                #if UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1
                currentTexture.SetPlatformTextureSettings(tempString, 1024, TextureImporterFormat.AutomaticCompressed, 0);
                                #else
                currentTexture.SetPlatformTextureSettings(tempString, 1024, TextureImporterFormat.AutomaticCompressed, 0, true);
                                #endif
                currentTexture.ClearPlatformTextureSettings(tempString);
            }
            foreach (PlatformTextureSettings tempPlatSettings in platformTextureSettings)
            {
                                #if UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_0
                currentTexture.SetPlatformTextureSettings(tempPlatSettings.spritePlatform, tempPlatSettings.spriteMaxTextureSize, tempPlatSettings.spriteTextureFormat, tempPlatSettings.spriteCompressionQuality);
                                #else
                currentTexture.SetPlatformTextureSettings(tempPlatSettings.spritePlatform, tempPlatSettings.spriteMaxTextureSize, tempPlatSettings.spriteTextureFormat, tempPlatSettings.spriteCompressionQuality, true);
                                #endif
            }
            break;

        //***************************************
        case "AllDataNoOverride":
            //Copy over sprites
            currentTexture.spritesheet = clipboard.spriteData.ToArray();

            //Copy over settings
            currentTexture.SetTextureSettings(clipboard.spriteSettings);
            break;

        //***************************************
        case "OnlyOverride":
            //Copy over overrides
            foreach (string tempString in availablePlatforms)
            {
                                #if UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1
                currentTexture.SetPlatformTextureSettings(tempString, 1024, TextureImporterFormat.AutomaticCompressed, 0);
                                #else
                currentTexture.SetPlatformTextureSettings(tempString, 1024, TextureImporterFormat.AutomaticCompressed, 0, true);
                                #endif

                currentTexture.ClearPlatformTextureSettings(tempString);
            }
            foreach (PlatformTextureSettings tempPlatSettings in platformTextureSettings)
            {
                                #if UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1
                currentTexture.SetPlatformTextureSettings(tempPlatSettings.spritePlatform, tempPlatSettings.spriteMaxTextureSize, tempPlatSettings.spriteTextureFormat, tempPlatSettings.spriteCompressionQuality);
                                #else
                currentTexture.SetPlatformTextureSettings(tempPlatSettings.spritePlatform, tempPlatSettings.spriteMaxTextureSize, tempPlatSettings.spriteTextureFormat, tempPlatSettings.spriteCompressionQuality, true);
                                #endif
            }
            break;
        }

        //Refresh asset/apply settings
        AssetDatabase.ImportAsset(currentTexture.assetPath, ImportAssetOptions.ForceUpdate);
    }
Exemplo n.º 47
0
 private static void ContextMenuItemOpenIsolatedHierarchyNewTab(MenuCommand command)
 {
     OpenIsolatedHierarchy(command, false);
 }
 private static void Paste8x(MenuCommand command)
 {
     PasteScaledSettings(command, 8);
 }
Exemplo n.º 49
0
 private static void ContextMenuItemNewTab(MenuCommand command)
 {
     InspectPlusWindow.Inspect(command.context, false);
 }
 private static void PasteSpriteTextureSettings(MenuCommand command)
 {
     PasteScaledSettings(command, 1);
 }
Exemplo n.º 51
0
 private static bool MenuItemPasteAssetFilesFromBinValidate(MenuCommand command)
 {
     return(GetSelectedAssetPaths(true, false).Length > 0);
 }
Exemplo n.º 52
0
 private static void ClearAllTiles(MenuCommand menuCommand)
 {
     var tilemap = menuCommand.context as Tilemap;
     if (tilemap == null) return;
     tilemap.ClearAllTiles();
 }
Exemplo n.º 53
0
 private static bool MenuItemCopyAssetFilesValidate(MenuCommand command)
 {
     return(GetSelectedAssetPaths(false, true).Length > 0);
 }
Exemplo n.º 54
0
        public static void CreateEventSystem(MenuCommand menuCommand)
        {
            GameObject parent = menuCommand.context as GameObject;

            CreateEventSystem(true, parent);
        }
Exemplo n.º 55
0
 private static bool MenuItemPasteCompleteGameObjectValidate(MenuCommand command)
 {
     return(PasteBinWindow.ActiveClipboard != null && PasteBinWindow.ActiveClipboard.CanPasteCompleteGameObject(PreferablyGameObject(command.context) as GameObject));
 }
Exemplo n.º 56
0
        static public void AddScrollView(MenuCommand menuCommand)
        {
            GameObject go = DefaultControls.CreateScrollView(GetStandardResources());

            PlaceUIElementRoot(go, menuCommand);
        }
Exemplo n.º 57
0
 private static bool ContextMenuItemPasteObjectFromBinValidate(MenuCommand command)
 {
     return(ValidatePasteOperation(command));
 }
Exemplo n.º 58
0
        static public void AddText24(MenuCommand menuCommand)
        {
            GameObject go = CreateText(GetStandardResources(), 24);

            PlaceUIElementRoot(go, menuCommand);
        }
Exemplo n.º 59
0
 static void MenuOption(MenuCommand menuCommand)
 {
     PopulateRuleOverideTileWizard.CreateWizard(menuCommand.context as RuleOverrideTile);
 }
Exemplo n.º 60
0
 private static void CreateComponent(MenuCommand menuCommand)
 {
     DoozyUtils.AddToScene <SpriteTargetUnityEvent>(MenuUtils.SpriteTargetUnityEvent_GameObject_Name, false, true);
 }