12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- import { RDPlatformManager } from "./RDPlatformManager";
- import { RDCommand } from "./RDCommand";
- import { RDAdsEntity } from "./RDAdsEntity";
- import { LOG_TAG, Log } from "../log/Log";
- export class RDSocialManager {
- public static readonly PAGE_COUNT: number = 100;
- private static _instance: RDSocialManager = new RDSocialManager();
-
- private lastRank: number = 0;
- private currentRank: number = 0;
- public static getInstance(): RDSocialManager {
- return this._instance;
- }
- public init(): void {
- Log.log(LOG_TAG.DEBUG,"[RDSocialManager] Init");
- this.updateRankInfo();
- }
- public setLastRank(rank: number): void {
- if(rank > 0){
- this.lastRank = rank;
- }
- }
- public setCurrentRank(rank: number): void {
- if (rank > 0) {
- this.currentRank = rank;
- }
- }
- public getRankUp(): number {
- if(this.lastRank <= 0){
- return this.currentRank;
- }
- return (this.lastRank - this.currentRank);
- }
- public getCurrentRank(): number {
- return this.currentRank;
- }
- public updateRankInfo(): void {
- RDPlatformManager.getInstance().sendData(RDCommand.CMD_GET_RANK, null);
- }
- public invite(completeCallback: (error: Error) => void): void {
- RDPlatformManager.getInstance().invite(completeCallback);
- }
- public submitScore(score: number, completeCallback: (error: Error) => void): void {
- if(score <= 0){
- return;
- }
- RDPlatformManager.getInstance().submitScore(score, completeCallback);
- }
- public share(score: number): void {
- RDPlatformManager.getInstance().sendData(RDCommand.CMD_SHARE, score);
- }
- /**
- * 开始录制视频
- * @param time 录制时间
- */
- public startRecordVideo(time){
- RDPlatformManager.getInstance().sendData(RDCommand.CMD_RECORDVIDEO,time);
- }
-
- public pauseRecordVideo(){
- RDPlatformManager.getInstance().sendData(RDCommand.CMD_STOPRECORDVIDEO,null);
- }
- public shareVideo(data: RDAdsEntity){
- RDPlatformManager.getInstance().sendData(RDCommand.CMD_SHAREVIDEO,data);
- }
- }
|