Bladeren bron

Merge branch 'qqplay-1.0' of http://svn.ouj.com:3000/DWG/budingGame into qqplay-1.0

# Conflicts:
#	assets/Script/Game/GameSence.js
Roy 6 jaren geleden
bovenliggende
commit
0ebdcfe7a4
4 gewijzigde bestanden met toevoegingen van 55 en 46 verwijderingen
  1. 3 3
      assets/Script/Configure.js
  2. 7 7
      assets/Script/Game/GameSence.js
  3. 13 32
      assets/Script/Home/HomeSence.js
  4. 32 4
      assets/Script/UserInfoJS.js

+ 3 - 3
assets/Script/Configure.js

@@ -163,15 +163,15 @@ var config = {
 
     skinCondition: [{},
         {
-            score: 5,
+            score: 20,
             scoreType: 0
         },
         {
-            score: 20,
+            score: 100,
             scoreType: 0
         },
         {
-            score: 50,
+            score: 300,
             scoreType: 1
         },
     ]

+ 7 - 7
assets/Script/Game/GameSence.js

@@ -169,7 +169,7 @@ cc.Class({
 
         var gameOverNode = this.node.getChildByName("GameOver");
         gameOverNode.active = true;
-        // window.deadBanner.show();
+        UserInfo.showDeadBanner();
 
         var endLayerNumLabel = gameOverNode.getChildByName("EndLayerNumLabel");
         endLayerNumLabel.getComponent("cc.Label").string = this.sumScore;
@@ -264,13 +264,13 @@ cc.Class({
             UserInfo.addGold(this.sumScore);
         })
 
-        // window.deadBanner.hide();
+        UserInfo.destroyDeadBanner();
         // window.accountBanner.show();
     },
 
 
     continueGame: function () {
-        // window.deadBanner.hide();
+        UserInfo.destroyDeadBanner();
         // window.accountBanner.hide();
         this.bShare = false;
         this.bDead = false;
@@ -572,8 +572,8 @@ cc.Class({
 
     onShieldBtn: function () {
         if (CC_QQPLAY) {
-            this.onPassBtn();
-
+            this.onPauseBtn();
+            
             var gameOverNode = this.node.getChildByName("GameOver");
             var countDownLabel = gameOverNode.getChildByName("ShareNode").getChildByName("EndCountDownLabel");
             var isFinish = false;
@@ -857,7 +857,7 @@ cc.Class({
         this.gameOver();
 
         if (CC_QQPLAY) {
-            // window.deadBanner.hide();
+            UserInfo.destroyDeadBanner();
             this.rankScene.status = 3;
             this.showRank();
             this.updateXYXScore('showMyRank', null);
@@ -967,7 +967,7 @@ cc.Class({
         this.node.getChildByName("GameOver").active = false;
         this.node.parent.getChildByName("PHB").active = false;
         this.node.parent.getComponent("SenceManager").enterSence("Game", "Home");
-        // window.indexBanner.show();
+        UserInfo.showIndexBanner();
     },
 
     onBtnAudio: function () {

+ 13 - 32
assets/Script/Home/HomeSence.js

@@ -70,10 +70,11 @@ cc.Class({
         //     }
         // })
 
-		// if (CC_QQPLAY) {
-		// 	this.QQLogin();
-		// 	this.initShare();
-		// }
+		if (CC_QQPLAY) {
+			// this.QQLogin();
+            // this.initShare();
+            UserInfo.showIndexBanner();
+		}
     },
 
     start() {
@@ -91,7 +92,6 @@ cc.Class({
 			BK.Console.log('登录成功')
 		}
 	},
-
     // initShare(data) {
     //     let datavalue = UserInfo.getString('allscore');
     //     let key = UserInfo.getCurWeekScoreValue();
@@ -153,11 +153,6 @@ cc.Class({
     // },
 
     onRankBtn: function (event, optData) {
-        console.log('onrankbtn:', optData)
-        // wx.postMessage({
-        //     method: 'showFriendRank',
-        //     data: optData
-        // });
 
         cc.find("Canvas/PHB").getChildByName("BtnPHBClose").active = (optData == "true");
         cc.find("Canvas/PHB").getChildByName("emptyBtn").active = (optData == "true");
@@ -165,16 +160,12 @@ cc.Class({
 		
         if (this.node.active) {
             if ("true" == optData) {
-                // window.indexBanner.hide();
+                UserInfo.destroyIndexBanner();
                 this.rankScene.status = 1;
                 this.showRank();
             }
             if ("false" == optData) {
-                // window.indexBanner.show();
-                // wx.postMessage({
-                //     method: 'hideRank',
-                //     data: optData
-                // });
+                UserInfo.showIndexBanner();
                 cc.find("Canvas/PHB").active = false;
             }
         } else {
@@ -207,7 +198,7 @@ cc.Class({
 
     onGameStartBtn: function () {
         this.node.parent.getChildByName("SkinNode").active = false;
-        // window.indexBanner.hide();
+        UserInfo.destroyIndexBanner();
         if (this.showGuide()) {
             this.GuideNode.active = true;
         } else {
@@ -229,7 +220,7 @@ cc.Class({
         console.log('show guide');
         
         var key = 'guideTime';
-        var guideTime = cc.sys.localStorage.getItem(key);
+        var guideTime = UserInfo.getItem(key);
         var now = new Date();
         var year = now.getFullYear();
         var month = now.getMonth() + 1;
@@ -237,7 +228,7 @@ cc.Class({
         var guideTimeValue = [year, month, date].join('/');
 
         if (!guideTime || guideTime != guideTimeValue) {
-            cc.sys.localStorage.setItem(key, guideTimeValue);
+            UserInfo.setItem(key, guideTimeValue);
             return false;
         } else {
             this.GuideNode && this.GuideNode.destroy();
@@ -254,10 +245,10 @@ cc.Class({
             sumScoreLabel.getComponent("cc.Label").string = UserInfo.getTotalGold();
 
             this.updateSkinNode();
-            // window.indexBanner.hide();
+            UserInfo.destroyIndexBanner();
         } else if (optData == "false") {
             this.node.parent.getChildByName("SkinNode").active = false;
-            // window.indexBanner.show();
+            UserInfo.showIndexBanner();
         }
     },
 
@@ -339,7 +330,7 @@ cc.Class({
 
     onGuideBtn: function (event) {
         this.node.parent.getChildByName("Guide").active = false;
-        // window.indexBanner.show();
+        // UserInfo.showIndexBanner();
     },
 
     onNextBtn: function (event, optData) {
@@ -386,14 +377,6 @@ cc.Class({
     },
 
     onShareBtn: function () {
-        if (CC_WECHATGAME) {
-            var data = {
-                titleData: UserInfo.shareDesc,
-                imgurlData: UserInfo.shareUrl
-            }
-            WxCommon.ShareAppMessage(data, this, null);
-		}
-		
 		if (CC_QQPLAY) {
 			var data = {
                 titleData: UserInfo.shareDesc,
@@ -451,7 +434,5 @@ cc.Class({
         cc.audioEngine.playEffect(this.buttonAudio);
     }
 
-
-
     // update (dt) {},
 });

+ 32 - 4
assets/Script/UserInfoJS.js

@@ -27,10 +27,12 @@ window.UserInfo = {
 	},
 
 	setItem (key, value) {
-		if(CC_QQPLAY) {
-			BK.localStorage.setItem(key, value)
-		} else {
-			cc.sys.localStorage.setItem(key, value)
+		if(value) {
+			if(CC_QQPLAY) {
+				BK.localStorage.setItem(key, value.toString())
+			} else {
+				cc.sys.localStorage.setItem(key, value.toString())
+			}
 		}
 	},
 
@@ -336,4 +338,30 @@ window.UserInfo = {
 		var week = Math.ceil((d + 1) / 7);
 		return week;
 	},
+
+	showIndexBanner() {
+		this.indexBanner = BK.Advertisement.createBannerAd({
+            viewId:1001,
+            style: {x: 0, y: 0}
+		});
+
+		this.indexBanner.show()
+	},
+
+	destroyIndexBanner() {
+		this.indexBanner.destory()
+	},
+
+	showDeadBanner() {
+		this.deadBanner = BK.Advertisement.createBannerAd({
+            viewId:1002,
+            style: {x: 0, y: 0}
+		});
+
+		this.deadBanner.show()
+	},
+
+	destroyDeadBanner() {
+		this.deadBanner.destory()
+	},
 };