-
-
Notifications
You must be signed in to change notification settings - Fork 47
/
assets.dart
189 lines (171 loc) · 7.57 KB
/
assets.dart
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
import 'enums/enums.dart';
import 'extensions/string_extensions.dart';
class Assets {
static String dbPath = 'assets/db';
static String charactersDbPath = '$dbPath/characters.json';
static String weaponsDbPath = '$dbPath/weapons.json';
static String artifactsDbPath = '$dbPath/artifacts.json';
static String materialsDbPath = '$dbPath/materials.json';
static String elementsDbPath = '$dbPath/elements.json';
static String gameCodesDbPath = '$dbPath/game_codes.json';
static String monstersDbPath = '$dbPath/monsters.json';
static String translationsBasePath = 'assets/i18n';
//General
static String artifactsBasePath = 'assets/artifacts';
static String charactersBasePath = 'assets/characters';
static String characterFullBasePath = 'assets/characters_full';
static String skillsBasePath = 'assets/skills';
static String elementsBasePath = 'assets/elements';
static String noImageAvailableName = 'na.png';
//Weapons
static String weaponsBasePath = 'assets/weapons';
static String bowsBasePath = '$weaponsBasePath/bows';
static String catalystBasePath = '$weaponsBasePath/catalysts';
static String claymoresBasePath = '$weaponsBasePath/claymores';
static String polearmsBasePath = '$weaponsBasePath/polearms';
static String swordsBasePath = '$weaponsBasePath/swords';
//Items
static String itemsBasePath = 'assets/items';
static String commonBasePath = '$itemsBasePath/common';
static String elementalBasePath = '$itemsBasePath/elemental';
static String jewelsBasePath = '$itemsBasePath/jewels';
static String localBasePath = '$itemsBasePath/local';
static String talentBasePath = '$itemsBasePath/talents';
static String weaponBasePath = '$itemsBasePath/weapon';
static String weaponPrimaryBasePath = '$itemsBasePath/weapon_primary';
static String currencyBasePath = '$itemsBasePath/currency';
static String othersBasePath = '$itemsBasePath/others';
static String ingredientsBasePath = '$itemsBasePath/ingredients';
static String experienceBasePath = '$itemsBasePath/experience';
//Others
static String otherImgsBasePath = 'assets/others';
//Monsters
static String monstersImgsBasePath = 'assets/monsters';
static String getArtifactPath(String name) => '$artifactsBasePath/$name';
static String getCharacterPath(String name) => '$charactersBasePath/$name';
static String getCharacterFullPath(String name) => '$characterFullBasePath/$name';
static String getSkillPath(String name) {
if (name.isNullEmptyOrWhitespace) {
return '$othersBasePath/$noImageAvailableName';
}
return '$skillsBasePath/$name';
}
static String getOtherImgsPath(String name) => '$otherImgsBasePath/$name';
static String getMonsterImgPath(String name) => '$monstersImgsBasePath/$name';
static String getBowPath(String name) => '$bowsBasePath/$name';
static String getCatalystPath(String name) => '$catalystBasePath/$name';
static String getClaymorePath(String name) => '$claymoresBasePath/$name';
static String getPolearmPath(String name) => '$polearmsBasePath/$name';
static String getSwordPath(String name) => '$swordsBasePath/$name';
static String getCommonMaterialPath(String name) => '$commonBasePath/$name';
static String getElementalMaterialPath(String name) => '$elementalBasePath/$name';
static String getJewelMaterialPath(String name) => '$jewelsBasePath/$name';
static String getLocalMaterialPath(String name) => '$localBasePath/$name';
static String getTalentMaterialPath(String name) => '$talentBasePath/$name';
static String getWeaponMaterialPath(String name) => '$weaponBasePath/$name';
static String getWeaponPrimaryMaterialPath(String name) => '$weaponPrimaryBasePath/$name';
static String getCurrencyMaterialPath(String name) => '$currencyBasePath/$name';
static String getOtherMaterialPath(String name) => '$othersBasePath/$name';
static String getIngredientMaterialPath(String name) => '$ingredientsBasePath/$name';
static String getExperienceMaterialPath(String name) => '$experienceBasePath/$name';
static String getMaterialPath(String name, MaterialType type) {
switch (type) {
case MaterialType.common:
return getCommonMaterialPath(name);
case MaterialType.currency:
return getCurrencyMaterialPath(name);
case MaterialType.elementalStone:
return getElementalMaterialPath(name);
case MaterialType.jewels:
return getJewelMaterialPath(name);
case MaterialType.local:
return getLocalMaterialPath(name);
case MaterialType.talents:
return getTalentMaterialPath(name);
case MaterialType.weapon:
return getWeaponMaterialPath(name);
case MaterialType.weaponPrimary:
return getWeaponPrimaryMaterialPath(name);
case MaterialType.others:
return getOtherMaterialPath(name);
case MaterialType.ingredient:
return getIngredientMaterialPath(name);
case MaterialType.expCharacter:
case MaterialType.expWeapon:
return getExperienceMaterialPath(name);
default:
throw Exception('Invalid material type = $type');
}
}
static String getTranslationPath(AppLanguageType languageType) {
switch (languageType) {
case AppLanguageType.french:
case AppLanguageType.english:
return '$translationsBasePath/en.json';
case AppLanguageType.spanish:
return '$translationsBasePath/es.json';
case AppLanguageType.russian:
return '$translationsBasePath/ru.json';
case AppLanguageType.simplifiedChinese:
return '$translationsBasePath/zh_CN.json';
default:
throw Exception('Invalid language = $languageType');
}
}
static String getWeaponPath(String name, WeaponType type) {
switch (type) {
case WeaponType.bow:
return getBowPath(name);
case WeaponType.catalyst:
return getCatalystPath(name);
case WeaponType.claymore:
return getClaymorePath(name);
case WeaponType.polearm:
return getPolearmPath(name);
case WeaponType.sword:
return getSwordPath(name);
default:
throw Exception('Invalid language = $type');
}
}
static String getElementPath(String name) => '$elementsBasePath/$name';
static String getElementPathFromType(ElementType type) {
switch (type) {
case ElementType.anemo:
return getElementPath('anemo.png');
case ElementType.cryo:
return getElementPath('cryo.png');
case ElementType.dendro:
return getElementPath('dendro.png');
case ElementType.electro:
return getElementPath('electro.png');
case ElementType.geo:
return getElementPath('geo.png');
case ElementType.hydro:
return getElementPath('hydro.png');
case ElementType.pyro:
return getElementPath('pyro.png');
default:
throw Exception('Invalid element type = $type');
}
}
static ElementType getElementTypeFromPath(String path) {
return ElementType.values.firstWhere((type) => getElementPathFromType(type) == path);
}
static String getArtifactPathFromType(ArtifactType type) {
switch (type) {
case ArtifactType.clock:
return getMaterialPath('clock.png', MaterialType.others);
case ArtifactType.crown:
return getMaterialPath('crown.png', MaterialType.others);
case ArtifactType.flower:
return getMaterialPath('flower.png', MaterialType.others);
case ArtifactType.goblet:
return getMaterialPath('goblet.png', MaterialType.others);
case ArtifactType.plume:
return getMaterialPath('plume.png', MaterialType.others);
default:
throw Exception('Invalid artifact type = $type');
}
}
}