Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
HitSummary.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using UnityEngine;
3
4public class HitSummary : EClass
5{
6 public int money;
7
8 public int count;
9
10 public int countValid;
11
12 public Recipe recipe;
13
14 public List<IInspect> targets = new List<IInspect>();
15
16 public List<InspectGroup> groups = new List<InspectGroup>();
17
18 public Thing factory;
19
20 public bool hasFactory;
21
22 public void Clear()
23 {
24 money = (count = (countValid = 0));
25 targets.Clear();
26 groups.Clear();
28 }
29
30 public void SetRecipe(Recipe r)
31 {
32 recipe = r;
33 hasFactory = true;
34 if (r != null && !r.UseStock && r.source.NeedFactory)
35 {
36 PropSet propSet = EClass._map.Installed.cardMap.TryGetValue(r.source.idFactory);
37 if ((propSet == null || propSet.Count == 0) && EClass.pc.things.Find((Thing t) => t.id == r.source.idFactory) == null)
38 {
39 hasFactory = false;
40 }
41 }
42 }
43
44 public bool CanExecute()
45 {
47 {
48 return true;
49 }
51 {
52 return false;
53 }
55 {
56 return true;
57 }
58 if (recipe != null)
59 {
60 if (!recipe.UseStock)
61 {
62 Dictionary<Thing, int> dictionary = new Dictionary<Thing, int>();
63 foreach (Recipe.Ingredient ingredient in recipe.ingredients)
64 {
65 if (ingredient.thing != null)
66 {
67 if (!dictionary.ContainsKey(ingredient.thing))
68 {
69 dictionary.Add(ingredient.thing, 0);
70 }
71 dictionary[ingredient.thing] += ingredient.req * countValid;
72 }
73 }
74 foreach (KeyValuePair<Thing, int> item in dictionary)
75 {
76 if (item.Key.Num < item.Value)
77 {
78 return false;
79 }
80 }
81 foreach (Recipe.Ingredient ingredient2 in recipe.ingredients)
82 {
83 if (!ingredient2.optional)
84 {
85 if (ingredient2.thing == null)
86 {
87 return false;
88 }
89 if (ingredient2.thing.Num < ingredient2.req * countValid)
90 {
91 return false;
92 }
93 }
94 }
95 }
96 else if (recipe.ingredients[0].thing == null || recipe.ingredients[0].thing.Num < countValid)
97 {
98 return false;
99 }
100 }
101 return true;
102 }
103
104 public void Execute()
105 {
107 {
109 }
110 if (recipe == null || (recipe.UseStock && !recipe.VirtualBlock))
111 {
112 return;
113 }
115 {
117 }
119 {
120 return;
121 }
122 foreach (Recipe.Ingredient ingredient in recipe.ingredients)
123 {
124 Thing thing = (recipe.UseStock ? recipe.ingredients[0].thing : ingredient.RefreshThing());
125 if (thing == null)
126 {
127 if (!EClass.debug.enable)
128 {
129 Debug.LogError("no ing");
130 }
131 break;
132 }
133 int num = ingredient.req * countValid;
134 int num2 = ((thing.Num >= num) ? num : thing.Num);
136 {
137 thing.ModNum(-num2);
138 }
139 }
140 }
141}
BaseTileSelector tileSelector
static BuildMenu Instance
Definition: BuildMenu.cs:77
UIRecipeInfo info1
Definition: BuildMenu.cs:27
string id
Definition: Card.cs:31
int GetCurrency(string id="money")
Definition: Card.cs:3652
void ModCurrency(int a, string id="money")
Definition: Card.cs:3638
ThingContainer things
Definition: Card.cs:34
int Num
Definition: Card.cs:154
void ModNum(int a, bool notify=true)
Definition: Card.cs:3262
bool enable
Definition: CoreDebug.cs:285
bool godBuild
Definition: CoreDebug.cs:303
bool ignoreBuildRule
Definition: CoreDebug.cs:184
Definition: EClass.cs:5
static Map _map
Definition: EClass.cs:18
static BaseGameScreen screen
Definition: EClass.cs:32
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
void SetRecipe(Recipe r)
Definition: HitSummary.cs:30
int countValid
Definition: HitSummary.cs:10
int count
Definition: HitSummary.cs:8
void Clear()
Definition: HitSummary.cs:22
List< InspectGroup > groups
Definition: HitSummary.cs:16
void Execute()
Definition: HitSummary.cs:104
List< IInspect > targets
Definition: HitSummary.cs:14
int money
Definition: HitSummary.cs:6
Recipe recipe
Definition: HitSummary.cs:12
Thing factory
Definition: HitSummary.cs:18
bool hasFactory
Definition: HitSummary.cs:20
bool CanExecute()
Definition: HitSummary.cs:44
PropsInstalled Installed
Definition: Map.cs:123
bool instaComplete
Definition: Player.cs:956
Dictionary< string, PropSet > cardMap
Definition: Props.cs:10
string idFactory
Definition: RecipeSource.cs:85
bool NeedFactory
Definition: RecipeSource.cs:61
Definition: Recipe.cs:7
string id
Definition: Recipe.cs:161
virtual bool RequireIngredients
Definition: Recipe.cs:263
virtual TileType tileType
Definition: Recipe.cs:198
RecipeSource source
Definition: Recipe.cs:187
List< Ingredient > ingredients
Definition: Recipe.cs:164
bool VirtualBlock
Definition: Recipe.cs:173
bool UseStock
Definition: Recipe.cs:167
Thing Find(int uid)
Definition: Thing.cs:8
virtual bool CanInstaComplete
Definition: TileType.cs:199
Dictionary< string, int > lastMats
Definition: UIRecipeInfo.cs:69