zhaochengyang před 5 roky
rodič
revize
5e0b769020
38 změnil soubory, kde provedl 945 přidání a 61 odebrání
  1. 1 1
      .laya/wxgame.json
  2. 9 0
      .rpt2_cache/rpt2_981034996b69972eab67662e90386ed59173930e/code/cache/71220f6c77f9fd0bce941ba40436a64ead52481b
  3. 2 2
      .rpt2_cache/rpt2_981034996b69972eab67662e90386ed59173930e/code/cache/d0cf91d73279450e00b9b8ea592561235a917851
  4. 0 8
      .rpt2_cache/rpt2_981034996b69972eab67662e90386ed59173930e/code/cache/c83855964b676abc8b3ca7916f6cfcfa16a0849d
  5. 9 0
      .rpt2_cache/rpt2_ced057ff145136f44a10ed5d8de26027aa95246d/code/cache/71220f6c77f9fd0bce941ba40436a64ead52481b
  6. 2 2
      .rpt2_cache/rpt2_ced057ff145136f44a10ed5d8de26027aa95246d/code/cache/d0cf91d73279450e00b9b8ea592561235a917851
  7. 0 8
      .rpt2_cache/rpt2_ced057ff145136f44a10ed5d8de26027aa95246d/code/cache/c83855964b676abc8b3ca7916f6cfcfa16a0849d
  8. 5 0
      .rpt2_cache/rpt2_ced057ff145136f44a10ed5d8de26027aa95246d/code/cache/d069ddcce7e825931ad99b272f04537f4f1dc503
  9. 0 5
      .rpt2_cache/rpt2_ced057ff145136f44a10ed5d8de26027aa95246d/code/cache/ee70e902c798528a9b736d47ffa59d582a66bf03
  10. binární
      bin/Game/res/Skin/giftbox.png
  11. 1 1
      bin/fileconfig.json
  12. 1 1
      bin/game.json
  13. 2 2
      bin/h5/.rec
  14. 1 1
      bin/h5/WinView.atlas
  15. binární
      bin/h5/WinView.png
  16. 14 5
      bin/js/bundle.js
  17. 1 1
      bin/js/bundle.js.map
  18. binární
      laya/assets/LotteryView/tinified.zip
  19. binární
      laya/assets/WinView/guoguan-1-6.png
  20. binární
      laya/assets/WinView/lingqu-1.png
  21. binární
      laya/assets/WinView/lingqu-2.png
  22. 22 11
      laya/pages/GetRewardView.scene
  23. binární
      release/wxgame/BtmopenDataContext/.DS_Store
  24. binární
      release/wxgame/BtmopenDataContext/asset/paihang-1-3.png
  25. binární
      release/wxgame/BtmopenDataContext/asset/paihang-1-4.png
  26. binární
      release/wxgame/BtmopenDataContext/asset/paihang-1-5.png
  27. 101 0
      release/wxgame/BtmopenDataContext/bottomscoreitem.js
  28. 402 0
      release/wxgame/BtmopenDataContext/index.js
  29. 101 0
      release/wxgame/BtmopenDataContext/libs/label.js
  30. 120 0
      release/wxgame/BtmopenDataContext/libs/sprite.js
  31. 133 0
      release/wxgame/BtmopenDataContext/rankitem.js
  32. 1 1
      release/wxgame/game.json
  33. 1 1
      release/wxgame/js/bundle.js
  34. 1 1
      release/wxgame/js/bundle.js.map
  35. 0 3
      src/Rank/RankSDK.ts
  36. 6 0
      src/View/GetRewardView.ts
  37. 7 6
      src/View/RankView.ts
  38. 2 1
      src/ui/layaMaxUI.ts

+ 1 - 1
.laya/wxgame.json

@@ -64,5 +64,5 @@
     "forceCompile": false,
     "onlyIndexJS": true,
     "projectType": "ts",
-    "pubTime": 1579331581313
+    "pubTime": 1579336636861
 }

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 9 - 0
.rpt2_cache/rpt2_981034996b69972eab67662e90386ed59173930e/code/cache/71220f6c77f9fd0bce941ba40436a64ead52481b


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 2 - 2
.rpt2_cache/rpt2_981034996b69972eab67662e90386ed59173930e/code/cache/d0cf91d73279450e00b9b8ea592561235a917851


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 8
.rpt2_cache/rpt2_981034996b69972eab67662e90386ed59173930e/code/cache/c83855964b676abc8b3ca7916f6cfcfa16a0849d


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 9 - 0
.rpt2_cache/rpt2_ced057ff145136f44a10ed5d8de26027aa95246d/code/cache/71220f6c77f9fd0bce941ba40436a64ead52481b


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 2 - 2
.rpt2_cache/rpt2_ced057ff145136f44a10ed5d8de26027aa95246d/code/cache/d0cf91d73279450e00b9b8ea592561235a917851


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 8
.rpt2_cache/rpt2_ced057ff145136f44a10ed5d8de26027aa95246d/code/cache/c83855964b676abc8b3ca7916f6cfcfa16a0849d


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 5 - 0
.rpt2_cache/rpt2_ced057ff145136f44a10ed5d8de26027aa95246d/code/cache/d069ddcce7e825931ad99b272f04537f4f1dc503


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 5
.rpt2_cache/rpt2_ced057ff145136f44a10ed5d8de26027aa95246d/code/cache/ee70e902c798528a9b736d47ffa59d582a66bf03


binární
bin/Game/res/Skin/giftbox.png


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
bin/fileconfig.json


+ 1 - 1
bin/game.json

@@ -12,5 +12,5 @@
         "name": "Game",
         "root": "Game/res"
       }
-    ]
+    ],"openDataContext":"BtmopenDataContext"
   }

+ 2 - 2
bin/h5/.rec

@@ -88,7 +88,6 @@ P 85D0A840 func2.png
 P 545B3AB1 func3.png
 P B34E5C7C func4.png
 P 3A6A1563 func5.png
-R C996B60A tinified.zip
 D MainView
 R 7DB6C5A8 logo.png
 P EA19D664 zhujiemian-1-1(1).png
@@ -227,5 +226,6 @@ R 5587C072 guoguan-1-1.png
 P 0F165482 guoguan-1-2.png
 P 0F044DE6 guoguan-1-3.png
 P C8B71A09 guoguan-1-4.png
-P 6E057776 guoguan-1-6.png
 R FC201E20 guoguan-1-7.png
+P 7590E2DB lingqu-1.png
+P BB02510F lingqu-2.png

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
bin/h5/WinView.atlas


binární
bin/h5/WinView.png


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 14 - 5
bin/js/bundle.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
bin/js/bundle.js.map


binární
laya/assets/LotteryView/tinified.zip


binární
laya/assets/WinView/guoguan-1-6.png


binární
laya/assets/WinView/lingqu-1.png


binární
laya/assets/WinView/lingqu-2.png


+ 22 - 11
laya/pages/GetRewardView.scene

@@ -1,12 +1,12 @@
 {
     "x":0,
     "type":"Scene",
-    "selectedBox":3,
-    "selecteID":7,
+    "selectedBox":2,
+    "selecteID":9,
     "searchKey":"Scene",
     "props":{"width":720,"sceneColor":"#000000","height":1280},
     "nodeParent":-1,
-    "maxID":8,
+    "maxID":10,
     "label":"Scene",
     "isOpen":true,
     "isDirectory":true,
@@ -21,14 +21,13 @@
             "props":{"y":488,"x":360,"width":696,"skin":"WinView/guoguan-1-7.png","pivotY":376,"pivotX":348,"height":720},
             "nodeParent":2,
             "label":"Image",
-            "isOpen":true,
+            "isOpen":false,
             "isDirectory":true,
             "isAniNode":true,
             "hasChild":true,
             "compId":3,
             "child":[
                 {
-                    "x":30,
                     "type":"Image",
                     "searchKey":"Image,skillicon",
                     "props":{"y":182,"x":328,"width":126,"var":"skillicon","pivotY":62,"pivotX":63,"height":124},
@@ -42,10 +41,9 @@
                         ]
                 },
                 {
-                    "x":30,
                     "type":"Text",
                     "searchKey":"Text,des1",
-                    "props":{"y":440,"x":347,"width":433,"var":"des1","valign":"middle","text":"获得二倍道具","pivotY":44,"pivotX":217,"height":88,"fontSize":40,"align":"center"},
+                    "props":{"y":408,"x":347,"width":433,"var":"des1","valign":"middle","text":"获得二倍道具","pivotY":28,"pivotX":217,"height":56,"fontSize":30,"align":"center"},
                     "nodeParent":3,
                     "label":"des1",
                     "isDirectory":false,
@@ -56,10 +54,9 @@
                         ]
                 },
                 {
-                    "x":30,
                     "type":"Text",
                     "searchKey":"Text,des2",
-                    "props":{"y":536,"x":347,"width":435,"var":"des2","valign":"middle","text":"将一个球变为2倍","pivotY":44,"pivotX":218,"height":88,"fontSize":40,"align":"center"},
+                    "props":{"y":472,"x":348,"width":435,"var":"des2","valign":"middle","text":"将一个球变为2倍","pivotY":33,"pivotX":218,"height":59,"fontSize":30,"align":"center"},
                     "nodeParent":3,
                     "label":"des2",
                     "isDirectory":false,
@@ -73,14 +70,28 @@
         {
             "x":15,
             "type":"Button",
+            "searchKey":"Button,VideoGetBtn",
+            "props":{"y":771,"x":360,"var":"VideoGetBtn","stateNum":"1","skin":"WinView/lingqu-1.png","anchorY":0.5,"anchorX":0.5},
+            "nodeParent":2,
+            "label":"VideoGetBtn",
+            "isDirectory":false,
+            "isAniNode":true,
+            "hasChild":false,
+            "compId":8,
+            "child":[
+                ]
+        },
+        {
+            "x":15,
+            "type":"Button",
             "searchKey":"Button,GetBtn",
-            "props":{"y":759,"x":360,"width":264,"var":"GetBtn","stateNum":"1","skin":"WinView/guoguan-1-6.png","pivotY":53,"pivotX":132,"height":106},
+            "props":{"y":670,"x":360,"width":291,"var":"GetBtn","stateNum":"1","skin":"WinView/lingqu-2.png","height":90,"anchorY":0.5,"anchorX":0.5},
             "nodeParent":2,
             "label":"GetBtn",
             "isDirectory":false,
             "isAniNode":true,
             "hasChild":false,
-            "compId":5,
+            "compId":9,
             "child":[
                 ]
         }],

binární
release/wxgame/BtmopenDataContext/.DS_Store


