private static void CreateSpritePolygon(int sides) { string empty = string.Empty; int num = sides; string str; switch (num) { case 0: str = "Square"; break; case 3: str = "Triangle"; break; case 4: str = "Diamond"; break; case 6: str = "Hexagon"; break; default: str = num == 42 ? "Everythingon" : (num == 128 ? "Circle" : "Polygon"); break; } Texture2D image = EditorGUIUtility.IconContent("Sprite Icon").image as Texture2D; DoCreateSpritePolygon instance = ScriptableObject.CreateInstance <DoCreateSpritePolygon>(); instance.sides = sides; ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, (EndNameEditAction)instance, str + ".png", image, (string)null); }
private static void CreateSpritePolygon(int sides) { string str; switch (sides) { case 0: str = "Square"; goto IL_8E; case 1: case 2: case 5: IL_29: if (sides == 42) { str = "Everythingon"; goto IL_8E; } if (sides != 128) { str = "Polygon"; goto IL_8E; } str = "Circle"; goto IL_8E; case 3: str = "Triangle"; goto IL_8E; case 4: str = "Diamond"; goto IL_8E; case 6: str = "Hexagon"; goto IL_8E; } goto IL_29; IL_8E: Texture2D icon = EditorGUIUtility.IconContent("Sprite Icon").image as Texture2D; DoCreateSpritePolygon doCreateSpritePolygon = ScriptableObject.CreateInstance <DoCreateSpritePolygon>(); doCreateSpritePolygon.sides = sides; ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, doCreateSpritePolygon, str + ".png", icon, null); }
private static void CreateSpritePolygon(int sides) { string str = ""; switch (sides) { case 0: str = "Square"; break; case 3: str = "Triangle"; break; case 4: str = "Diamond"; break; case 6: str = "Hexagon"; break; default: if (sides != 0x2a) { if (sides == 0x80) { str = "Circle"; } else { str = "Polygon"; } } else { str = "Everythingon"; } break; } Texture2D image = EditorGUIUtility.IconContent("Sprite Icon").image as Texture2D; DoCreateSpritePolygon endAction = ScriptableObject.CreateInstance <DoCreateSpritePolygon>(); endAction.sides = sides; StartNameEditingIfProjectWindowExists(0, endAction, str + ".png", image, null); }
static private void CreateSpritePolygon(int sides) { string assetName = ""; switch (sides) { case 0: assetName = "Square"; break; case 3: assetName = "Triangle"; break; case 4: assetName = "Diamond"; break; case 6: assetName = "Hexagon"; break; case 42: // http://hitchhikers.wikia.com/wiki/42 assetName = "Everythingon"; break; case 128: assetName = "Circle"; break; default: assetName = "Polygon"; break; } var icon = EditorGUIUtility.IconContent <Sprite>().image as Texture2D; DoCreateSpritePolygon action = ScriptableObject.CreateInstance <DoCreateSpritePolygon>(); action.sides = sides; StartNameEditingIfProjectWindowExists(0, action, assetName + ".png", icon, null); }