1、概述

1.1.目的

指导合作伙伴的HTML5工程师开发集成sgt平台开放能力。

2、准备

2.1.技术架构

使用jQuery库

2.2.引用jQuery和jsonrpc2.0

2.2.定义变量

var sgth5={

Appid:null,//zsd_sgp 应用标识

Appgateway:‘http://…………/route‘,//网关

Approutedata:null,//节点node

channelId:null,//标识

username:null,//用户

userpassword:null,//用户密码

userdata:null,//用户信息

playserverdata:null,//player服务器信息

};

用户使用前先填写Appid、Appgateway、channelId信息

2.2.定义对象

Player对象

var player=function(){this.customId=null,//String 自定义ID

this.equip=null,//String 装备

this.id=0,//String 主键

this.lastLoginTime=sgth5.userdata.lastLoginTime,this.level=null,//int 等级

this.name=null,//String 名字

this.serverId=sgth5.playserverdata.id,this.type=null,//String 类型

this.userId=sgth5.userdata.userid,this.vip=null;//int VIP 等级

};

mail对象

var mail=function(){this.attachment=null,//String 附件

this.content=null,//String 内容

this.fromId=null,//String 发送者ID

this.fromName=null,//String 发送者名称

this.id=null,//主键

this.sendTime=(new Date()).getTime(),//发送时间

this.status=0,//状态

this.title=null,//String 标题

this.toId=null,//String 接收者ID

this.toName=null,//String 接收者名称

this.type=0;//类型

};

ticke对象

var Ticke=function(){this.content=null,//反馈给后台的内容

this.createTime=(new Date()).getTime(),//提交时间

this.feedbackInfo=null,//处理完返回给提交者的信息

this.id=0,//主键

this.senderPlayerId=null,//提交者ID

this.status=1,//状态

this.targetPlayerId=null,//目标角色ID

this.title=null,//标题

this.type=1;//类型

};

3、接入流程

3.1.

url解释

Var backClient=new

$.JsonRpcClient({ajaxUrl: ${host}+‘/‘+ ${appid}+‘/${appServer}.do‘ });

3.2

API设计

sgth5.GetPlayerInfo=sgth5.Class.extend({

url:null,

playerId:null,

userData:null,

playerData:null,//当前角色信息

init:function(){if(sgth5.GetServer.userData==null){

console.log(‘There was an error:‘, ‘没有取得用户数据!‘);return false;

}if(sgth5.GetServer.playServerData==null){

console.log(‘There was an error:‘, ‘没获取角色服务器信息!‘);return false;

}this.userData=sgth5.GetServer.userData;this.url=sgth5.GetServer.playServerData.address+‘/‘+sgt.AppId+‘/sgpplayer.do‘;return true;

},/**创建角色

* playerinfo palyer对象

*

* obj 回调函数*/creatPlayer:function(playerinfo,obj){

playerinfo.lastLoginTime=this.userData.lastLoginTime;

playerinfo.serverId=sgth5.GetServer.playServerData.id;

playerinfo.userId=this.userData.userid;var backClient = new $.JsonRpcClient({ ajaxUrl: this.url });

backClient.call(‘create‘,

[playerinfo],function(result){

obj(true,result);

},function(error){

console.log(‘There was an error:‘, error);

obj(false,error.message);

}

);

}

……

});

sgth5.GetPlayerInfo.create=function(playerId){var ret = newsgth5.GetPlayerInfo();if(playerId!=null){

ret.playerId=playerId;

}if (ret &&ret.init())returnret;return null;

};

4、API定义

/**

* 获取获取注册或登录的服务器api*/sgth5.getnode={/**

* 获取user节点

* type String 类型

* obj 回调函数*/getRegisterServer:function(type,obj){

……

},/**

* 玩家注册

*

* obj 回调函数*/register:function(obj){

……

},/**

* 玩家登录

*

* obj 回调函数*/login:function(obj){

……

},/**

* 获取player服务器信息

*

* obj 回调函数*/getplayserver:function(obj){

……

}

};/**

* 玩家角色API*/sgth5.getplayerinfo={/**创建角色

* playerinfo palyer对象

*

* obj 回调函数*/creatplayer:function(playerinfo,obj){

……

},

……

……

};

sgth5.GetPlayerInfo.create=function(playerId){var ret = newsgth5.GetPlayerInfo();if(playerId!=null){

ret.playerId=playerId;

}if (ret &&ret.init())returnret;return null;

};/**

* 公告API*/sgth5.announcementinfo=sgth5.Class.extend({

……

……

});

sgth5.announcementinfo.create=function(playerId){

……

};/**

* 签到API*/sgth5.Checkininfo=sgth5.Class.extend({

……

……

});/**

* 排行榜API*/sgth5.LeaderBoardinfo=sgth5.Class.extend({

……

……

});/**

* 邮件API*/sgth5.Mailinfo=sgth5.Class.extend({

……

……

});/**

* 活动业务接口*/sgth5.Campaigninfo=sgth5.Class.extend({

……

……

});/**

* BOSS业务接口*/sgth5.Bossinfo=sgth5.Class.extend({

……

……

});/**

* 抽奖业务接口*/sgth5.GachaBoxinfo=sgth5.Class.extend({

……

……

});/**

* 黑名单业务接口*/sgth5.Blacklistinfo=sgth5.Class.extend({

……

……

});/**

* 好友业务接口*/sgth5.Friendshipinfo=sgth5.Class.extend({

……

……

});/**

* 反馈举报 业务接口*/sgth5.Tickeinfo=sgth5.Class.extend({

……

……

});