binární
release/wxgame/BtmopenDataContext/asset/paihang-1-3.png


binární
release/wxgame/BtmopenDataContext/asset/paihang-1-4.png


binární
release/wxgame/BtmopenDataContext/asset/paihang-1-5.png


+ 101 - 0
release/wxgame/BtmopenDataContext/bottomscoreitem.js

@@ -0,0 +1,101 @@
+var Sprite = require('./libs/sprite.js').Sprite
+var Label = require('./libs/label.js').Label
+
+function BottomScoreItem(x, y, width, height) {
+  this.x = x;
+  this.y = y;
+  this.width = width;
+  this.height = height;
+}
+var circlebg = "openDataContext/asset/circle.png";
+BottomScoreItem.prototype.create = function() {
+
+  // this.rankbg = new Sprite("openDataContext/asset/paiwei_xin_1_6_6.png", this.x - 50, this.y + this.height * 0.5 * 0.1, 720, 300);
+  // this.rankbg.parent = this;
+
+  let labelOffset = 65;
+  let labelStyle = "#ffffff";
+  let fontSize = "35px";
+
+  this.rankLabel = new Label(this.x+90 , this.y-315 );
+  this.rankLabel.fontSize = "65px";
+  this.rankLabel.fillStyle = labelStyle;
+  this.rankLabel.textAlign = 'center';
+
+  let rankWidth = 67;
+  let rankHeight = 63;
+  //this.rankimg = new Sprite('', this.x + 20, this.y + this.height * 0.5 - rankHeight * 0.5, rankWidth, rankHeight);
+
+  let offsetX = 90;
+  // let circleWidth = 96;
+  // let circleHeight = 96;
+  // this.circleicon = new Sprite(circlebg, this.x + offsetX, this.y + this.height * 0.5 - circleHeight * 0.5, circleWidth, circleHeight);
+  // this.circleicon.visible = false;
+  let iconWidth = 60;
+  let iconHeight = 60;
+  this.icon = new Sprite('', this.x + 120, this.y -365/**+ this.height * 0.5 - iconHeight * 0.5 + 20*/, iconWidth, iconHeight);
+
+  this.nameLabel = new Label(this.x + 220, this.y - 320);
+  this.nameLabel.fontSize = fontSize;
+  this.nameLabel.fillStyle = labelStyle;
+
+  this.scoreNum = new Label(this.x + this.width - 170, this.y - 320);
+  this.scoreNum.fontSize = fontSize;
+  this.scoreNum.fillStyle = labelStyle;
+  this.scoreNum.textAlign = "center";
+
+  this.scoreLabel = new Label(this.x + this.width - 100, this.y - 320);
+  this.scoreLabel.fontSize = fontSize;
+  this.scoreLabel.fillStyle = labelStyle;
+  this.scoreLabel.textAlign = "right";
+}
+
+BottomScoreItem.prototype.setData = function(rankNum,name, iconUrl, score) {
+  this.icon.src = iconUrl;
+  this.nameLabel.text = name;
+  this.scoreNum.text = score;
+  this.scoreLabel.text ="第        关";
+  this.rankLabel.text = rankNum;
+  if (rankNum <= 3) {
+    //this.rankLabel.visible = false;
+    //this.rankimg.visible = true;
+    //this.rankimg.src = this.getRankUrl(rankNum);
+  } else {
+    //this.rankLabel.visible = true;
+    //this.rankimg.visible = false;
+    //this.rankLabel.text = rankNum;
+  }
+}
+// var rank1url = "openDataContext/asset/paihang-1-3.png";
+// var rank2url = "openDataContext/asset/paihang-1-3-2.png";
+// var rank3url = "openDataContext/asset/paihang-1-3-1.png";
+// BottomScoreItem.prototype.getRankUrl = function(num) {
+//   let rankNum = num;
+//   let url = "";
+//   switch (rankNum) {
+
+//     case 1:
+//       url = rank1url;
+//       break;
+//     case 2:
+//       url = rank2url;
+//       break;
+//     case 3:
+//       url = rank3url;
+//       break;
+//     default:
+//       url = "";
+//       break;
+//   }
+//   return url;
+// }
+BottomScoreItem.prototype.drawToCanvas = function(ctx) {
+  //this.rankbg.drawToCanvas(ctx);
+  this.scoreNum.drawToCanvas(ctx);
+  this.rankLabel.drawToCanvas(ctx);
+  this.icon.drawToCanvas(ctx);
+  this.nameLabel.drawToCanvas(ctx);
+  this.scoreLabel.drawToCanvas(ctx);
+}
+
+module.exports.BottomScoreItem = BottomScoreItem;

+ 402 - 0
release/wxgame/BtmopenDataContext/index.js

