|
@@ -0,0 +1,63 @@
|
|
|
|
+
|
|
|
|
+cc.Class({
|
|
|
|
+ extends: cc.Component,
|
|
|
|
+
|
|
|
|
+ properties: {
|
|
|
|
+ userIdRichText: cc.RichText,
|
|
|
|
+ copyRichText: cc.RichText,
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // LIFE-CYCLE CALLBACKS:
|
|
|
|
+
|
|
|
|
+ onLoad () {
|
|
|
|
+ this.userId = GameGlobal.user.uid;
|
|
|
|
+ this.userIdRichText.string = `<b><outline color=#75bc42 width=2>我的ID:${this.userId}</outline></b>`;
|
|
|
|
+
|
|
|
|
+ this.copyRichText.node.on(cc.Node.EventType.TOUCH_END, (event) => {
|
|
|
|
+ this.copyUserId();
|
|
|
|
+ }, this);
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ onDestroy() {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ start () {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ init() {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ //复制我的ID
|
|
|
|
+ copyUserId() {
|
|
|
|
+ if (window.tt != undefined) {
|
|
|
|
+
|
|
|
|
+ } else if (CC_WECHATGAME) {
|
|
|
|
+ wx.setClipboardData({
|
|
|
|
+ data: this.userId,
|
|
|
|
+ success(res) {
|
|
|
|
+ wx.getClipboardData({
|
|
|
|
+ success(res) {
|
|
|
|
+ GameGlobal.commonAlert.showCommonErrorAlert('复制成功');
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ fail() {
|
|
|
|
+ GameGlobal.commonAlert.showCommonErrorAlert('复制失败请重试');
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ GameGlobal.commonAlert.showCommonErrorAlert('复制成功');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ addFriend() {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // update (dt) {},
|
|
|
|
+});
|