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

Classes

class  PutbackInfo
 

Public Member Functions

void OnOpen ()
 
LayerDragGrid SetInv (InvOwnerDraglet owner, bool refuelFromLayerDragGrid=false)
 
int GetPrice ()
 
void RefreshCost ()
 
bool IsAllGridSet ()
 
override void ClearButtons ()
 
override void RefreshCurrentGrid ()
 
override List< ThingGetTargets ()
 
void Validate ()
 
void Redraw ()
 
void AddPutBack (Thing t, Thing container)
 
void TryPutBack ()
 
override void OnEndCraft ()
 
override void OnKill ()
 
override void OnUpdateInput ()
 
override void OnRightClick ()
 
- Public Member Functions inherited from LayerBaseCraft
virtual List< ThingGetTargets ()
 
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)
 
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 ()
 

Static Public Member Functions

static LayerDragGrid Create (InvOwnerDraglet owner, bool refuelFromLayerDragGrid=false)
 
static LayerDragGrid CreateChaosOffering (TraitAltarChaos altar)
 
static LayerDragGrid CreateOffering (TraitAltar altar)
 
static LayerDragGrid CreateDeliver (InvOwnerDeliver.Mode mode=InvOwnerDeliver.Mode.Default, Card owner=null)
 
static LayerDragGrid CreateGive (Chara c)
 
static LayerDragGrid CreateCraft (TraitCrafter crafter)
 
static LayerDragGrid CreateRecycle (TraitRecycle recycle)
 
static LayerDragGrid CreateGacha (TraitGacha gacha)
 
static LayerDragGrid TryProc (Chara cc, InvOwnerEffect owner)
 
static LayerDragGrid CreateIdentify (Chara cc, bool superior=false, BlessedState state=BlessedState.Normal, int price=0, int count=1)
 
static LayerDragGrid CreateEnchant (Chara cc, bool armor, bool superior=false, BlessedState state=BlessedState.Normal, int count=1)
 
static LayerDragGrid CreateChangeMaterial (Chara cc, Thing consume, SourceMaterial.Row mat, EffectId idEffect, BlessedState state=BlessedState.Normal, int price=0, int count=1)
 
static LayerDragGrid CreateChangeRarity (Chara cc, Thing consume, EffectId idEffect, BlessedState state=BlessedState.Normal, int price=0, int count=1)
 
static LayerDragGrid CreateUncurse (Chara cc, BlessedState state=BlessedState.Normal, int price=0, int count=1)
 
static LayerDragGrid CreateLighten (Chara cc, BlessedState state=BlessedState.Normal, int price=0, int count=1)
 
static LayerDragGrid CreateReconstruction (Chara cc, BlessedState state=BlessedState.Normal, int power=100, int price=0, int count=1)
 
- 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)
 

Public Attributes

List< PutbackInfoputBacks = new List<PutbackInfo>()
 
UIItem itemCost
 
Image imageOwner
 
UIText textTitle
 
UIText textFuel
 
Transform transIndex
 
List< ButtonGridbuttons
 
ButtonGrid buttonOwner
 
UIButton buttonRefuel
 
UIButton buttonAutoRefuel
 
UIButton buttonAlly
 
UIButton buttonStock
 
UIButton buttonDeliver
 
InvOwnerDraglet owner
 
UICurrency uiCurrency
 
int currentIndex
 
UIDragGridInfo info
 
UIList listAlly
 
UIDragGridIngredients uiIngredients
 
- 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 LayerDragGrid 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" }
 

Properties

ButtonGrid CurrentButton [get]
 
override bool CanCancelAI [get]
 
override bool RepeatAI [get]
 
- 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]
 

Private Member Functions

void Update ()
 

Private Attributes

bool wasInventoryOpen
 
int lastNum
 

Additional Inherited Members

- 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
 

Detailed Description

Definition at line 5 of file LayerDragGrid.cs.

Member Function Documentation

◆ AddPutBack()

void LayerDragGrid.AddPutBack ( Thing  t,
Thing  container 
)
inline

Definition at line 342 of file LayerDragGrid.cs.

343 {
344 if (container != null)
345 {
346 putBacks.Add(new PutbackInfo
347 {
348 thing = t,
349 container = container
350 });
351 }
352 }
List< PutbackInfo > putBacks

Referenced by UIDragGridIngredients.Refresh(), and UIDragGridIngredients.Update().

◆ ClearButtons()

