Elin Decompiled Documentation EA 23.359.1 Nightly
Loading...
Searching...
No Matches
LayerCraft Class Reference
Inheritance diagram for LayerCraft:
LayerBaseCraft ELayer Layer IUISkin

Public Member Functions

override void RefreshCurrentGrid ()
 
override void ClearButtons ()
 
override string GetTextHeader (Window window)
 
override void OnAfterInit ()
 
override void OnKill ()
 
void SetFactory (Thing t)
 
void OnClickCraft ()
 
override List< Thing > GetTargets ()
 
override int GetReqIngredient (int index)
 
override void OnEndCraft ()
 
void OnCompleteCraft ()
 
void WaitUntilIdle ()
 
void RefreshInfo ()
 
void RefreshCategory (string cat, bool first=false)
 
void OnChangeIngredient ()
 
void RefreshRecipe (bool first)
 
void RefreshTrackButton ()
 
void RefreshInputNum ()
 
void RefreshProduct ()
 
bool IsQualityMet ()
 
void RefreshQuality ()
 
void OnClickExamine ()
 
virtual List< Thing > GetTargets ()
 
virtual int GetReqIngredient (int index)
 
virtual void RefreshCurrentGrid ()
 
virtual void ClearButtons ()
 
virtual void OnEndCraft ()
 
- Public Member Functions inherited from ELayer
override void OnBeforeAddLayer ()
 
void InitInspector ()
 
sealed override void Init ()
 
override void OnAfterAddLayer ()
 
void TryShowHelp ()
 
void AddLayerToUI (string id)
 
void TryShowHint (string _langHint=null)
 
void TalkHomeMemeber (string id)
 
void TalkMaid (string id)
 
override void OnRightClick ()
 
- Public Member Functions inherited from Layer
virtual string GetTextHeader (Window window)
 
virtual bool HeaderIsListOf (int id)
 
virtual void Init ()
 
virtual void OnInit ()
 
virtual void OnAfterInit ()
 
virtual void ApplySkin ()
 
void ShowScreenLock (string id)
 
void UpdateInput ()
 
virtual void OnUpdateInput ()
 
virtual void OnRightClick ()
 
virtual bool OnBack ()
 
virtual void OnChangeLayer ()
 
virtual void OnCreate ()
 
void _AddLayer (string id)
 
Layer AddLayer (string id)
 
T AddLayer< T > ()
 
T AddLayer< T > (string id)
 
T AddLayerDontCloseOthers< T > ()
 
T AddLayerDontCloseOthers< T > (string path)
 
Layer AddLayerDontCloseOthers (Layer l)
 
T GetOrAddLayer< T > ()
 
virtual void OnBeforeAddLayer ()
 
virtual void OnAfterAddLayer ()
 
Layer AddLayer (Layer l)
 
void ToggleLayer (string id)
 
T ToggleLayer< T > (string id=null)
 
void WaitAndClose ()
 
void OnClickClose ()
 
virtual void Close ()
 
void CloseLayers ()
 
void RemoveLayers (bool removeImportant=false)
 
bool RemoveLayer< T > ()
 
void RemoveLayer (Layer l)
 
virtual void OnKill ()
 
Layer SetOnKill (Action action)
 
void DisableClose ()
 
void Delay (float duration=0.05f)
 
Layer SetDelay (float d)
 
Layer GetLayer (string id)
 
T GetLayer< T > (bool fromTop=false)
 
Layer GetTopLayer ()
 
void SwitchContent (int idWindow, int i)
 
virtual void OnSwitchContent (Window window)
 
Layer SetTitles (string langList, string idHeaderRow=null)
 
bool IsBlockWidgetClick ()
 
bool IsHideHud ()
 
bool IsAllowGeneralInput ()
 
bool IsUseBlur ()
 
bool IsPointerOnLayer ()
 
void ApplySkin ()
 

Public Attributes

UIDynamicList list
 
UIRecipeInfo info1
 
UIRecipeInfo info2
 
Vector3 posInfo
 
Thing factory
 
Thing product
 
Recipe recipe
 
UIButton toggleRepeat
 
UIButton toggleCraftTo
 
UIButton buttonTrack
 
UIInputText inputNum
 
UIInputText moldInputNum
 
List< RecipeSource > newRecipes = new List<RecipeSource>()
 
Window windowList
 
bool showInfo
 
UIButton buttonRefuel
 
UIButton buttonAutoRefuel
 
Transform transFuel
 
UIText textFuel
 
UIText textQualityInvalid
 
UIText textQualityValid
 
Image imageQualityReq
 
Image imageQualityCurrent
 
float waitComplete
 
float qualityBarWidth
 
ButtonGrid lastB
 
- Public Attributes inherited from Layer
Option option
 
UnityEvent onKill
 
Anime animeIn
 
