blob: 253257648cc743439553d91bfa61899b034e63a1 (
plain)
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
104
105
106
107
108
109
110
111
112
113
114
|
using System;
using System.Collections.Generic;
using I2.Loc;
[Serializable]
public class Quest
{
public enum EType
{
BeatTheLevel = 0,
AchieveScoreOf = 2,
BeatTheLevelWith = 1,
BeatTheLevelWithout = 3
}
public EType questType;
public List<Equippable> beatTheLevelWith = new List<Equippable>();
public int achieveScoreOf;
public List<Equippable> beatTheLevelWithout = new List<Equippable>();
private bool IsBeatLevelWith => questType == EType.BeatTheLevelWith;
private bool IsAchieveScoreOf => questType == EType.AchieveScoreOf;
private bool IsBeatLevelWithout => questType == EType.BeatTheLevelWithout;
public bool CheckBeaten(LevelData _myLevelData)
{
switch (questType)
{
case EType.BeatTheLevel:
return _myLevelData.beatenBest;
case EType.AchieveScoreOf:
return _myLevelData.highscoreBest >= achieveScoreOf;
case EType.BeatTheLevelWith:
{
for (int k = 0; k < _myLevelData.levelHasBeenBeatenWith.Count; k++)
{
List<Equippable> list2 = _myLevelData.levelHasBeenBeatenWith[k];
int num = beatTheLevelWith.Count;
for (int l = 0; l < list2.Count; l++)
{
if (beatTheLevelWith.Contains(list2[l]))
{
num--;
}
if (num <= 0)
{
return true;
}
}
}
return false;
}
case EType.BeatTheLevelWithout:
{
for (int i = 0; i < _myLevelData.levelHasBeenBeatenWith.Count; i++)
{
List<Equippable> list = _myLevelData.levelHasBeenBeatenWith[i];
bool flag = true;
for (int j = 0; j < list.Count; j++)
{
if (beatTheLevelWithout.Contains(list[j]))
{
flag = false;
break;
}
}
if (flag)
{
return true;
}
}
return false;
}
default:
return false;
}
}
public string GetMissionStatement()
{
string result = "";
switch (questType)
{
case EType.AchieveScoreOf:
result = LocalizationManager.GetTranslation("Achieve Score") + " " + achieveScoreOf;
break;
case EType.BeatTheLevel:
result = LocalizationManager.GetTranslation("Achieve Victory");
break;
case EType.BeatTheLevelWith:
result = LocalizationManager.GetTranslation("Achieve Victory With");
foreach (Equippable item in beatTheLevelWith)
{
result = result + " " + item.displayName + " +";
}
result = result.Remove(result.Length - 1, 1);
break;
case EType.BeatTheLevelWithout:
result = LocalizationManager.GetTranslation("Achieve Victory Without");
foreach (Equippable item2 in beatTheLevelWithout)
{
result = result + " " + item2.displayName + " +";
}
result = result.Remove(result.Length - 1, 1);
break;
}
return result;
}
}
|