Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
DragItemCard Class Reference
Inheritance diagram for DragItemCard:
DragItem EClass

Classes

class  DragInfo
 

Public Member Functions

 DragItemCard (ButtonGrid _button, bool setDragImage=true)
 
override void OnStartDrag ()
 
override void OnEndDrag ()
 
override bool OnDragSpecial ()
 
override bool OnDrag (bool execute, bool cancel=false)
 
- Public Member Functions inherited from DragItem
virtual Image GetDragImage ()
 
virtual void OnStartDrag ()
 
virtual void OnEndDrag ()
 
virtual bool OnDrag (bool execute, bool cancel=false)
 
virtual bool OnDragSpecial ()
 

Public Attributes

ButtonGrid button
 
DragInfo from
 
DragInfo to
 

Properties

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

Additional Inherited Members

- Static Public Member Functions inherited from EClass
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 
- Static Public Attributes inherited from EClass
static Core core
 

Detailed Description

Definition at line 3 of file DragItemCard.cs.

Constructor & Destructor Documentation

◆ DragItemCard()

DragItemCard.DragItemCard ( ButtonGrid  _button,
bool  setDragImage = true 
)
inline

Definition at line 60 of file DragItemCard.cs.

61 {
62 button = _button;
63 from = new DragInfo(button);
64 if (setDragImage)
65 {
66 EClass.ui.hud.SetDragImage(button.icon, null, button.mainText);
67 }
68 }
ButtonGrid button
Definition: DragItemCard.cs:52
DragInfo from
Definition: DragItemCard.cs:54
Definition: EClass.cs:5
static UI ui
Definition: EClass.cs:16
Image icon
Definition: UIButton.cs:110
UIText mainText
Definition: UIButton.cs:102

References button, from, UIButton.icon, UIButton.mainText, and EClass.ui.

Member Function Documentation

◆ OnDrag()

override bool DragItemCard.OnDrag ( bool  execute,
bool  cancel = false 
)
inlinevirtual

Reimplemented from DragItem.

Definition at line 112 of file DragItemCard.cs.

113 {
114 DragInfo dragInfo = new DragInfo(InputModuleEX.GetComponentOf<ButtonGrid>());
115 bool num = from.invOwner.OnDrag(from, dragInfo, execute, cancel);
116 if (num && EClass.core.config.game.doubleClickToHold && EClass.ui.dragDuration < 0.35f && dragInfo.button == from.button && from.thing != null)
117 {
118 dragInfo.button.invOwner.TryHold(from.thing);
119 }
120 return num;
121 }
new GameConfig game
Definition: CoreConfig.cs:596
CoreConfig config
Definition: Core.cs:70
static Core core
Definition: EClass.cs:6
virtual bool OnDrag(DragItemCard.DragInfo from, DragItemCard.DragInfo to, bool execute, bool cancel=false)
Definition: InvOwner.cs:1175

References DragItemCard.DragInfo.button, Core.config, EClass.core, CoreConfig.GameConfig.doubleClickToHold, from, CoreConfig.game, ButtonGrid.invOwner, DragItemCard.DragInfo.invOwner, InvOwner.OnDrag(), DragItemCard.DragInfo.thing, InvOwner.TryHold(), and EClass.ui.

◆ OnDragSpecial()

override bool DragItemCard.OnDragSpecial ( )
inlinevirtual

Reimplemented from DragItem.

Definition at line 89 of file DragItemCard.cs.

90 {
91 DragInfo dragInfo = new DragInfo(InputModuleEX.GetComponentOf<ButtonGrid>());
92 if (dragInfo != null && (bool)dragInfo.button && dragInfo.button.interactable && !(dragInfo.invOwner is InvOwnerHotbar) && dragInfo.invOwner.owner == from.invOwner.owner && dragInfo.invOwner.owner.IsPC && from.thing.Num > 1 && (dragInfo.thing == null || dragInfo.thing.CanStackTo(from.thing)))
93 {
94 bool num = dragInfo.thing != null;
95 Thing thing = from.thing.Split(1);
96 SE.Play(thing.material.GetSoundDrop(thing.sourceCard));
97 if (num)
98 {
99 dragInfo.thing.ModNum(1);
100 }
101 else
102 {
103 dragInfo.invOwner.Container.AddThing(thing, tryStack: false);
104 thing.invX = dragInfo.invX;
105 thing.invY = dragInfo.invY;
106 }
107 return true;
108 }
109 return false;
110 }
Thing Split(int a)
Definition: Card.cs:3231
SourceMaterial.Row material
Definition: Card.cs:1927
virtual bool IsPC
Definition: Card.cs:2019
int Num
Definition: Card.cs:154
void ModNum(int a, bool notify=true)
Definition: Card.cs:3262
Card owner
Definition: InvOwner.cs:538
Definition: Thing.cs:8
override CardRow sourceCard
Definition: Thing.cs:47

References Card.AddThing(), DragItemCard.DragInfo.button, Thing.CanStackTo(), InvOwner.Container, from, DragItemCard.DragInfo.invOwner, DragItemCard.DragInfo.invX, DragItemCard.DragInfo.invY, Card.IsPC, Card.material, Card.ModNum(), Card.Num, InvOwner.owner, Thing.sourceCard, Card.Split(), and DragItemCard.DragInfo.thing.

◆ OnEndDrag()

override void DragItemCard.OnEndDrag ( )
inlinevirtual

Reimplemented from DragItem.

Definition at line 79 of file DragItemCard.cs.

80 {
81 WidgetEquip.dragEquip = null;
83 if ((bool)LayerDragGrid.Instance)
84 {
86 }
87 }
void Dettach(string id)
Definition: ButtonGrid.cs:78
ButtonGrid CurrentButton
static LayerDragGrid Instance
static void Redraw()
Definition: WidgetEquip.cs:69

References LayerDragGrid.CurrentButton, ButtonGrid.Dettach(), LayerDragGrid.Instance, and WidgetEquip.Redraw().

◆ OnStartDrag()

override void DragItemCard.OnStartDrag ( )
inlinevirtual

Reimplemented from DragItem.

Definition at line 70 of file DragItemCard.cs.

71 {
74 {
75 LayerDragGrid.Instance.CurrentButton.Attach("guide", rightAttach: false);
76 }
77 }
Transform Attach(string id, bool rightAttach=true)
Definition: ButtonGrid.cs:63
void OnStartDrag(DragItemCard.DragInfo from)
Definition: InvOwner.cs:1151
virtual bool ShouldShowGuide(Thing t)
Definition: InvOwner.cs:686
InvOwnerDraglet owner

References ButtonGrid.Attach(), LayerDragGrid.CurrentButton, from, LayerDragGrid.Instance, DragItemCard.DragInfo.invOwner, InvOwner.OnStartDrag(), LayerDragGrid.owner, InvOwner.ShouldShowGuide(), and DragItemCard.DragInfo.thing.

Member Data Documentation

◆ button

◆ from

DragInfo DragItemCard.from

Definition at line 54 of file DragItemCard.cs.

Referenced by DragItemCard(), OnDrag(), OnDragSpecial(), OnStartDrag(), and Thing.ShowSplitMenu().

◆ to

DragInfo DragItemCard.to

Definition at line 56 of file DragItemCard.cs.

Property Documentation

◆ Button

override UIButton DragItemCard.Button
get

Definition at line 58 of file DragItemCard.cs.


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