原文: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.
咱們也鼓勵你在本身的代碼裏使用這些接口,替換不一樣的實現是很方便的,將來也許咱們會有新的實現,若是你遵照這些規則,將盡量小的對你產生影響。