Photon——Extending Lite 扩展Lite
2013-05-15 13:52
176 查看
Extending Lite 扩展Lite
Persistency is currently not covered in the SDKs we provide. None of our applications saves any data. Every game and application is different and on a high performance server solution, you probably want to control this aspect yourself.持久性是目前没有包含在我们提供的sdk里。我们没有应用程序要保存任何数据。在高性能服务器解决方案中每个游戏和应用程序都是不同的,你可能想要控制这个方面通过你自己。
You are free to use any of the many professional solutions developed in C#. As example, take a look at:
NHibernate : Mature, open source object-relational mapper for the .NET framework
Membase : Distributed key-value database management system
CSharp-SQLite : SQL database in a local file
Lightspeed : High performance .NET domain modeling and O/R mapping framework
你可以自由的使用任何专业的基于C#的开发解决方案。例如:
NHibernate:成熟的,开放源的对象关系映射器的
Membase:分布式数据库键值管理系统
CSharp-SQLite:SQL数据库在一个本地文件
Lightspeed:高性能建模和O/R映射框架
Trigger Game-Logic In Intervals 在时间间隔触发游戏逻辑
If you want your server application to execute some logic in intervals, add this as method into LiteGame and schedule a message for the room. By using a message, the method call will be in sequence with any operations (avoiding threading issues).In the Lite Lobby Application’s LiteLobbyRoom.cs we used this code:如果你想让你的服务器应用程序在时间间隔内执行某些逻辑,添加这个方法到LiteGame和安排房间的消息。通过使用一个消息,方法调用将带着任何操作入队 (避免线程问题)。在Lite Lobby应用程序的LiteLobbyRoom.cs中我们使用这些代码:
/// <summary>Schedules a broadcast of all changes.</summary>
private
void
SchedulePublishChanges()
{
var
message =
new
RoomMessage((
byte
)LobbyMessageCode.PublishChangeList);
this
.schedule =
this
.ScheduleMessage(message, LobbySettings.Default.LobbyUpdateIntervalMs);
}
/// <summary>Initializes a new instance of the LiteLobbyRoom class.</summary>
public
LiteLobbyRoom(
string
lobbyName)
:
base
(lobbyName)
{
this
.roomList =
new
Hashtable();
this
.changedRoomList =
new
Hashtable();
// schedule sending the change list
this
.SchedulePublishChanges();
}
/// <summary>Sends the change list to all users in the lobby and then clears it.</summary>
private
void
PublishChangeList()
{
//do something in intervals...
//schedule the next call!
this
.SchedulePublishChanges();
}
As you can see, at the end of PublishChangeList the next call is scheduled explicitly.
我们可以看到,在PublishChangeList 的最后安排了下一个调用。
相关文章推荐
- Extending and Embedding PHP-扩展和移植PHP(九)
- 编写Python扩展(Extending Python with C or C++)
- 利用 Cache_Lite代替codeigniter中的cache功能, --- ci 缓存扩展
- Extending and Embedding PHP-扩展和移植PHP(七)
- 扩展和嵌入Python 解释器(Extending and Embedding the Python Interpreter)--摘要
- 扩展和嵌入Python 解释器(Extending and Embedding the Python Interpreter)--第一章
- Tutorial:Extending Ext2 Class (扩展EXT2组件类)-修改版
- Multi-Language Programming - Extending Flash Lite with Java ME or Symbian C++
- 自已扩展EXT组件(Extending Ext Components)
- Tutorial:Extending Ext2 Class (扩展EXT2组件类)
- Overloading,overriding,and extending functions and events 重载,重写和扩展函数和事件
- 扩展PHP[Extending PHP](一)
- 用C/C++扩展Python(Extending Python with C or C++)
- Photon官方Lite类中Lite Concepts
- 用C/C++扩展Python(Extending Python with C or C++)
- Extending and Embedding PHP-扩展和移植PHP(六)
- 创建和扩展Flex 2组件(Creating and Extending Flex 2 Components)学习笔记
- megento api soap xmlrpc接口 自定义扩展 Creating a Custom API or Extending the Core API
- Extending and Embedding PHP-扩展和移植PHP(八)
- Photon——Lite Lobby Chat Demo Lite大厅的聊天演示