override void LayerDragGrid.ClearButtons ( )
inlinevirtual

Reimplemented from LayerBaseCraft.

Definition at line 267 of file LayerDragGrid.cs.

268 {
269 for (int i = 0; i < owner.numDragGrid; i++)
270 {
271 buttons[i].SetCardGrid(null);
272 }
275 }
virtual int numDragGrid
Definition: InvOwner.cs:619
InvOwnerDraglet owner
UIDragGridIngredients uiIngredients
List< ButtonGrid > buttons
override void RefreshCurrentGrid()

References InvOwner.numDragGrid, and UIDragGridIngredients.Refresh().

Referenced by InvOwnerDraglet.OnClick().

◆ Create()

static LayerDragGrid LayerDragGrid.Create ( InvOwnerDraglet  owner,
bool  refuelFromLayerDragGrid = false 
)
inlinestatic

Definition at line 409 of file LayerDragGrid.cs.

410 {
411 return ELayer.ui.AddLayer<LayerDragGrid>("LayerInventory/LayerDragGrid").SetInv(owner, refuelFromLayerDragGrid);
412 }
Definition: ELayer.cs:4
static UI ui
Definition: ELayer.cs:21
LayerDragGrid SetInv(InvOwnerDraglet owner, bool refuelFromLayerDragGrid=false)

References ELayer.ui.

Referenced by ActPlan._Update(), TraitMod.OnUse(), LayerCraft.SetFactory(), and Trait.TrySetToggleAct().

◆ CreateChangeMaterial()

static LayerDragGrid LayerDragGrid.CreateChangeMaterial ( Chara  cc,
Thing  consume,
SourceMaterial::Row  mat,
EffectId  idEffect,
BlessedState  state = BlessedState::Normal,
int  price = 0,
int  count = 1 
)
inlinestatic

Definition at line 527 of file LayerDragGrid.cs.

528 {
529 return TryProc(cc, new InvOwnerChangeMaterial
530 {
531 consume = consume,
532 mat = mat,
533 state = state,
534 price = price,
535 count = count,
536 idEffect = idEffect
537 });
538 }
static LayerDragGrid TryProc(Chara cc, InvOwnerEffect owner)

Referenced by ActEffect.Proc().

◆ CreateChangeRarity()

static LayerDragGrid LayerDragGrid.CreateChangeRarity ( Chara  cc,
Thing  consume,
EffectId  idEffect,
BlessedState  state = BlessedState::Normal,
int  price = 0,
int  count = 1 
)
inlinestatic

Definition at line 540 of file LayerDragGrid.cs.

541 {
542 return TryProc(cc, new InvOwnerChangeRarity
543 {
544 consume = consume,
545 state = state,
546 price = price,
547 count = count,
548 idEffect = idEffect
549 });
550 }

Referenced by ActEffect.Proc().

◆ CreateChaosOffering()

static LayerDragGrid LayerDragGrid.CreateChaosOffering ( TraitAltarChaos  altar)
inlinestatic

Definition at line 414 of file LayerDragGrid.cs.

415 {
416 Msg.Say("offer_what");
417 return Create(new InvOwnerChaosOffering(altar.owner)
418 {
419 altar = altar
420 });
421 }
static LayerDragGrid Create(InvOwnerDraglet owner, bool refuelFromLayerDragGrid=false)
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
Card owner
Definition: Trait.cs:28

References Trait.owner, and Msg.Say().

Referenced by TraitAltarChaos.TrySetAct().

◆ CreateCraft()

static LayerDragGrid LayerDragGrid.CreateCraft ( TraitCrafter  crafter)
inlinestatic

Definition at line 453 of file LayerDragGrid.cs.

454 {
455 return Create(new InvOwnerCraft(crafter.owner)
456 {
457 crafter = crafter
458 });
459 }

References Trait.owner.

Referenced by TraitCrafter.OnUse(), and TraitCrafter.TrySetAct().

◆ CreateDeliver()

static LayerDragGrid LayerDragGrid.CreateDeliver ( InvOwnerDeliver::Mode  mode = InvOwnerDeliver::Mode::Default,
Card  owner = null 
)
inlinestatic

Definition at line 432 of file LayerDragGrid.cs.

433 {
434 if (mode == InvOwnerDeliver.Mode.Tax)
435 {
436 Msg.Say("bills", ELayer.player.taxBills.ToString() ?? "");
437 }
438 Msg.Say("deliver_what");
439 return Create(new InvOwnerDeliver(owner)
440 {
441 mode = mode
442 });
443 }
static Player player
Definition: ELayer.cs:13
int taxBills
Definition: Player.cs:975

References ELayer.player, Msg.Say(), and Player.taxBills.

Referenced by TraitBank.OnUse(), TraitFarmChest.OnUse(), and TraitTaxChest.OnUse().

◆ CreateEnchant()

static LayerDragGrid LayerDragGrid.CreateEnchant ( Chara  cc,
bool  armor,
bool  superior = false,
BlessedState  state = BlessedState::Normal,
int  count = 1 
)
inlinestatic

Definition at line 516 of file LayerDragGrid.cs.

517 {
518 return TryProc(cc, new InvOwnerEnchant
519 {
520 armor = armor,
521 state = state,
522 superior = superior,
523 count = count
524 });
525 }

References armor.

Referenced by ActEffect.Proc().

◆ CreateGacha()

static LayerDragGrid LayerDragGrid.CreateGacha ( TraitGacha  gacha)
inlinestatic

Definition at line 470 of file LayerDragGrid.cs.

471 {
472 Msg.Say("target_what");
473 return Create(new InvOwnerGacha(gacha.owner)
474 {
475 gacha = gacha
476 });
477 }

References Trait.owner, and Msg.Say().

Referenced by TraitGacha.TrySetAct().

◆ CreateGive()

static LayerDragGrid LayerDragGrid.CreateGive ( Chara  c)
inlinestatic

Definition at line 445 of file LayerDragGrid.cs.

446 {
447 return Create(new InvOwnerGive(c)
448 {
449 chara = c
450 });
451 }

◆ CreateIdentify()

static LayerDragGrid LayerDragGrid.CreateIdentify ( Chara  cc,
bool  superior = false,
BlessedState  state = BlessedState::Normal,
int  price = 0,
int  count = 1 
)
inlinestatic

Definition at line 505 of file LayerDragGrid.cs.

506 {
507 return TryProc(cc, new InvOwnerIdentify
508 {
509 state = state,
510 price = price,
511 count = count,
512 superior = superior
513 });
514 }

Referenced by ActEffect.Proc().

◆ CreateLighten()

static LayerDragGrid LayerDragGrid.CreateLighten ( Chara  cc,
BlessedState  state = BlessedState::Normal,
int  price = 0,
int  count = 1 
)
inlinestatic

Definition at line 562 of file LayerDragGrid.cs.

563 {
564 return TryProc(cc, new InvOwnerLighten
565 {
566 state = state,
567 price = price,
568 count = count
569 });
570 }

Referenced by ActEffect.Proc().

◆ CreateOffering()

static LayerDragGrid LayerDragGrid.CreateOffering ( TraitAltar  altar)
inlinestatic

Definition at line 423 of file LayerDragGrid.cs.

424 {
425 Msg.Say("offer_what");
426 return Create(new InvOwnerOffering(altar.owner)
427 {
428 altar = altar
429 });
430 }

References Trait.owner, and Msg.Say().

Referenced by TraitAltar.TrySetAct().

◆ CreateReconstruction()

static LayerDragGrid LayerDragGrid.CreateReconstruction ( Chara  cc,
BlessedState  state = BlessedState::Normal,
int  power = 100,
int  price = 0,
int  count = 1 
)
inlinestatic

Definition at line 572 of file LayerDragGrid.cs.

573 {
574 return TryProc(cc, new InvOwnerReconstruction
575 {
576 state = state,
577 price = price,
578 count = count,
579 power = power
580 });
581 }

Referenced by ActEffect.Proc().

◆ CreateRecycle()

static LayerDragGrid LayerDragGrid.CreateRecycle ( TraitRecycle  recycle)
inlinestatic

Definition at line 461 of file LayerDragGrid.cs.

462 {
463 Msg.Say("recycle_what");
464 return Create(new InvOwnerRecycle(recycle.owner)
465 {
466 recycle = recycle
467 });
468 }

References Trait.owner, and Msg.Say().

Referenced by TraitRecycle.OnUse().

◆ CreateUncurse()

static LayerDragGrid LayerDragGrid.CreateUncurse ( Chara  cc,
BlessedState  state = BlessedState::Normal,
int  price = 0,
int  count = 1 
)
inlinestatic

Definition at line 552 of file LayerDragGrid.cs.

