123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- import { AccountManager } from "./AccountManager";
- //用户user数据
- export enum AccountUser{buyed_kun,diamond,equip_themes,favorite_times,game_times,get_themes,list_kun,moeny,progress_themes,revival,stage }
- export class PlayerData {
- constructor(_token: string, _config: Object, _appSetting: Object, _user: Object, _userbase: Object, _useInvite: any[], _user_stage: Object = null, _user_sign, _user_achievement,lottery) {
- this.zhengshu = _token;
- //this.peizhis = _config;
- this.netzheshe = _appSetting;
- this.account = _user;
- this.accountssss = _userbase;
- this.qiandao = _user_sign;
- this.renwu = _user_achievement;
- this.userId = this.account["user_id"];
- this.openid = this.accountssss["openid"];
- this.m_invite = _useInvite;
- this.lottery=lottery;
- console.log("user_id:" + this.userId);
- }
- public zhengshu: string;
- public peizhis: Object;
- public netzheshe: Object;
- public account: Object;
- public accountssss: Object;
- public qiandao: Object;
- public renwu: Object;
- public openid: string = "";
- public userId: string = "";
- public m_invite: any[];
- public lottery: any;
-
- public GainCollocation(_type: string): any {
- return this.peizhis[_type];
- }
- public GainAccount(_type: string) {
- return this.account[_type];
- }
- public get fenxiang(): boolean {
- return this.netzheshe["share"] == "1";
- }
- public get fenxiangneirong(): string {
- return this.netzheshe["sharecontent"];
- }
- public get fuhuocishu(): number {
- return Number(this.netzheshe["revivenum"]);
- }
- public get wudishijian(): number {
- return Number(this.netzheshe["Invincibletime"]);
- }
- public get wudaoshijian() {
- return Number(this.netzheshe["cheattime"]);
- }
- public get banner(): boolean {
- return this.netzheshe["banner"] == "1";
- }
- public get video(): boolean {
- return this.netzheshe["video"] == "1";
- }
- public get wudao(): boolean {
- return this.netzheshe["cheat"] == "1";
- }
- public get jiancechangjin(): boolean {
- return this.netzheshe["checkscence"] == 1;
- }
- public get reviverate(): number {
- return Number(this.netzheshe["revive"]);
- }
- public get uintid() {
- return this.netzheshe["uintid"];
- }
- public get music(): boolean {
- return this.netzheshe["music"] == "1";
- }
- public get skin(): boolean {
- return this.netzheshe["skinget"] == "1";
- }
- public get aicheatspeed(): number {
- return Number(this.netzheshe["aicheatspeed"]);
- }
- public get aispeedtime(): number {
- return Number(this.netzheshe["aispeedtime"]);
- }
- public get videoshare(): boolean {
- return this.netzheshe["videoshare"] == "1";
- }
- public get trial(): boolean {
- return this.netzheshe["trial"] == "1";
- }
- public get invite(): boolean {
- return this.netzheshe["invite"] == 1;
- }
- public get re(): boolean {
- return this.netzheshe["re"] == 1;
- }
- public get autosign(): boolean {
- return this.netzheshe["autosign"] == 1;
- }
- public get showgift(): boolean {
- return this.netzheshe["showgift"] == 1;
- }
- public get showshop(): boolean {
- return this.netzheshe["showshop"] == 1;
- }
- public get lotteryTimer(): Number {
- if(this.netzheshe["lotteryTimer"]) return Number(this.netzheshe["lotteryTimer"]);
- return 0;
- }
- //获取高度线
- public get falldownline():number{
- return this.netzheshe["FallDownLine"];
- }
- //获取球的弹性值
- public get Restitution():number{
- return this.netzheshe["restitution"];
- }
- //获取球合成的速度
- public get MergeSpeed():number{
- return this.netzheshe["MergeSpeed"]
- }
- //获取失败检测的时间间隔
- public get CheckLose():number{
- return this.netzheshe["CheckLose"]
- }
- //获取存档的时间间隔
- public get Save():number{
- return this.netzheshe["Save"]
- }
- //获取新手指引关高度线
- public get GuideHeight():number{
- return this.netzheshe["GuideHeight"]
- }
- //获取震动消除数量
- public get ShakeNum():number{
- return this.netzheshe["ShakeNum"];
- }
- //获取球球之间的消除间隔距离
- public get Distance():number{
- return this.netzheshe["Distance"]
- }
- //获取球的溢出线
- public get OverRun():number{
- return this.netzheshe["OverRun"]
- }
- public get touchsize():number
- {
- return Number(this.netzheshe["touchsize"]);
- }
- public get touchsmoothness():number
- {
- return Number(this.netzheshe["touchsmoothness"]);
- }
- public jianglidic: { [key: string]: any } = {};
- public shitidic: { [key: string]: any } = {};
- public chengjiuliebiao: { [key: string]: any } = {};
- public GainQinDao(_key: string) {
- return this.qiandao[_key];
- }
- public GainShiTi(_key: string, shuxing: string) {
- return this.shitidic[_key][shuxing];
- }
- public GainJiangLi(_rewardid: number): any {
- var reward = this.jianglidic[_rewardid];
- return reward;
- }
- //获取各道具数量
- public GetPropNum(_index:number) {
- var type = this.account["functions"];
- var num = type[_index.toString()];
- if(num){
- return num
- }
- else{
- return 0;
- }
- }
- /** 判断玩家是否含有角色*/
- public HasRole(_id: number): boolean {
- var data = this.GainAccount("get_themes");
- for (var i = 0; i < data.length; i++) {
- var hd = data[i];
- if (_id == hd) {
- return true;
- }
- }
- return false;
- }
- /** 判断玩家是否含有枪械*/
- public HasGun(_id: number): boolean {
- var data = this.GainAccount("functions");
- for (var i = 0; i < data.length; i++) {
- var hd = data[i];
- if (_id ==hd ) {
- return true;
- }
- }
- return false;
- }
- /**返回玩家看视频获得角色及枪械的进度 */
- public GetProgress(_id:number):number{
- var config = this.account["progress_themes"];
- var progress = config[_id] ? config[_id] : 0;
- return progress;
- }
-
- GetJiangLiLieBiao() {
- var peiz = this.GainCollocation("rewards");
- for (var key in peiz) {
- this.jianglidic[peiz[key].id] = peiz[key];
- }
- }
- GetShiTiLieBiao() {
- var peiz = this.GainCollocation("entity");
- for (var key in peiz) {
- this.shitidic[peiz[key].entity_id] = peiz[key];
- }
- }
- GetChengJiuLieBiao() {
- var shujiu = this.GainCollocation("achievement");
- var aadsadsdas = {};
- for (var key1 in shujiu) {
- var type1 = shujiu[key1].type;
- //var obj = {};
- if (aadsadsdas[type1]) {
- continue;
- }
- var fasas = [];
- for (var key2 in shujiu) {
- var type2 = shujiu[key2].type;
- if (type1 == type2) {
- fasas.push(shujiu[key2]);
- }
- }
- aadsadsdas[type1] = fasas;
- }
- this.chengjiuliebiao = aadsadsdas;
- }
- }
|