Elin Decompiled Documentation EA 23.102 Nightly
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Pages
InvOwnerDraglet.cs
Go to the documentation of this file.
1using DG.Tweening;
2using UnityEngine;
3
5{
6 public enum ProcessType
7 {
8 None,
10 }
11
12 public int count = -1;
13
15
16 public int price;
17
18 public virtual ProcessType processType => ProcessType.None;
19
20 public virtual bool ShowFuel => false;
21
22 public virtual bool CanTargetAlly => false;
23
24 public virtual string langWhat => "";
25
26 public virtual bool AllowStockIngredients => false;
27
28 public override bool AllowTransfer => true;
29
30 public override bool AllowAutouse => false;
31
32 public override bool AllowContext => false;
33
34 public override bool UseGuide => true;
35
36 public override bool CopyOnTransfer => true;
37
38 public override bool InvertSell => true;
39
40 public override bool DenyImportant => false;
41
43
44 public override bool AllowHold(Thing t)
45 {
46 return false;
47 }
48
49 public InvOwnerDraglet(Card owner = null, Card container = null, CurrencyType _currency = CurrencyType.Money)
50 : base(owner, container, _currency)
51 {
52 }
53
54 public override void OnInit()
55 {
56 if (price == 0)
57 {
59 }
60 if (!langWhat.IsEmpty())
61 {
63 }
64 }
65
66 public override void OnClick(ButtonGrid button)
67 {
68 if (button.card != null)
69 {
70 if (button.index == 0)
71 {
73 }
74 else
75 {
76 button.SetCard(null);
78 }
81 SE.Equip();
83 {
85 }
86 }
87 }
88
89 public override void OnRightClick(ButtonGrid button)
90 {
91 OnClick(button);
92 }
93
94 public override int GetPrice(Thing t, CurrencyType currency, int num, bool sell)
95 {
96 return price;
97 }
98
99 public override string GetTextDetail(Thing t, CurrencyType currency, int num, bool sell)
100 {
101 int num2 = GetPrice(t, currency, num, sell);
102 return "invInteraction2".lang(num.ToString() ?? "", langTransfer.lang()) + ((num2 == 0) ? "" : "invInteraction3".lang(num2.ToString() ?? "", EClass.sources.things.map[base.IDCurrency].GetName()));
103 }
104
105 public virtual void OnWriteNote(Thing t, UINote n)
106 {
107 }
108
109 public sealed override void OnProcess(Thing t)
110 {
111 if (!dragGrid.IsAllGridSet())
112 {
115 t.PlaySoundDrop(spatial: false);
116 return;
117 }
118 _OnProcess(t);
121 if (processType == ProcessType.Consume)
122 {
123 EInput.haltInput = true;
124 foreach (ButtonGrid b in dragGrid.buttons)
125 {
126 b.icon.rectTransform.DOScale(0f, 0.3f).SetEase(Ease.InBack).OnComplete(delegate
127 {
128 if (b.transform != null)
129 {
130 b.icon.rectTransform.localScale = Vector3.one;
131 b.SetCardGrid(null, b.invOwner);
132 RedrawButton();
133 }
134 EInput.haltInput = false;
135 });
136 }
137 }
138 else
139 {
140 RedrawButton();
141 }
143 if (count > 0)
144 {
145 count--;
146 if (count == 0)
147 {
148 dragGrid.Close();
149 }
150 else if (!langWhat.IsEmpty())
151 {
153 }
154 }
155 }
156
157 public virtual void _OnProcess(Thing t)
158 {
159 }
160
161 public virtual void OnAfterRefuel()
162 {
163 }
164
165 public void RedrawButton()
166 {
169 }
170
171 public override void BuildUICurrency(UICurrency uiCurrency, bool canReroll = false)
172 {
173 base.BuildUICurrency(uiCurrency);
174 uiCurrency.SetActive(price != 0);
175 }
176}
BlessedState
Definition: BlessedState.cs:2
CurrencyType
Definition: CurrencyType.cs:2
Status Success(Action action=null)
Definition: AIAct.cs:252
virtual bool IsRunning
Definition: AIAct.cs:31
Card card
Definition: ButtonGrid.cs:24
void SetCard(Card c, Mode mode=Mode.Default, Action< UINote > onWriteNote=null)
Definition: ButtonGrid.cs:184
Definition: Card.cs:11
void PlaySoundDrop(bool spatial=true)
Definition: Card.cs:5389
AIAct ai
Definition: Chara.cs:187
Definition: EClass.cs:5
static SourceManager sources
Definition: EClass.cs:42
static Chara pc
Definition: EClass.cs:14
Definition: EInput.cs:8
static bool haltInput
Definition: EInput.cs:275
virtual bool CanTargetAlly
override bool AllowContext
LayerDragGrid dragGrid
virtual bool AllowStockIngredients
override bool AllowTransfer
override int GetPrice(Thing t, CurrencyType currency, int num, bool sell)
override void OnClick(ButtonGrid button)
virtual void _OnProcess(Thing t)
override bool CopyOnTransfer
virtual string langWhat
BlessedState state
override void BuildUICurrency(UICurrency uiCurrency, bool canReroll=false)
override string GetTextDetail(Thing t, CurrencyType currency, int num, bool sell)
override bool DenyImportant
virtual void OnWriteNote(Thing t, UINote n)
virtual void OnAfterRefuel()
override void OnRightClick(ButtonGrid button)
override bool AllowHold(Thing t)
override void OnInit()
sealed override void OnProcess(Thing t)
virtual ProcessType processType
InvOwnerDraglet(Card owner=null, Card container=null, CurrencyType _currency=CurrencyType.Money)
override bool InvertSell
virtual bool ShowFuel
override bool AllowAutouse
override bool UseGuide
Card owner
Definition: InvOwner.cs:538
CurrencyType currency
Definition: InvOwner.cs:532
virtual string langTransfer
Definition: InvOwner.cs:592
override void ClearButtons()
UIDragGridIngredients uiIngredients
List< ButtonGrid > buttons
void RefreshCost()
bool IsAllGridSet()
static LayerDragGrid Instance
override void RefreshCurrentGrid()
static void SetDirty(Thing t)
virtual void Close()
Definition: Layer.cs:463
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
SourceThing things
Definition: Thing.cs:8
Image icon
Definition: UIButton.cs:110
static void TryShowTip(Transform root=null, bool highlight=true, bool ignoreWhenRightClick=true)
Definition: UIButton.cs:778
Definition: UINote.cs:6