553 {
554 return TryProc(cc, new InvOwnerUncurse
555 {
556 state = state,
557 price = price,
558 count = count
559 });
560 }

Referenced by ActEffect.Proc().

◆ GetPrice()

int LayerDragGrid.GetPrice ( )
inline

Definition at line 234 of file LayerDragGrid.cs.

235 {
236 return owner.price;
237 }

References InvOwnerDraglet.price.

◆ GetTargets()

override List< Thing > LayerDragGrid.GetTargets ( )
inlinevirtual

Reimplemented from LayerBaseCraft.

Definition at line 300 of file LayerDragGrid.cs.

301 {
302 List<Thing> list = new List<Thing>();
303 TraitCrafter traitCrafter = owner.owner.trait as TraitCrafter;
304 for (int i = 0; i < traitCrafter.numIng; i++)
305 {
306 list.Add(buttons[i].card?.Thing ?? null);
307 }
308 return list;
309 }
Definition: Thing.cs:8
virtual int numIng
Definition: TraitCrafter.cs:35

References card, and TraitCrafter.numIng.

◆ IsAllGridSet()

bool LayerDragGrid.IsAllGridSet ( )
inline

Definition at line 255 of file LayerDragGrid.cs.

256 {
257 for (int i = 0; i < owner.numDragGrid; i++)
258 {
259 if (buttons[i].card == null)
260 {
261 return false;
262 }
263 }
264 return true;
265 }

References card, and InvOwner.numDragGrid.

Referenced by InvOwnerDraglet.OnProcess().

◆ OnEndCraft()

override void LayerDragGrid.OnEndCraft ( )
inlinevirtual

Reimplemented from LayerBaseCraft.

Definition at line 367 of file LayerDragGrid.cs.

368 {
369 TryPutBack();
370 }

◆ OnKill()

override void LayerDragGrid.OnKill ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 372 of file LayerDragGrid.cs.

373 {
374 EInput.haltInput = false;
376 InvOwner.Trader = null;
377 if (!wasInventoryOpen && ELayer.ui.IsInventoryOpen)
378 {
379 ELayer.ui.ToggleInventory();
380 }
383 {
384 ELayer.pc.ai.Cancel();
385 }
386 }
virtual bool IsRunning
Definition: AIAct.cs:31
virtual Status Cancel()
Definition: AIAct.cs:305
AIAct ai
Definition: Chara.cs:204
static Chara pc
Definition: ELayer.cs:15
bool wasInventoryOpen
static bool CloseAllyInv(Chara c)
static void SetDirtyAll(bool immediate=false)

References Chara.ai, AIAct.Cancel(), LayerInventory.CloseAllyInv(), AIAct.IsRunning, ELayer.pc, LayerInventory.SetDirtyAll(), and ELayer.ui.

◆ OnOpen()

void LayerDragGrid.OnOpen ( )
inline

Definition at line 64 of file LayerDragGrid.cs.

65 {
66 Instance = this;
67 InvOwner.Trader = owner;
68 wasInventoryOpen = ELayer.ui.IsInventoryOpen;
70 {
71 ELayer.ui.OpenFloatInv(ignoreSound: true);
72 }
73 }
static LayerDragGrid Instance

References Instance, owner, ELayer.ui, and wasInventoryOpen.

Referenced by SetInv().

◆ OnRightClick()

override void LayerDragGrid.OnRightClick ( )
inlinevirtual

Reimplemented from ELayer.

Definition at line 401 of file LayerDragGrid.cs.

402 {
403 if (InputModuleEX.GetComponentOf<ButtonGrid>() == null)
404 {
405 Close();
406 }
407 }
virtual void Close()
Definition: Layer.cs:463

◆ OnUpdateInput()

override void LayerDragGrid.OnUpdateInput ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 388 of file LayerDragGrid.cs.

389 {
390 if (EInput.action == EAction.MenuInventory || Input.GetKeyDown(KeyCode.Tab))
391 {
392 Close();
394 }
395 else
396 {
397 base.OnUpdateInput();
398 }
399 }
EAction
Definition: EAction.cs:2
Definition: EInput.cs:8
static void WaitReleaseKey()
Definition: EInput.cs:661
static EAction action
Definition: EInput.cs:270

References EInput.action, and EInput.WaitReleaseKey().

◆ Redraw()

void LayerDragGrid.Redraw ( )
inline

Definition at line 330 of file LayerDragGrid.cs.

331 {
332 foreach (ButtonGrid button in buttons)
333 {
334 if (button.gameObject.activeSelf)
335 {
336 button.Redraw();
337 }
338 }
339 LayerInventory.SetDirtyAll(immediate: true);
340 }
void Redraw()
Definition: ButtonGrid.cs:140

References ButtonGrid.Redraw(), and LayerInventory.SetDirtyAll().

Referenced by AI_UseCrafter.Run().

◆ RefreshCost()

void LayerDragGrid.RefreshCost ( )
inline

Definition at line 239 of file LayerDragGrid.cs.

240 {
241 buttonAutoRefuel.mainText.text = (owner.owner.autoRefuel ? "On" : "Off");
242 buttonAutoRefuel.icon.SetAlpha(owner.owner.autoRefuel ? 1f : 0.4f);
243 buttonStock.mainText.text = ((!owner.owner.c_isDisableStockUse) ? "On" : "Off");
244 buttonStock.icon.SetAlpha((!owner.owner.c_isDisableStockUse) ? 1f : 0.4f);
245 textFuel.text = (int)((float)owner.owner.c_charges / (float)owner.owner.trait.MaxFuel * 100f) + "%";
246 int price = GetPrice();
247 itemCost.transform.parent.SetActive(price != 0);
248 if (price != 0)
249 {
251 itemCost.image1.sprite = SpriteSheet.Get("icon_" + owner.IDCurrency);
252 }
253 }
FontColor
Definition: FontColor.cs:2
int GetCurrency(string id="money")
Definition: Card.cs:4059
bool autoRefuel
Definition: Card.cs:629
Trait trait
Definition: Card.cs:54
bool c_isDisableStockUse
Definition: Card.cs:1099
Card owner
Definition: InvOwner.cs:533
string IDCurrency
Definition: InvOwner.cs:637
Definition: Lang.cs:6
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:164
UIButton buttonAutoRefuel
UIButton buttonStock
static Sprite Get(string id)
Definition: SpriteSheet.cs:28
virtual int MaxFuel
Definition: Trait.cs:462
Image icon
Definition: UIButton.cs:110
UIText text1
Definition: UIItem.cs:6
void SetText(string s)
Definition: UIText.cs:163

References Lang._currency(), Card.autoRefuel, Card.c_isDisableStockUse, SpriteSheet.Get(), Card.GetCurrency(), UIButton.icon, InvOwner.IDCurrency, Trait.MaxFuel, InvOwner.owner, ELayer.pc, UIText.SetText(), UIItem.text1, and Card.trait.

Referenced by InvOwnerDraglet.RedrawButton(), and SetInv().

◆ RefreshCurrentGrid()

override void LayerDragGrid.RefreshCurrentGrid ( )
inlinevirtual

Reimplemented from LayerBaseCraft.

Definition at line 277 of file LayerDragGrid.cs.

278 {
279 int num = -1;
280 for (int i = 0; i < buttons.Count; i++)
281 {
282 bool flag = buttons[i].Card != null;
283 if (num == -1 && (!flag || i == owner.numDragGrid - 1))
284 {
285 num = i;
286 }
287 buttons[i].interactable = flag || num == i;
288 buttons[i].GetComponent<CanvasGroup>().alpha = (buttons[i].interactable ? 1f : 0.5f);
289 }
290 currentIndex = num;
291 bool flag2 = num >= 0 && num < owner.numDragGrid;
292 if (flag2)
293 {
294 transIndex.position = buttons[num].transform.position;
295 }
296 transIndex.SetActive(flag2);
297 Redraw();
298 }
Transform transIndex

References InvOwner.numDragGrid.

Referenced by InvOwnerDraglet.OnClick(), InvOwnerDraglet.OnProcess(), InvOwnerDraglet.RedrawButton(), and SetInv().

◆ SetInv()

LayerDragGrid LayerDragGrid.SetInv ( InvOwnerDraglet  owner,
bool  refuelFromLayerDragGrid = false 
)
inline

Definition at line 75 of file LayerDragGrid.cs.

