xx hace 2 años
padre
commit
31bbfb7d07
Se han modificado 1 ficheros con 21 adiciones y 0 borrados
  1. 21 0
      assets/Scripts/Tools.ts

+ 21 - 0
assets/Scripts/Tools.ts

@@ -1,6 +1,7 @@
 import { _decorator, Component, Node, SpriteFrame, assetManager, Texture2D, Sprite, ImageAsset, isValid } from 'cc';
 import { Constant } from './constant';
 import GBoardChess from './Game/ChessGame/GBoardChess';
+import { GameMng } from './GameMng';
 const { ccclass, property } = _decorator;
 
 @ccclass('Tools')
@@ -37,6 +38,26 @@ export class Tools  {
     public static makeUrl(){
         return "ws://"+Constant.SEVER_INFO.IP+":"+Constant.SEVER_INFO.PORT+"/ws"
     }
+
+    public static getShareObj():string{
+        let roomId = 0;
+        if(GameMng._userData.room!=null){
+            roomId = GameMng._userData.room.roomid;
+        }
+        let firendOpenId = "";
+        if(GameMng._userData.wx_openid!=null&&GameMng._userData.wx_openid!=undefined){
+            firendOpenId = GameMng._userData.wx_openid;
+        }
+        let s = "firendOpenId=" +firendOpenId+"&roomId="+roomId;
+
+        let s_o = {"webpageUrl":"http://xiangqi.moyue2020.com/xint.html?"+s,
+        "title":"楚汉对决,等你来战!",
+        "description":"末将在!待主公一声令下,必将杀他个片甲不留...",
+                };
+        return JSON.stringify(s_o);
+
+
+    }
     public static loadWeiXinHead(avatarurl:string,sf:Sprite){
 
         if(Tools.cache[avatarurl]!=null){