第一次开发设计SDK可能有很多不合理的地方,有大神可以指点一下!

原文:http://www.cnblogs.com/lady/p/3757823.html

html5游戏sdk开发,自用游戏HTML5 sdk技术设计手册相关推荐

  1. 基于cocoCreator版本2.4.5整理一款2D小游戏快速开发的游戏框架

    前言:基于cocoCreator版本2.4.5整理一款2D小游戏快速开发的游戏框架. 一.cocosCreator的UI框架. 中心思想, 将所有的UI窗体分为3类管理(1级窗体, 2级窗体, 3级窗 ...

  2. 游戏引擎开发涉及的知识和技术

    游戏引擎开发涉及的知识和技术 运行时引擎架构 可以看到游戏引擎架构由多个软件层组成,几乎涵盖了计算机软件所有方面的内容.这里也不可能将全部讲清,主要是讲些重要的.这里主要以unity为例. 1.物理引 ...

  3. GOOGLE VR SDK开发VR游戏,VR播放器之二

    之前简单说了CardBoardView的使用,这里写CardboardView.StereoRenderer的,使用上十分简单,和编写glsurface的Renderer一样导出有关的接口,使用OPG ...

  4. 用Flash、HTML5和Unity开发网页游戏的现实

    今天对于全球的Flash开发者来说是黑暗的一天,因为Adobe宣布将不再对移动设备上的浏览器进行Flash技术支持.在这之前,Adobe刚刚宣布了公司范围内的大幅度裁员.尽管这似乎并不是什么严重的问题 ...

  5. 细数那些年我们一起玩过的Unity3D游戏(unity开发的游戏有哪些)

    经典重现<新仙剑OL> <新仙剑OL>采用跨平台Unity3D引擎,耗资数千万,历时三年多,由台湾大宇正版授权,"仙剑之父"姚壮宪监制的全球首款Unity3 ...

  6. html5移动web开发简答题,HTML5移动Web开发简单知识点介绍

    原标题:HTML5移动Web开发简单知识点介绍 1 :基于HTML5的移动Web应用 Canvas绘图:通过获取HTML中的Dom元素Canvas,调用其渲染上下文的Context对象,使用Js进行图 ...

  7. GOOGLE VR SDK开发VR游戏,VR播放器之一

    最近一年来,VR虚拟现实和AR增强现实技术的宣传甚嚣尘上.其实VR,AR技术很早就有了,一直没有流行开来,不可否认价格是影响技术推广的最大壁垒.谷歌对VR最大的贡献是提供了廉价的谷歌眼镜,按照GOOG ...

  8. GOOGLE VR SDK开发VR游戏,VR播放器之中的一个

    近期一年来,VR虚拟现实和AR增强现实技术的宣传甚嚣尘上.事实上VR,AR技术非常早就有了,一直没有流行开来.不可否认价格是影响技术推广的最大壁垒. 谷歌对VR最大的贡献是提供了便宜的谷歌眼镜,依照G ...

  9. python有什么游戏可以开发-主流游戏引擎有哪些?python能开发手游?

    主流游戏引擎除了unity就是ue4,cocos2d-x坑越堆越多基本快成过去式了,至于其他霜寒等等实际各大游戏厂家都已经越来越少使用了.当然RPGmakerMV和GAMEMAKER这类其实也能占据一 ...

最新文章

  1. Accessing tools within a VB6 program - AE中使用VB调用Geoprocessing
  2. 质数,约数(数论) AcWing算法课
  3. try-with-resources引起的Socket关闭,产生java.net.SocketException: Socket is closed?
  4. php cookie控制提交频率
  5. 计算机网络期末复习提纲
  6. 02怎么取整php,php取整的几种方式
  7. MariaDB一之编译安装MariaDB、MariaDB初始化及MariaDB的图形化工具
  8. linux下的powerline安装教程
  9. ModuleNotFoundError: No module named ‘yaml‘
  10. 通用高拍仪软件_动态展示和教学 良田YL1050AF高拍仪评测
  11. Visual Studio 2017 配置AnkhSVN
  12. MySQL数据库主从同步,一致性解决方案
  13. 3DMAX渲染时,vray渲染有光斑、噪点?几招就解决。
  14. OO2019助教工作总结
  15. iPhone突然掉电快是什么情况,该如何解决?
  16. 使用redis的setnx可以非同一线程进行加锁和解锁(附源码)
  17. 万象优鲜生鲜配送系统源码 团队开发
  18. 网页多媒体服务器,大区网页直播间搭建,服务器流媒体全对接服务
  19. 【转载】Android提醒微技巧,你真的了解Dialog、Toast和Snackbar吗?
  20. 转载 NLS_LANG设置

热门文章

  1. php获取文件详细,PHP 获取文件内容
  2. JAVA三元表达式详解
  3. python抓包拦截_python实现抓包、解析流程,超过瘾!
  4. 贪心算法(导弹系统)
  5. 常见的框图方式有哪些?
  6. UltraISO软件
  7. 使用ajax前必须了解的知识
  8. 获取基站LAC CID
  9. HikariPool连接池配置
  10. html自动编号小圆点怎么实现,css如何实现自动编号?计数器的使用