AdvertiserOptIn.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. Copyright 2014 Google Inc. All rights reserved.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. @CustomPropertyDrawer(AdvertiserOptInAttribute)
  14. class AdvertiserOptInDrawer extends PropertyDrawer {
  15. function OnGUI(position : Rect, property : SerializedProperty, label : GUIContent) {
  16. // TODO: I don't like this, but guilayout was not cooperating, revisit later.
  17. var indent = 25;
  18. var row1 = position.y + 15;
  19. var row2 = row1 + 25;
  20. var row3 = row2 + 85;
  21. EditorGUI.LabelField(Rect(position.x, row1, 155, 25), "Advertiser Id Support");
  22. var style = new GUIStyle(EditorStyles.textArea);
  23. style.wordWrap = true;
  24. EditorGUI.TextArea(Rect(position.x+indent, row2, position.width - 40, 75), "If you enable this collection, ensure that you review and adhere to the Google Analytics policies for SDKs and advertising features. Click the button below to view them in your browser.", style);
  25. EditorGUI.LabelField(Rect(position.x+indent, row3, 155, 25), "Send IDFA/AdID");
  26. EditorGUI.PropertyField(Rect(position.x+125, row3, 15, 25), property, GUIContent.none);
  27. if(GUI.Button(Rect(position.x+150, row3 - 5, 115, 25), "View GA Policies")) {
  28. Application.OpenURL("https://support.google.com/analytics/answer/2700409");
  29. }
  30. }
  31. function GetPropertyHeight (property : SerializedProperty, label : GUIContent) {
  32. var height = EditorGUI.GetPropertyHeight(property, label);
  33. return height + 140;
  34. }
  35. }