@@ -0,0 +1,402 @@
+var RankItem = require('./rankitem.js').RankItem;
+var Label = require('./libs/label.js').Label;
+var Sprite = require('./libs/sprite.js').Sprite;
+
+var BottomScoreItem = require('./bottomscoreitem.js').BottomScoreItem;
+
+const PAGE_SIZE = 5;
+const ITEM_WIDTH =600;// 608;
+//100
+const ITEM_HEIGHT = 65;//126;
+//270
+const offsetY = 220;
+//间距
+const itemGap = 15;
+//1150
+const ownerY= 1150;
+
+
+const pageTextY=1250;
+var offsetX = 0;
+
+var canvawidth = 0;
+var canvaheight = 0;
+var normal_scale = 1;
+
+var swidth = 630;
+var sheight = 800;
+
+var friends_scores = [];
+//总排行数据 可为群或者好友
+var group_scores = [];
+//周排行数据 可为群或者好友
+var group_week_scores = [];
+var current_scores = [];
+
+var moveoffset = 0; //滑动偏移
+var allHeight = 0; //整个排行榜高
+var worldData;
+var isworldRank = false;
+
+const dataSorter = (gameDatas, filed = "Level") => {
+  console.log("玩家信息----",gameDatas);
+  return gameDatas.sort((a, b) => {
+    const kvDataA = a.KVDataList.find(kvData => kvData.key == filed);
+    const kvDataB = b.KVDataList.find(kvData => kvData.key == filed);
+    console.log("玩家分数为------------");
+    var stageA = JSON.parse(kvDataA.value).wxgame.Level;
+    
+    var stageB = JSON.parse(kvDataB.value).wxgame.Level;
+    const gradeA = kvDataA ? parseInt(stageA || 0) : 0;
+    const gradeB = kvDataB ? parseInt(stageB || 0) : 0;
+    return gradeA > gradeB ? -1 : gradeA < gradeB ? 1 : 0;
+  });
+}
+
+let myInfo;
+let avatarUrl;
+//获取个人信息
+wx.getUserInfo({
+  openIdList: ["selfOpenId"],
+  success: function (res) {
+    myInfo = res.data[0];
+    avatarUrl = myInfo.avatarUrl;
+    console.log(myInfo);
+  }
+})
+
+var adpater = 0;
+
+var h;//宽
+var v;//高
+class RankListRenderer {
+
+  constructor() {
+    this.totalPage = 0;
+    this.currPage = 0;
+    this.keyName = "";
+    this.rankitemArr = [];
+    this.init();
+    this.sys_info = wx.getSystemInfoSync();
+  }
+
+  init() {
+    this.canvas = wx.getSharedCanvas();
+    this.ctx = this.canvas.getContext('2d');
+    this.ctx.imageSmoothingEnabled = true;
+    this.ctx.imageSmoothingQuality = "high";
+    this.rankcanvas = wx.createCanvas();
+    this.rankctx = this.rankcanvas.getContext('2d');
+  }
+
+
+
+  listen() {
+    wx.onMessage(msg => {
+      console.log(msg);
+      switch (msg.action) {
+        case "canvase_width_height":
+          console.log(msg.data.width, msg.data.height);
+          canvawidth = msg.data.width;
+          canvaheight = msg.data.height;
+
+          v = canvaheight / this.screenHeight;
+          h = canvawidth / this.sys_info.screenWidth;
+          
+          offsetX = (canvawidth - ITEM_WIDTH) * 0.5 * normal_scale;
+          this.rankcanvas.width = canvawidth;
+          this.rankcanvas.height = canvaheight;
+          break;
+        case "clearctx":
+          this.rankctx.clearRect(0, 0, canvawidth, canvaheight);
+          break;
+        case "get_friend_storage":
+          this.getFriendStorage(msg.keyName);
+          break;
+        case "show_friend_rank":
+          console.log("keyname111111", msg.keyName);
+          this.keyName = msg.keyName;
+          this.fetchFriendData(msg.keyName);
+          isworldRank = false;
+          this.currPage = 0;
+          break;
+        case "show_group_rank":
+          console.log("show_group_rank", msg.data);
+          if (!msg.data) return;
+          this.keyName = msg.keyName;
+          this.fetchGroupData(msg.keyName, msg.data);
+          break;
+        case "show_world_rank":
+          console.log("show_group_rank", msg.data);
+          if (!msg.data) return;
+          this.keyName = msg.keyName;
+          worldData = msg.data;
+          this.totalPage = Math.ceil(worldData["list"].length / PAGE_SIZE);
+          isworldRank = true;
+          this.showWorldRanks(0);
+          break;
+        case "show_min_rank":
+          this.keyName = msg.keyName;
+          this.drawMinRank(msg.keyName, msg.data);
+          break;
+        case "show_up_page":
+          if (!isworldRank && !current_scores.length) {
+            return;
+          }
+          if (isworldRank && !worldData["list"].length) {
+            return;
+          } {
+            let page = this.currPage;
+            page -= 1;
+            if (page < 0) page = 0;
+            if (this.currPage > page) {
+              this.currPage = page;
+              if (isworldRank == false)
+                this.showRanks(this.currPage);
+              else this.showWorldRanks(this.currPage);
+            }
+
+          }
+          break;
+        case "show_next_page":
+          if (!isworldRank) {
+            if (!current_scores.length) return;
+
+          } else {
+            if (!worldData["list"].length) return;
+          } {
+
+            let page = this.currPage;
+            page += 1;
+            if (this.totalPage <= page) page = this.totalPage - 1;
+            if (this.currPage < page) {
+              this.currPage = page;
+              if (isworldRank == false)
+                this.showRanks(this.currPage);
+              else this.showWorldRanks(this.currPage);
+            }
+
+          }
+
+          break;
+        default:
+          console.log(`未知消息类型:msg.action=${msg.action}`);
+          break;
+      }
+    });
+
+  }
+
+
+  fetchFriendData(keyName) {
+    wx.getFriendCloudStorage({
+      keyList: [
+        keyName,
+      ],
+      success: res => {
+        console.log("wx.getFriendCloudStorage success", res);
+        const dataLen = res.data.length;
+        friends_scores = dataSorter(res.data, keyName);
+        console.log("Sort success", friends_scores);
+        current_scores = friends_scores;
+        this.totalPage = Math.ceil(current_scores.length / PAGE_SIZE);
+        console.log(" this.totalPage", this.totalPage);
+        if (dataLen) {
+          this.showRanks(0);
+
+        }
+
+      },
+
+      fail: res => {
+        console.log("wx.getFriendCloudStorage fail", res);
+      },
+
+    });
+  }
+
+
+
+  showRanks(page) {
+
+    const startIndex = page * PAGE_SIZE;
+    const stopIndex = startIndex + PAGE_SIZE;
+    const datas = current_scores.slice(startIndex, stopIndex);
+    let x = 0;
+    if (this.sys_info.model.match("iPhone X")) {
+      x = 110
+    }
+    this.ctx.clearRect(0, 0, canvawidth, canvaheight);
+    for (let i = 0, len = datas.length; i < len; i++) {
+      let data = datas[i];
+      const nick = data.nickname.length <= 5 ? data.nickname : data.nickname.substr(0, 5) + "...";
+      const kvData = data.KVDataList.find(kvData => kvData.key == this.keyName);
+      const itemGapY = (ITEM_HEIGHT + itemGap) * i + offsetY;
+      const avatarUrl = data.avatarUrl;
+      
+      const grade = kvData ? this.max_crossed_stage(kvData.value) : 0;
+      let rankItem = this.rankitemArr[i];
+      if (rankItem == null) {
+        rankItem = new RankItem(offsetX, itemGapY, ITEM_WIDTH, ITEM_HEIGHT);
+        this.rankitemArr.push(rankItem);
+        rankItem.create();
+      }
+
+      rankItem.setData(i + startIndex + 1, avatarUrl, nick, grade, this.keyName);
+      rankItem.drawToCanvas(this.ctx);
+      console.log("offsetY", offsetY);
+    }
+
+    // let page_y = canvaheight - 360;
+    // let pageLabel = new Label(canvawidth * 0.5-40 , pageTextY);
+    // pageLabel.fontSize = "45px"
+    // pageLabel.fillStyle = "#ffffff";
+    // pageLabel.text = `${this.currPage + 1} / ${this.totalPage}`;
+    // pageLabel.drawToCanvas(this.ctx);
+    this.showBottomOwner();
+  }
+
+  max_crossed_stage(value)
+  {
+    return parseInt(JSON.parse(value).wxgame.Level);
+
+  }
+
+  showBottomOwner() {
+    let grade = 0;
+    let mydata;
+    let ranking=0;
+    for (let i = current_scores.length - 1; i >= 0; i--) {
+
+      let data = current_scores[i];
+      if (data.avatarUrl == avatarUrl) {
+        mydata = data;
+        ranking=i+1;
+        break;
+      }
+    }
+    let kvData = mydata.KVDataList.find(kvData => kvData.key == this.keyName);
+    grade = kvData ? this.max_crossed_stage(kvData.value) : 0;
+    if (this.ownerItem == null) {
+      //this.ownerItem = new BottomScoreItem(offsetX, 1040 + adpater, ITEM_WIDTH, ITEM_HEIGHT);
+      this.ownerItem = new BottomScoreItem(offsetX, ownerY, ITEM_WIDTH, ITEM_HEIGHT);
+      this.ownerItem.create();
+    }
+    console.log(mydata.nickname);
+    console.log(grade);
+    //this.ownerItem.setData( mydata.nickname, avatarUrl, grade);
+    this.ownerItem.setData(ranking, mydata.nickname, avatarUrl, grade);
+    this.ownerItem.drawToCanvas(this.ctx);
+  }
+
+  showWorldRanks(page) {
+    const startIndex = page * PAGE_SIZE;
+    const stopIndex = startIndex + PAGE_SIZE;
+    const datas = worldData["list"].slice(startIndex, stopIndex);
+    console.log("datas", datas);
+    let x = 0;
+    if (this.sys_info.model.match("iPhone X")) {
+      x = 110
+    }
+    this.ctx.clearRect(0, 0, canvawidth, canvaheight);
+    for (let i = 0, len = datas.length; i < len; i++) {
+      let data = datas[i];
+      let nick = data.nickname.length <= 10 ? data.nickname : data.nickname.substr(0, 10) + "...";
+      nick = nick == "" ? "游客" : nick
+      const itemGapY = (ITEM_HEIGHT + 6) * i + offsetY;
+      const avatarUrl = data.avatar;
+      const grade = data.score;
+      let rankItem = this.rankitemArr[i];
+      if (rankItem == null) {
+        rankItem = new RankItem(offsetX, itemGapY, ITEM_WIDTH, ITEM_HEIGHT);
+        this.rankitemArr.push(rankItem);
+        rankItem.create();
+      }
+      rankItem.position(offsetX, itemGapY);
+      rankItem.setData(i + startIndex + 1, avatarUrl, nick, grade, this.keyName);
+      rankItem.drawToCanvas(this.ctx);
+      console.log("offsetY", offsetY);
+    }
+
+    let page_y = canvaheight - 360;
+    let pageLabel = new Label(canvawidth * 0.5 - 60, page_y);
+    pageLabel.fontSize = "35px"
+    pageLabel.fillStyle = "#ffffff";
+    pageLabel.text = `${this.currPage + 1} / ${this.totalPage}`;
+    pageLabel.drawToCanvas(this.ctx);
+    this.showBottomOwner();
+  }
+
+  fetchGroupData(keyName, shareTicket) {
+    //取出群同玩成员数据
+    wx.getGroupCloudStorage({
+      shareTicket,
+      keyList: [
+        keyName,
+      ],
+      success: res => {
+        console.log("wx.getGroupCloudStorage success", res);
+        const dataLen = res.data.length;
+        group_scores = dataSorter(res.data, keyName);
+        current_scores = group_scores;
+        this.totalPage = Math.ceil(current_scores.length / PAGE_SIZE);
+        console.log(" this.totalPage", this.totalPage);
+        if (dataLen) {
+          this.showRanks(0);
+        }
+
+      },
+      fail: res => {
+        console.log("wx.getGroupCloudStorage fail", res);
+      },
+    });
+  }
+
+  drawMinRank(keyName, shareTicket) {
+    wx.getFriendCloudStorage({
+      keyList: [
+        keyName,
+      ],
+      success: res => {
+        console.log("wx.getFriendCloudStorage success", res);
+        const dataLen = res.data.length;
+        friends_scores = dataSorter(res.data, keyName);
+        current_scores = friends_scores;
+        this.totalPage = Math.ceil(current_scores.length / PAGE_SIZE);
+        console.log(" this.totalPage", this.totalPage);
+        if (dataLen) this.showMinRanks();
+
+      },
+
+      fail: res => {
+        console.log("wx.getFriendCloudStorage fail", res);
+      },
+
+    });
+  }
+
+
+  getFriendStorage(keyName) {
+    wx.getFriendCloudStorage({
+      keyList: [
+        keyName,
+      ],
+      success: res => {
+        console.log("wx.getFriendCloudStorage success", res);
+        const dataLen = res.data.length;
+        friends_scores = dataSorter(res.data, keyName);
+        current_scores = friends_scores;
+        console.log(" this.totalPage", this.totalPage);
+      },
+
+      fail: res => {
+        console.log("wx.getFriendCloudStorage fail", res);
+      },
+
+    });
+  }
+}
+
+
+let ranklist = new RankListRenderer();
+ranklist.listen();

