-
Notifications
You must be signed in to change notification settings - Fork 1
/
WonderModel.cs
88 lines (81 loc) · 2.15 KB
/
WonderModel.cs
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using NewGameMode.Diffculty;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewGameMode
{
public class WonderModel
{
private static WonderModel _instance;
public int money;
private WonderModel()
{
}
public static WonderModel instance
{
get
{
if (WonderModel._instance == null)
{
WonderModel._instance = new WonderModel();
}
return WonderModel._instance;
}
}
public void Init()
{
this.money = 0;
}
/*
public Dictionary<string, object> GetSaveData()
{
return new Dictionary<string, object>
{
{
"wonder",
this.money
}
};
}
*/
public void LoadData(Dictionary<string, object> dic)
{
GameUtil.TryGetValue<int>(dic, "wonder", ref this.money);
}
public bool EnoughCheck(int cost)
{
return this.money >= cost;
}
public void Add(int added)
{
var nowDifficulty = DifficultyManager.GetNowDifficulty();
float wonderTimes = nowDifficulty.WonderTimes();
foreach (var meme in MemeManager.instance.current_list)
{
wonderTimes += meme.script.WonderTimes();
}
int wonderAdder = nowDifficulty.WonderAdder();
foreach (var meme in MemeManager.instance.current_list)
{
wonderAdder += meme.script.WonderAdder();
}
int realAdded = (int)(Math.Round(added * wonderTimes)) + wonderAdder;
this.money += realAdded;
if (this.money < 0)
{
this.money = 0;
}
}
public bool Pay(int cost)
{
if (this.money >= cost)
{
this.money -= cost;
return true;
}
return false;
}
}
}