Elin Decompiled Documentation EA 23.102 Nightly
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Pages
LayerInventory Class Reference
Inheritance diagram for LayerInventory:
ELayer Layer IUISkin

Public Member Functions

bool IsPlayerContainer (bool includePlayer=false)
 
Card GetPlayerContainer ()
 
override bool HeaderIsListOf (int id)
 
override void OnInit ()
 
override void OnAfterInit ()
 
UIInventory SetInv (int idWindow=0)
 
override void OnUpdateInput ()
 
override void OnKill ()
 
override void OnRightClick ()
 
- 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 LayerInventory GetTopLayer (Thing t, bool includePlayer=false, InvOwner exclude=null)
 
static LayerInventory GetLayer (Card t)
 
static LayerInventory GetPCLayer ()
 
static void Close (Thing t)
 
static bool IsOpen (Thing t)
 
static void SetDirty (Thing t)
 
static void SetDirtyAll (bool immediate=false)
 
static void TryShowGuide (UIList list)
 
static void TryShowGuide (List< ButtonGrid > list)
 
static LayerInventory _Create (string path="")
 
static LayerInventory CreatePCBackpack (bool mousePos=false)
 
static bool CloseAllyInv (Chara c)
 
static void CloseAllyInv ()
 
static LayerInventory CreateContainerAlly (Chara owner, Card container)
 
static bool IsOpen (Card container)
 
static LayerInventory CreateContainerPC (Card container)
 
static LayerInventory CreateContainer (Card owner)
 
static LayerInventory CreateContainer (Card owner, Card container)
 
static LayerInventory CreateContainer< T > (Card c, Card container, CurrencyType currency=CurrencyType.None)
 
static LayerInventory CreateBuy (Card c, CurrencyType currency=CurrencyType.Money, PriceType price=PriceType.Default)
 
- 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< UIInventoryinvs = new List<UIInventory>()
 
UICurrency uiCurrency
 
bool floatInv
 
bool mainInv
 
WindowCharaMini mini
 
bool wasInventoryOpen
 
- 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 List< LayerInventorylistInv = new List<LayerInventory>()
 
static InvOwner highlightInv
 
- 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

InvOwner Inv [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 OnDestroy ()
 

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 LayerInventory.cs.

Member Function Documentation

◆ _Create()

static LayerInventory LayerInventory._Create ( string  path = "")
inlinestatic

Definition at line 344 of file LayerInventory.cs.

345 {
346 if (ELayer.game.altInv && path.IsEmpty())
347 {
348 path = "LayerInventoryGrid";
349 }
350 return Layer.Create(path.IsEmpty() ? "LayerInventory" : ("LayerInventory/" + path)) as LayerInventory;
351 }
Definition: ELayer.cs:4
static Game game
Definition: ELayer.cs:9
bool altInv
Definition: Game.cs:263
Definition: Layer.cs:9
static Layer Create(string path)
Definition: Layer.cs:299

References Game.altInv, Layer.Create(), and ELayer.game.

Referenced by CreateBuy(), CreateContainer(), CreateContainer< T >(), CreateContainerAlly(), CreateContainerPC(), and CreatePCBackpack().

◆ Close()

static void LayerInventory.Close ( Thing  t)
inlinestatic

Definition at line 63 of file LayerInventory.cs.

64 {
65 foreach (LayerInventory item in listInv)
66 {
67 if (item.invs[0].owner.Container == t)
68 {
69 item.Close();
70 break;
71 }
72 }
73 }
static List< LayerInventory > listInv

References item, and listInv.

Referenced by ActionMode.UpdateInput().

◆ CloseAllyInv() [1/2]

static void LayerInventory.CloseAllyInv ( )
inlinestatic

Definition at line 379 of file LayerInventory.cs.

380 {
381 foreach (LayerInventory item in listInv.Copy())
382 {
383 if (!item.IsPlayerContainer(includePlayer: true))
384 {
385 ELayer.ui.layerFloat.RemoveLayer(item);
386 }
387 }
388 }
static UI ui
Definition: ELayer.cs:21

References item, listInv, and ELayer.ui.

Referenced by CreateContainerAlly().

◆ CloseAllyInv() [2/2]

static bool LayerInventory.CloseAllyInv ( Chara  c)
inlinestatic

Definition at line 366 of file LayerInventory.cs.

367 {
368 foreach (LayerInventory item in listInv.Copy())
369 {
370 if (item.Inv.owner == c)
371 {
372 ELayer.ui.layerFloat.RemoveLayer(item);
373 return true;
374 }
375 }
376 return false;
377 }

References item, listInv, and ELayer.ui.

Referenced by LayerDragGrid.OnKill(), and LayerDragGrid.SetInv().

◆ CreateBuy()

static LayerInventory LayerInventory.CreateBuy ( Card  c,
CurrencyType  currency = CurrencyType::Money,
PriceType  price = PriceType::Default 
)
inlinestatic

Definition at line 604 of file LayerInventory.cs.

605 {
606 LayerInventory layerInventory = _Create();
607 UIInventory uIInventory = layerInventory.SetInv();
608 Thing thing = c.things.Find("chest_merchant");
609 SE.Play("shop_open");
610 InvOwnerShop invOwnerShop = new InvOwnerShop(c, thing, currency, price);
611 uIInventory.AddTab(invOwnerShop, UIInventory.Mode.Buy).dest = ELayer.pc;
612 if (Window.dictData.TryGetValue("ChestMerchant") == null)
613 {
614 Window.dictData.Add("ChestMerchant", new Window.SaveData
615 {
616 useBG = true
617 });
618 }
619 layerInventory.windows[0].saveData = thing.GetWindowSaveData();
620 uIInventory.tabs[0].owner.BuildUICurrency(layerInventory.uiCurrency, c.trait.CostRerollShop != 0);
621 ShopTransaction.current = new ShopTransaction
622 {
623 trader = invOwnerShop
624 };
626 return layerInventory;
627 }
@ currency
Trait trait
Definition: Card.cs:49
Window.SaveData GetWindowSaveData()
Definition: Card.cs:2376
ThingContainer things
Definition: Card.cs:34
static Chara pc
Definition: ELayer.cs:15
static LayerInventory _Create(string path="")
UIInventory SetInv(int idWindow=0)
UICurrency uiCurrency
List< Window > windows
Definition: Layer.cs:116
Layer SetOnKill(Action action)
Definition: Layer.cs:579
static ShopTransaction current
Thing Find(int uid)
Definition: Thing.cs:8
virtual int CostRerollShop
Definition: Trait.cs:492
List< Tab > tabs
Definition: UIInventory.cs:133
Tab AddTab(Card c, Mode mode, Thing container=null)
Definition: UIInventory.cs:212
Definition: Window.cs:13
static Dictionary< string, SaveData > dictData
Definition: Window.cs:594

References _Create(), UIInventory.AddTab(), Trait.CostRerollShop, currency, ShopTransaction.current, UIInventory.Tab.dest, Window.dictData, ThingContainer.Find(), Card.GetWindowSaveData(), ShopTransaction.OnEndTransaction(), ELayer.pc, SetInv(), Layer.SetOnKill(), UIInventory.tabs, Card.things, Card.trait, uiCurrency, and Layer.windows.

Referenced by TraitVendingMachine.OnUse().

◆ CreateContainer() [1/2]

static LayerInventory LayerInventory.CreateContainer ( Card  owner)
inlinestatic

Definition at line 541 of file LayerInventory.cs.

542 {
543 if (owner.GetRootCard() == ELayer.pc)
544 {
545 return CreateContainerPC(owner);
546 }
547 Card card = owner;
548 if (owner.trait is TraitShippingChest)
549 {
551 card.things.SetSize(owner.things.width, owner.things.height);
552 ELayer.player.uidLastShippedZone = ELayer._zone.uid;
553 }
554 if (owner.trait is TraitDeliveryChest)
555 {
557 Tutorial.Play("deliver_box");
558 }
559 return CreateContainer(owner, card);
560 }
Thing container_shipping
Definition: CardManager.cs:52
Thing container_deliver
Definition: CardManager.cs:55
Definition: Card.cs:11
Card GetRootCard()
Definition: Card.cs:3173
static Zone _zone
Definition: ELayer.cs:25
CardManager cards
Definition: Game.cs:155
static LayerInventory CreateContainer(Card owner)
static LayerInventory CreateContainerPC(Card container)
int uid
Definition: Spatial.cs:70
static void Play(string idStep)
Definition: Tutorial.cs:7

References ELayer._zone, card, Game.cards, CardManager.container_deliver, CardManager.container_shipping, CreateContainer(), CreateContainerPC(), ELayer.game, Card.GetRootCard(), ThingContainer.height, ELayer.pc, Tutorial.Play(), Card.things, Card.trait, Spatial.uid, and ThingContainer.width.

Referenced by ActPlan._Update(), CreateContainer(), ActionMode.DoFunc(), WidgetEquip.OnActivate(), TraitContainer.Open(), UI.OpenFloatInv(), and ButtonRoster.Refresh().

◆ CreateContainer() [2/2]

static LayerInventory LayerInventory.CreateContainer ( Card  owner,
Card  container 
)
inlinestatic

Definition at line 562 of file LayerInventory.cs.

563 {
564 if (container.isChara)
565 {
566 SE.PopInventory();
567 }
568 LayerInventory layerInventory = _Create();
569 layerInventory.SetInv().AddTab(owner, UIInventory.Mode.Take, container.Thing).dest = ELayer.pc;
570 if (container.c_windowSaveData == null)
571 {
572 container.c_windowSaveData = new Window.SaveData
573 {
574 useBG = true
575 };
576 if (container == ELayer.game.cards.container_shipping)
577 {
578 container.c_windowSaveData.autodump = AutodumpFlag.none;
579 }
580 }
581 layerInventory.windows[0].saveData = container.c_windowSaveData;
582 ELayer.ui.AddLayer(layerInventory);
583 return layerInventory;
584 }
AutodumpFlag
Definition: AutodumpFlag.cs:2
virtual bool isChara
Definition: Card.cs:1959
virtual Thing Thing
Definition: Card.cs:1934
Window.SaveData c_windowSaveData
Definition: Card.cs:1721

References _Create(), UIInventory.AddTab(), Card.c_windowSaveData, Game.cards, CardManager.container_shipping, UIInventory.Tab.dest, ELayer.game, Card.isChara, ELayer.pc, SetInv(), Card.Thing, ELayer.ui, and Layer.windows.

◆ CreateContainer< T >()

static LayerInventory LayerInventory.CreateContainer< T > ( Card  c,
Card  container,
CurrencyType  currency = CurrencyType::None 
)
inlinestatic
Type Constraints
T :InvOwner 

Definition at line 586 of file LayerInventory.cs.

586 : InvOwner
587 {
588 LayerInventory layerInventory = _Create();
589 UIInventory uIInventory = layerInventory.SetInv();
590 T owner = Activator.CreateInstance(typeof(T), c, container, currency) as T;
591 uIInventory.AddTab(owner, UIInventory.Mode.Buy).dest = ELayer.pc;
592 if (container.c_windowSaveData == null)
593 {
594 container.c_windowSaveData = new Window.SaveData
595 {
596 useBG = true
597 };
598 }
599 layerInventory.windows[0].saveData = container.c_windowSaveData;
600 ELayer.ui.AddLayer(layerInventory);
601 return layerInventory;
602 }

References _Create(), UIInventory.AddTab(), Card.c_windowSaveData, currency, UIInventory.Tab.dest, ELayer.pc, SetInv(), ELayer.ui, and Layer.windows.

◆ CreateContainerAlly()

static LayerInventory LayerInventory.CreateContainerAlly ( Chara  owner,
Card  container 
)
inlinestatic

Definition at line 390 of file LayerInventory.cs.

391 {
392 SetDirty(container.Thing);
393 CloseAllyInv();
394 LayerInventory layerInventory = _Create("LayerInventoryFloat");
395 UIInventory uIInventory = layerInventory.SetInv();
396 Window window = layerInventory.windows[0];
397 window.buttonClose.SetActive(enable: true);
398 uIInventory.AddTab(new InvOwnerAlly(owner, container.Thing));
399 uIInventory.tabs[0].textTab = container.Name;
400 uIInventory.floatMode = true;
401 if (ELayer.player.windowAllyInv == null)
402 {
403 Vector2 sizeDelta = window.Rect().sizeDelta;
404 ELayer.player.windowAllyInv = new Window.SaveData
405 {
406 x = 0f,
407 y = 200f,
408 w = sizeDelta.x,
409 h = sizeDelta.y,
410 anchor = RectPosition.Center,
412 advDistribution = false
413 };
414 }
415 window.saveData = ELayer.player.windowAllyInv;
416 window.saveData.open = true;
417 ELayer.ui.layerFloat.AddLayer(layerInventory);
418 window.ClampToScreen();
419 window.UpdateSaveData();
420 return layerInventory;
421 }
RectPosition
Definition: RectPosition.cs:2
string Name
Definition: Card.cs:2013
new GameConfig game
Definition: CoreConfig.cs:596
CoreConfig config
Definition: Core.cs:70
static Player player
Definition: ELayer.cs:13
static Core core
Definition: ELayer.cs:7
static void SetDirty(Thing t)
static void CloseAllyInv()
Window.SaveData windowAllyInv
Definition: Player.cs:931
void ClampToScreen()
Definition: Window.cs:1765
Button buttonClose
Definition: Window.cs:624
void UpdateSaveData()
Definition: Window.cs:1093

References _Create(), UIInventory.AddTab(), Window.buttonClose, Window.ClampToScreen(), CloseAllyInv(), Core.config, ELayer.core, CoreConfig.game, Card.Name, ELayer.player, SetDirty(), SetInv(), CoreConfig.GameConfig.showInvBG, UIInventory.tabs, Card.Thing, ELayer.ui, Window.UpdateSaveData(), Player.windowAllyInv, Layer.windows, and Window.SaveData.x.

Referenced by LayerDragGrid.SetInv().

◆ CreateContainerPC()

static LayerInventory LayerInventory.CreateContainerPC ( Card  container)
inlinestatic

Definition at line 435 of file LayerInventory.cs.

436 {
437 SetDirty(container.Thing);
438 foreach (LayerInventory item in listInv)
439 {
440 if (item.GetPlayerContainer() == container)
441 {
442 ELayer.ui.layerFloat.RemoveLayer(item);
443 return null;
444 }
445 }
446 LayerInventory layerInventory = _Create("LayerInventoryFloat");
447 UIInventory uIInventory = layerInventory.SetInv();
448 Window window = layerInventory.windows[0];
449 Vector2 anchoredPosition = default(Vector2);
450 bool flag = container.c_windowSaveData == null;
451 window.buttonClose.SetActive(enable: true);
452 uIInventory.AddTab(new InvOwner(ELayer.pc, container.Thing));
453 uIInventory.tabs[0].textTab = container.Name;
454 uIInventory.floatMode = true;
455 if (container.c_windowSaveData == null)
456 {
457 anchoredPosition = window.Rect().anchoredPosition + new Vector2(-80f, -80f);
458 Vector2 sizeDelta = window.Rect().sizeDelta;
459 container.c_windowSaveData = new Window.SaveData
460 {
461 x = anchoredPosition.x,
462 y = anchoredPosition.y,
463 w = sizeDelta.x,
464 h = sizeDelta.y,
465 anchor = RectPosition.Auto,
467 advDistribution = false
468 };
469 if (container.trait.IsFridge)
470 {
471 container.c_windowSaveData.onlyRottable = true;
472 }
473 }
474 if (container.IsToolbelt)
475 {
476 container.c_windowSaveData.useBG = false;
477 }
478 window.saveData = container.c_windowSaveData;
479 window.saveData.open = true;
480 if (container.IsToolbelt)
481 {
482 return layerInventory;
483 }
484 ELayer.ui.layerFloat.AddLayer(layerInventory);
485 if (flag)
486 {
487 RectTransform rectTransform = window.Rect();
489 {
490 rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
491 rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
492 anchoredPosition = new Vector2(0f, rectTransform.sizeDelta.y / 2f);
493 }
494 else
495 {
496 RectTransform rectTransform2 = null;
497 RectTransform rectTransform3 = null;
498 foreach (LayerInventory item2 in listInv)
499 {
500 if (!(item2 == layerInventory) && item2.IsFloat)
501 {
502 RectTransform rectTransform4 = item2.windows[0].Rect();
503 if (!rectTransform3 || rectTransform4.Rect().localPosition.x < rectTransform3.Rect().localPosition.x)
504 {
505 rectTransform3 = rectTransform4;
506 }
507 if (!rectTransform2 || rectTransform4.Rect().localPosition.y > rectTransform2.Rect().localPosition.y)
508 {
509 rectTransform2 = rectTransform4;
510 }
511 }
512 }
513 if (uIInventory.tabs[0].owner.Container.things.width < 3 && (bool)rectTransform3)
514 {
515 rectTransform.anchorMin = rectTransform3.anchorMin;
516 rectTransform.anchorMax = rectTransform3.anchorMax;
517 anchoredPosition.x = rectTransform3.anchoredPosition.x - rectTransform.sizeDelta.x - rectTransform3.sizeDelta.x * 0.5f + 35f;
518 anchoredPosition.y = rectTransform3.anchoredPosition.y;
519 }
520 else if ((bool)rectTransform2)
521 {
522 rectTransform.anchorMin = rectTransform2.anchorMin;
523 rectTransform.anchorMax = rectTransform2.anchorMax;
524 anchoredPosition.x = rectTransform2.anchoredPosition.x;
525 anchoredPosition.y = rectTransform2.anchoredPosition.y + rectTransform.sizeDelta.y - 25f;
526 }
527 else
528 {
529 rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
530 rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
531 anchoredPosition = Vector2.one;
532 }
533 }
534 rectTransform.anchoredPosition = anchoredPosition;
535 window.ClampToScreen();
536 window.UpdateSaveData();
537 }
538 return layerInventory;
539 }
bool IsToolbelt
Definition: Card.cs:2045
bool IsFloat
Definition: ELayer.cs:45
bool openContainerCenter
Definition: Player.cs:799
virtual bool IsFridge
Definition: Trait.cs:121

References _Create(), UIInventory.AddTab(), Window.buttonClose, Window.ClampToScreen(), Core.config, ELayer.core, CoreConfig.game, ELayer.IsFloat, item, listInv, Player.openContainerCenter, ELayer.pc, ELayer.player, SetDirty(), SetInv(), CoreConfig.GameConfig.showInvBG, UIInventory.tabs, Card.Thing, ELayer.ui, Window.UpdateSaveData(), Layer.windows, and Window.SaveData.x.

Referenced by CreateContainer().

◆ CreatePCBackpack()

static LayerInventory LayerInventory.CreatePCBackpack ( bool  mousePos = false)
inlinestatic

Definition at line 353 of file LayerInventory.cs.

354 {
355 LayerInventory layerInventory = _Create("LayerInventoryFloatMain");
356 Window window = layerInventory.windows[0];
357 layerInventory.mainInv = true;
358 window.setting.saveWindow = true;
359 UIInventory uIInventory = layerInventory.SetInv();
360 uIInventory.AddTab(new InvOwner(ELayer.pc));
361 uIInventory.SetHeader("stash");
362 uIInventory.floatMode = true;
363 return layerInventory;
364 }
void SetHeader(string s)
Definition: UIInventory.cs:207

References _Create(), UIInventory.AddTab(), ELayer.pc, UIInventory.SetHeader(), SetInv(), and Layer.windows.

Referenced by UI.OpenFloatInv().

◆ GetLayer()

static LayerInventory LayerInventory.GetLayer ( Card  t)
inlinestatic

Definition at line 45 of file LayerInventory.cs.

46 {
47 LayerInventory result = null;
48 foreach (LayerInventory item in listInv)
49 {
50 if (item.Inv.Container == t)
51 {
52 return item;
53 }
54 }
55 return result;
56 }

References item, and listInv.

Referenced by GetPCLayer(), and ActionMode.UpdateInput().

◆ GetPCLayer()

static LayerInventory LayerInventory.GetPCLayer ( )
inlinestatic

Definition at line 58 of file LayerInventory.cs.

59 {
60 return GetLayer(ELayer.pc);
61 }
static LayerInventory GetLayer(Card t)

References GetLayer(), and ELayer.pc.

Referenced by InvOwner.GetShitDestOwner().

◆ GetPlayerContainer()

Card LayerInventory.GetPlayerContainer ( )
inline

Definition at line 223 of file LayerInventory.cs.

224 {
225 UIInventory.Tab tab = invs[0].tabs[0];
226 if (!IsPlayerContainer())
227 {
228 return null;
229 }
230 return tab.owner.Container;
231 }
Card Container
Definition: InvOwner.cs:540
List< UIInventory > invs
bool IsPlayerContainer(bool includePlayer=false)
InvOwner owner
Definition: UIInventory.cs:68

References InvOwner.Container, invs, IsPlayerContainer(), and UIInventory.Tab.owner.

◆ GetTopLayer()

static LayerInventory LayerInventory.GetTopLayer ( Thing  t,
bool  includePlayer = false,
InvOwner  exclude = null 
)
inlinestatic

Definition at line 26 of file LayerInventory.cs.

27 {
28 LayerInventory result = null;
29 int num = -1;
30 foreach (LayerInventory item in listInv)
31 {
32 if (item.IsPlayerContainer(includePlayer) && item.Inv != exclude && !item.Inv.Container.IsToolbelt && !item.Inv.Container.things.IsFull(t, recursive: false))
33 {
34 int siblingIndex = item.transform.GetSiblingIndex();
35 if (siblingIndex > num)
36 {
37 num = siblingIndex;
38 result = item;
39 }
40 }
41 }
42 return result;
43 }

References item, and listInv.

Referenced by InvOwner.GetShitDestOwner().

◆ HeaderIsListOf()

override bool LayerInventory.HeaderIsListOf ( int  id)
inlinevirtual

Reimplemented from Layer.

Definition at line 233 of file LayerInventory.cs.

234 {
235 return false;
236 }

◆ IsOpen() [1/2]

static bool LayerInventory.IsOpen ( Card  container)
inlinestatic

Definition at line 423 of file LayerInventory.cs.

424 {
425 foreach (LayerInventory item in listInv)
426 {
427 if (item.GetPlayerContainer() == container)
428 {
429 return true;
430 }
431 }
432 return false;
433 }

References item, and listInv.

◆ IsOpen() [2/2]

static bool LayerInventory.IsOpen ( Thing  t)
inlinestatic

Definition at line 75 of file LayerInventory.cs.

76 {
77 foreach (LayerInventory item in listInv)
78 {
79 if (item.invs[0].owner.Container == t)
80 {
81 return true;
82 }
83 }
84 return false;
85 }

References item, and listInv.

Referenced by InvOwner.ListInteractions(), and TraitContainer.OnSetCardGrid().

◆ IsPlayerContainer()

bool LayerInventory.IsPlayerContainer ( bool  includePlayer = false)
inline

Definition at line 210 of file LayerInventory.cs.

211 {
212 if (invs[0].tabs[0].mode != UIInventory.Mode.All)
213 {
214 return false;
215 }
216 if (!includePlayer && invs[0].owner.Container == ELayer.pc)
217 {
218 return false;
219 }
220 return invs[0].owner.Container.GetRootCard() == ELayer.pc;
221 }

References invs, and ELayer.pc.

Referenced by GetPlayerContainer(), and UI.ToggleInventory().

◆ OnAfterInit()

override void LayerInventory.OnAfterInit ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 260 of file LayerInventory.cs.

261 {
262 ELayer.core.actionsNextFrame.Add(delegate
263 {
264 ELayer.core.actionsNextFrame.Add(delegate
265 {
266 if ((bool)invs[0] && (bool)invs[0].gameObject)
267 {
268 invs[0].RefreshHighlight();
269 }
270 });
271 });
272 }
List< Action > actionsNextFrame
Definition: BaseCore.cs:31

References BaseCore.actionsNextFrame, ELayer.core, and invs.

◆ OnDestroy()

void LayerInventory.OnDestroy ( )
inlineprivate

Definition at line 323 of file LayerInventory.cs.

324 {
325 if (invs.Count > 0)
326 {
327 SetDirty(invs[0].owner.Container.Thing);
328 }
329 listInv.Remove(this);
330 }

References invs, listInv, and SetDirty().

◆ OnInit()

override void LayerInventory.OnInit ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 238 of file LayerInventory.cs.

239 {
240 foreach (UIInventory inv in invs)
241 {
242 inv.OnInit();
243 }
244 listInv.Add(this);
245 if (Inv.Container == ELayer.pc)
246 {
247 InvOwner.Main = Inv;
248 }
249 if (!floatInv)
250 {
251 InvOwner.Trader = Inv;
252 wasInventoryOpen = ELayer.ui.IsInventoryOpen;
253 if (!wasInventoryOpen)
254 {
255 ELayer.ui.OpenFloatInv(ignoreSound: true);
256 }
257 }
258 }
void OnInit()
Definition: UIInventory.cs:229

References InvOwner.Container, floatInv, Inv, invs, listInv, UIInventory.OnInit(), ELayer.pc, ELayer.ui, and wasInventoryOpen.

◆ OnKill()

override void LayerInventory.OnKill ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 297 of file LayerInventory.cs.

298 {
299 listInv.Remove(this);
300 EInput.haltInput = false;
301 if (Inv == InvOwner.Trader)
302 {
303 if (Inv.UseGuide)
304 {
305 SetDirtyAll();
306 }
307 InvOwner.Trader = null;
308 if (!wasInventoryOpen && ELayer.ui.IsInventoryOpen)
309 {
310 ELayer.ui.ToggleInventory();
311 }
312 }
313 if (Inv.Container == ELayer.pc)
314 {
315 InvOwner.Main = null;
316 }
318 {
319 SE.Play("pop_inventory_deactivate");
320 }
321 }
bool isKilling
Definition: Game.cs:237
static InvOwner Trader
Definition: InvOwner.cs:524
Card owner
Definition: InvOwner.cs:538
virtual bool UseGuide
Definition: InvOwner.cs:576
static void SetDirtyAll(bool immediate=false)

References InvOwner.Container, ELayer.game, Inv, Game.isKilling, listInv, InvOwner.owner, ELayer.pc, SetDirtyAll(), InvOwner.Trader, ELayer.ui, InvOwner.UseGuide, and wasInventoryOpen.

◆ OnRightClick()

override void LayerInventory.OnRightClick ( )
inlinevirtual

Reimplemented from ELayer.

Definition at line 332 of file LayerInventory.cs.

333 {
334 if (invs[0].isList)
335 {
336 base.OnRightClick();
337 }
338 if (!invs[0].floatMode && InputModuleEX.GetComponentOf<ButtonGrid>() == null)
339 {
340 Close();
341 }
342 }
virtual void Close()
Definition: Layer.cs:463

References Layer.Close(), and invs.

◆ OnUpdateInput()

override void LayerInventory.OnUpdateInput ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 282 of file LayerInventory.cs.

283 {
284 if (EInput.action == EAction.MenuInventory || Input.GetKeyDown(KeyCode.Tab))
285 {
286 Close();
288 return;
289 }
290 if (EInput.action == EAction.Dump)
291 {
293 }
294 base.OnUpdateInput();
295 }
EAction
Definition: EAction.cs:2
Definition: EInput.cs:8
static void WaitReleaseKey()
Definition: EInput.cs:650
static EAction action
Definition: EInput.cs:259
static void TryPerform()
Definition: TaskDump.cs:6

References EInput.action, Layer.Close(), TaskDump.TryPerform(), and EInput.WaitReleaseKey().

◆ SetDirty()

static void LayerInventory.SetDirty ( Thing  t)
inlinestatic

Definition at line 87 of file LayerInventory.cs.

88 {
89 if (!ELayer.game.altInv || t == null)
90 {
91 return;
92 }
93 foreach (LayerInventory item in listInv)
94 {
95 if (item.invs[0].owner.Container == t.parent || ((bool)item.mini && item.mini.gameObject.activeInHierarchy))
96 {
97 item.invs[0].dirty = true;
98 }
99 }
100 if (t.invY == 1 || ELayer.pc.held == t)
101 {
102 WidgetCurrentTool.dirty = true;
103 }
104 if (t.isEquipped)
105 {
106 WidgetEquip.dirty = true;
107 }
108 }
int invY
Definition: Card.cs:1831
ICardParent parent
Definition: Card.cs:51
Card held
Definition: Chara.cs:67
bool isEquipped
Definition: Thing.cs:17

References Game.altInv, ELayer.game, Chara.held, item, listInv, and ELayer.pc.

Referenced by Card.AddThing(), ActMelee.Attack(), Card.ChangeMaterial(), CreateContainerAlly(), CreateContainerPC(), Card.Decay(), Chara.DropHeld(), CharaBody.Equip(), InvOwner.Grab(), Chara.HoldCard(), Thing.Identify(), Card.ModCharge(), Card.OnChildNumChange(), OnDestroy(), InvOwnerDraglet.OnProcess(), ConSleep.OnRemoved(), TraitEquipItem.OnUse(), TraitFoodPreparedPackage.OnUse(), ActRanged.Perform(), Chara.PickHeld(), ActEffect.Proc(), UIInventory.RefreshMenu(), Card.RemoveThing(), Card.SetCharge(), Chara.TryAbsorbRod(), ActRanged.TryReload(), ButtonAbility.TryUse(), and CharaBody.Unequip().

◆ SetDirtyAll()

static void LayerInventory.SetDirtyAll ( bool  immediate = false)
inlinestatic

Definition at line 110 of file LayerInventory.cs.

111 {
112 foreach (LayerInventory item in listInv)
113 {
114 item.invs[0].dirty = true;
115 if (immediate)
116 {
117 item.invs[0].CheckDirty();
118 }
119 }
120 if ((bool)WidgetEquip.Instance)
121 {
122 WidgetEquip.dirty = true;
123 if (immediate)
124 {
126 }
127 }
128 WidgetCurrentTool.dirty = true;
129 if (immediate)
130 {
132 }
133 }
static WidgetCurrentTool Instance
static WidgetEquip Instance
Definition: WidgetEquip.cs:11
void CheckDirty()
Definition: WidgetEquip.cs:61

References WidgetCurrentTool.CheckDirty(), WidgetEquip.CheckDirty(), WidgetCurrentTool.Instance, WidgetEquip.Instance, item, and listInv.

Referenced by LayerAbility.ClearHotElement(), TraitBaseSpellbook.ModCharge(), WidgetSearch.OnDeactivate(), LayerDragGrid.OnKill(), OnKill(), CoreDebug.QuickStart(), LayerDragGrid.Redraw(), UIInventory.RefreshGrid(), WidgetSearch.RefreshList(), and LayerAbility.SelectGroup().

◆ SetInv()

UIInventory LayerInventory.SetInv ( int  idWindow = 0)
inline

Definition at line 274 of file LayerInventory.cs.

275 {
276 UIInventory uIInventory = invs[idWindow];
277 uIInventory.window = windows[idWindow];
278 uIInventory.layer = this;
279 return uIInventory;
280 }

References invs, and Layer.windows.

Referenced by CreateBuy(), CreateContainer(), CreateContainer< T >(), CreateContainerAlly(), CreateContainerPC(), and CreatePCBackpack().

◆ TryShowGuide() [1/2]

static void LayerInventory.TryShowGuide ( List< ButtonGrid list)
inlinestatic

Definition at line 149 of file LayerInventory.cs.

150 {
151 bool flag = InvOwner.HasTrader && InvOwner.Trader.UseGuide;
152 if (flag)
153 {
154 WidgetSearch.selected = null;
155 }
156 bool flag2 = (bool)WidgetSearch.Instance && WidgetSearch.selected != null && !ELayer.ui.IsDragging;
157 if (!flag2 && WidgetEquip.dragEquip == null && LayerAbility.hotElement == null && !flag)
158 {
159 return;
160 }
161 foreach (ButtonGrid item in list)
162 {
163 Thing thing = item.card as Thing;
164 if (LayerAbility.hotElement != null)
165 {
166 if ((bool)item && item.invOwner != null && (thing == null || thing.trait is TraitAbility) && item.invOwner.owner == ELayer.pc && !(item.invOwner is InvOwnerEquip))
167 {
168 item.Attach("guide", rightAttach: false);
169 }
170 }
171 else if (WidgetEquip.dragEquip != null && !flag)
172 {
173 if (item.invOwner is InvOwnerEquip invOwnerEquip && invOwnerEquip.slot.elementId == WidgetEquip.dragEquip.category.slot)
174 {
175 item.Attach("guide", rightAttach: false);
176 }
177 }
178 else if (flag2)
179 {
181 {
182 item.Attach("guide", rightAttach: false);
183 }
184 }
185 else
186 {
187 if (thing == null)
188 {
189 continue;
190 }
191 bool show = InvOwner.Trader.ShouldShowGuide(thing);
192 if (!show && thing.CanSearchContents)
193 {
194 thing.things.Foreach(delegate(Thing _t)
195 {
196 if (!show && InvOwner.Trader.ShouldShowGuide(_t))
197 {
198 show = true;
199 }
200 });
201 }
202 if (show)
203 {
204 item.Attach("guide", rightAttach: false);
205 }
206 }
207 }
208 }
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
int elementId
Definition: BodySlot.cs:6
SourceCategory.Row category
Definition: Card.cs:1925
BodySlot slot
Definition: InvOwnerEquip.cs:3
virtual bool ShouldShowGuide(Thing t)
Definition: InvOwner.cs:686
static ButtonAbility hotElement
Definition: LayerAbility.cs:23
void Foreach(Action< Thing > action, bool onlyAccessible=true)
bool CanSearchContents
Definition: Thing.cs:80
static Thing dragEquip
Definition: WidgetEquip.cs:15
static WidgetSearch Instance
Definition: WidgetSearch.cs:25
static Card selected
Definition: WidgetSearch.cs:29

References Thing.CanSearchContents, Card.category, WidgetEquip.dragEquip, BodySlot.elementId, ThingContainer.Foreach(), LayerAbility.hotElement, if(), WidgetSearch.Instance, item, Card.parent, ELayer.pc, WidgetSearch.selected, InvOwner.ShouldShowGuide(), InvOwnerEquip.slot, Card.things, InvOwner.Trader, ELayer.ui, and InvOwner.UseGuide.

◆ TryShowGuide() [2/2]

static void LayerInventory.TryShowGuide ( UIList  list)
inlinestatic

Definition at line 135 of file LayerInventory.cs.

136 {
137 List<ButtonGrid> list2 = new List<ButtonGrid>();
138 foreach (UIList.ButtonPair button in list.buttons)
139 {
140 ButtonGrid buttonGrid = button.component as ButtonGrid;
141 if ((bool)buttonGrid)
142 {
143 list2.Add(buttonGrid);
144 }
145 }
146 TryShowGuide(list2);
147 }
static void TryShowGuide(UIList list)
Definition: UIList.cs:9
List< ButtonPair > buttons
Definition: UIList.cs:244

References UIList.buttons, and TryShowGuide().

Referenced by WidgetCurrentTool.RebuildSlots(), WidgetEquip.RefreshEquipment(), UIInventory.RefreshGrid(), and TryShowGuide().

Member Data Documentation

◆ floatInv

bool LayerInventory.floatInv

Definition at line 15 of file LayerInventory.cs.

Referenced by OnInit().

◆ highlightInv

InvOwner LayerInventory.highlightInv
static

Definition at line 9 of file LayerInventory.cs.

Referenced by UIInventory.Update().

◆ invs

◆ listInv

◆ mainInv

bool LayerInventory.mainInv

Definition at line 17 of file LayerInventory.cs.

◆ mini

WindowCharaMini LayerInventory.mini

Definition at line 19 of file LayerInventory.cs.

◆ uiCurrency

UICurrency LayerInventory.uiCurrency

Definition at line 13 of file LayerInventory.cs.

Referenced by CreateBuy().

◆ wasInventoryOpen

bool LayerInventory.wasInventoryOpen

Definition at line 22 of file LayerInventory.cs.

Referenced by OnInit(), and OnKill().

Property Documentation

◆ Inv

InvOwner LayerInventory.Inv
get

Definition at line 24 of file LayerInventory.cs.

Referenced by InvOwner.GetShitDestOwner(), OnInit(), OnKill(), and ButtonRoster.Refresh().


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