Advertisement
LittleAngel

Tools

Jul 8th, 2011
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. // SpriteTextTools.cs
  2.  
  3. //@MenuItem ("ezG-Wiz/UnPreFab a PreFab")
  4. //static function UnPreFabaPreFab() {
  5. // for (var g : GameObject in Selection.gameObjects) {
  6. //// var thisUIListItemContainer : UIListItemContainer = g.GetComponent(UIListItemContainer);
  7. // if (thisUIListItemContainer) {
  8. // var thisSpriteTextObject : SpriteText = thisUIListItemContainer.GetComponentInChildren(SpriteText);
  9. // if (thisSpriteTextObject) {
  10. // thisSpriteTextObject.Text = thisUIListItemContainer.Text;
  11. // Debug.Log ("YUP");
  12. // }
  13. // }
  14. // }
  15. //}
  16.  
  17.  
  18. @MenuItem ("ezG-Wiz/Reset UIListItemContainer Text")
  19. static function ResetUIListItemContainerText() {
  20. for (var g : GameObject in Selection.gameObjects) {
  21. var thisUIListItemContainer : UIListItemContainer = g.GetComponent(UIListItemContainer);
  22. if (thisUIListItemContainer) {
  23. var thisSpriteTextObject : SpriteText = thisUIListItemContainer.GetComponentInChildren(SpriteText);
  24. if (thisSpriteTextObject) {
  25. thisSpriteTextObject.Text = thisUIListItemContainer.Text;
  26. Debug.Log ("YUP");
  27. }
  28. }
  29. }
  30. }
  31.  
  32. @MenuItem ("ezG-Wiz/Reset UIButton Text")
  33. static function ResetUIButtonText() {
  34. for (var g : GameObject in Selection.gameObjects) {
  35. var thisUIButton : UIButton = g.GetComponent(UIButton);
  36. if (thisUIButton) {
  37. var thisSpriteTextObject : SpriteText = thisUIButton.GetComponentInChildren(SpriteText);
  38. if (thisSpriteTextObject) {
  39. thisSpriteTextObject.Text = thisUIButton.Text;
  40. }
  41. }
  42. }
  43. }
  44.  
  45.  
  46. @MenuItem ("ezG-Wiz/Set Box Colliders")
  47. static function SetBoxColliders() {
  48. for (var g : GameObject in Selection.gameObjects) {
  49. var thisUIButton : UIButton = g.GetComponent(UIButton);
  50. if (thisUIButton) {
  51. var thisBoxCollider: BoxCollider = thisUIButton.GetComponentInChildren(BoxCollider);
  52. if (thisBoxCollider) {
  53. thisBoxCollider.size = Vector3 (1000,650,0); // SET BY HAND
  54. thisBoxCollider.center = Vector3 (0,0,0); // SET BY HAND
  55. }
  56. }
  57. }
  58. }
  59.  
  60.  
  61. @MenuItem ("ezG-Wiz/Create Null Box Colliders")
  62. static function CreateNullBoxColliders() {
  63. for (var g : GameObject in Selection.gameObjects) {
  64. // var thisUIButton : UIButton = g.GetComponent(UIButton);
  65. // if (thisUIButton) {
  66. // var aBoxCollider : BoxCollider = g.GetComponent(BoxCollider);
  67. // if (!aBoxCollider) {
  68. var thisBoxCollider: BoxCollider = g.AddComponent(BoxCollider);
  69. thisBoxCollider.size = Vector3.zero;
  70. thisBoxCollider.center = Vector3.zero;
  71. // } else {
  72. // Debug.Log ("There is already a box collider on " + g.name + "!");
  73. // }
  74. // }
  75. }
  76. }
  77.  
  78.  
  79. @MenuItem ("ezG-Wiz/Null-ify Script With Method")
  80. static function NullifyScriptWithMethod() {
  81. for (var g : GameObject in Selection.gameObjects) {
  82. var thisUIButton : UIButton = g.GetComponent(UIButton);
  83. if (thisUIButton) {
  84. thisUIButton.scriptWithMethodToInvoke = null;
  85. }
  86. }
  87. }
  88.  
  89.  
  90. @MenuItem ("ezG-Wiz/Set Method To Invoke")
  91. static function SetMethodToInvoke() {
  92. var trackNumber : int = 0;
  93. var objects : GameObject[] = Selection.gameObjects;
  94. var names : String[] = new String[objects.Length];
  95. for (var i : int = 0; i < objects.Length; i++) {
  96. names[i] = objects[i].name;
  97. }
  98. System.Array.Sort(names, objects);
  99.  
  100. for (var g : GameObject in objects) {
  101. var thisUIButton : UIButton = g.GetComponent(UIButton);
  102. if (thisUIButton) {
  103. thisUIButton.methodToInvoke = "PlayTrack0" + trackNumber;
  104. }
  105. trackNumber ++;
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement