TipSystem.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. const { ccclass, property } = cc._decorator;
  2. @ccclass
  3. /**
  4. * 提示管理类
  5. * @author 邹勇
  6. */
  7. export default class TipSystem extends cc.Component {
  8. @property({ type: cc.Integer, displayName: "飘动时间" })
  9. tween_time: number = 3;
  10. @property({ type: cc.Integer, displayName: "开始坐标x" })
  11. src_x: number = 0;
  12. @property({ type: cc.Integer, displayName: "开始坐标y" })
  13. src_y: number = 0;
  14. @property({ type: cc.Integer, displayName: "目标坐标x" })
  15. tar_x: number = 0;
  16. @property({ type: cc.Integer, displayName: "目标坐标y" })
  17. tar_y: number = 100;
  18. @property({ type: cc.Integer, displayName: "背景透明度" })
  19. bg_opacity: number = 40;
  20. @property({ type: cc.Color, displayName: "背景颜色" })
  21. bg_color: cc.Color = new cc.Color(200, 200, 200);
  22. @property({ type: cc.Color, displayName: "文本颜色" })
  23. tip_color: cc.Color = new cc.Color(255, 255, 255);
  24. @property({ type: cc.Integer, displayName: "文本字体" })
  25. tip_size: number = 40;
  26. private labels: cc.Label[];
  27. onLoad() {
  28. mk.tip = this;
  29. this.labels = [];
  30. }
  31. start() {
  32. }
  33. public async pop(str: string) {
  34. let node = await mk.pool.getPrefab("game/prefab/tips");
  35. let bg = node.getChildByName("bg");
  36. let lbl = node.getChildByName("lbl");
  37. bg.getComponent(cc.Sprite)
  38. console.log(node);
  39. }
  40. }
  41. export enum TipType {
  42. label = 1,
  43. }