smartfoxserver2X入门指导翻译1

原文:http://docs2x.smartfoxserver.com/Overview/using-the-documentation

注:本文属个人学习使用,英文未过四级,纯个人感觉+google translate+有道 翻译出来的,勿喷。

How to use the documentation and examples

如何使用文档和例子

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.

本文档提供了一个快速,合理的方式来指导如何使用SmartFoxServer2x文档。我们推荐阅读例子和技术文章前首先阅读指导文章。

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等。

 The Examples

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.

SmartFoxServer 包含了很多简单的和复杂的例子,ActionScript 3Objective-C, Java 和 C#的都有,你能够学到基础的,并且快速发现更多有趣的东西和强大的特性。

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.

每一个例子都有客户端和服务端的源码,并且努力保持跟之前的例子保持连续性。

» The Java/AS3/C# doc

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

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 LoginRequestJoinRoomRequest,SendPublicMessageRequest and many more. There are also two separate subpackagesgame 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 server side

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包里,特别说明:

  • SFSApi: here you find dozens of methods for the most common server operations: login, create/remove rooms, send messages, join users, set variables, etc.
  • SFSAPI:在这里你能找到许多常用的业务方法:登录,创建或删除房间,发送消息,加入用户,设置变量等。
  • SFSGameApi: game specific API
  • SFSGameApi:针对游戏的API
  • SFSBuddyApi: buddy list specific API
  • SFSBuddyAPi:针对好友列表的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调用了,开发者不应该调用这些字段或方法,可能会发生意想不到的问题。


» Programming to interfaces

编程接口

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:

例子:

  • SFSZone implements Zone
  • SFSRoom implements Room
  • SFSUser implements User
  • SFSBuddy implements Buddy
  • SFSObject implements ISFSObject
  • SFSArray implements ISFSArray
  • SFSRoomVariable implements RoomVariable
  • SFSUserVariable implements UserVariable

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.

我们也鼓励你在自己的代码里使用这些接口,替换不同的实现是很方便的,未来也许我们会有新的实现,如果你遵守这些规则,将尽可能小的对你产生影响。

你可能感兴趣的:(教程,手册,smartfoxserver,sfs)