+ 101 - 0
release/wxgame/BtmopenDataContext/libs/label.js

@@ -0,0 +1,101 @@
+
+  function Label (x = 0, y = 0) {
+
+    this.x = x
+    this.y = y
+    this._text=""
+    this._fillStyle ="#ffffff"
+    this._textAlign ="left"
+    this._font ="Helvetica"
+    this._fontSize="30px"
+    this._baseLine ="middle"
+    this._name=""
+    this._globalAlpha = 1;
+    this.visible = true
+  }
+
+Label.prototype={
+  set name(tex) {
+    this._name = tex;
+  },
+
+  get name() {
+    return this._name;
+  },
+
+  set text(tex) {
+    this._text = tex;
+  },
+
+  get text() {
+    return this._text;
+  },
+
+  set fillStyle(tex) {
+    this._fillStyle = tex;
+  },
+
+  get fillStyle() {
+    return this._fillStyle;
+  },
+
+  set textAlign(tex) {
+    this._textAlign = tex;
+  },
+
+  get textAlign() {
+    return this._textAlign;
+  },
+
+  set font(tex) {
+    this._font = tex;
+  },
+
+  get font() {
+    return this._font;
+  },
+
+  set fontSize(tex) {
+    this._fontSize = tex;
+  },
+
+  get fontSize() {
+    return this._fontSize;
+  },
+  set baseLine(tex) {
+    this._baseLine = tex;
+  },
+
+  get baseLine() {
+    return this._baseLine;
+  },
+  get globalAlpha() {
+    return this._globalAlpha;
+  },
+
+  set globalAlpha(tex) {
+    this._globalAlpha = tex;
+  },
+}
+
+Label.prototype.position = function(x,y){
+
+  this.x = x;
+  this.y = y;
+
+}
+  /**
+   * 将文字绘制在canvas上
+   */
+Label.prototype.drawToCanvas=function(ctx){
+  if (!this.visible)
+    return
+  ctx.globalAlpha = this.globalAlpha;
+  ctx.fillStyle = this.fillStyle;
+  ctx.textAlign = this.textAlign;
+  ctx.baseLine = this.baseLine;
+  ctx.font = `${this.fontSize} ${this.font}`;
+  ctx.fillText(this.text, this.x, this.y);
+}
+
+module.exports.Label = Label;

+ 120 - 0
release/wxgame/BtmopenDataContext/libs/sprite.js

@@ -0,0 +1,120 @@
+/**
+ * 游戏基础的精灵类
+ */
+function Sprite(imgSrc = '', x = 0, y = 0, width = 0, height = 0,iscircle=false) {
+
+  this._width = width
+  this._height = height
+
+  this.x = x
+  this.y = y
+  this._name = ""
+  this._fillStyle = "#ffffff"
+  this._globalAlpha = 1;
+  this.visible = true
+  this.iscircle=iscircle
+  this.src = imgSrc
+
+}
+
+Sprite.prototype = {
+  set name(tex) {
+    this._name = tex;
+  },
+
+  get name() {
+    return this._name;
+  },
+
+  set width(tex) {
+    this._width = tex;
+  },
+
+  get width() {
+    return this._width;
+  },
+
+  set height(tex) {
+    this._height = tex;
+  },
+
+  get height() {
+    return this._height;
+  },
+
+  set fillStyle(tex) {
+    this._fillStyle = tex;
+  },
+
+  set iscircle(iscircle) {
+    this._iscircle = iscircle;
+  },
+  get globalAlpha() {
+    return this._globalAlpha;
+  },
+
+  set globalAlpha(tex) {
+    this._globalAlpha = tex;
+  },
+
+  get fillStyle() {
+    return this._fillStyle;
+  },
+
+  set src(tex) {
+    this._src = tex;
+    if (tex != '' && tex != null) {
+      this.img = wx.createImage();
+      this.img.src = tex;
+      this.img.onload = () => {
+        if (this.ctx != null)
+          if (this.parent) {
+            this.parent.drawToCanvas(this.ctx);
+
+          } else {
+            this.drawToCanvas(this.ctx);
+          }
+      };
+    }
+  },
+
+  get src() {
+    return this._src;
+  }
+
+}
+
+Sprite.prototype.position = function(x, y) {
+
+  this.x = x;
+  this.y = y;
+
+}
+
+/**
+ * 将精灵图绘制在canvas上
+ */
+Sprite.prototype.drawToCanvas = function(ctx) {
+
+  if (!this.visible)
+    return
+  this.ctx = ctx;
+  ctx.globalAlpha = this.globalAlpha;
+  if (this.src != '' && this.src != null) {
+    if (this._iscircle) {
+      ctx.save();
+      let r = Math.ceil(this.width * 0.5) ;
+      ctx.arc(this.x + r, this.y + r, r, 0, Math.PI * 2);
+      ctx.clip();
+      ctx.drawImage(this.img, this.x, this.y, 2 * r, 2 * r);
+      ctx.restore();
+    } else {
+      ctx.drawImage(this.img, this.x, this.y, this.width, this.height)
+    }
+  } else {
+    ctx.fillStyle = this.fillStyle;
+    ctx.fillRect(this.x, this.y, this.width, this.height);
+  }
+}
+
+module.exports.Sprite = Sprite;

+ 133 - 0
release/wxgame/BtmopenDataContext/rankitem.js

@@ -0,0 +1,133 @@
+var Sprite = require('./libs/sprite.js').Sprite
+var Label = require('./libs/label.js').Label
+
+function RankItem(x, y, width, height) {
+  this.x = x;
+  this.y = y;
+  this.width = width;
+  this.height = height;
+}
+
+RankItem.prototype.create = function() {
+  let labelOffset = 55;
+  let labelStyle = "#ffffff";
+  let fontSize = "35px";
+
+  // this.rankbg = new Sprite("openDataContext/asset/paiwei_xin_1_6_1.png",this.x, this.y + this.height * 0.5 - 150 * 0.5, 650, 140);
+  // this.rankbg.parent = this;
+
+  this.rankLabel = new Label(this.x + 100, this.y + labelOffset+5);
+  this.rankLabel.fontSize = "40px";
+  this.rankLabel.fillStyle = labelStyle;
+  this.rankLabel.textAlign = 'center';
+  this.rankLabel.fontFamily = "Microsoft YaHei";
+
+  let rankWidth = 38;
+  let rankHeight = 48;
+  this.rankimg = new Sprite('', this.x + 80, this.y+25/** + this.height * 0.5 - rankHeight * 0.5*/, rankWidth, rankHeight);
+
+  let offsetX = 75;
+  let iconWidth = 56;
+  let iconHeight = 56;
+  this.icon = new Sprite('', this.x + offsetX + 50, this.y+20 /**+ this.height * 0.5 - iconHeight * 0.5*/, iconWidth, iconHeight);
+
+  this.nameLabel = new Label(this.x + 190, this.y + labelOffset);
+  this.nameLabel.fontSize = fontSize;
+  this.nameLabel.fillStyle = labelStyle;
+  this.nameLabel.fontFamily = "Microsoft YaHei";
+
+  this.scoreNum = new Label(this.x + this.width - 160, this.y + 55);
+  this.scoreNum.fontSize = "35px";
+  this.scoreNum.fillStyle = labelStyle;
+  this.scoreNum.textAlign = "center"
+  this.scoreNum.fontFamily = "Microsoft YaHei";
+
+  this.scoreLabel = new Label(this.x + this.width - 100, this.y + labelOffset);
+  this.scoreLabel.fontSize = fontSize;
+  this.scoreLabel.fillStyle = labelStyle;
+  this.scoreLabel.textAlign = "right"
+  this.scoreLabel.fontFamily = "Microsoft YaHei";
+}
+
+RankItem.prototype.getBgFillStyle = function(num) {
+  let rankNum = num;
+  let style = "#ffffff";
+  if (num % 2 == 1) {
+    style = "#ffffff";
+  }
+  return style;
+}
+
+var rank1url = "BtmopenDataContext/asset/paihang-1-3.png";
+var rank2url = "BtmopenDataContext/asset/paihang-1-4.png";
+var rank3url = "BtmopenDataContext/asset/paihang-1-5.png";
+var bgImg = "openDataContext/asset/bg.png";
+RankItem.prototype.getRankUrl = function(num) {
+  let rankNum = num;
+  let url = "";
+  switch (rankNum) {
+
+    case 1:
+      url = rank1url;
+      break;
+    case 2:
+      url = rank2url;
+      break;
+    case 3:
+      url = rank3url;
+      break;
+    default:
+      url = "";
+      break;
+  }
+  return url;
+}
+
+RankItem.prototype.setData = function(rankNum, iconUrl, name, score, keyName) {
+
+  this.icon.src = iconUrl;
+  this.nameLabel.text = name;
+  this.scoreNum.text = score;
+  this.scoreLabel.text ="第     关";
+  this.rankLabel.text = rankNum;
+  if (rankNum <= 3) {
+    this.rankLabel.visible = false;
+    this.rankimg.visible = true;
+    this.rankimg.src = this.getRankUrl(rankNum);
+  } else {
+    this.rankLabel.visible = true;
+    this.rankimg.visible = false;
+    this.rankLabel.text = rankNum;
+  }
+}
+
+RankItem.prototype.position = function(x, y) {
+  this.x = x;
+  this.y = y;
+
+  let labelOffset = 80;
+  this.rankLabel.position(this.x + 50, this.y + labelOffset);
+
+  let rankWidth = 51;
+  let rankHeight = 73;
+  this.rankimg.position(this.x + 30, this.y )//+ this.height * 0.5 - rankHeight * 0.5);
+
+  let offsetX = 90;
+  let iconWidth = 60;
+  let iconHeight = 60;
+  this.icon.position(this.x + offsetX + 30, this.y-10)// + this.height * 0.5 - iconHeight * 0.5);
+  this.nameLabel.position(this.x + 110, this.y + labelOffset);
+
+  this.scoreLabel.position(this.x + this.width - 50, this.y + labelOffset);
+}
+
+RankItem.prototype.drawToCanvas = function(ctx) {
+  this.rankLabel.drawToCanvas(ctx);
+  this.rankimg.drawToCanvas(ctx);
+  this.scoreNum.drawToCanvas(ctx);
+  this.icon.drawToCanvas(ctx);
+  this.nameLabel.drawToCanvas(ctx);
+  this.scoreLabel.drawToCanvas(ctx);
+}
+
+module.exports.RankItem = RankItem;

+ 1 - 1
release/wxgame/game.json

@@ -4,4 +4,4 @@
         "name": "Game",
         "root": "Game/res"
       }
-    ]}
+    ],"openDataContext":"BtmopenDataContext"}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
release/wxgame/js/bundle.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
release/wxgame/js/bundle.js.map


+ 0 - 3
src/Rank/RankSDK.ts

@@ -23,7 +23,6 @@ import RankPan from "./RankPan";
     //     if (Main.OnWx)
     //         this.JHGGGIGO(keyName, "show_world_rank", data);
     // }
-
     public static Leftpe() {
         if (Laya.Browser.onWeiXin)
             this.Send("", "show_up_page");
@@ -65,13 +64,11 @@ import RankPan from "./RankPan";
         this.Send("", "canvase_width_height", data);
     }
     private static Send(keyName: string, action: string, data?: any) {
-        console.log("消息发送成功0---send");
         Laya.Browser.window.wx.postMessage({
             keyName: keyName,
             action: action,
             data: data
         });
-        console.log("消息发送成功---send");
     }
 
     private static SetStage(keyName: string, value: string,callBack:Function=null) {

+ 6 - 0
src/View/GetRewardView.ts

@@ -19,6 +19,7 @@ export default class SetView extends ui.GetRewardViewUI implements SC{
     Show(data?){
         this.FreshDescribe(data);
         this.GetBtn.clickHandler = Laya.Handler.create(this,this.GetReward);
+        this.VideoGetBtn.clickHandler = Laya.Handler.create(this,this.VideoGetReward);
         this.height = Laya.stage.height; 
         Laya.stage.on(Laya.Event.RESIZE,this,()=>
         {
@@ -40,8 +41,13 @@ export default class SetView extends ui.GetRewardViewUI implements SC{
         this.des2.text = arr[data-1].des2;
         this.skillicon.skin = "Game/res/Skin/func"+ arr[data-1].id + ".png";
     }
+    //普通领取
     GetReward(){
 
     }
+    //看视频双倍领取
+    VideoGetReward(){
+
+    }
         
 }

+ 7 - 6
src/View/RankView.ts

@@ -17,7 +17,7 @@ export default class RankView extends ui.RankViewUI implements SC{
     }
     Show(){
         RankSDK.OpenPan();
-        RankSDK.OpenRank("max_score");
+        RankSDK.OpenRank("Level");
         this.CloseBtn.clickHandler = Laya.Handler.create(this,this.ClickClose);
         this.UpPageBtn.clickHandler = Laya.Handler.create(this,this.UpPage);
         this.DownPageBtn.clickHandler = Laya.Handler.create(this,this.DownPage);
@@ -27,17 +27,18 @@ export default class RankView extends ui.RankViewUI implements SC{
             this.height = Laya.stage.height;
         })
     }
-    Close(){
-        
-    }
     ClickClose(){
         ViewManager.Instance.ShowView(ViewType.MainView);
     }
     UpPage(){
-
+        RankSDK.Leftpe();
     }
     DownPage(){
-
+        RankSDK.Rightpe();
+    }
+    Close(){
+        RankSDK.ClosePan();
     }
+    
 
 } 

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 2 - 1
src/ui/layaMaxUI.ts