lq_data.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. import {IPos, IRect} from "./lq_interface";
  2. import Vec2 = cc.Vec2;
  3. import Rect = cc.Rect;
  4. import Sprite = cc.Sprite;
  5. import Label = cc.Label;
  6. import Node = cc.Node;
  7. export class LQRect implements IRect {
  8. public x: number;
  9. public y: number;
  10. public width: number;
  11. public height: number;
  12. public half_width: number;
  13. public half_height: number;
  14. constructor(x: number, y: number, width: number, height: number) {
  15. this.x = x;
  16. this.y = y;
  17. this.width = width;
  18. this.height = height;
  19. this.half_width = width * 0.5;
  20. this.half_height = height * 0.5;
  21. }
  22. public top_left(): Vec2 {
  23. return new Vec2(this.x - this.half_width, this.y + this.half_height);
  24. }
  25. public top_right(): Vec2 {
  26. return new Vec2(this.x + this.half_width, this.y + this.half_height);
  27. }
  28. public bottom_left(): Vec2 {
  29. return new Vec2(this.x - this.half_width, this.y - this.half_height);
  30. }
  31. public bottom_right(): Vec2 {
  32. return new Vec2(this.x + this.half_width, this.y - this.half_height);
  33. }
  34. public pos(): cc.Vec2 {
  35. return new Vec2(this.x, this.y);
  36. }
  37. public sub(pos: IPos): Vec2 {
  38. return new Vec2(pos.x - this.x, pos.y - this.y);
  39. }
  40. public add(pos: IPos): Vec2 {
  41. return new Vec2(pos.x + this.x, pos.y + this.y);
  42. }
  43. public to_cocos_rect() {
  44. return new Rect(this.x - this.half_width, this.y - this.half_height, this.width, this.height);
  45. }
  46. }
  47. export class LQNativeComponent {
  48. public node_btn_arr: Node[] = [];
  49. public sprite_logo!: Sprite;
  50. public sprite_img!: Sprite;
  51. public sprite_ad_tip!: Sprite;
  52. public label_title!: Label;
  53. public label_desc!: Label;
  54. }
  55. export class LQShareData {
  56. public title!: string;
  57. public remote_url!: string;
  58. public url_id!: string;
  59. public query!: string;
  60. public content!: string;
  61. public extra!: any;
  62. public type!: string;
  63. constructor(obj?: { title?: string, remote_url?: string, url_id?: string, query?: string, content?: string, extra?: any, type?: string }) {
  64. if (obj.title) {
  65. this.title = obj.title;
  66. }
  67. if (obj.remote_url) {
  68. this.remote_url = obj.remote_url;
  69. }
  70. if (obj.url_id) {
  71. this.url_id = obj.url_id;
  72. }
  73. if (obj.query) {
  74. this.query = obj.query;
  75. }
  76. if (obj.content) {
  77. this.content = obj.content;
  78. }
  79. if (obj.extra) {
  80. this.extra = obj.extra;
  81. }
  82. if (obj.type) {
  83. this.type = obj.type;
  84. }
  85. }
  86. }
  87. export class LQPlatformData {
  88. public app_id!: string;
  89. public print_log!: boolean;
  90. public show_share_menu!: boolean;
  91. public keep_screen_on!: boolean;
  92. public banner_id!: string;
  93. public banner_width!: number;
  94. public interstitial_id!: string;
  95. public native_id!: string;
  96. public video_id!: string;
  97. public is_video_free!: boolean;
  98. public is_cache_video!: boolean;
  99. public ad_type!: string;
  100. public ad_id!: string;
  101. public ad_key!: string;
  102. public switch_ad!: boolean;
  103. public share_data_arr!: LQShareData[];
  104. }