Elin Decompiled Documentation EA 23.344.1 Nightly
Loading...
Searching...
No Matches
BuildMenu Class Reference
Inheritance diagram for BuildMenu:
EMono

Public Types

enum  Mode {
  Build , None , Hide , Area ,
  PartialMap
}
 

Public Member Functions

void OnActivate ()
 
void Init ()
 
void Search (string s)
 
void ClearSearch ()
 
void ClearSearch (bool refresh)
 
void Refresh ()
 
void SelectCategory (string cat)
 
void Select (AM_Picker.Result r)
 
void Unselect ()
 
void RefreshCategoryArea ()
 
void RefreshCategory (string cat)
 
void OnClickPicker ()
 

Static Public Member Functions

static void Toggle ()
 
static void Activate ()
 
static void Deactivate ()
 
static void Show ()
 
static void Hide ()
 
- Static Public Member Functions inherited from EMono
static int rnd (int a)
 

Public Attributes

GridLayoutGroup gridTab
 
UISelectableGroup groupTab
 
UIDynamicList list
 
UIDynamicList listArea
 
Dictionary< string, int > catDic = new Dictionary<string, int>()
 
UIRecipeInfo info1
 
UIRecipeInfo info2
 
RectTransform transOption
 
RectTransform transMain
 
Vector2 posInfo2
 
Vector2 posInfo1
 
Vector2 posOption
 
CanvasGroup cg
 
float hideSpeed
 
float intervalSearch
 
bool moveInfo1
 
TerrainMenu terrainMenu
 
InputField inputSearch
 
string currentCat
 
string lastCat
 
UIButton buttonClearSearch
 
string[] categories
 
ButtonRecipe lastButtonRecipe
 
Dictionary< string, int > counts = new Dictionary<string, int>()
 
Dictionary< string, UIButtontabs = new Dictionary<string, UIButton>()
 
UIButton buttonUndo
 
string lastSearch
 
HashSet< RecipesearchRecipes = new HashSet<Recipe>()
 

Static Public Attributes

static BuildMenu Instance
 
static bool dirtyCat
 
- Static Public Attributes inherited from EMono
static Core core
 

Properties

Mode mode [get]
 