Anime animeOut
 
bool closeOthers
 
bool defaultActionMode = true
 
Button screenLock
 
Layer parent
 
string idLayer
 
List< Layer > layers = new List<Layer>()
 
Vector2 lastParentPos
 
List< Window > windows = new List<Window>()
 
string langHint
 

Static Public Attributes

static LayerCraft Instance
 
- Static Public Attributes inherited from Layer
static int skipInput
 
static bool closeOnRightClick
 
static bool rightClicked
 
static bool cancelKeyDown
 
static bool ignoreSounds
 
static Transform blurStopInstance
 
static string[] searchPath = new string[3] { "Layer", "Layer/Dialog", "Layer/LayerHome" }
 

Private Member Functions

void Update ()
 

Private Attributes

bool pickaxeCrafted
 
bool workbenchCrafted
 
int wcount
 
bool tabBuilt
 

Additional Inherited Members

- Static Public Member Functions inherited from ELayer
static int rnd (int a)
 
- Static Public Member Functions inherited from Layer
static T Create< T > ()
 
static T Create< T > (string path)
 
static Layer Create (string path)
 
- Protected Member Functions inherited from ELayer
sealed override void _Close ()
 
sealed override void Kill ()
 
- Protected Member Functions inherited from Layer
virtual void Awake ()
 
virtual void _Close ()
 
virtual void Kill ()
 
- Protected Attributes inherited from Layer
RectTransform _rect
 
bool isDestroyed
 
- Properties inherited from LayerBaseCraft
virtual bool CanCancelAI [get]
 
virtual bool RepeatAI [get]
 
- Properties inherited from ELayer
static Core core [get]
 
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static FactionBranch Branch [get]
 