76 {
77 owner.Init();
79 this.owner = owner;
80 textTitle.text = owner.langTransfer.lang();
81 OnOpen();
84 for (int j = 0; j < buttons.Count; j++)
85 {
86 buttons[j].gameObject.AddComponent<CanvasGroup>();
87 if (owner.numDragGrid > j)
88 {
89 buttons[j].SetCardGrid(null, owner);
90 buttons[j].index = j;
91 owner.buttons.Add(buttons[j]);
92 }
93 else
94 {
95 buttons[j].SetActive(enable: false);
96 }
97 }
101 InvokeRepeating("RefreshCost", 0f, 0.2f);
102 this.RebuildLayout(recursive: true);
104 RefreshCost();
105 this.RebuildLayout(recursive: true);
106 buttonRefuel.SetActive(owner.ShowFuel);
110 if (owner.CanTargetAlly && ELayer.pc.party.members.Count > 1)
111 {
112 listAlly.callbacks = new UIList.Callback<Chara, UIButton>
113 {
114 onInstantiate = delegate(Chara a, UIButton b)
115 {
116 a.SetImage(b.icon);
117 b.SetTooltipLang(a.Name);
118 },
119 onClick = delegate(Chara c, UIButton i)
120 {
122 {
123 SE.PopInventory();
125 }
126 },
127 onSort = delegate(Chara a, UIList.SortMode m)
128 {
129 a.SetSortVal(m);
130 return -a.sortVal;
131 },
132 onList = delegate
133 {
134 foreach (Chara member in ELayer.pc.party.members)
135 {
136 if (!member.IsPC)
137 {
138 listAlly.Add(member);
139 }
140 }
141 }
142 };
143 listAlly.List();
144 }
145 else
146 {
147 listAlly.SetActive(enable: false);
148 }
149 buttonRefuel.SetOnClick(delegate
150 {
151 if (!ELayer.pc.HasNoGoal)
152 {
153 SE.BeepSmall();
154 }
155 else
156 {
157 windows[0].SetInteractable(enable: false, 0f);
158 info.InitFuel(owner.owner);
159 Create(new InvOwnerRefuel(owner.owner), refuelFromLayerDragGrid: true).SetOnKill(delegate
160 {
161 if (!isDestroyed)
162 {
163 windows[0].SetInteractable(enable: true);
164 info.Init(owner.owner);
165 OnOpen();
166 RefreshCurrentGrid();
167 Redraw();
168 owner.OnAfterRefuel();
169 }
170 });
171 }
172 });
173 buttonAutoRefuel.SetOnClick(delegate
174 {
175 SE.Click();
176 owner.owner.autoRefuel = !owner.owner.autoRefuel;
177 RefreshCost();
179 {
181 }
182 });
183 buttonStock.SetOnClick(delegate
184 {
185 SE.Click();
186 owner.owner.c_isDisableStockUse = !owner.owner.c_isDisableStockUse;
188 RefreshCost();
189 });
190 buttonDeliver.SetOnClick(delegate
191 {
193 QuestHarvest questHarvest = ELayer.game.quests.Get<QuestHarvest>();
194 int num = 0;
195 if (questHarvest != null)
196 {
197 foreach (Thing item in ELayer.pc.things.List((Thing a) => deliver.ShouldShowGuide(a)))
198 {
199 Msg.Say("farm_chest", item, Lang._weight(item.SelfWeight * item.Num));
200 questHarvest.weightDelivered += item.SelfWeight * item.Num;
201 item.Destroy();
202 num++;
203 }
204 }
205 if (num > 0)
206 {
207 SE.Pick();
208 }
209 else
210 {
211 SE.BeepSmall();
212 }
213 Close();
214 });
215 if (owner is InvOwnerRefuel)
216 {
217 if (refuelFromLayerDragGrid)
218 {
219 info.SetActive(enable: false);
220 }
221 else
222 {
223 Debug.Log(owner.owner);
225 }
226 }
227 else
228 {
230 }
231 return this;
232 }
void SetCardGrid(Card c, InvOwner owner=null)
Definition: ButtonGrid.cs:145
string Name
Definition: Card.cs:2179
int sortVal
Definition: Card.cs:104
ThingContainer things
Definition: Card.cs:39
void SetImage(Image image, int dir, int idSkin=0)
Definition: Card.cs:6388
Definition: Chara.cs:10
override void SetSortVal(UIList.SortMode m, CurrencyType currency=CurrencyType.Money)
Definition: Chara.cs:7471
override bool IsPC
Definition: Chara.cs:626
Party party
Definition: Chara.cs:43
bool HasNoGoal
Definition: Chara.cs:1014
static Game game
Definition: ELayer.cs:9
QuestManager quests
Definition: Game.cs:183
override bool ShouldShowGuide(Thing t)
virtual bool CanTargetAlly
virtual bool AllowStockIngredients
override void BuildUICurrency(UICurrency uiCurrency, bool canReroll=false)
virtual void OnAfterRefuel()
virtual bool ShowButtonDeliver
virtual bool ShowFuel
void Init()
Definition: InvOwner.cs:738
Card Container
Definition: InvOwner.cs:535
List< ButtonGrid > buttons
Definition: InvOwner.cs:537
virtual string langTransfer
Definition: InvOwner.cs:587
static string _weight(int a, int b, bool showUnit=true, int unitSize=0)
Definition: Lang.cs:174
UIDragGridInfo info
UIButton buttonRefuel
void RefreshCost()
UICurrency uiCurrency
ButtonGrid buttonOwner
UIButton buttonDeliver
static LayerInventory CreateContainerAlly(Chara owner, Card container)
List< Chara > members
Definition: Party.cs:19
Quest Get(string id)
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
bool IsRequireFuel
Definition: Trait.cs:477
bool IsFuelEnough(int num=1, List< Thing > excludes=null, bool tryRefuel=true)
Definition: Trait.cs:1337
void SetTooltipLang(string lang=null)
Definition: UIButton.cs:373
void Init(Card _owner)
void InitFuel(Card _owner)
Definition: UIList.cs:9
SortMode
Definition: UIList.cs:27
override void Add(object item)
Definition: UIList.cs:354
override void List()
Definition: UIList.cs:769

References UIList.Add(), InvOwnerDraglet.AllowStockIngredients, InvOwnerDraglet.BuildUICurrency(), buttonAutoRefuel, buttonDeliver, buttonOwner, buttonRefuel, InvOwner.buttons, buttons, buttonStock, InvOwnerDraglet.CanTargetAlly, LayerInventory.CloseAllyInv(), InvOwner.Container, LayerInventory.CreateContainerAlly(), Chara.HasNoGoal, UIButton.icon, imageOwner, InvOwner.Init(), Chara.IsPC, Trait.IsRequireFuel, InvOwner.langTransfer, UIList.List(), listAlly, Party.members, Card.Name, InvOwner.numDragGrid, OnOpen(), InvOwner.owner, owner, Chara.party, ELayer.pc, UIDragGridIngredients.Refresh(), RefreshCost(), RefreshCurrentGrid(), ThingContainer.RefreshGrid(), ButtonGrid.SetCardGrid(), Card.SetImage(), Chara.SetSortVal(), UIButton.SetTooltipLang(), InvOwnerDraglet.ShowButtonDeliver, InvOwnerDraglet.ShowFuel, Card.sortVal, textFuel, Card.things, Card.trait, uiCurrency, and uiIngredients.

◆ TryProc()

static LayerDragGrid LayerDragGrid.TryProc ( Chara  cc,
InvOwnerEffect  owner 
)
inlinestatic

Definition at line 479 of file LayerDragGrid.cs.

480 {
481 owner.cc = cc;
482 if (cc.IsPC)
483 {
484 return Create(owner);
485 }
486 int num = ((owner.count == -1) ? 1 : owner.count);
487 for (int i = 0; i < num; i++)
488 {
489 List<Thing> list = cc.things.List((Thing t) => owner.ShouldShowGuide(t), onlyAccessible: true);
490 if (list.Count > 0)
491 {
492 Thing t2 = list.RandomItem();
493 owner._OnProcess(t2);
494 continue;
495 }
496 if (i == 0)
497 {
499 }
500 break;
501 }
502 return null;
503 }
void SayNothingHappans()
Definition: Card.cs:7120
virtual void _OnProcess(Thing t)
virtual bool ShouldShowGuide(Thing t)
Definition: InvOwner.cs:681

References InvOwnerDraglet._OnProcess(), InvOwnerDraglet.count, Chara.IsPC, ThingContainer.List(), Card.SayNothingHappans(), InvOwner.ShouldShowGuide(), and Card.things.

◆ TryPutBack()

void LayerDragGrid.TryPutBack ( )
inline

Definition at line 354 of file LayerDragGrid.cs.

355 {
356 foreach (PutbackInfo putBack in putBacks)
357 {
358 if (!putBack.thing.isDestroyed && putBack.thing.Num != 0 && putBack.thing.parent != putBack.container && !putBack.container.isDestroyed)
359 {
360 putBack.container.AddCard(putBack.thing);
361 }
362 }
363 putBacks.Clear();
365 }

References Card.AddCard(), LayerDragGrid.PutbackInfo.container, Card.isDestroyed, Card.Num, Card.parent, and LayerDragGrid.PutbackInfo.thing.

Referenced by InvOwnerDraglet.OnClick().

◆ Update()

void LayerDragGrid.Update ( )
inlineprivate

Definition at line 311 of file LayerDragGrid.cs.

312 {
313 Validate();
314 }

◆ Validate()

void LayerDragGrid.Validate ( )
inline

Definition at line 316 of file LayerDragGrid.cs.

317 {
319 if (card.Num != lastNum)
320 {
321 lastNum = card.Num;
323 }
324 if (card == null || card.isDestroyed)
325 {
326 Close();
327 }
328 }
Card card
Definition: ButtonGrid.cs:24
Definition: Card.cs:11

References ButtonGrid.card, card, InvOwner.owner, and ButtonGrid.SetCardGrid().

Member Data Documentation

◆ buttonAlly

UIButton LayerDragGrid.buttonAlly

Definition at line 36 of file LayerDragGrid.cs.

◆ buttonAutoRefuel

UIButton LayerDragGrid.buttonAutoRefuel

Definition at line 34 of file LayerDragGrid.cs.

Referenced by SetInv().

◆ buttonDeliver

UIButton LayerDragGrid.buttonDeliver

Definition at line 40 of file LayerDragGrid.cs.

Referenced by SetInv().

◆ buttonOwner

ButtonGrid LayerDragGrid.buttonOwner

Definition at line 30 of file LayerDragGrid.cs.

Referenced by SetInv().

◆ buttonRefuel

UIButton LayerDragGrid.buttonRefuel

Definition at line 32 of file LayerDragGrid.cs.

Referenced by SetInv().

◆ buttons

◆ buttonStock

UIButton LayerDragGrid.buttonStock

Definition at line 38 of file LayerDragGrid.cs.

Referenced by SetInv().

◆ currentIndex

◆ imageOwner

Image LayerDragGrid.imageOwner

Definition at line 20 of file LayerDragGrid.cs.

Referenced by SetInv().

◆ info

UIDragGridInfo LayerDragGrid.info

Definition at line 48 of file LayerDragGrid.cs.

Referenced by TraitCrafter.Craft().

◆ Instance

◆ itemCost

UIItem LayerDragGrid.itemCost

Definition at line 18 of file LayerDragGrid.cs.

◆ lastNum

int LayerDragGrid.lastNum
private

Definition at line 56 of file LayerDragGrid.cs.

◆ listAlly

UIList LayerDragGrid.listAlly

Definition at line 50 of file LayerDragGrid.cs.

Referenced by SetInv().

◆ owner

◆ putBacks

List<PutbackInfo> LayerDragGrid.putBacks = new List<PutbackInfo>()

Definition at line 16 of file LayerDragGrid.cs.

◆ textFuel

UIText LayerDragGrid.textFuel

Definition at line 24 of file LayerDragGrid.cs.

Referenced by SetInv().

◆ textTitle

UIText LayerDragGrid.textTitle

Definition at line 22 of file LayerDragGrid.cs.

◆ transIndex

Transform LayerDragGrid.transIndex

Definition at line 26 of file LayerDragGrid.cs.

◆ uiCurrency

UICurrency LayerDragGrid.uiCurrency

Definition at line 44 of file LayerDragGrid.cs.

Referenced by SetInv().

◆ uiIngredients

UIDragGridIngredients LayerDragGrid.uiIngredients

Definition at line 52 of file LayerDragGrid.cs.

Referenced by InvOwnerDraglet.OnClick(), InvOwnerDraglet.OnProcess(), and SetInv().

◆ wasInventoryOpen

bool LayerDragGrid.wasInventoryOpen
private

Definition at line 54 of file LayerDragGrid.cs.

Referenced by OnOpen().

Property Documentation

◆ CanCancelAI

override bool LayerDragGrid.CanCancelAI
get

Definition at line 60 of file LayerDragGrid.cs.

◆ CurrentButton

ButtonGrid LayerDragGrid.CurrentButton
get

◆ RepeatAI

override bool LayerDragGrid.RepeatAI
get

Definition at line 62 of file LayerDragGrid.cs.


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