- Properties inherited from EMono
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SoundManager Sound [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static CoreDebug debug [get]
 

Private Member Functions

void _Search ()
 
void LateUpdate ()
 

Private Attributes

Vector2 orgPos
 
Vector2 orgPosOption
 
float timerSearch
 
bool firstRefresh = true
 

Detailed Description

Definition at line 6 of file BuildMenu.cs.

Member Enumeration Documentation

◆ Mode

Enumerator
Build 
None 
Hide 
Area 
PartialMap 

Definition at line 8 of file BuildMenu.cs.

9 {
10 Build,
11 None,
12 Hide,
13 Area,
15 }
static void Hide()
Definition: BuildMenu.cs:338

Member Function Documentation

◆ _Search()

void BuildMenu._Search ( )
inlineprivate

Definition at line 240 of file BuildMenu.cs.

241 {
242 string s = lastSearch;
244 HashSet<Recipe> newRecipes = new HashSet<Recipe>();
245 if (!s.IsEmpty())
246 {
248 {
249 if (item.noListing || item.isBridgePillar || (!EMono.debug.godBuild && !item.alwaysKnown && !EMono.player.recipes.knownRecipes.ContainsKey(item.id)) || (!item.row.GetSearchName(jp: false).Contains(s) && !item.row.GetSearchName(jp: true).Contains(s) && !item.id.Contains(s) && !item.row.category.Contains(s)))
250 {
251 continue;
252 }
253 for (int i = 0; i < ((item.row.skins == null) ? 1 : (item.row.skins.Length + 1)); i++)
254 {
255 Recipe recipe = Recipe.Create(item);
256 recipe.idSkin = i;
257 if (recipe == null)
258 {
259 Debug.Log(item.Name + "/" + item.id);
260 }
261 else
262 {
263 newRecipes.Add(recipe);
264 }
265 }
266 }
267 foreach (Thing thing in EMono._map.Stocked.Things)
268 {
269 if (!EMono._map.Stocked.ShouldListAsResource(thing) || (!thing.source.name.Contains(s) && !thing.source.name_JP.Contains(s) && !thing.NameOne.Contains(s)))
270 {
271 continue;
272 }
273 Recipe recipe2 = Recipe.Create(thing);
274 if (!recipe2.source.noListing)
275 {
276 if (recipe2 == null)
277 {
278 Debug.Log(thing.Name + "/" + thing.id);
279 }
280 else
281 {
282 newRecipes.Add(recipe2);
283 }
284 }
285 }
286 EMono.pc.things.Foreach(delegate(Thing t)
287 {
288 if (t.trait.CanBeDropped && !t.trait.CanOnlyCarry && !t.isEquipped && (t.source.name.Contains(s) || t.source.name_JP.Contains(s) || t.NameOne.Contains(s)))
289 {
290 Recipe recipe3 = Recipe.Create(t);
291 if (!recipe3.source.noListing)
292 {
293 if (recipe3 == null)
294 {
295 Debug.Log(t.Name + "/" + t.id);
296 }
297 else
298 {
299 newRecipes.Add(recipe3);
300 }
301 }
302 }
303 });
304 }
305 if (!newRecipes.SetEquals(searchRecipes))
306 {
307 searchRecipes = newRecipes;
309 }
310 lastSearch = s;
311 }
string lastSearch
Definition: BuildMenu.cs:85
void RefreshCategory(string cat)
Definition: BuildMenu.cs:498
HashSet< Recipe > searchRecipes
Definition: BuildMenu.cs:87
string currentCat
Definition: BuildMenu.cs:53
string id
Definition: Card.cs:36
string NameOne
Definition: Card.cs:2195
string Name
Definition: Card.cs:2191
Trait trait
Definition: Card.cs:54
ThingContainer things
Definition: Card.cs:39
bool godBuild
Definition: CoreDebug.cs:320
Definition: EMono.cs:4
static Chara pc
Definition: EMono.cs:13
static Player player
Definition: EMono.cs:11
static Map _map
Definition: EMono.cs:17
static CoreDebug debug
Definition: EMono.cs:45
PropsStocked Stocked
Definition: Map.cs:126
RecipeManager recipes
Definition: Player.cs:1167
List< Thing > Things
Definition: Props.cs:37
bool ShouldListAsResource(Thing t)
Definition: Props.cs:174
static void BuildList()
static List< RecipeSource > list
Dictionary< string, int > knownRecipes
Definition: Recipe.cs:7
RecipeSource source
Definition: Recipe.cs:204
static Recipe Create(RecipeSource _source, int idMat=-1, Thing ing=null)
Definition: Recipe.cs:325
void Foreach(Action< Thing > action, bool onlyAccessible=true)
Definition: Thing.cs:8
SourceThing.Row source
Definition: Thing.cs:11
bool isEquipped
Definition: Thing.cs:17
virtual bool CanBeDropped
Definition: Trait.cs:313
virtual bool CanOnlyCarry
Definition: Trait.cs:305

References EMono._map, RecipeManager.BuildList(), Trait.CanBeDropped, Trait.CanOnlyCarry, Recipe.Create(), currentCat, EMono.debug, Debug, ThingContainer.Foreach(), CoreDebug.godBuild, Card.id, Thing.isEquipped, item, RecipeManager.knownRecipes, lastSearch, RecipeManager.list, Card.Name, Card.NameOne, RecipeSource.noListing, EMono.pc, EMono.player, Player.recipes, RefreshCategory(), searchRecipes, Props.ShouldListAsResource(), Recipe.source, Thing.source, Map.Stocked, Card.things, Props.Things, and Card.trait.

Referenced by LateUpdate().

◆ Activate()

static void BuildMenu.Activate ( )
inlinestatic

Definition at line 117 of file BuildMenu.cs.

118 {
119 if (!Instance)
120 {
121 Instance = Util.Instantiate<BuildMenu>("UI/BuildMenu/BuildMenu", EMono.ui);
122 Instance.Init();
123 }
124 if (EMono.debug.godBuild)
125 {
127 }
130 EMono.screen.focusPos = null;
131 }
static BuildMenu Instance
Definition: BuildMenu.cs:77
void OnActivate()
Definition: BuildMenu.cs:133
void Init()
Definition: BuildMenu.cs:187
static UI ui
Definition: EMono.cs:15
void RevealAll(bool reveal=true)
Definition: Map.cs:1011
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67

References EMono._map, RecipeManager.BuildList(), EMono.debug, CoreDebug.godBuild, Init(), Instance, OnActivate(), Map.RevealAll(), EMono.ui, and Util.

Referenced by ActionMode.Activate().

◆ ClearSearch() [1/2]

void BuildMenu.ClearSearch ( )
inline

Definition at line 313 of file BuildMenu.cs.

314 {
315 ClearSearch(refresh: true);
316 }
void ClearSearch()
Definition: BuildMenu.cs:313

References ClearSearch().

Referenced by ClearSearch(), Init(), and Select().

◆ ClearSearch() [2/2]

void BuildMenu.ClearSearch ( bool  refresh)
inline

Definition at line 318 of file BuildMenu.cs.

319 {
320 SE.Click();
321 inputSearch.text = "";
322 timerSearch = 0f;
323 lastSearch = "";
324 if (refresh)
325 {
327 }
328 }
float timerSearch
Definition: BuildMenu.cs:83

References currentCat, lastSearch, RefreshCategory(), and timerSearch.

◆ Deactivate()

static void BuildMenu.Deactivate ( )
inlinestatic

Definition at line 173 of file BuildMenu.cs.

174 {
175 if ((bool)Instance)
176 {
177 UnityEngine.Object.DestroyImmediate(Instance.gameObject);
178 if (EMono.game.altUI)
179 {
181 }
182 EMono.ui.ShowFloats();
184 }
185 }
static Zone _zone
Definition: EMono.cs:19
static BaseGameScreen screen
Definition: EMono.cs:29
static Game game
Definition: EMono.cs:7
bool altUI
Definition: Game.cs:268
void RefreshBGM()
Definition: Zone.cs:3309

References EMono._zone, Game.altUI, EMono.game, Instance, BaseGameScreen.RefreshAll(), Zone.RefreshBGM(), EMono.screen, and EMono.ui.

Referenced by ActionMode.Activate(), and Scene.Init().

◆ Hide()

static void BuildMenu.Hide ( )
inlinestatic

Definition at line 338 of file BuildMenu.cs.

339 {
340 if ((bool)Instance)
341 {
342 Instance.SetActive(enable: false);
343 }
344 }

References Instance.

Referenced by LayerArea.OnInit().

◆ Init()

void BuildMenu.Init ( )
inline

Definition at line 187 of file BuildMenu.cs.

188 {
189 info1.Init();
190 info2.Init();
191 info2.transform.position = info1.transform.position;
192 orgPos = info1.Rect().anchoredPosition;
193 orgPosOption = transOption.anchoredPosition;
194 for (int i = 0; i < categories.Length; i++)
195 {
196 if (!categories[i].IsEmpty())
197 {
198 catDic.Add(categories[i], i);
199 }
200 }
201 UIButton t = gridTab.CreateMold<UIButton>();
202 for (int j = 0; j < categories.Length - 1; j++)
203 {
204 int _i = j;
205 UIButton uIButton = Util.Instantiate(t, gridTab);
206 uIButton.onClick.AddListener(delegate
207 {
208 ClearSearch(refresh: false);
210 });
211 uIButton.mainText.SetText(("cat_" + categories[j]).lang());
212 tabs[categories[j]] = uIButton;
213 if (categories[j].IsEmpty())
214 {
215 uIButton.mainText.SetActive(enable: false);
216 uIButton.interactable = false;
217 }
218 }
219 groupTab.Init(-1);
220 EMono.ui.hud.frame.SetActive(EMono.game.altUI);
221 inputSearch.onValueChanged.AddListener(Search);
222 inputSearch.onSubmit.AddListener(Search);
223 if (EMono.game.altUI)
224 {
225 EMono.Sound.SwitchPlaylist(EMono.Sound.playlistBuild);
226 }
227 }
InputField inputSearch
Definition: BuildMenu.cs:51
RectTransform transOption
Definition: BuildMenu.cs:31
void SelectCategory(string cat)
Definition: BuildMenu.cs:406
GridLayoutGroup gridTab
Definition: BuildMenu.cs:17
UISelectableGroup groupTab
Definition: BuildMenu.cs:19
string[] categories
Definition: BuildMenu.cs:60
Vector2 orgPos
Definition: BuildMenu.cs:73
UIRecipeInfo info1
Definition: BuildMenu.cs:27
Dictionary< string, int > catDic
Definition: BuildMenu.cs:25
Vector2 orgPosOption
Definition: BuildMenu.cs:75
Dictionary< string, UIButton > tabs
Definition: BuildMenu.cs:71
UIRecipeInfo info2
Definition: BuildMenu.cs:29
static SoundManager Sound
Definition: EMono.cs:39
UIText mainText
Definition: UIButton.cs:102
virtual void Init(int index=0, UnityAction< int > action=null, bool directChildren=false)
void SetText(string s)
Definition: UIText.cs:163

References Game.altUI, catDic, categories, ClearSearch(), EMono.game, gridTab, groupTab, info1, info2, UIRecipeInfo.Init(), UISelectableGroup.Init(), inputSearch, UIButton.mainText, orgPos, orgPosOption, Search, SelectCategory(), UIText.SetText(), EMono.Sound, tabs, transOption, EMono.ui, and Util.

Referenced by Activate().

◆ LateUpdate()

void BuildMenu.LateUpdate ( )
inlineprivate

Definition at line 346 of file BuildMenu.cs.

347 {
348 Refresh();
349 if (timerSearch > 0f)
350 {
352 if (timerSearch <= 0f)
353 {
354 _Search();
355 }
356 }
357 }
void _Search()
Definition: BuildMenu.cs:240
void Refresh()
Definition: BuildMenu.cs:359
Definition: Core.cs:14
static float delta
Definition: Core.cs:17

References _Search(), Core.delta, Refresh(), and timerSearch.

◆ OnActivate()

void BuildMenu.OnActivate ( )
inline

Definition at line 133 of file BuildMenu.cs.

134 {
136 {
138 }
139 EMono.ui.HideFloats();
140 this.SetActive(mode != Mode.None);
141 transMain.SetActive(mode == Mode.Build && (EMono.debug.godBuild || EMono._zone.elements.Has(4005) || (EMono._zone is Zone_Tent && EMono.pc.homeBranch.elements.Has(4005))));
142 switch (mode)
143 {
144 case Mode.Build:
145 {
146 string cat = EMono.player.pref.lastBuildCategory.IsEmpty("wall");
147 SelectCategory(cat);
148 Refresh();
149 cg.GetComponentInChildren<UIScrollView>()?.RebuildLayout(recursive: true);
150 buttonUndo.onClick.RemoveAllListeners();
151 buttonUndo.onClick.AddListener(delegate
152 {
154 });
155 buttonUndo.SetTooltip("note", delegate(UITooltip tp)
156 {
158 });
159 break;
160 }
161 case Mode.Area:
163 Refresh();
164 break;
165 }
166 if (EMono.debug.enable)
167 {
169 }
171 }
RectTransform transMain
Definition: BuildMenu.cs:33
CanvasGroup cg
Definition: BuildMenu.cs:41
Mode mode
Definition: BuildMenu.cs:91
UIButton buttonUndo
Definition: BuildMenu.cs:79
void RefreshCategoryArea()
Definition: BuildMenu.cs:454
FactionBranch homeBranch
Definition: Chara.cs:1113
Thing GetDebugContainer()
Definition: CoreDebug.cs:806
bool enable
Definition: CoreDebug.cs:302
void EnableDebugResource()
Definition: CoreDebug.cs:818
bool Has(int ele)
ElementContainerZone elements
void ResetEditorPos()
Definition: Map.cs:362
TaskManager tasks
Definition: Map.cs:37
string lastBuildCategory
Definition: Player.cs:26
Pref pref
Definition: Player.cs:1083
UndoManager undo
Definition: TaskManager.cs:64
void SetTooltip(Action< UITooltip > onShowTooltip=null, bool enable=true)
Definition: UIButton.cs:361
UINote note
Definition: UITooltip.cs:21
void WriteNote(UINote n)
Definition: UndoManager.cs:76
void Perform()
Definition: UndoManager.cs:93
ElementContainerZone elements
Definition: Zone.cs:46

References EMono._map, EMono._zone, buttonUndo, cg, EMono.debug, FactionBranch.elements, Zone.elements, CoreDebug.enable, CoreDebug.EnableDebugResource(), CoreDebug.GetDebugContainer(), CoreDebug.godBuild, ElementContainer.Has(), Chara.homeBranch, Player.Pref.lastBuildCategory, mode, UITooltip.note, EMono.pc, UndoManager.Perform(), EMono.player, Player.pref, Refresh(), BaseGameScreen.RefreshAll(), RefreshCategoryArea(), Map.ResetEditorPos(), EMono.screen, SelectCategory(), UIButton.SetTooltip(), Map.tasks, transMain, EMono.ui, TaskManager.undo, and UndoManager.WriteNote().

Referenced by Activate().

◆ OnClickPicker()

void BuildMenu.OnClickPicker ( )
inline

Definition at line 682 of file BuildMenu.cs.

683 {
685 }
static AM_Picker Picker
Definition: ActionMode.cs:43
void Activate(bool toggle=true, bool forceActivate=false)
Definition: ActionMode.cs:339

References ActionMode.Activate(), and ActionMode.Picker.

◆ Refresh()

void BuildMenu.Refresh ( )
inline

Definition at line 359 of file BuildMenu.cs.

360 {
361 ButtonGrid buttonGrid = InputModuleEX.GetComponentOf<ButtonGrid>();
362 if ((bool)buttonGrid && buttonGrid.recipe == null && buttonGrid.area == null)
363 {
364 buttonGrid = null;
365 }
366 bool flag = EMono.scene.actionMode.ShouldHideBuildMenu || (EMono.scene.actionMode != ActionMode.Build && EMono.scene.actionMode != ActionMode.Inspect && EMono.scene.actionMode != ActionMode.EditArea);
367 cg.SetActive(!flag, delegate(bool enabled)
368 {
369 if (enabled)
370 {
373 }
374 });
376 transOption.anchoredPosition = (groupTab.gameObject.activeInHierarchy ? orgPosOption : posOption);
377 if (info1.hideMode != flag || firstRefresh)
378 {
379 info1.hideMode = flag;
380 if (moveInfo1)
381 {
382 info1.Rect().anchoredPosition = (flag ? posInfo1 : orgPos);
383 }
384 }
385 if ((bool)buttonGrid && !flag)
386 {
387 info2.transform.position = buttonGrid.transform.position;
388 info2.Rect().anchoredPosition = new Vector2(info2.Rect().anchoredPosition.x + posInfo2.x, posInfo2.y);
389 if (buttonGrid.area != null)
390 {
391 info2.SetArea(buttonGrid.area);
392 }
393 else
394 {
395 info2.SetRecipe(buttonGrid.recipe);
396 }
397 info2.SetActive(enable: true);
398 }
399 else
400 {
401 info2.SetActive(enable: false);
402 }
403 firstRefresh = false;
404 }
static AM_EditArea EditArea
Definition: ActionMode.cs:53
UIDynamicList list
Definition: BuildMenu.cs:21
Vector2 posOption
Definition: BuildMenu.cs:39
Vector2 posInfo1
Definition: BuildMenu.cs:37
Vector2 posInfo2
Definition: BuildMenu.cs:35
bool firstRefresh
Definition: BuildMenu.cs:89
bool moveInfo1
Definition: BuildMenu.cs:47
Area area
Definition: ButtonGrid.cs:18
Recipe recipe
Definition: ButtonGrid.cs:20
static Scene scene
Definition: EMono.cs:27
ActionMode actionMode
Definition: Scene.cs:79
bool RefreshHighlight(bool invoke=false)
void SetArea(Area a)
Definition: UIRecipeInfo.cs:86
void SetRecipe(Recipe r)

References Scene.actionMode, ButtonGrid.area, cg, ActionMode.EditArea, firstRefresh, groupTab, UIRecipeInfo.hideMode, info1, info2, list, moveInfo1, orgPos, orgPosOption, posInfo1, posInfo2, posOption, ButtonGrid.recipe, UISelectableGroup.RefreshButtons(), UIDynamicList.RefreshHighlight(), EMono.scene, UIRecipeInfo.SetArea(), and UIRecipeInfo.SetRecipe().

Referenced by LateUpdate(), and OnActivate().

◆ RefreshCategory()

void BuildMenu.RefreshCategory ( string  cat)
inline

Definition at line 498 of file BuildMenu.cs.

499 {
500 cat = cat.IsEmpty(categories[0]);
501 EMono.player.pref.lastBuildCategory = cat;
502 currentCat = cat;
503 list.Clear();
504 object selected = null;
505 counts.Clear();
506 list.callbacks = new UIList.Callback<Recipe, ButtonGrid>
507 {
508 onClick = delegate(Recipe a, ButtonGrid b)
509 {
510 SE.Click();
511 EMono.ui.hud.hint.Refresh();
512 EMono.player.pref.lastBuildRecipe = a.source.id;
513 if (a.UseStock && (a.ingredients[0].uid == 0 || a.ingredients[0].thing == null))
514 {
515 Debug.LogError("expection: invalid ingredient:" + a.ingredients[0].uid);
516 }
517 if (info1.recipe != a && !a.UseStock)
518 {
519 foreach (Recipe.Ingredient ingredient in a.ingredients)
520 {
521 ingredient.SetThing();
522 }
523 }
524 if (a.UseStock && (a.ingredients[0].uid == 0 || a.ingredients[0].thing == null))
525 {
526 Debug.LogError("expection: invalid ingredient:" + a.ingredients[0].uid);
527 }
528 info1.SetRecipe(a);
529 if (a.UseStock && (a.ingredients[0].uid == 0 || a.ingredients[0].thing == null))
530 {
531 Debug.LogError("expection: invalid ingredient:" + a.ingredients[0].uid);
532 }
534 ActionMode.Build.StartBuild(a, () => list.GetComp<ButtonGrid>(a));
535 info1.SetRecipe(a);
536 list.Select(a);
537 if (a.UseStock && (a.ingredients[0].uid == 0 || a.ingredients[0].thing == null))
538 {
539 Debug.LogError("expection: invalid ingredient:" + a.ingredients[0].uid);
540 }
541 },
542 onRedraw = delegate(Recipe a, ButtonGrid b, int i)
543 {
544 b.SetActive(a != null);
545 if (a != null)
546 {
547 b.SetRecipe(a);
548 if (info1.recipe != null && a.id == info1.recipe.id)
549 {
550 selected = a;
551 }
553 }
554 },
555 onList = delegate
556 {
557 string[] array = categories;
558 foreach (string key in array)
559 {
560 counts[key] = 0;
561 }
562 if (inputSearch.text != "")
563 {
564 foreach (Recipe searchRecipe in searchRecipes)
565 {
566 if (searchRecipe.UseStock)
567 {
568 Thing thing = searchRecipe.ingredients[0].thing;
569 if (thing == null || thing.isDestroyed || thing.ExistsOnMap || (thing.parentCard != null && thing.parentCard.c_lockLv > 0))
570 {
571 continue;
572 }
573 }
574 list.Add(searchRecipe);
575 }
576 return;
577 }
579 {
580 if (EMono.debug.godBuild || !(item.row.GetAlias != "block_invisi") || (!item.noListing && !item.row.tileType.EditorTile && EMono.player.recipes.IsKnown(item.id) && (item.row.factory.Length == 0 || !(item.row.factory[0] == "none"))))
581 {
582 counts[item.recipeCat]++;
583 if (!(item.recipeCat != cat))
584 {
585 for (int j = 0; j < ((item.row.skins != null) ? item.row.skins.Length : 0) + 1; j++)
586 {
587 Recipe recipe = Recipe.Create(item);
588 recipe.idSkin = j;
589 list.Add(recipe);
590 }
591 }
592 }
593 }
595 {
596 foreach (Thing thing2 in EMono._map.Stocked.Things)
597 {
599 {
600 counts[thing2.trait.RecipeCat]++;
601 if (thing2.trait.RecipeCat == cat)
602 {
603 Card rootCard = thing2.GetRootCard();
604 if (rootCard != null && rootCard.c_lockLv == 0)
605 {
607 }
608 }
609 }
610 }
611 EMono.pc.things.Foreach(delegate(Thing t)
612 {
614 {
616 if (t.trait.RecipeCat == cat && t.invY != 1)
617 {
619 }
620 }
621 });
622 }
623 if (cat == "other")
624 {
625 list.objects.Sort((object a, object b) => string.Compare((a as Recipe).id, (b as Recipe).id));
626 }
627 else if (cat == "wall" || cat == "floor" || cat == "foundation" || cat == "obj")
628 {
629 list.objects.Sort((object a, object b) => (a as Recipe).renderRow.sort - (b as Recipe).renderRow.sort);
630 }
631 else
632 {
633 list.objects.Sort(delegate(object a, object b)
634 {
635 Recipe recipe2 = a as Recipe;
636 Recipe recipe3 = b as Recipe;
637 int num = recipe2.renderRow.sort - recipe3.renderRow.sort;
638 if (num == 0)
639 {
640 RecipeCard recipeCard = recipe2 as RecipeCard;
641 RecipeCard recipeCard2 = recipe3 as RecipeCard;
642 num = ((recipeCard == null || recipeCard2 == null) ? string.Compare(recipe2.id, recipe3.id) : string.Compare(recipeCard.sourceCard._origin.IsEmpty(recipeCard.sourceCard.id), recipeCard2.sourceCard._origin.IsEmpty(recipeCard2.sourceCard.id)));
643 if (num == 0)
644 {
645 num = (recipe2.IngAsProduct ? recipe2.ingredients[0].uid : 0) - (recipe3.IngAsProduct ? recipe3.ingredients[0].uid : 0);
646 }
647 }
648 return num;
649 });
650 }
651 array = categories;
652 foreach (string text in array)
653 {
654 if (!(text == "area") && !(text == ""))
655 {
656 if (counts[text] == 0)
657 {
658 tabs[text].subText.text = "";
659 }
660 else
661 {
662 tabs[text].subText.text = counts[text].ToString() ?? "";
663 }
664 }
665 }
666 }
667 };
668 list.List();
669 if (lastCat != currentCat)
670 {
671 list.Scroll();
672 }
673 groupTab.Select(catDic[cat]);
674 if (selected != null)
675 {
676 list.Select(selected);
677 }
679 list.RebuildLayoutTo<BuildMenu>();
680 }
bool Compare(float lhs)
void StartBuild(Recipe r, Func< ButtonGrid > _button)
Definition: AM_Build.cs:164
static AM_Build Build
Definition: ActionMode.cs:49
Dictionary< string, int > counts
Definition: BuildMenu.cs:69
string lastCat
Definition: BuildMenu.cs:55
void SetRecipe()
Definition: ButtonGrid.cs:540
string _origin
Definition: CardRow.cs:15
string id
Definition: CardRow.cs:7
Definition: Card.cs:11
bool isDestroyed
Definition: Card.cs:78
int c_lockLv
Definition: Card.cs:991
int invY
Definition: Card.cs:2007
bool ExistsOnMap
Definition: Card.cs:2137
bool c_isImportant
Definition: Card.cs:1051
Card GetRootCard()
Definition: Card.cs:3607
Card parentCard
Definition: Card.cs:106
bool hidePCItemsInBuild
Definition: CoreDebug.cs:225
CardRow sourceCard
Definition: RecipeCard.cs:20
bool IsKnown(string id)
string id
Definition: Recipe.cs:178
virtual RenderRow renderRow
Definition: Recipe.cs:210
List< Ingredient > ingredients
Definition: Recipe.cs:181
virtual void OnChangeIngredient()
Definition: Recipe.cs:562
bool UseStock
Definition: Recipe.cs:184
virtual void BuildIngredientList()
Definition: Recipe.cs:539
bool IngAsProduct
Definition: Recipe.cs:187
int sort
Definition: RenderRow.cs:18
virtual Recipe GetBuildModeRecipe()
Definition: Trait.cs:928
virtual string RecipeCat
Definition: Trait.cs:377
override void List()
List< object > objects
void Scroll(int index=0)
override void Add(object o)
bool Select(object o, bool invoke=false)
override void Clear()
Definition: UIList.cs:9
Recipe recipe
Definition: UIRecipeInfo.cs:32
void Select(UIButton button, bool check=true)

References EMono._map, CardRow._origin, UIDynamicList.Add(), ActionMode.Build, Recipe.BuildIngredientList(), Card.c_isImportant, Card.c_lockLv, Trait.CanBeDropped, Trait.CanOnlyCarry, catDic, categories, UIDynamicList.Clear(), Compare(), counts, Recipe.Create(), currentCat, EMono.debug, Debug, Card.ExistsOnMap, ThingContainer.Foreach(), Trait.GetBuildModeRecipe(), Card.GetRootCard(), CoreDebug.godBuild, groupTab, CoreDebug.hidePCItemsInBuild, CardRow.id, Recipe.id, RecipeSource.id, info1, Recipe.IngAsProduct, Recipe.ingredients, inputSearch, Card.invY, Card.isDestroyed, Thing.isEquipped, RecipeManager.IsKnown(), item, lastCat, list, UIDynamicList.List(), RecipeManager.list, UIDynamicList.objects, Recipe.OnChangeIngredient(), Card.parentCard, EMono.pc, EMono.player, UIRecipeInfo.recipe, Trait.RecipeCat, Player.recipes, Recipe.renderRow, UIDynamicList.Scroll(), searchRecipes, UIDynamicList.Select(), UISelectableGroup.Select(), ButtonGrid.SetRecipe(), UIRecipeInfo.SetRecipe(), Props.ShouldListAsResource(), RenderRow.sort, Recipe.source, RecipeCard.sourceCard, AM_Build.StartBuild(), Map.Stocked, tabs, Card.things, Props.Things, Card.trait, EMono.ui, and Recipe.UseStock.

Referenced by _Search(), ClearSearch(), AM_Build.OnFinishProcessTiles(), Select(), and SelectCategory().

◆ RefreshCategoryArea()

void BuildMenu.RefreshCategoryArea ( )
inline

Definition at line 454 of file BuildMenu.cs.

455 {
456 UIDynamicList uIDynamicList = listArea;
457 List<Area> list = new List<Area>();
458 foreach (SourceArea.Row row in EMono.sources.areas.rows)
459 {
460 Area area = Area.Create(row.id);
461 area.data.name = null;
462 list.Add(area);
463 }
464 uIDynamicList.Clear();
465 object selected = null;
466 uIDynamicList.callbacks = new UIList.Callback<Area, ButtonGrid>
467 {
468 onClick = delegate(Area a, ButtonGrid b)
469 {
470 SE.Click();
473 {
475 }
476 EMono.ui.hud.hint.Refresh();
477 info1.SetArea(a);
478 },
479 onRedraw = delegate(Area a, ButtonGrid b, int i)
480 {
481 b.SetRecipe(a);
482 if (info1.area != null && a.source == info1.area.source)
483 {
484 selected = a;
485 }
486 }
487 };
488 foreach (Area item in list)
489 {
490 if (item.isListable)
491 {
492 uIDynamicList.Add(item);
493 }
494 }
495 uIDynamicList.List();
496 }
void SetArea(Area a)
static AM_CreateArea CreateArea
Definition: ActionMode.cs:51
Definition: Area.cs:4
static Area Create(string id)
Definition: Area.cs:104
SourceArea.Row source
Definition: BaseArea.cs:50
UIDynamicList listArea
Definition: BuildMenu.cs:23
static SourceManager sources
Definition: EMono.cs:41
SourceArea areas

References Scene.actionMode, ActionMode.Activate(), UIDynamicList.Add(), Area, UIRecipeInfo.area, SourceManager.areas, UIDynamicList.Clear(), Area.Create(), ActionMode.CreateArea, info1, item, list, listArea, EMono.scene, AM_CreateArea.SetArea(), UIRecipeInfo.SetArea(), ButtonGrid.SetRecipe(), BaseArea.source, EMono.sources, and EMono.ui.

Referenced by OnActivate().

◆ Search()

void BuildMenu.Search ( string  s)
inline

Definition at line 229 of file BuildMenu.cs.

230 {
231 s = s.ToLower();
232 buttonClearSearch.SetActive(inputSearch.text != "");
233 if (!(s == lastSearch))
234 {
236 lastSearch = s;
237 }
238 }
float intervalSearch
Definition: BuildMenu.cs:45
UIButton buttonClearSearch
Definition: BuildMenu.cs:57

References buttonClearSearch, inputSearch, intervalSearch, lastSearch, and timerSearch.

◆ Select()

void BuildMenu.Select ( AM_Picker::Result  r)
inline

Definition at line 416 of file BuildMenu.cs.

417 {
418 EInput.Consume(consumeAxis: false, 10);
420 ClearSearch(refresh: false);
422 foreach (object @object in list.objects)
423 {
424 Recipe recipe = @object as Recipe;
425 if (r.source == recipe.source && (r.thing == null || r.thing.idSkin == recipe.idSkin))
426 {
427 int index = list.GetIndex(recipe);
428 if (index != -1)
429 {
430 list.dsv.scrollByItemIndex(index);
431 list.Refresh();
432 }
433 break;
434 }
435 }
436 ButtonGrid[] componentsInChildren = list.GetComponentsInChildren<ButtonGrid>();
437 foreach (ButtonGrid buttonGrid in componentsInChildren)
438 {
439 if (buttonGrid.recipe.source == r.source && (r.thing == null || r.thing.idSkin == buttonGrid.recipe.idSkin))
440 {
441 info1.lastMats[buttonGrid.recipe.id] = r.mat.id;
442 buttonGrid.onClick.Invoke();
443 break;
444 }
445 }
446 }
int idSkin
Definition: Card.cs:365
Definition: EInput.cs:8
static void Consume(int _skipFrame)
Definition: EInput.cs:667
static int skipFrame
Definition: EInput.cs:298
string recipeCat
Definition: RecipeSource.cs:37
int idSkin
Definition: Recipe.cs:198
int GetIndex(object o)
DynamicScrollView dsv
Dictionary< string, int > lastMats
Definition: UIRecipeInfo.cs:69
SourceMaterial.Row mat
Definition: AM_Picker.cs:10
RecipeSource source
Definition: AM_Picker.cs:8

References ClearSearch(), EInput.Consume(), Debug, UIDynamicList.dsv, UIDynamicList.GetIndex(), Recipe.id, Recipe.idSkin, info1, UIRecipeInfo.lastMats, list, UIDynamicList.objects, ButtonGrid.recipe, UIDynamicList.Refresh(), RefreshCategory(), EInput.skipFrame, and Recipe.source.

Referenced by AM_Picker.Select().

◆ SelectCategory()

void BuildMenu.SelectCategory ( string  cat)
inline

Definition at line 406 of file BuildMenu.cs.

407 {
408 if (dirtyCat || !(currentCat == cat))
409 {
410 dirtyCat = false;
411 groupTab.Select(catDic[cat]);
412 RefreshCategory(cat);
413 }
414 }
static bool dirtyCat
Definition: BuildMenu.cs:81

References catDic, currentCat, dirtyCat, groupTab, RefreshCategory(), and UISelectableGroup.Select().

Referenced by Init(), and OnActivate().

◆ Show()

static void BuildMenu.Show ( )
inlinestatic

Definition at line 330 of file BuildMenu.cs.

331 {
332 if ((bool)Instance)
333 {
334 Instance.SetActive(enable: true);
335 }
336 }

References Instance.

Referenced by LayerArea.OnKill().

◆ Toggle()

static void BuildMenu.Toggle ( )
inlinestatic

Definition at line 93 of file BuildMenu.cs.

94 {
96 EMono.player.hotbars.bars[3].dirty = true;
98 EMono.player.hotbars.bars[4].dirty = true;
100 {
102 }
103 else if (ActionMode.LastBuildMode != null)
104 {
106 }
107 else if (EMono.debug.godBuild || (EMono.Branch != null && EMono.Branch.elements.Has(4006)))
108 {
110 }
111 else
112 {
114 }
115 }
void Activate(Thing t)
static AM_Inspect Inspect
Definition: ActionMode.cs:23
static AM_Terrain Terrain
Definition: ActionMode.cs:65
static ActionMode LastBuildMode
Definition: ActionMode.cs:79
static FactionBranch Branch
Definition: EMono.cs:21
Hotbar[] bars
Definition: HotbarManager.cs:6
void ResetHotbar(int id)
Definition: HotbarManager.cs:8
bool dirty
Definition: Hotbar.cs:89
HotbarManager hotbars
Definition: Player.cs:1155

References ActionMode.Activate(), AM_MoveInstalled.Activate(), HotbarManager.bars, EMono.Branch, ActionMode.Build, EMono.debug, Hotbar.dirty, FactionBranch.elements, CoreDebug.godBuild, ElementContainer.Has(), Player.hotbars, ActionMode.Inspect, ActionMode.LastBuildMode, ActionMode.Picker, EMono.player, HotbarManager.ResetHotbar(), and ActionMode.Terrain.

Referenced by ActionMode.DoFunc(), HotItemActionMode.Execute(), and TraitBuildBoard.TrySetAct().

◆ Unselect()

void BuildMenu.Unselect ( )
inline

Member Data Documentation

◆ buttonClearSearch

UIButton BuildMenu.buttonClearSearch

Definition at line 57 of file BuildMenu.cs.

Referenced by Search().

◆ buttonUndo

UIButton BuildMenu.buttonUndo

Definition at line 79 of file BuildMenu.cs.

Referenced by OnActivate().

◆ catDic

Dictionary<string, int> BuildMenu.catDic = new Dictionary<string, int>()

Definition at line 25 of file BuildMenu.cs.

Referenced by Init(), RefreshCategory(), and SelectCategory().

◆ categories

string [] BuildMenu.categories
Initial value:
= new string[20]
{
"wall", "floor", "foundation", "door", "furniture", "storage", "spot", "mount", "facility", "tool",
"deco", "mech", "light", "junk", "ext", "goods", "food", "obj", "other", "area"
}

Definition at line 60 of file BuildMenu.cs.

Referenced by Init(), and RefreshCategory().

◆ cg

CanvasGroup BuildMenu.cg

Definition at line 41 of file BuildMenu.cs.

Referenced by OnActivate(), and Refresh().

◆ counts

Dictionary<string, int> BuildMenu.counts = new Dictionary<string, int>()

Definition at line 69 of file BuildMenu.cs.

Referenced by RefreshCategory().

◆ currentCat

string BuildMenu.currentCat

Definition at line 53 of file BuildMenu.cs.

Referenced by _Search(), ClearSearch(), RefreshCategory(), and SelectCategory().

◆ dirtyCat

bool BuildMenu.dirtyCat
static

Definition at line 81 of file BuildMenu.cs.

Referenced by SelectCategory().

◆ firstRefresh

bool BuildMenu.firstRefresh = true
private

Definition at line 89 of file BuildMenu.cs.

Referenced by Refresh().

◆ gridTab

GridLayoutGroup BuildMenu.gridTab

Definition at line 17 of file BuildMenu.cs.

Referenced by Init().

◆ groupTab

UISelectableGroup BuildMenu.groupTab

Definition at line 19 of file BuildMenu.cs.

Referenced by Init(), Refresh(), RefreshCategory(), and SelectCategory().

◆ hideSpeed

float BuildMenu.hideSpeed

Definition at line 43 of file BuildMenu.cs.

◆ info1

◆ info2

UIRecipeInfo BuildMenu.info2

Definition at line 29 of file BuildMenu.cs.

Referenced by Init(), and Refresh().

◆ inputSearch

InputField BuildMenu.inputSearch

Definition at line 51 of file BuildMenu.cs.

Referenced by Init(), RefreshCategory(), and Search().

◆ Instance

◆ intervalSearch

float BuildMenu.intervalSearch

Definition at line 45 of file BuildMenu.cs.

Referenced by Search().

◆ lastButtonRecipe

ButtonRecipe BuildMenu.lastButtonRecipe

Definition at line 67 of file BuildMenu.cs.

◆ lastCat

string BuildMenu.lastCat

Definition at line 55 of file BuildMenu.cs.

Referenced by RefreshCategory().

◆ lastSearch

string BuildMenu.lastSearch

Definition at line 85 of file BuildMenu.cs.

Referenced by _Search(), ClearSearch(), and Search().

◆ list

UIDynamicList BuildMenu.list

Definition at line 21 of file BuildMenu.cs.

Referenced by Refresh(), RefreshCategory(), RefreshCategoryArea(), Select(), and Unselect().

◆ listArea

UIDynamicList BuildMenu.listArea

Definition at line 23 of file BuildMenu.cs.

Referenced by RefreshCategoryArea().

◆ moveInfo1

bool BuildMenu.moveInfo1

Definition at line 47 of file BuildMenu.cs.

Referenced by Refresh().

◆ orgPos

Vector2 BuildMenu.orgPos
private

Definition at line 73 of file BuildMenu.cs.

Referenced by Init(), and Refresh().

◆ orgPosOption

Vector2 BuildMenu.orgPosOption
private

Definition at line 75 of file BuildMenu.cs.

Referenced by Init(), and Refresh().

◆ posInfo1

Vector2 BuildMenu.posInfo1

Definition at line 37 of file BuildMenu.cs.

Referenced by Refresh().

◆ posInfo2

Vector2 BuildMenu.posInfo2

Definition at line 35 of file BuildMenu.cs.

Referenced by Refresh().

◆ posOption

Vector2 BuildMenu.posOption

Definition at line 39 of file BuildMenu.cs.

Referenced by Refresh().

◆ searchRecipes

HashSet<Recipe> BuildMenu.searchRecipes = new HashSet<Recipe>()

Definition at line 87 of file BuildMenu.cs.

Referenced by _Search(), and RefreshCategory().

◆ tabs

Dictionary<string, UIButton> BuildMenu.tabs = new Dictionary<string, UIButton>()

Definition at line 71 of file BuildMenu.cs.

Referenced by Init(), and RefreshCategory().

◆ terrainMenu

TerrainMenu BuildMenu.terrainMenu

Definition at line 49 of file BuildMenu.cs.

Referenced by ActionMode.Activate(), and AM_Copy.RefreshMenu().

◆ timerSearch

float BuildMenu.timerSearch
private

Definition at line 83 of file BuildMenu.cs.

Referenced by ClearSearch(), LateUpdate(), and Search().

◆ transMain

RectTransform BuildMenu.transMain

Definition at line 33 of file BuildMenu.cs.

Referenced by OnActivate().

◆ transOption

RectTransform BuildMenu.transOption

Definition at line 31 of file BuildMenu.cs.

Referenced by Init().

Property Documentation

◆ mode

Mode BuildMenu.mode
get

Definition at line 91 of file BuildMenu.cs.

Referenced by OnActivate().


The documentation for this class was generated from the following file: