原文:http://docs2x.smartfoxserver.com/Overview/using-the-documentation java
注:本文属我的学习使用,英文未过四级,纯我的感受+google translate+有道 翻译出来的,勿喷。 编程
This document provides a quick tutorial on how to obtain the best from the provided SmartFoxServer 2X (aka SFS2X) documentation. Our first recommendation is to consult the articles provided in this section before proceeding with the examples and technical docs. api
本文档提供了一个快速,合理的方式来指导如何使用SmartFoxServer2x文档。咱们推荐阅读例子和技术文章前首先阅读指导文章。 app
Whether you are a seasoned SmartFox developer or you have just moved your first step in the multiplayer world, you will find the initial articles particularly useful to get started. The Getting Started section will guide you in the client and server setup phase while the Advanced Topics section provides an insight on the new Extension system, the server API and lots more. 框架
不管你是一个经验丰富的smarfox开发者,仍是刚刚步入多人游戏世界,你都将发现引导文章在开始阶段对你是很是有用的。Getting Started 这部分文章将在client和server方面指导你逐步前进。Advanced Topics这部分文章将讲解更深层的扩展系统,server api等。 ide
We're strong advocates of our patent-pending Learning-While-Doing™ methodology. Of course we are kidding about the patent thing, but we are serious about learning by following a series of examples of increasing complexity. 学习
在学习的过程当中,咱们坚定维护咱们的专利权利,固然这是咱们开的一个玩笑,但咱们是认真的推荐学习一系列逐渐复杂的例子。 测试
SmartFoxServer comes packed full with simple and advanced examples made in ActionScript 3, Objective-C, Java and C#, where you can learn the very basics and quickly move to the more interesting and powerful features. ui
SmartFoxServer 包含了不少简单的和复杂的例子,ActionScript 3,Objective-C, Java 和 C#的都有,你可以学到基础的,而且快速发现更多有趣的东西和强大的特性。 this
Each example comes with source code for both client and server side and attempts to build on the previous examples in the serie to provide a sense of continuity.
每个例子都有客户端和服务端的源码,而且努力保持跟以前的例子保持连续性。
Once you have gotten an idea of what the new SmartFoxServer 2X can do for you and tested some of the examples, you will be probably eager to start playing with the API and prototyping some ideas. This is of course the moment where the ActionScript/C#/etc docs (client) and Javadoc (server) will come in handy.
你可以了解到新的SmartFoxServer 2X可以为你作什么,和一些测试例子,你或许想要开始使用API而且了解其设计模型,ActionScript/C#/etc docs (client) and Javadoc (server)会使这变得更容易。
Below follows a list of tips to get started with API without getting lost in the host of packages and classes that you will encounter.
下面是一个API的列表,防止你迷失在包和类中。
The client-side API main object is the SmartFox class, found in the com.smartfoxserver.v2 (AS3), Sfs2X(C#) or sfs2x.client (Java) package. This is the main entry point of the client API. This object allows you to manage your event listeners, start a connection and send requests via the send() method.
client-side API 是SmartFox最主要的类,它在com.smartfoxserver.v2 (AS3), Sfs2X(C#) or sfs2x.client (Java)包里,这是客户端的入口API,它允许你管理本身的事件监听器,开启一个链接,和发送一个请求,用send()方法。
Another important section of the client framework is thecom.smartfoxserver.v2.requests (AS3),Sfs2X.Requests (C#) or sfs2x.client.requests (Java) package. Here you will find dozens of different classes, each one representing a specific client request such as LoginRequest, JoinRoomRequest,SendPublicMessageRequest and many more. There are also two separate subpackages, game andbuddylist (Game and Buddylist for C# API), where you can find advanced API for building games and managing buddy lists respectively.
客户端另外一个重要的包是com.smartfoxserver.v2.requests (AS3),Sfs2X.Requests (C#) or sfs2x.client.requests (Java) ,这里你能找到许多不一样的类,每个表明一个特定的客户端请求,好比用户登陆请求LoginRequest, 加入房间请求JoinRoomRequest,发送公共消息请求SendPublicMessageRequest等。
The classes that act as entry points to the server-side API are found in the com.smartfoxserver.v2.apipackge. Specifically:
做为server-side API的入口类在com.smartfoxserver.v2.api包里,特别说明:
IMPORTANT NOTE
While browsing the Javadoc you might at times find fields or methods with little to no documentation. Besides a few exceptions due to the current state of the documentation, this is done on purpose to indicate that these methods shouldn't be used directly. The API classes already use these lower level methods for you behind the scenes and you don't have to deal with them directly. Using them might break the proper SFS2X functioning.
请注意
当你浏览javadoc的时候,你可能会发现有些字段或方法没有文档内容,这是由于这些字段,方法在底层被SFS调用了,开发者不该该调用这些字段或方法,可能会发生意想不到的问题。
编程接口
In general, throughout the client and server API, you will notice that all important classes of the framework are backed by an interface.
通常状况下,经过客户端和服务端的API,你可以了解框架全部重要的类的接口。
For instance:
例子:
You will also notice that the whole framework uses these interfaces in almost each and every method signature or return type.
你也能了解整个框架使用的接口,和每个方法名,返回类型。
We would like to encourage and emphasize the use of these interfaces in your code too. The reason is that this helps swapping different implementations easily and without side effects. In future release we might introduce new implementations to these interfaces which will affect your code minimally if you stick to this habit as much as possible.
咱们也鼓励你在本身的代码里使用这些接口,替换不一样的实现是很方便的,将来也许咱们会有新的实现,若是你遵照这些规则,将尽量小的对你产生影响。