Blame view

docs/自动增长类变量实现.txt 1.14 KB
314bc5df   zhengshouren   提交服务器初始代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
  Role.magics = {
  	talentPoint = {
  		timestr = "talentLastTime",	-- timestamps
  		limit = function (role)
  			return globalCsv.talentPointLimit
  		end,
  		recover = "talentRecoveryTime", -- globaldefine
  		collectIn = "in_talentPoint",
  		collectOut = "out_talentPoint",
  		cycle = true, -- 回复满,是否复用时间
  	},-- 天赋点
  }
  
  方法:
  1. produce 生产
  
  2. consume 消费
  
  3. onRecoverTimer 定时更新
  
  4. onRecoverLogin 登录回复
  
  使用前准备:
  
  在 timestamp 类中添加 talentLastTime ,上次修改时间
  
  在 globaldefine 中添加 talentPointLimit ,添加上限值,如上,limit中是function 可以根据role的属性来调整上限值;例如可根据vip调整上限值
  
  在 globaldefine 中添加 talentRecoveryTime ,每(多少)个单位时间回复该值,这里默认以分钟为单位
  
  collectIn 和 out_talentPoint 变量 是日志字段
  
  cycle 是标志位 意思是 满了后消耗,会接着上次剩余时间回复该值
  
  ====================================================================
  
  对外提供接口
  
  role:produce(params)
  role:consume(params)
  
  params 可使用字段
  
  field
  
  delta
  
  cantOver
  
  notify