Skip to content

Navigation Menu

Sign in
Sign up

Commit 0105121

Browse files
README.md
1 parent 225893d commit 0105121

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,4 +305,22 @@ protected void RemoteCall(string remoteNode, string service, string method, byte
305305
* context:发起rpc调用,并要求回应的时候,需要保存的上下文环境变量,将被存储在这个结构内
306306
* cb:当被请求服务返回回应时,这个函数用于处理回应信息
307307
308-
具体例子可以参见Game目录下的Example,TestSender进程内的服务,如何向Battle进程内的服务发起远程RPC请求,并处理回应的。
308+
具体例子可以参见Game目录下的Example,TestSender进程内的服务,如何向Battle进程内的服务发起远程RPC请求,并处理回应的。
309+
310+
# 设置定时器
311+
SparkServer的ServiceContext基类,提供了一个设置定时器的函数Timeout函数,我们来看一下它的定义:
312+
313+
```
314+
// @context:要保存的上下文环境变量,这些变量用于在定时器触发时使用
315+
// @timeout:多少秒后触发这个定时器
316+
// @callback:定时器回调函数
317+
protected void Timeout(SSContext context, long timeout, TimeoutCallback callback)
318+
```
319+
320+
定时器回调函数,是当定时器触发时,要被调用的函数:
321+
322+
```
323+
delegate void TimeoutCallback(SSContext context, long currentTime);
324+
```
325+
326+
我们只需要遵循这样的格式即可。具体的例子可以参考Game/Process/TestSender/Sender.cs,Sender这个服务的调用方式。

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /