Share.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { _decorator, Button, Component, Node } from 'cc';
  2. import { UtilsPanel } from '../scene/script/UtilsPanel';
  3. import { Config, nav_info } from '../scene/script/NavInfo';
  4. import { Utils } from '../scene/script/Utils';
  5. const { ccclass, property } = _decorator;
  6. @ccclass('Share')
  7. export class Share extends Component {
  8. private node_go: Node = null;
  9. // private node_go1: Node = null;
  10. protected onLoad(){
  11. UtilsPanel.getAllNeedCom(this, this.node, true);
  12. UtilsPanel.addBtnEvent(this.node_go, this.onGoClick, this).transition = Button.Transition.NONE;
  13. // UtilsPanel.addBtnEvent(this.node_go1, this.onGoClick, this).transition = Button.Transition.NONE;
  14. }
  15. private onGoClick(){
  16. let str = Config.copy_prefix + "pddshare&" + nav_info.user_id;
  17. Utils.copyToZone(str, this, this.onCopy);
  18. }
  19. public onCopy(succ:boolean){
  20. if(succ){
  21. console.log("copy succ")
  22. nav_info.scene.showTip("copy succc");
  23. Utils.tryStartApp();
  24. }
  25. else{
  26. nav_info.scene.showTip("copy fail");
  27. }
  28. }
  29. }