-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWonderModel.cs
More file actions
103 lines (94 loc) · 2.56 KB
/
WonderModel.cs
File metadata and controls
103 lines (94 loc) · 2.56 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using NewGameMode.Diffculty;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
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(int wonder)
{
this.money = wonder;
}
/*
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;
}
Harmony_Patch.dayResult[4] += realAdded;
}
public bool Pay(int cost)
{
if (this.money >= cost)
{
this.money -= cost;
return true;
}
return false;
}
}
/// <summary>
/// 更新奇思数量
/// </summary>
public class UpdateWonder : MonoBehaviour
{
void Update()
{
base.gameObject.GetComponent<Text>().text = LocalizeTextDataModel.instance.GetText("Meme_Wonder") + ":" + WonderModel.instance.money;
}
}
}