Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
LayerCraftFloat Class Reference
Inheritance diagram for LayerCraftFloat:
ELayer Layer IUISkin

Public Member Functions

override void OnInit ()
 
override void OnSwitchContent (Window window)
 
void Update ()
 
void OnCompleteCraft ()
 
void RefreshCraft ()
 
void ShowContextMenu (Recipe a)
 
void RefreshDisassemble ()
 
void RefreshSize ()
 
- 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)
 
AddLayer< T > ()
 
AddLayer< T > (string id)
 
AddLayerDontCloseOthers< T > ()
 
Layer AddLayerDontCloseOthers (Layer l)
 
GetOrAddLayer< T > ()
 
virtual void OnBeforeAddLayer ()
 
virtual void OnAfterAddLayer ()
 
Layer AddLayer (Layer l)
 
void ToggleLayer (string id)
 
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)
 
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
 
Recipe recipe
 
UIButton moldButtonContext
 
int maxSize
 
int paddingY
 
int paddingY2
 
string idLastRecipe
 
- 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< Layerlayers = new List<Layer>()
 
Vector2 lastParentPos
 
List< Windowwindows = new List<Window>()
 
string langHint
 

Static Public Attributes

static LayerCraftFloat 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" }
 

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 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 4 of file LayerCraftFloat.cs.

Member Function Documentation

◆ OnCompleteCraft()

void LayerCraftFloat.OnCompleteCraft ( )
inline

Definition at line 63 of file LayerCraftFloat.cs.

64 {
65 }

Referenced by TaskCraft.Run().

◆ OnInit()

override void LayerCraftFloat.OnInit ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 22 of file LayerCraftFloat.cs.

23 {
24 Instance = this;
25 }
static LayerCraftFloat Instance

References Instance.

◆ OnSwitchContent()

override void LayerCraftFloat.OnSwitchContent ( Window  window)
inlinevirtual

Reimplemented from Layer.

Definition at line 27 of file LayerCraftFloat.cs.

28 {
30 {
32 }
33 }
Point pos
Definition: Card.cs:55
bool IsGameStarted
Definition: Core.cs:84
Definition: ELayer.cs:4
static Chara pc
Definition: ELayer.cs:15
static Core core
Definition: ELayer.cs:7
static Game game
Definition: ELayer.cs:9
RecipeUpdater recipe
Definition: GameUpdater.cs:363
GameUpdater updater
Definition: Game.cs:243
void Build(Point _p, Mode _mode=Mode.Passive)

References RecipeUpdater.Build(), ELayer.core, ELayer.game, Core.IsGameStarted, ELayer.pc, Card.pos, GameUpdater.recipe, and Game.updater.

◆ RefreshCraft()

void LayerCraftFloat.RefreshCraft ( )
inline

Definition at line 67 of file LayerCraftFloat.cs.

68 {
69 list.callbacks = new UIList.Callback<Recipe, ButtonGrid>
70 {
71 onClick = delegate(Recipe a, ButtonGrid b)
72 {
73 ELayer.ui.RemoveLayers();
75 if (!RecipeUpdater.recipes.Contains(a))
76 {
77 SE.BeepSmall();
79 }
80 else
81 {
83 recipe = a;
86 {
87 SE.BeepSmall();
88 }
89 else
90 {
91 TaskCraft taskCraft = new TaskCraft
92 {
93 recipe = recipe,
94 num = 1,
95 repeat = false,
96 floatMode = true
97 };
98 taskCraft.ResetReq();
99 if (!taskCraft.IsIngredientsValid(destoryResources: false, taskCraft.num))
100 {
101 SE.Beep();
102 }
103 else
104 {
105 ELayer.pc.SetAI(taskCraft);
107 }
108 }
109 }
110 },
111 onRedraw = delegate(Recipe a, ButtonGrid b, int i)
112 {
113 b.SetCraftRecipe(a, ButtonGrid.Mode.RecipeGrid, tooltip: true);
114 if (!ELayer.player.recipes.hoveredRecipes.Contains(a.id))
115 {
116 b.Attach("recipe_new", rightAttach: false);
117 }
118 b.onRightClick = delegate
119 {
121 };
122 },
123 onList = delegate
124 {
126 {
127 list.Add(recipe);
128 }
129 }
130 };
131 list.List();
132 RefreshSize();
133 list.dsv.OnResize();
134 }
void SetTurbo(int mtp=-1)
Definition: AM_Adv.cs:1040
static AM_Adv Adv
Definition: ActionMode.cs:15
void SetCraftRecipe(Recipe r, Mode mode, bool tooltip=false)
Definition: ButtonGrid.cs:585
Transform Attach(string id, bool rightAttach=true)
Definition: ButtonGrid.cs:63
AIAct SetAI(AIAct g)
Definition: Chara.cs:8045
static Player player
Definition: ELayer.cs:13
static UI ui
Definition: ELayer.cs:21
UIDynamicList list
void ShowContextMenu(Recipe a)
RecipeManager recipes
Definition: Player.cs:898
bool waitingInput
Definition: Player.cs:960
HashSet< string > hoveredRecipes
static HashSet< Recipe > recipes
Definition: Recipe.cs:7
string id
Definition: Recipe.cs:161
virtual void OnChangeIngredient()
Definition: Recipe.cs:532
void ResetReq()
Definition: TaskCraft.cs:53
int num
Definition: TaskCraft.cs:13
bool IsIngredientsValid(bool destoryResources=false, int numCraft=1)
Definition: TaskCraft.cs:111
override void List()
override void Add(object o)
DynamicScrollView dsv
Definition: UIList.cs:9

References UIDynamicList.Add(), ActionMode.Adv, ButtonGrid.Attach(), RecipeUpdater.Build(), UIDynamicList.dsv, ELayer.game, RecipeManager.hoveredRecipes, Recipe.id, idLastRecipe, TaskCraft.IsIngredientsValid(), list, UIDynamicList.List(), TaskCraft.num, Recipe.OnChangeIngredient(), ELayer.pc, ELayer.player, Card.pos, GameUpdater.recipe, recipe, Player.recipes, RecipeUpdater.recipes, RefreshSize(), TaskCraft.ResetReq(), Chara.SetAI(), ButtonGrid.SetCraftRecipe(), AM_Adv.SetTurbo(), ShowContextMenu(), ELayer.ui, Game.updater, and Player.waitingInput.

Referenced by RecipeUpdater.RunRecipe().

◆ RefreshDisassemble()

void LayerCraftFloat.RefreshDisassemble ( )
inline

Definition at line 189 of file LayerCraftFloat.cs.

190 {
191 list.callbacks = new UIList.Callback<Thing, ButtonGrid>
192 {
193 onClick = delegate(Thing a, ButtonGrid b)
194 {
196 {
197 SE.BeepSmall();
198 }
199 else
200 {
201 a.Disassemble();
203 }
204 },
205 onRedraw = delegate(Thing a, ButtonGrid b, int i)
206 {
207 b.SetCard(a, ButtonGrid.Mode.RecipeGrid, delegate(UINote n)
208 {
209 RecipeSource recipeSource = RecipeManager.Get(a.id);
210 if (recipeSource != null)
211 {
212 n.Space();
213 Recipe.Create(recipeSource).WriteReqSkill(n);
214 }
215 });
216 b.mainText.SetActive(enable: false);
217 },
218 onList = delegate
219 {
220 foreach (Thing item in RecipeUpdater.listD)
221 {
222 list.Add(item);
223 }
224 }
225 };
226 list.List();
227 RefreshSize();
228 list.dsv.OnResize();
229 }
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
void SetCard(Card c, Mode mode=Mode.Default, Action< UINote > onWriteNote=null)
Definition: ButtonGrid.cs:184
string id
Definition: Card.cs:31
void EndTurn(bool consume=true)
Definition: Player.cs:1866
static RecipeSource Get(string id)
static List< Thing > listD
static Recipe Create(RecipeSource _source, int idMat=-1, Thing ing=null)
Definition: Recipe.cs:308
Definition: Thing.cs:8
void Disassemble()
Definition: Thing.cs:1691
UIText mainText
Definition: UIButton.cs:102
Definition: UINote.cs:6
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62

References UIDynamicList.Add(), Recipe.Create(), Thing.Disassemble(), UIDynamicList.dsv, Player.EndTurn(), RecipeManager.Get(), Card.id, if(), item, list, UIDynamicList.List(), RecipeUpdater.listD, UIButton.mainText, ELayer.player, RefreshSize(), ButtonGrid.SetCard(), UINote.Space(), and Player.waitingInput.

Referenced by RecipeUpdater.RunDisassemble().

◆ RefreshSize()

void LayerCraftFloat.RefreshSize ( )
inline

Definition at line 231 of file LayerCraftFloat.cs.

232 {
233 list.dsv.GetComponent<UIScrollView>().enabled = list.ItemCount > 0;
234 RectTransform rectTransform = windows[0].Rect();
235 float x = rectTransform.sizeDelta.x;
236 float num = list.Rect().sizeDelta.y;
237 if (num > (float)maxSize)
238 {
239 num = maxSize;
240 }
241 rectTransform.sizeDelta = new Vector2(x, num + (float)((list.ItemCount > 0) ? paddingY : paddingY2));
242 rectTransform.RebuildLayout();
243 }
List< Window > windows
Definition: Layer.cs:116
override int ItemCount

References UIDynamicList.dsv, UIDynamicList.ItemCount, list, maxSize, paddingY, paddingY2, and Layer.windows.

Referenced by RefreshCraft(), and RefreshDisassemble().

◆ ShowContextMenu()

void LayerCraftFloat.ShowContextMenu ( Recipe  a)
inline

Definition at line 136 of file LayerCraftFloat.cs.

137 {
138 UIContextMenu i = ELayer.ui.CreateContextMenuInteraction();
139 Point point = ELayer.pc.pos.Copy();
140 foreach (Recipe.Ingredient ing in a.ingredients)
141 {
142 UIContextMenu uIContextMenu = ((a.ingredients.Count == 1) ? i : i.AddChild(ing.GetName() + "x" + ing.req));
143 List<Thing> list = new List<Thing>();
144 foreach (Thing thing in ELayer.pc.things)
145 {
146 thing.GetIngredients(ing, list);
147 }
148 for (int j = point.x - 1; j < point.x + 2; j++)
149 {
150 if (j < 0 || j >= ELayer._map.Size)
151 {
152 continue;
153 }
154 for (int k = point.z - 1; k < point.z + 2; k++)
155 {
156 if (k < 0 || k >= ELayer._map.Size)
157 {
158 continue;
159 }
160 Cell cell = ELayer._map.cells[j, k];
161 if (cell.detail == null || cell.detail.things.Count == 0)
162 {
163 continue;
164 }
165 foreach (Thing thing2 in cell.detail.things)
166 {
167 thing2.GetIngredients(ing, list);
168 }
169 }
170 }
171 foreach (Thing t in list)
172 {
174 uIContextMenu.AddGameObject(uIButton);
175 t.SetImage(uIButton.icon);
176 uIButton.mainText.text = t.Name + ((t.parent == ELayer.pc) ? "" : ("(" + ((t.parent == ELayer._zone) ? "ground".lang() : (t.parent as Card)?.Name) + ")"));
177 uIButton.onClick.AddListener(delegate
178 {
179 ing.thing = t;
180 SE.ClickOk();
181 this.list.List();
182 i.Hide();
183 });
184 }
185 }
186 i.Show();
187 }
Definition: Card.cs:11
ICardParent parent
Definition: Card.cs:51
ThingContainer things
Definition: Card.cs:34
void SetImage(Image image, int dir, int idSkin=0)
Definition: Card.cs:5355
List< Thing > things
Definition: CellDetail.cs:11
Definition: Cell.cs:7
CellDetail detail
Definition: Cell.cs:92
static Map _map
Definition: ELayer.cs:23
static Zone _zone
Definition: ELayer.cs:25
UIButton moldButtonContext
int Size
Definition: MapBounds.cs:20
Cell[,] cells
Definition: Map.cs:85
Definition: Point.cs:9
Point Copy()
Definition: Point.cs:467
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
List< Ingredient > ingredients
Definition: Recipe.cs:164
void GetIngredients(Recipe.Ingredient ing, List< Thing > list)
Definition: Thing.cs:1654
Image icon
Definition: UIButton.cs:110
void Show(UIItem i)
UIContextMenu AddChild(string idLang, TextAnchor anchor)
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67

References ELayer._map, ELayer._zone, UIContextMenu.AddChild(), Map.cells, Point.Copy(), Cell.detail, Thing.GetIngredients(), UIContextMenu.Hide(), UIButton.icon, Recipe.ingredients, list, moldButtonContext, Card.parent, ELayer.pc, Card.pos, Card.SetImage(), UIContextMenu.Show(), MapBounds.Size, Card.things, CellDetail.things, ELayer.ui, Util, Point.x, and Point.z.

Referenced by RefreshCraft(), and Update().

◆ Update()

void LayerCraftFloat.Update ( )
inline

Definition at line 35 of file LayerCraftFloat.cs.

36 {
38 {
39 ButtonGrid componentOf = InputModuleEX.GetComponentOf<ButtonGrid>();
40 if ((bool)componentOf && componentOf.transform.IsChildOf(base.transform))
41 {
42 Recipe recipe = componentOf.recipe;
43 if (recipe != null && windows[0].idTab == 0)
44 {
46 }
47 }
48 }
49 if (Input.GetMouseButton(0))
50 {
51 ButtonGrid componentOf2 = InputModuleEX.GetComponentOf<ButtonGrid>();
52 if ((bool)componentOf2 && componentOf2.transform.IsChildOf(base.transform) && ELayer.player.waitingInput && ELayer.pc.HasNoGoal && componentOf2.recipe.id == idLastRecipe)
53 {
54 list.callbacks.OnClick(componentOf2.recipe, componentOf2);
55 }
56 }
57 else
58 {
59 idLastRecipe = null;
60 }
61 }
UIList.ICallback callbacks
Definition: BaseList.cs:13
Recipe recipe
Definition: ButtonGrid.cs:20
Definition: EInput.cs:8
static ButtonState middleMouse
Definition: EInput.cs:353

References BaseList.callbacks, ButtonState.down, idLastRecipe, list, EInput.middleMouse, ButtonGrid.recipe, recipe, ShowContextMenu(), and Layer.windows.

Member Data Documentation

◆ idLastRecipe

string LayerCraftFloat.idLastRecipe

Definition at line 20 of file LayerCraftFloat.cs.

Referenced by RefreshCraft(), and Update().

◆ Instance

LayerCraftFloat LayerCraftFloat.Instance
static

◆ list

UIDynamicList LayerCraftFloat.list

◆ maxSize

int LayerCraftFloat.maxSize

Definition at line 14 of file LayerCraftFloat.cs.

Referenced by RefreshSize().

◆ moldButtonContext

UIButton LayerCraftFloat.moldButtonContext

Definition at line 12 of file LayerCraftFloat.cs.

Referenced by ShowContextMenu().

◆ paddingY

int LayerCraftFloat.paddingY

Definition at line 16 of file LayerCraftFloat.cs.

Referenced by RefreshSize().

◆ paddingY2

int LayerCraftFloat.paddingY2

Definition at line 18 of file LayerCraftFloat.cs.

Referenced by RefreshSize().

◆ recipe

Recipe LayerCraftFloat.recipe

Definition at line 10 of file LayerCraftFloat.cs.

Referenced by RefreshCraft(), and Update().


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