static Faction Home [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static CoreConfig config [get]
 
static GameSetting setting [get]
 
static ColorProfile Colors [get]
 
static SourceManager sources [get]
 
static World world [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 
bool IsFloat [get]
 
virtual string IdHelp [get]
 
- Properties inherited from Layer
Layer TopLayer [get]
 
string uid [get]
 
virtual RectTransform rectLayers [get]
 
virtual bool blockWidgetClick [get]
 

Detailed Description

Definition at line 6 of file LayerCraft.cs.

Member Function Documentation

◆ ClearButtons()

override void LayerCraft.ClearButtons ( )
inlinevirtual

Reimplemented from LayerBaseCraft.

Definition at line 75 of file LayerCraft.cs.

76 {
77 RefreshRecipe(first: true);
78 }
void RefreshRecipe(bool first)
Definition: LayerCraft.cs:416

References RefreshRecipe().

◆ GetReqIngredient()

override int LayerCraft.GetReqIngredient ( int  index)
inlinevirtual

Reimplemented from LayerBaseCraft.

Definition at line 209 of file LayerCraft.cs.

210 {
211 return recipe.ingredients[index].req * inputNum.Num;
212 }
UIInputText inputNum
Definition: LayerCraft.cs:30
Recipe recipe
Definition: LayerCraft.cs:22
List< Ingredient > ingredients
Definition: Recipe.cs:181

References Recipe.ingredients, inputNum, UIInputText.Num, and recipe.

◆ GetTargets()

override List< Thing > LayerCraft.GetTargets ( )
inlinevirtual

Reimplemented from LayerBaseCraft.

Definition at line 196 of file LayerCraft.cs.

197 {
198 List<Thing> list = new List<Thing>();
199 foreach (Recipe.Ingredient ingredient in recipe.ingredients)
200 {
201 if (!ingredient.optional || (ingredient.thing != null && !ingredient.thing.isDestroyed))
202 {
203 list.Add(ingredient.thing);
204 }
205 }
206 return list;
207 }
UIDynamicList list
Definition: LayerCraft.cs:10
Definition: Recipe.cs:7
override void Add(object o)

References UIDynamicList.Add(), Recipe.ingredients, list, and recipe.

◆ GetTextHeader()

override string LayerCraft.GetTextHeader ( Window  window)
inlinevirtual

Reimplemented from Layer.

Definition at line 80 of file LayerCraft.cs.

81 {
82 return null;
83 }

◆ IsQualityMet()

bool LayerCraft.IsQualityMet ( )
inline

Definition at line 504 of file LayerCraft.cs.

505 {
506 return true;
507 }

◆ OnAfterInit()

override void LayerCraft.OnAfterInit ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 85 of file LayerCraft.cs.

86 {
87 info1.searchMode = StockSearchMode.AroundPC;
88 info1.ddList.pivot.SetActive(enable: true);
89 Instance = this;
90 }
StockSearchMode
RectTransform pivot
Definition: DropdownGrid.cs:20
static LayerCraft Instance
Definition: LayerCraft.cs:8
UIRecipeInfo info1
Definition: LayerCraft.cs:12
DropdownGrid ddList
Definition: UIRecipeInfo.cs:62

References UIRecipeInfo.ddList, info1, Instance, and DropdownGrid.pivot.

◆ OnChangeIngredient()

void LayerCraft.OnChangeIngredient ( )
inline

Definition at line 411 of file LayerCraft.cs.

412 {
413 RefreshRecipe(first: true);
414 }

References RefreshRecipe().

Referenced by DropdownGrid.Activate(), and ButtonGrid.SetIngredient().

◆ OnClickCraft()

void LayerCraft.OnClickCraft ( )
inline

Definition at line 138 of file LayerCraft.cs.

139 {
140 Dictionary<Thing, int> dictionary = new Dictionary<Thing, int>();
141 foreach (Recipe.Ingredient ingredient in recipe.ingredients)
142 {
143 if (ingredient.thing != null)
144 {
145 if (!dictionary.ContainsKey(ingredient.thing))
146 {
147 dictionary.Add(ingredient.thing, 0);
148 }
149 dictionary[ingredient.thing] += ingredient.req * inputNum.Num;
150 }
151 }
152 foreach (KeyValuePair<Thing, int> item in dictionary)
153 {
154 if (item.Key.Num < item.Value)
155 {
156 SE.Beep();
157 Msg.Say("craftDupError");
158 return;
159 }
160 }
161 if (inputNum.Num == 0)
162 {
163 SE.Beep();
164 return;
165 }
166 TraitCrafter traitCrafter = factory?.trait as TraitCrafter;
167 if (traitCrafter == null)
168 {
169 traitCrafter = Trait.SelfFactory;
170 traitCrafter.owner = ELayer.pc;
171 }
172 (traitCrafter as TraitFactory).recipe = recipe;
173 switch (recipe.id)
174 {
175 case "workbench":
176 workbenchCrafted = true;
177 break;
178 case "axe":
179 case "hammer":
180 case "pickaxe":
181 pickaxeCrafted = true;
182 break;
183 }
186 {
187 crafter = traitCrafter,
188 layer = this,
189 recipe = recipe,
190 num = inputNum.Num
191 });
193 base.gameObject.SetActive(value: false);
194 }
void SetTurbo(int mtp=-1)
Definition: AM_Adv.cs:1091
static AM_Adv Adv
Definition: ActionMode.cs:15
Trait trait
Definition: Card.cs:54
AIAct SetAI(AIAct g)
Definition: Chara.cs:9527
Definition: ELayer.cs:4
static Chara pc
Definition: ELayer.cs:15
bool pickaxeCrafted
Definition: LayerCraft.cs:40
Thing factory
Definition: LayerCraft.cs:18
bool workbenchCrafted
Definition: LayerCraft.cs:42
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
string id
Definition: Recipe.cs:178
void SaveLastIngredients()
Definition: Recipe.cs:1027
Definition: Trait.cs:7
static TraitSelfFactory SelfFactory
Definition: Trait.cs:26

References ActionMode.Adv, factory, Recipe.id, Recipe.ingredients, inputNum, item, UIInputText.Num, ELayer.pc, pickaxeCrafted, recipe, Recipe.SaveLastIngredients(), Msg.Say(), Trait.SelfFactory, Chara.SetAI(), AM_Adv.SetTurbo(), Card.trait, and workbenchCrafted.

◆ OnClickExamine()

void LayerCraft.OnClickExamine ( )
inline

Definition at line 513 of file LayerCraft.cs.

514 {
515 ELayer.ui.AddLayer<LayerInfo>().Set(product);
516 }
static UI ui
Definition: ELayer.cs:21
Thing product
Definition: LayerCraft.cs:20

References product, and ELayer.ui.

◆ OnCompleteCraft()

void LayerCraft.OnCompleteCraft ( )
inline

Definition at line 219 of file LayerCraft.cs.

220 {
221 CancelInvoke("WaitUntilIdle");
222 EInput.haltInput = true;
223 TweenUtil.Tween(waitComplete, null, delegate
224 {
225 EInput.haltInput = false;
226 base.gameObject.SetActive(value: true);
227 foreach (Window window in windows)
228 {
229 window.SetInteractable(enable: true);
230 }
231 list.Redraw();
232 recipe = list.objects.OfType<Recipe>().FirstOrDefault((Recipe r) => r.id == recipe.id && r.idSkin == recipe.idSkin) ?? recipe;
233 if (recipe.ingredients.Count == 0)
234 {
236 }
237 RefreshRecipe(first: true);
240 });
241 }
Window windowList
Definition: LayerCraft.cs:36
float waitComplete
Definition: LayerCraft.cs:60
List< Window > windows
Definition: Layer.cs:116
int idSkin
Definition: Recipe.cs:198
virtual void BuildIngredientList()
Definition: Recipe.cs:539
List< object > objects
override void Redraw()
bool Select(object o, bool invoke=false)
Definition: Window.cs:13
UISelectableGroup groupTab
Definition: Window.cs:658
void SetInteractable(bool enable, float alpha=0.5f)
Definition: Window.cs:1525

References Recipe.BuildIngredientList(), Window.groupTab, Recipe.id, Recipe.idSkin, Recipe.ingredients, list, UIDynamicList.objects, recipe, UIDynamicList.Redraw(), UISelectableGroup.RefreshButtons(), RefreshRecipe(), UIDynamicList.Select(), Window.SetInteractable(), waitComplete, windowList, and Layer.windows.

Referenced by OnEndCraft(), and TaskCraft.Run().

◆ OnEndCraft()

override void LayerCraft.OnEndCraft ( )
inlinevirtual

Reimplemented from LayerBaseCraft.

Definition at line 214 of file LayerCraft.cs.

215 {
217 }
void OnCompleteCraft()
Definition: LayerCraft.cs:219

References OnCompleteCraft().

Referenced by SetFactory().

◆ OnKill()

override void LayerCraft.OnKill ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 92 of file LayerCraft.cs.

93 {
95 {
96 Tutorial.Play("middle_click");
97 }
99 {
100 Tutorial.Play("hardness");
101 }
102 string key = ((factory == null) ? "hand" : factory.id);
104 }
string id
Definition: Card.cs:36
static Player player
Definition: ELayer.cs:13
Dictionary< string, string > lastRecipes
Definition: Player.cs:1128
static void Play(string idStep)
Definition: Tutorial.cs:7

References factory, Card.id, Recipe.id, Player.lastRecipes, pickaxeCrafted, Tutorial.Play(), ELayer.player, recipe, and workbenchCrafted.

◆ RefreshCategory()

void LayerCraft.RefreshCategory ( string  cat,
bool  first = false 
)
inline

Definition at line 286 of file LayerCraft.cs.

287 {
288 Dictionary<string, int> cats = new Dictionary<string, int>();
290 list.callbacks = new UIList.Callback<Recipe, ButtonGrid>
291 {
292 onClick = delegate(Recipe a, ButtonGrid b)
293 {
294 if (recipe != null)
295 {
297 }
298 recipe = a;
299 SE.Play("click_recipe");
300 RefreshRecipe(first: true);
302 b.Dettach("recipe_new");
303 list.Select(a);
304 },
305 onRedraw = delegate(Recipe a, ButtonGrid b, int i)
306 {
307 if (a.ingredients.Count == 0)
308 {
310 }
311 b.SetCraftRecipe(a, ButtonGrid.Mode.Recipe);
312 if (!ELayer.player.recipes.hoveredRecipes.Contains(a.id))
313 {
314 b.Attach("recipe_new", rightAttach: false);
315 }
316 if (a.HasFirstTimeBonus())
317 {
318 b.Attach("recipe_firstTime", rightAttach: false).GetComponent<Image>().SetAlpha((a.idSkin == 0) ? 1f : 0.5f);
319 }
320 },
321 onList = delegate
322 {
323 newRecipes.Clear();
325 {
326 if (cat == "all" || item.row.Category.IsChildOf(cat))
327 {
328 Recipe o2 = Recipe.Create(item);
329 list.Add(o2);
330 if (item.row.skins != null && item.row.skins.Length != 0 && !item.row.HasTag(CTAG.noSkinRecipe))
331 {
332 for (int i = 0; i < item.row.skins.Length; i++)
333 {
334 o2 = Recipe.Create(item);
335 o2.idSkin = i + 1;
336 list.Add(o2);
337 }
338 }
339 }
340 SourceCategory.Row row = item.row.Category.GetSecondRoot();
341 if (row.id != "lightsource" && row.IsChildOf("armor"))
342 {
343 row = ELayer.sources.categories.map["armor"];
344 }
345 if (!cats.ContainsKey(row.id))
346 {
347 cats.Add(row.id, 1);
348 }
349 else
350 {
351 cats[row.id]++;
352 }
353 }
354 list.objects.Sort((object a, object b) => (b as Recipe).GetSortVal() - (a as Recipe).GetSortVal());
355 _ = newRecipes.Count;
356 },
357 onSort = (Recipe a, UIList.SortMode m) => a.GetSortVal()
358 };
359 list.sortMode = UIList.SortMode.ByLevel;
360 list.List();
361 if (cats.Count > 1 && !tabBuilt)
362 {
363 windowList.AddTab("all", null, delegate
364 {
365 RefreshCategory("all");
366 });
367 foreach (KeyValuePair<string, int> c in cats)
368 {
369 windowList.AddTab(ELayer.sources.categories.map[c.Key].GetName() + "(" + c.Value + ")", null, delegate
370 {
371 RefreshCategory(c.Key);
372 });
373 }
374 tabBuilt = true;
376 }
377 list.Scroll();
378 if (list.rows.Count <= 0)
379 {
380 return;
381 }
382 object o = list.rows[0].objects[0];
383 if (first)
384 {
385 string key = ((factory == null) ? "hand" : factory.id);
386 if (ELayer.player.lastRecipes.ContainsKey(key))
387 {
388 string text = ELayer.player.lastRecipes[key];
389 foreach (object @object in list.objects)
390 {
391 if ((@object as Recipe).id == text)
392 {
393 o = @object;
394 break;
395 }
396 }
397 }
398 list.Scroll(o);
399 if (!list.Select(o, invoke: true))
400 {
401 list.Scroll();
402 list.Select(list.rows[0].objects[0]);
403 }
404 }
405 else
406 {
407 list.Select(o, invoke: true);
408 }
409 }
CTAG
Definition: CTAG.cs:2
void SetCraftRecipe(Recipe r, Mode mode, bool tooltip=false)
Definition: ButtonGrid.cs:597
Transform Attach(string id, bool rightAttach=true)
Definition: ButtonGrid.cs:63
void Dettach(string id)
Definition: ButtonGrid.cs:78
static SourceManager sources
Definition: ELayer.cs:37
List< RecipeSource > newRecipes
Definition: LayerCraft.cs:34
void RefreshCategory(string cat, bool first=false)
Definition: LayerCraft.cs:286
bool tabBuilt
Definition: LayerCraft.cs:68
RecipeManager recipes
Definition: Player.cs:1176
static void BuildList()
List< RecipeSource > ListSources(Thing factory, List< RecipeSource > newRecipes=null)
HashSet< string > hoveredRecipes
int GetSortVal()
Definition: Recipe.cs:996
static Recipe Create(RecipeSource _source, int idMat=-1, Thing ing=null)
Definition: Recipe.cs:325
bool HasFirstTimeBonus()
Definition: Recipe.cs:1002
bool IsChildOf(string id)
SourceCategory categories
override void List()
List< Row > rows
void Scroll(int index=0)
Definition: UIList.cs:9
SortMode
Definition: UIList.cs:27
void BuildTabs(int index=-1)
Definition: Window.cs:1396
Setting.Tab AddTab(string idLang, UIContent content=null, Action action=null, Sprite sprite=null, string langTooltip=null)
Definition: Window.cs:1443

References UIDynamicList.Add(), Window.AddTab(), ButtonGrid.Attach(), Recipe.BuildIngredientList(), RecipeManager.BuildList(), Window.BuildTabs(), SourceManager.categories, Recipe.Create(), ButtonGrid.Dettach(), factory, Recipe.GetSortVal(), Recipe.HasFirstTimeBonus(), RecipeManager.hoveredRecipes, Card.id, Recipe.id, SourceCategory.Row.id, Recipe.idSkin, Recipe.ingredients, SourceCategory.Row.IsChildOf(), item, Player.lastRecipes, list, UIDynamicList.List(), RecipeManager.ListSources(), newRecipes, UIDynamicList.objects, ELayer.player, recipe, Player.recipes, RefreshCategory(), RefreshRecipe(), UIDynamicList.rows, Recipe.SaveLastIngredients(), UIDynamicList.Scroll(), UIDynamicList.Select(), ButtonGrid.SetCraftRecipe(), ELayer.sources, tabBuilt, and windowList.

Referenced by RefreshCategory(), and SetFactory().

◆ RefreshCurrentGrid()

override void LayerCraft.RefreshCurrentGrid ( )
inlinevirtual

Reimplemented from LayerBaseCraft.

Definition at line 70 of file LayerCraft.cs.

71 {
72 RefreshRecipe(first: true);
73 }

References RefreshRecipe().

◆ RefreshInfo()

void LayerCraft.RefreshInfo ( )
inline

Definition at line 273 of file LayerCraft.cs.

274 {
275 ButtonGrid buttonGrid = InputModuleEX.GetComponentOf<ButtonGrid>();
276 if ((bool)buttonGrid && buttonGrid.recipe == null)
277 {
278 buttonGrid = null;
279 }
280 if (!(buttonGrid == lastB))
281 {
282 lastB = buttonGrid;
283 }
284 }
ButtonGrid lastB
Definition: LayerCraft.cs:66

References lastB.

Referenced by Update().

◆ RefreshInputNum()

void LayerCraft.RefreshInputNum ( )
inline

Definition at line 450 of file LayerCraft.cs.

451 {
453 inputNum.onValueChanged = delegate
454 {
456 };
458 }
void RefreshProduct()
Definition: LayerCraft.cs:460
int GetMaxCount()
Definition: Recipe.cs:965
void SetMinMax(int _min, int _max)
Definition: UIInputText.cs:76
void Validate()
Definition: UIInputText.cs:115

References Recipe.GetMaxCount(), inputNum, recipe, RefreshProduct(), UIInputText.SetMinMax(), and UIInputText.Validate().

Referenced by RefreshProduct().

◆ RefreshProduct()

void LayerCraft.RefreshProduct ( )
inline

Definition at line 460 of file LayerCraft.cs.

461 {
463 ELayer.screen.tileSelector.summary.countValid = inputNum.Num;
464 ELayer.screen.tileSelector.summary.factory = factory;
466 if (factory != null)
467 {
468 textFuel.text = "craftFuel".lang(((int)((float)factory.c_charges / (float)factory.trait.MaxFuel * 100f)).ToString() ?? "");
469 buttonAutoRefuel.mainText.text = (factory.autoRefuel ? "On" : "Off");
470 buttonAutoRefuel.icon.SetAlpha(factory.autoRefuel ? 1f : 0.4f);
471 }
473 List<Thing> list = new List<Thing>();
474 foreach (Recipe.Ingredient ingredient in recipe.ingredients)
475 {
476 if (ingredient.thing != null)
477 {
478 list.Add(ingredient.thing);
479 }
480 }
481 Thing thing = recipe.Craft(BlessedState.Normal, sound: false, list, null, model: true);
482 thing.SetNum(inputNum.Num);
483 if (thing.sockets != null)
484 {
485 thing.sockets.Clear();
486 }
488 {
489 foreach (Element item in thing.elements.dict.Values.ToList())
490 {
491 _ = item;
492 }
493 }
495 ButtonGrid comp = this.list.GetComp<ButtonGrid>(recipe);
496 if ((bool)comp)
497 {
498 recipe.SetImage(comp.icon);
499 }
500 thing.WriteNote(info1.note, null, IInspect.NoteMode.Product, recipe);
501 product = thing;
502 }
BlessedState
Definition: BlessedState.cs:2
void SetCard(Card c, Mode mode=Mode.Default, Action< UINote > onWriteNote=null)
Definition: ButtonGrid.cs:184
ElementContainerCard elements
Definition: Card.cs:42
bool IsEquipmentOrRangedOrAmmo
Definition: Card.cs:2284
Thing SetNum(int a)
Definition: Card.cs:3676
bool autoRefuel
Definition: Card.cs:629
int c_charges
Definition: Card.cs:1309
List< int > sockets
Definition: Card.cs:48
Dictionary< int, Element > dict
void RefreshInputNum()
Definition: LayerCraft.cs:450
void RefreshQuality()
Definition: LayerCraft.cs:509
UIButton buttonAutoRefuel
Definition: LayerCraft.cs:46
virtual Thing Craft(BlessedState blessed, bool sound=false, List< Thing > ings=null, TraitCrafter crafter=null, bool model=false)
Definition: Recipe.cs:566
virtual void SetImage(Image icon)
Definition: Recipe.cs:934
Definition: Thing.cs:8
override void WriteNote(UINote n, Action< UINote > onWriteNote=null, IInspect.NoteMode mode=IInspect.NoteMode.Default, Recipe recipe=null)
Definition: Thing.cs:903
virtual int MaxFuel
Definition: Trait.cs:466
Image icon
Definition: UIButton.cs:110
void RefreshBalance()
ButtonGrid buttonProduct
Definition: UIRecipeInfo.cs:66
NoteMode
Definition: IInspect.cs:7

References UIDynamicList.Add(), Card.autoRefuel, buttonAutoRefuel, UIRecipeInfo.buttonProduct, Card.c_charges, Recipe.Craft(), ElementContainer.dict, Card.elements, factory, UIButton.icon, info1, Recipe.ingredients, inputNum, Card.IsEquipmentOrRangedOrAmmo, item, list, Trait.MaxFuel, UIRecipeInfo.note, UIInputText.Num, product, recipe, UIRecipeInfo.RefreshBalance(), RefreshInputNum(), RefreshQuality(), ButtonGrid.SetCard(), Recipe.SetImage(), Card.SetNum(), Card.sockets, Card.trait, and Thing.WriteNote().

Referenced by RefreshInputNum(), RefreshRecipe(), SetFactory(), and DropdownGrid.TrySelect().

◆ RefreshQuality()

void LayerCraft.RefreshQuality ( )
inline

Definition at line 509 of file LayerCraft.cs.

510 {
511 }

Referenced by RefreshProduct().

◆ RefreshRecipe()

void LayerCraft.RefreshRecipe ( bool  first)
inline

Definition at line 416 of file LayerCraft.cs.

417 {
418 foreach (Recipe.Ingredient ingredient in recipe.ingredients)
419 {
420 if (info1.recipe != recipe || (!ingredient.optional && (ingredient.thing == null || ingredient.thing.isDestroyed)))
421 {
422 ingredient.SetThing();
423 }
424 }
425 if (first)
426 {
427 toggleCraftTo.SetToggle(isOn: false);
428 toggleRepeat.SetToggle(isOn: false);
429 inputNum.Num = 1;
430 info1.recipe = null;
431 }
432 info1.factory = factory;
437 }
UIButton toggleRepeat
Definition: LayerCraft.cs:24
void RefreshTrackButton()
Definition: LayerCraft.cs:439
UIButton toggleCraftTo
Definition: LayerCraft.cs:26
virtual void OnChangeIngredient()
Definition: Recipe.cs:562
void SetToggle(bool isOn, Action< bool > onToggle=null)
Definition: UIButton.cs:341
void SetRecipe(Recipe r)
Recipe recipe
Definition: UIRecipeInfo.cs:32

References factory, info1, Recipe.ingredients, Recipe.OnChangeIngredient(), recipe, UIRecipeInfo.recipe, RefreshProduct(), RefreshTrackButton(), UIRecipeInfo.SetRecipe(), UIButton.SetToggle(), toggleCraftTo, and toggleRepeat.

Referenced by ClearButtons(), OnChangeIngredient(), OnCompleteCraft(), RefreshCategory(), and RefreshCurrentGrid().

◆ RefreshTrackButton()

void LayerCraft.RefreshTrackButton ( )
inline

Definition at line 439 of file LayerCraft.cs.

440 {
442 buttonTrack.SetOnClick(delegate
443 {
444 recipe.ToggleTrack(quest);
446 });
447 buttonTrack.icon.SetActive(quest != null && quest.idRecipe == recipe.id);
448 }
UIButton buttonTrack
Definition: LayerCraft.cs:28
QuestTrackCraft GetQuestTrack()
Definition: Recipe.cs:1038
void ToggleTrack(QuestTrackCraft quest)
Definition: Recipe.cs:1052

References buttonTrack, Recipe.GetQuestTrack(), UIButton.icon, Recipe.id, QuestTrackCraft.idRecipe, recipe, RefreshTrackButton(), and Recipe.ToggleTrack().

Referenced by ItemQuestTracker.OnClickClose(), RefreshRecipe(), and RefreshTrackButton().

◆ SetFactory()

void LayerCraft.SetFactory ( Thing  t)
inline

Definition at line 106 of file LayerCraft.cs.

107 {
108 factory = t;
109 RefreshCategory("all", first: true);
110 bool flag = t != null && t.trait.IsRequireFuel;
111 transFuel.SetActive(flag);
112 if (!flag)
113 {
114 return;
115 }
116 buttonRefuel.SetOnClick(delegate
117 {
118 foreach (Window window in windows)
119 {
120 window.SetInteractable(enable: false, 0f);
121 }
123 {
124 if (!isDestroyed)
125 {
126 OnEndCraft();
127 }
128 });
129 });
130 buttonAutoRefuel.SetOnClick(delegate
131 {
132 SE.Click();
133 t.autoRefuel = !t.autoRefuel;
135 });
136 }
override void OnEndCraft()
Definition: LayerCraft.cs:214
Transform transFuel
Definition: LayerCraft.cs:48
UIButton buttonRefuel
Definition: LayerCraft.cs:44
static LayerDragGrid Create(InvOwnerDraglet owner, bool refuelFromLayerDragGrid=false)
bool isDestroyed
Definition: Layer.cs:98
Layer SetOnKill(Action action)
Definition: Layer.cs:584
bool IsRequireFuel
Definition: Trait.cs:481

References Card.autoRefuel, buttonAutoRefuel, buttonRefuel, LayerDragGrid.Create(), factory, Layer.isDestroyed, Trait.IsRequireFuel, OnEndCraft(), RefreshCategory(), RefreshProduct(), Window.SetInteractable(), Layer.SetOnKill(), Card.trait, transFuel, and Layer.windows.

◆ Update()

void LayerCraft.Update ( )
inlineprivate

Definition at line 252 of file LayerCraft.cs.

253 {
254 float axis = Input.GetAxis("Mouse ScrollWheel");
255 if (Input.GetMouseButton(0))
256 {
257 wcount = 2;
258 }
259 if (axis != 0f)
260 {
261 wcount = 2;
262 }
263 else if (wcount > 0)
264 {
265 wcount--;
266 }
267 else
268 {
269 RefreshInfo();
270 }
271 }
int wcount
Definition: LayerCraft.cs:64
void RefreshInfo()
Definition: LayerCraft.cs:273

References RefreshInfo(), and wcount.

◆ WaitUntilIdle()

void LayerCraft.WaitUntilIdle ( )
inline

Definition at line 243 of file LayerCraft.cs.

244 {
246 {
247 CancelInvoke();
248 Close();
249 }
250 }
bool IsActive
Definition: ActionMode.cs:121
bool HasNoGoal
Definition: Chara.cs:1056
virtual void Close()
Definition: Layer.cs:468

References ActionMode.Adv, Layer.Close(), Chara.HasNoGoal, ActionMode.IsActive, and ELayer.pc.

Member Data Documentation

◆ buttonAutoRefuel

UIButton LayerCraft.buttonAutoRefuel

Definition at line 46 of file LayerCraft.cs.

Referenced by RefreshProduct(), and SetFactory().

◆ buttonRefuel

UIButton LayerCraft.buttonRefuel

Definition at line 44 of file LayerCraft.cs.

Referenced by SetFactory().

◆ buttonTrack

UIButton LayerCraft.buttonTrack

Definition at line 28 of file LayerCraft.cs.

Referenced by RefreshTrackButton().

◆ factory

Thing LayerCraft.factory

◆ imageQualityCurrent

Image LayerCraft.imageQualityCurrent

Definition at line 58 of file LayerCraft.cs.

◆ imageQualityReq

Image LayerCraft.imageQualityReq

Definition at line 56 of file LayerCraft.cs.

◆ info1

UIRecipeInfo LayerCraft.info1

Definition at line 12 of file LayerCraft.cs.

Referenced by OnAfterInit(), RefreshProduct(), and RefreshRecipe().

◆ info2

UIRecipeInfo LayerCraft.info2

Definition at line 14 of file LayerCraft.cs.

◆ inputNum

UIInputText LayerCraft.inputNum

Definition at line 30 of file LayerCraft.cs.

Referenced by GetReqIngredient(), OnClickCraft(), RefreshInputNum(), and RefreshProduct().

◆ Instance

◆ lastB

ButtonGrid LayerCraft.lastB

Definition at line 66 of file LayerCraft.cs.

Referenced by RefreshInfo().

◆ list

UIDynamicList LayerCraft.list

Definition at line 10 of file LayerCraft.cs.

Referenced by GetTargets(), OnCompleteCraft(), RefreshCategory(), and RefreshProduct().

◆ moldInputNum

UIInputText LayerCraft.moldInputNum

Definition at line 32 of file LayerCraft.cs.

◆ newRecipes

List<RecipeSource> LayerCraft.newRecipes = new List<RecipeSource>()

Definition at line 34 of file LayerCraft.cs.

Referenced by RefreshCategory().

◆ pickaxeCrafted

bool LayerCraft.pickaxeCrafted
private

Definition at line 40 of file LayerCraft.cs.

Referenced by OnClickCraft(), and OnKill().

◆ posInfo

Vector3 LayerCraft.posInfo

Definition at line 16 of file LayerCraft.cs.

◆ product

Thing LayerCraft.product

Definition at line 20 of file LayerCraft.cs.

Referenced by OnClickExamine(), RefreshProduct(), and ActionMode.UpdateInput().

◆ qualityBarWidth

float LayerCraft.qualityBarWidth

Definition at line 62 of file LayerCraft.cs.

◆ recipe

◆ showInfo

bool LayerCraft.showInfo

Definition at line 38 of file LayerCraft.cs.

◆ tabBuilt

bool LayerCraft.tabBuilt
private

Definition at line 68 of file LayerCraft.cs.

Referenced by RefreshCategory().

◆ textFuel

UIText LayerCraft.textFuel

Definition at line 50 of file LayerCraft.cs.

◆ textQualityInvalid

UIText LayerCraft.textQualityInvalid

Definition at line 52 of file LayerCraft.cs.

◆ textQualityValid

UIText LayerCraft.textQualityValid

Definition at line 54 of file LayerCraft.cs.

◆ toggleCraftTo

UIButton LayerCraft.toggleCraftTo

Definition at line 26 of file LayerCraft.cs.

Referenced by RefreshRecipe().

◆ toggleRepeat

UIButton LayerCraft.toggleRepeat

Definition at line 24 of file LayerCraft.cs.

Referenced by RefreshRecipe().

◆ transFuel

Transform LayerCraft.transFuel

Definition at line 48 of file LayerCraft.cs.

Referenced by SetFactory().

◆ waitComplete

float LayerCraft.waitComplete

Definition at line 60 of file LayerCraft.cs.

Referenced by OnCompleteCraft().

◆ wcount

int LayerCraft.wcount
private

Definition at line 64 of file LayerCraft.cs.

Referenced by Update().

◆ windowList

Window LayerCraft.windowList

Definition at line 36 of file LayerCraft.cs.

Referenced by OnCompleteCraft(), and RefreshCategory().

◆ workbenchCrafted

bool LayerCraft.workbenchCrafted
private

Definition at line 42 of file LayerCraft.cs.

Referenced by OnClickCraft(), and OnKill().


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