Merge branch 'zhuguoqing/dev' into 'master'

add friend

See merge request client/pubgv3!1
This commit is contained in:
zhuguoqing 2022-05-22 15:37:41 +08:00
commit a68805ba04
12 changed files with 6944 additions and 4408 deletions

View File

@ -47,8 +47,8 @@
}, },
"_scale": { "_scale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0.416015625, "x": 0.5703125,
"y": 0.416015625, "y": 0.5703125,
"z": 1 "z": 1
}, },
"_quat": { "_quat": {
@ -12654,7 +12654,7 @@
"__id__": 377 "__id__": 377
} }
], ],
"_active": false, "_active": true,
"_level": 2, "_level": 2,
"_components": [ "_components": [
{ {

File diff suppressed because it is too large Load Diff

View File

@ -31981,7 +31981,7 @@
"__id__": 662 "__id__": 662
}, },
"pb_friend": { "pb_friend": {
"__uuid__": "f5fe16a6-cbf6-489f-8f1d-dac0d59cba8c" "__uuid__": "1c680882-520e-49af-b19e-b28ac201d38e"
}, },
"_id": "" "_id": ""
}, },

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
{
"ver": "1.0.1",
"uuid": "cef03361-18fb-4a3d-a4fd-6babd3277617",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"subMetas": {}
}

View File

@ -0,0 +1,71 @@
cc.Class({
extends: cc.Component,
properties: {
addToBlack: {
default: null,
type: cc.Node,
},
delete: {
default: null,
type: cc.Node,
},
agree: {
default: null,
type: cc.Node,
},
refuse: {
default: null,
type: cc.Node,
},
addToFriend: {
default: null,
type: cc.Node,
},
playerHead: {
default: null,
type: cc.Node,
},
playerName: {
default: null,
type: cc.Node,
},
},
setToFriendList() {
this.addToBlack.active = true;
this.delete.active = true;
},
setToApplyList() {
this.agree.active = true;
this.refuse.active = true;
},
setToBlackList() {
this.addToFriend.active = true;
},
// friendlist
onAddToBlacklist() {
console.log("加入黑名单");
},
onDelete() {
console.log("删除好友");
},
// applylist
onAgree() {
console.log("同意申请");
},
onRefuse() {
console.log("拒绝申请");
},
// blacklist
onAddToFriend() {
console.log("加入好友列表");
},
});

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "10eaeefb-7816-45b9-a916-994bd57515fc",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -0,0 +1,141 @@
var SDKManage = require("SDKManage");
cc.Class({
extends: cc.Component,
properties: {
nd_friend: {
default: null,
type: cc.Node,
},
nd_apply: {
default: null,
type: cc.Node,
},
nd_blacklist: {
default: null,
type: cc.Node,
},
edit_find: {
default: null,
type: cc.EditBox,
},
pb_oneFriend: {
default: null,
type: cc.Prefab,
},
// contents
content_friend: {
default: null,
type: cc.Node,
},
content_apply: {
default: null,
type: cc.Node,
},
content_blacklist: {
default: null,
type: cc.Node,
},
},
onLoad() {
// get friendlist
cc.chatMgr.sendmsg("CMFriendList");
cc.Notifier.on("friendlist", this, this.getFriendList.bind(this));
this.setToFriend();
},
start() {},
setToNone() {
this.edit_find.string = "";
this.nd_friend.active = false;
this.nd_apply.active = false;
this.nd_blacklist.active = false;
},
testinitOne(index) {
for (let i = 0; i < 50; i += 1) {
const node = cc.instantiate(this.pb_oneFriend);
switch (index) {
case 0:
node.getComponent("SingleFriendList").setToFriendList();
this.content_friend.addChild(node);
break;
case 1:
node.getComponent("SingleFriendList").setToApplyList();
this.content_apply.addChild(node);
break;
case 2:
node.getComponent("SingleFriendList").setToBlackList();
this.content_blacklist.addChild(node);
break;
}
}
},
setToFriend() {
this.setToNone();
this.nd_friend.active = true;
this.testinitOne(0);
},
setToApply() {
this.setToNone();
this.nd_apply.active = true;
this.testinitOne(1);
},
setToBlackList() {
this.setToNone();
this.nd_blacklist.active = true;
this.testinitOne(2);
},
onClose() {
this.node.destroy();
},
onSearch() {
console.log(`search:${this.edit_find.string}`);
},
onClickToggle(event, data) {
switch (data) {
case "0":
this.setToFriend();
break;
case "1":
this.setToApply();
break;
case "2":
this.setToBlackList();
break;
}
},
getFriendList(msg) {
this.friend_list = [];
for (var m = 0; m < msg.friend_list.length; m++) {
this.friend_list.push(msg.friend_list[m]);
}
for (var i = this.friend_list.length - 1; i >= 0; i--) {
if (
this.friend_list[i].base_data["account_id"] ==
SDKManage.account_id
) {
this.friend_list.splice(i, 1);
break;
}
}
console.log(this.friend_list);
},
});

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "37ef4feb-9e80-4537-bda1-a246edae68d9",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -1,13 +1,13 @@
var jcfw = require('jcfw'); var jcfw = require("jcfw");
var Main = require('Main'); var Main = require("Main");
var Utils = require('Utils'); var Utils = require("Utils");
//var playerData = require("playerData") //var playerData = require("playerData")
var jcgamelog = jcfw.gamelog; var jcgamelog = jcfw.gamelog;
var jcshare = jcfw.share; var jcshare = jcfw.share;
var NetManage = require('NetManage'); var NetManage = require("NetManage");
var urlbuilder = require('urlbuilder'); var urlbuilder = require("urlbuilder");
var httpclient = require('httpclient'); var httpclient = require("httpclient");
var wxVoice = require('wxVoice'); var wxVoice = require("wxVoice");
cc.interstitialAdTime = 0; cc.interstitialAdTime = 0;
cc.notreward = 0; cc.notreward = 0;
var toCodePoint = function (unicodeSurrogates) { var toCodePoint = function (unicodeSurrogates) {
@ -43,10 +43,10 @@ var SDKManage = function () {
this.isoffical = Main.config.mainConfig.isoffical; this.isoffical = Main.config.mainConfig.isoffical;
this.checking = false; this.checking = false;
this.gameId = 2006; this.gameId = 2006;
this.nickName = 'test'; this.nickName = "test";
this.avatarUrl = ''; this.avatarUrl = "";
this.NodeId = 1; this.NodeId = 1;
this.session_id = ''; this.session_id = "";
this.m_hiID = 18001; this.m_hiID = 18001;
this.account_id = 0; //玩家账号ID this.account_id = 0; //玩家账号ID
@ -54,16 +54,16 @@ var SDKManage = function () {
// playerData.SDKManage = this // playerData.SDKManage = this
this.getplayerdata = function () { this.getplayerdata = function () {
if (!this.playerData) { if (!this.playerData) {
this.playerData = require('playerData'); this.playerData = require("playerData");
} }
return this.playerData; return this.playerData;
}; };
this.sixstr = function (str, maxChars, suffix) { this.sixstr = function (str, maxChars, suffix) {
if (str == '' || str == null) { if (str == "" || str == null) {
return ' '; return " ";
} }
maxChars = maxChars == null ? 6 : maxChars; maxChars = maxChars == null ? 6 : maxChars;
suffix = suffix == null ? '...' : suffix; suffix = suffix == null ? "..." : suffix;
maxChars *= 2; maxChars *= 2;
var codeArr = toCodePoint(str); var codeArr = toCodePoint(str);
@ -114,15 +114,15 @@ var SDKManage = function () {
}; };
this.compareVersion = function (v1, v2) { this.compareVersion = function (v1, v2) {
v1 = v1.split('.'); v1 = v1.split(".");
v2 = v2.split('.'); v2 = v2.split(".");
const len = Math.max(v1.length, v2.length); const len = Math.max(v1.length, v2.length);
while (v1.length < len) { while (v1.length < len) {
v1.push('0'); v1.push("0");
} }
while (v2.length < len) { while (v2.length < len) {
v2.push('0'); v2.push("0");
} }
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
@ -144,7 +144,7 @@ var SDKManage = function () {
this.logincbarr[this.loginStep](res); this.logincbarr[this.loginStep](res);
this.loginStep++; this.loginStep++;
} else { } else {
this.logEvent('loginend', '登录完成'); this.logEvent("loginend", "登录完成");
var lgtime = Number(new Date().getTime() - this.gameloginstartime); var lgtime = Number(new Date().getTime() - this.gameloginstartime);
jcgamelog.logEnterMainScene(lgtime); jcgamelog.logEnterMainScene(lgtime);
@ -155,13 +155,13 @@ var SDKManage = function () {
this.gamelogin = function () { this.gamelogin = function () {
// this.time1 = new Date().getTime() // this.time1 = new Date().getTime()
var token = cc.sys.localStorage.getItem('token'); var token = cc.sys.localStorage.getItem("token");
var self = this; var self = this;
if (!token || token == '') { if (!token || token == "") {
token = jcfw.makeUUID(); token = jcfw.makeUUID();
try { try {
cc.sys.localStorage.setItem('token', token); cc.sys.localStorage.setItem("token", token);
} catch (e) {} } catch (e) {}
} }
@ -169,14 +169,14 @@ var SDKManage = function () {
(res) => { (res) => {
cc.channelid = res.channel; cc.channelid = res.channel;
self.hasLogin = true; self.hasLogin = true;
self.logEvent('gamelogin', '游戏登录成功'); self.logEvent("gamelogin", "游戏登录成功");
self.account_id = res.account_id; self.account_id = res.account_id;
self.session_id = res.session_id; self.session_id = res.session_id;
self.openid = res.openid; self.openid = res.openid;
localStorage.setItem('loginaccount', res.account_id); localStorage.setItem("loginaccount", res.account_id);
localStorage.setItem('loginsession', res.session_id); localStorage.setItem("loginsession", res.session_id);
self.doLogin(); self.doLogin();
}, },
@ -237,10 +237,10 @@ var SDKManage = function () {
var self = this; var self = this;
var cb = function (obj) { var cb = function (obj) {
cc.playerData.refreshInfo(obj.info); cc.playerData.refreshInfo(obj.info);
self.logEvent('getUserInfo', '获取用户信息成功'); self.logEvent("getUserInfo", "获取用户信息成功");
self.initFriendInfo(); self.initFriendInfo();
self.doLogin(); self.doLogin();
console.log('改名次数:' + obj.info.rename_count); console.log("改名次数:" + obj.info.rename_count);
if (obj.info.rename_count == 0) { if (obj.info.rename_count == 0) {
window.canrename = true; window.canrename = true;
} else { } else {
@ -261,8 +261,8 @@ var SDKManage = function () {
NetManage.getNodeID(() => {}); NetManage.getNodeID(() => {});
// NetManage.getTime(() => {}) // NetManage.getTime(() => {})
console.log('start init 6516'); console.log("start init 6516");
self.logEvent('initNetManage', '初始化人物信息'); self.logEvent("initNetManage", "初始化人物信息");
setTimeout(() => { setTimeout(() => {
self.doLogin(); self.doLogin();
}, 10); }, 10);
@ -271,7 +271,7 @@ var SDKManage = function () {
this.getGameConfig = function () { this.getGameConfig = function () {
var self = this; var self = this;
var cb = function (res2) { var cb = function (res2) {
self.logEvent('getGameConfig', '获取配置信息成功'); self.logEvent("getGameConfig", "获取配置信息成功");
var res = {}; var res = {};
for (var i = 0; i < res2.length; i++) { for (var i = 0; i < res2.length; i++) {
res[res2[i].key] = res2[i].value; res[res2[i].key] = res2[i].value;
@ -287,7 +287,7 @@ var SDKManage = function () {
//cb(this.config) //cb(this.config)
jcfw.cloud.getConfig('', cb, cbf); jcfw.cloud.getConfig("", cb, cbf);
}; };
this.checkRate = function (nubmer) { this.checkRate = function (nubmer) {
@ -303,15 +303,15 @@ var SDKManage = function () {
if (CC_JSB) { if (CC_JSB) {
if (!v) { if (!v) {
v = ''; v = "";
} }
if (cc.sys.os == cc.sys.OS_ANDROID) { if (cc.sys.os == cc.sys.OS_ANDROID) {
//反射调用原生的隐藏方法 //反射调用原生的隐藏方法
jsb.reflection.callStaticMethod( jsb.reflection.callStaticMethod(
'org/cocos2dx/javascript/AppActivity', "org/cocos2dx/javascript/AppActivity",
'logEvent', "logEvent",
'(Ljava/lang/String;Ljava/lang/String;)V', "(Ljava/lang/String;Ljava/lang/String;)V",
k + '', k + "",
v v
); );
} }
@ -320,21 +320,21 @@ var SDKManage = function () {
this.getBattleCounts = function () { this.getBattleCounts = function () {
var count = 0; var count = 0;
var scount = cc.sys.localStorage.getItem('battleCount'); var scount = cc.sys.localStorage.getItem("battleCount");
var today = new Date(); var today = new Date();
var datakey = today.getMonth() + '-' + today.getDate(); var datakey = today.getMonth() + "-" + today.getDate();
var savedata = cc.sys.localStorage.getItem('datakey'); var savedata = cc.sys.localStorage.getItem("datakey");
if (savedata != datakey) { if (savedata != datakey) {
try { try {
cc.sys.localStorage.setItem('datakey', datakey); cc.sys.localStorage.setItem("datakey", datakey);
} catch (err) {} } catch (err) {}
try { try {
cc.sys.localStorage.setItem('battleCount', 0); cc.sys.localStorage.setItem("battleCount", 0);
} catch (err) {} } catch (err) {}
scount = null; scount = null;
} }
if (scount != null && scount != '') { if (scount != null && scount != "") {
count = parseInt(scount); count = parseInt(scount);
} }
return count; return count;
@ -342,7 +342,7 @@ var SDKManage = function () {
this.saveBattleCount = function () { this.saveBattleCount = function () {
var count = this.getBattleCounts() + 1; var count = this.getBattleCounts() + 1;
try { try {
cc.sys.localStorage.setItem('battleCount', count); cc.sys.localStorage.setItem("battleCount", count);
} catch (err) {} } catch (err) {}
}; };
@ -354,7 +354,7 @@ var SDKManage = function () {
this.initGameRes = function () //初始化进入游戏前数据 this.initGameRes = function () //初始化进入游戏前数据
{ {
wxVoice.playbgm('bgm'); wxVoice.playbgm("bgm");
cc.battleCache.loadwave(); cc.battleCache.loadwave();
cc.highmode = true; cc.highmode = true;
//SDKManage.nickName = "战斗测试" //SDKManage.nickName = "战斗测试"