Elin Decompiled Documentation EA 23.357 Nightly
Loading...
Searching...
No Matches
UIInventory Class Reference
Inheritance diagram for UIInventory:
EMono

Classes

class  Tab
 
class  Transaction
 

Public Types

enum  Mode {
  Default , Equip , Buy , Sell ,
  Gear , Other , Select , Food ,
  Item , Resource , Read , Hold ,
  Tool , Put , Take , Give ,
  Trade , All , Offer , Identify ,
  Drink , Deliver , HoldFurniture , HoldBlock ,
  Recycle
}
 
enum  SubMode { Default , IdentifyScroll , DeliverTax }
 
enum  InteractMode { Auto , Hold , Drop }
 

Public Member Functions

void SetHeader (string s)
 
Tab AddTab (Card c, Mode mode, Thing container=null)
 
Tab AddTab (InvOwner owner, Mode mode=Mode.All)
 
void OnInit ()
 
void RefreshWindow ()
 
void Close ()
 
void SwitchTab (Tab tab)
 
void DoAct (Act act)
 
void CheckDirty ()
 
void RefreshDestNum ()
 
bool DestNumIsMax ()
 
void RefreshMenu ()
 
Transform ShowDistribution (UIContextMenu dis, Window.SaveData data)
 
Transform ShowAdvDistribution (UIContextMenu dis, Window.SaveData data)
 
void Sort (bool redraw=true)
 
void RefreshList ()
 
void RefreshHighlight ()
 
void RefreshGrid ()
 

Static Public Member Functions

static void RefreshAllList ()
 
- Static Public Member Functions inherited from EMono
static int rnd (int a)
 

Public Attributes

UIList list
 
BodySlot bodySlot
 
LayerInventory layer
 
Transform headerRow
 
Transform transOverflow
 
string idMold
 
Func< Thing, bool > funcList
 
Action< Thing > actionClick
 
Window window
 
UIContent content
 
Tab currentTab
 
AIAct currentAct
 
InteractMode interactMode
 
bool floatMode
 
bool dirty
 
bool isList
 
bool sortDirty = true
 
Transaction lastTransaction
 
Image imageHighlight
 
Image imageHighlightGrid
 
UIButton moldSmallTab
 
ButtonGrid moldButtonGrid
 
ButtonGrid moldButtonGridless
 
UIButton buttonTakeAll
 
UIMagicChest uiMagic
 
List< Tab > tabs = new List<Tab>()
 
bool wasDirty
 

Properties

InvOwner owner [get]
 
Card dest [get]
 
bool UseBG [get]
 
bool UseGrid [get]
 
bool IsMagicChest [get]
 
bool IsToolbelt [get]
 
bool IsShop [get]
 
bool IsAdvSort [get]
 
CoreRef.InventoryStyle InvStyle [get]
 
bool IsMainMode [get]
 
CurrencyType CurrencyType [get]
 
string IDCurrency [get]
 
- Properties inherited from EMono
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 Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SoundManager Sound [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static CoreDebug debug [get]
 

Private Member Functions

void Update ()
 

Private Attributes

int destNum
 
int lastNum
 
bool firstMouseRightDown
 

Additional Inherited Members

- Static Public Attributes inherited from EMono
static Core core
 

Detailed Description

Definition at line 6 of file UIInventory.cs.

Member Enumeration Documentation

◆ InteractMode

Enumerator
Auto 
Hold 
Drop 

Definition at line 57 of file UIInventory.cs.

◆ Mode

Enumerator
Default 
Equip 
Buy 
Sell 
Gear 
Other 
Select 
Food 
Item 
Resource 
Read 
Hold 
Tool 
Put 
Take 
Give 
Trade 
All 
Offer 
Identify 
Drink 
Deliver 
HoldFurniture 
HoldBlock 
Recycle 

Definition at line 21 of file UIInventory.cs.

◆ SubMode

Enumerator
Default 
IdentifyScroll 
DeliverTax 

Definition at line 50 of file UIInventory.cs.

Member Function Documentation

◆ AddTab() [1/2]

Tab UIInventory.AddTab ( Card  c,
Mode  mode,
Thing  container = null 
)
inline

◆ AddTab() [2/2]

Tab UIInventory.AddTab ( InvOwner  owner,
Mode  mode = Mode::All 
)
inline

Definition at line 220 of file UIInventory.cs.

221 {
222 owner.Init();
223 Tab tab = new Tab
224 {
225 mode = mode,
226 owner = owner
227 };
228 tabs.Add(tab);
229 return tab;
230 }
void Init()
Definition: InvOwner.cs:746
InvOwner owner
Definition: UIInventory.cs:139
List< Tab > tabs
Definition: UIInventory.cs:135

References InvOwner.Init().

◆ CheckDirty()

void UIInventory.CheckDirty ( )
inline

Definition at line 412 of file UIInventory.cs.

413 {
414 if (dirty)
415 {
416 wasDirty = true;
417 if (UseGrid)
418 {
419 list.Redraw();
420 }
421 else
422 {
423 list.List();
424 }
426 }
427 }
static void TryShowTip(Transform root=null, bool highlight=true, bool ignoreWhenRightClick=true)
Definition: UIButton.cs:778
UIList list
Definition: UIInventory.cs:79
override void Redraw()
Definition: UIList.cs:796
override void List()
Definition: UIList.cs:773

References UIButton.TryShowTip().

◆ Close()

void UIInventory.Close ( )
inline

Definition at line 308 of file UIInventory.cs.

309 {
310 if (!floatMode)
311 {
312 layer.Close();
313 }
314 }
static void Close(Thing t)
LayerInventory layer
Definition: UIInventory.cs:83
bool floatMode
Definition: UIInventory.cs:105

◆ DestNumIsMax()

bool UIInventory.DestNumIsMax ( )
inline

Definition at line 442 of file UIInventory.cs.

443 {
444 Mode mode = currentTab.mode;
445 if ((uint)(mode - 2) <= 1u)
446 {
447 return false;
448 }
449 return true;
450 }
Tab currentTab
Definition: UIInventory.cs:99

◆ DoAct()

void UIInventory.DoAct ( Act  act)
inline

Definition at line 362 of file UIInventory.cs.

363 {
364 if (!EMono.pc.HasNoGoal || (act.LocalAct && EMono._zone.IsRegion))
365 {
366 SE.Beep();
367 return;
368 }
369 EMono.player.hotItemToRestore = EMono.player.currentHotItem;
370 if (act.IsAct)
371 {
372 act.Perform(EMono.pc);
373 return;
374 }
375 currentAct = act as AIAct;
378 if (!floatMode)
379 {
380 Close();
381 }
382 }
Definition: AIAct.cs:6
void SetTurbo(int mtp=-1)
Definition: AM_Adv.cs:1091
virtual bool Perform()
Definition: ACT.cs:266
virtual bool LocalAct
Definition: ACT.cs:173
virtual bool IsAct
Definition: ACT.cs:101
static AM_Adv Adv
Definition: ActionMode.cs:15
AIAct SetAI(AIAct g)
Definition: Chara.cs:9496
bool HasNoGoal
Definition: Chara.cs:1049
Definition: EMono.cs:4
static Chara pc
Definition: EMono.cs:13
static Player player
Definition: EMono.cs:11
static Zone _zone
Definition: EMono.cs:19
HotItem currentHotItem
Definition: Player.cs:1179
virtual bool IsRegion
Definition: Spatial.cs:515
void Close()
Definition: UIInventory.cs:308
AIAct currentAct
Definition: UIInventory.cs:101

References EMono._zone, ActionMode.Adv, Player.currentHotItem, Chara.HasNoGoal, Act.IsAct, Spatial.IsRegion, Act.LocalAct, EMono.pc, Act.Perform(), EMono.player, Chara.SetAI(), and AM_Adv.SetTurbo().

◆ OnInit()

void UIInventory.OnInit ( )
inline

Definition at line 232 of file UIInventory.cs.

233 {
235 foreach (Tab t in tabs)
236 {
237 string text = t.textTab.IsEmpty("inv" + t.mode);
238 if (!floatMode)
239 {
240 text = text.lang() + " - " + (t.owner.owner.IsPC ? "you".lang().ToTitleCase() : (t.owner.Chara?.Name ?? t.owner.Container.Name));
241 }
242 Window.Setting.Tab tab = window.AddTab(text, content, delegate
243 {
244 SwitchTab(t);
245 }, EMono.core.refs.icons.invTab.TryGetValue(t.mode), text);
246 if (t.smallTab)
247 {
248 tab.customTab = moldSmallTab;
249 }
250 }
251 if ((bool)layer.mini)
252 {
253 layer.mini.SetActive(owner.Container.isChara);
255 {
257 }
258 }
259 if ((bool)uiMagic)
260 {
261 uiMagic.SetActive(IsMagicChest);
262 if (IsMagicChest)
263 {
264 uiMagic.Init();
265 }
266 }
267 if (IsMagicChest)
268 {
269 TooltipManager.Instance.disableTimer = 0.1f;
270 }
271 }
virtual Chara Chara
Definition: Card.cs:2122
virtual bool isChara
Definition: Card.cs:2135
UDInvTab invTab
Definition: CoreRef.cs:139
Icons icons
Definition: CoreRef.cs:358
CoreRef refs
Definition: Core.cs:51
static Core core
Definition: EMono.cs:5
Card Container
Definition: InvOwner.cs:535
WindowCharaMini mini
UIInventory.InteractMode interactMode
Definition: Player.cs:57
Pref pref
Definition: Player.cs:1092
bool TryGetValue(TKey key, out TValue value)
Definition: UDictionary.cs:178
bool IsMagicChest
Definition: UIInventory.cs:157
InteractMode interactMode
Definition: UIInventory.cs:103
void SwitchTab(Tab tab)
Definition: UIInventory.cs:316
UIButton moldSmallTab
Definition: UIInventory.cs:119
UIMagicChest uiMagic
Definition: UIInventory.cs:127
Window window
Definition: UIInventory.cs:95
UIContent content
Definition: UIInventory.cs:97
void SetChara(Chara c)
Setting.Tab AddTab(string idLang, UIContent content=null, Action action=null, Sprite sprite=null, string langTooltip=null)
Definition: Window.cs:1443

References InvOwner.Chara, InvOwner.Container, EMono.core, CoreRef.icons, Player.Pref.interactMode, CoreRef.Icons.invTab, UIInventory.Tab.mode, Card.Name, UIInventory.Tab.owner, EMono.player, Player.pref, Core.refs, UIInventory.Tab.smallTab, UIInventory.Tab.textTab, and UDictionary< TKey, TValue >.TryGetValue().

Referenced by LayerInventory.OnInit().

◆ RefreshAllList()

static void UIInventory.RefreshAllList ( )
inlinestatic

Definition at line 201 of file UIInventory.cs.

202 {
203 UIInventory[] componentsInChildren = EMono.ui.rectLayers.GetComponentsInChildren<UIInventory>();
204 for (int i = 0; i < componentsInChildren.Length; i++)
205 {
206 componentsInChildren[i].list.Redraw();
207 }
208 }
static UI ui
Definition: EMono.cs:15

References list, UIList.Redraw(), and EMono.ui.

Referenced by WidgetHotbar.OnEndDrag(), and ButtonGridDrag.OnPointerUp().

◆ RefreshDestNum()

void UIInventory.RefreshDestNum ( )
inline

Definition at line 429 of file UIInventory.cs.

430 {
431 if (destNum <= 0)
432 {
433 destNum = ((!DestNumIsMax()) ? (EInput.isShiftDown ? (-1) : 0) : ((!EInput.isShiftDown) ? (-1) : 0));
434 if (destNum != lastNum)
435 {
437 list.Redraw();
438 }
439 }
440 }
Definition: EInput.cs:8
static bool isShiftDown
Definition: EInput.cs:272
bool DestNumIsMax()
Definition: UIInventory.cs:442

References EInput.isShiftDown.

◆ RefreshGrid()

void UIInventory.RefreshGrid ( )
inline

Definition at line 1213 of file UIInventory.cs.

1214 {
1215 _ = currentTab.mode;
1216 _ = currentTab.subMode;
1218 RefreshMenu();
1219 GridLayoutGroup g = list.GetComponent<GridLayoutGroup>();
1220 ContentSizeFitter component = list.GetComponent<ContentSizeFitter>();
1221 if (UseGrid)
1222 {
1223 g.constraintCount = ((window.saveData.columns == 0) ? owner.Container.things.width : window.saveData.columns);
1224 Vector2 cellSize = style.gridSize * (100 + window.saveData.size) / 100f;
1225 g.cellSize = cellSize;
1226 GridLayoutGroup gridLayoutGroup = g;
1227 bool flag = (component.enabled = true);
1228 gridLayoutGroup.enabled = flag;
1229 }
1230 else
1231 {
1232 GridLayoutGroup gridLayoutGroup2 = g;
1233 bool flag = (component.enabled = false);
1234 gridLayoutGroup2.enabled = flag;
1235 list.Rect().sizeDelta = style.sizeContainer;
1236 }
1237 list.Clear();
1238 int maxCapacity = (IsMagicChest ? owner.Container.things.MaxCapacity : 0);
1240 {
1241 onRedraw = delegate(Thing a, ButtonGrid b, int i)
1242 {
1243 b.index = i;
1244 bool flag4 = i >= owner.Things.Count;
1245 if (IsMagicChest)
1246 {
1247 flag4 = uiMagic.page * uiMagic.GridSize + i >= maxCapacity;
1248 }
1249 if (UseGrid)
1250 {
1251 b.SetCardGrid(a, flag4 ? null : owner);
1252 }
1253 else
1254 {
1255 b.SetCardGrid(a, owner);
1256 if (a != null)
1257 {
1258 b.Rect().anchoredPosition = new Vector2(a.posInvX, a.posInvY);
1259 }
1260 float num = 0.01f * (float)EMono.game.config.gridIconSize;
1261 b.icon.Rect().localScale = new Vector3(num, num, 1f);
1262 b.Rect().sizeDelta = b.icon.rectTransform.sizeDelta;
1263 }
1264 if (flag4)
1265 {
1266 b.interactable = false;
1267 b.image.sprite = null;
1268 b.image.color = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, 120);
1269 b.image.raycastTarget = true;
1270 }
1271 else
1272 {
1273 b.image.raycastTarget = true;
1274 }
1275 },
1276 onList = delegate
1277 {
1278 list.bgType = (UseGrid ? UIList.BGType.grid : UIList.BGType.none);
1279 if ((bool)list.bgGrid)
1280 {
1281 list.bgGrid.SetActive(UseGrid);
1282 list.bgGrid.color = style.gridColor;
1283 if (window.saveData.color.a != 0)
1284 {
1285 list.bgGrid.color = window.saveData.color;
1286 }
1287 }
1288 if (IsMagicChest)
1289 {
1291 }
1292 else
1293 {
1295 }
1296 if (UseGrid)
1297 {
1298 if (IsMagicChest)
1299 {
1300 for (int i = 0; i < owner.Container.things.GridSize; i++)
1301 {
1302 list.Add(owner.Things[i]);
1303 }
1304 }
1305 else
1306 {
1307 int count = owner.Things.Count;
1308 int num = (int)Mathf.Ceil(count / g.constraintCount + ((count % g.constraintCount != 0) ? 1 : 0)) * g.constraintCount;
1309 for (int j = 0; j < num; j++)
1310 {
1311 list.Add((j < count) ? owner.Things[j] : null);
1312 }
1313 }
1314 }
1315 else
1316 {
1317 Vector2 sizeDelta2 = list.Rect().sizeDelta;
1318 foreach (Thing thing2 in owner.Things)
1319 {
1320 if (thing2 != null)
1321 {
1322 list.Add(thing2);
1323 if (thing2.posInvX == 0 && thing2.posInvY == 0)
1324 {
1325 thing2.posInvX = EMono.rnd((int)sizeDelta2.x - 60) + 30;
1326 thing2.posInvY = EMono.rnd((int)sizeDelta2.y - 60) + 30;
1327 }
1328 }
1329 }
1330 }
1331 if (floatMode)
1332 {
1333 window.setting.tabs[0].idLang = "captionInvFloat".lang(owner.Container.IsPC ? "" : owner.Container.Name, ((float)owner.Container.ChildrenWeight / 1000f).ToString("F1") + "/" + ((float)owner.Container.WeightLimit / 1000f).ToString("F1"));
1334 }
1335 }
1336 };
1337 bool sorted = false;
1338 list.callbacks = callback;
1339 list.onBeforeRedraw = delegate
1340 {
1341 if (IsMagicChest)
1342 {
1343 if (firstMouseRightDown || (!Input.GetMouseButton(1) && !Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift)))
1344 {
1345 if (sortDirty)
1346 {
1347 Sort(redraw: false);
1348 }
1349 firstMouseRightDown = false;
1351 }
1352 }
1353 else
1354 {
1355 if (window.saveData.alwaysSort && sortDirty && !sorted && (firstMouseRightDown || (!Input.GetMouseButton(1) && !Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift))))
1356 {
1357 sorted = true;
1358 Sort();
1359 sorted = false;
1360 firstMouseRightDown = false;
1361 }
1363 }
1364 dirty = false;
1365 if (UseGrid)
1366 {
1367 UIList uIList = list;
1368 for (int i = 0; i < uIList.buttons.Count; i++)
1369 {
1370 UIList.ButtonPair value = uIList.buttons[i];
1371 value.obj = ((i < owner.Container.things.grid.Count) ? owner.Container.things.grid[i] : null);
1372 uIList.buttons[i] = value;
1373 }
1374 }
1375 };
1376 list.onAfterRedraw = delegate
1377 {
1378 if (!layer.floatInv)
1379 {
1380 int num = 0;
1381 foreach (UIList.ButtonPair button in list.buttons)
1382 {
1383 if ((button.component as ButtonGrid).card is Thing thing)
1384 {
1385 num += thing.ChildrenAndSelfWeight;
1386 }
1387 }
1388 string text = "";
1389 text = "statsInv2".lang(owner.Container.things.Count.ToString() ?? "", list.ItemCount.ToString() ?? "", Lang._weight(num) + "/" + Lang._weight(owner.Container.WeightLimit));
1390 layer.windows[0].textStats.SetText(text);
1391 }
1393 {
1394 if (!transOverflow)
1395 {
1396 transOverflow = Util.Instantiate("UI/Element/Other/InvOverflow", window.transform);
1397 }
1398 }
1399 else if ((bool)transOverflow)
1400 {
1401 UnityEngine.Object.Destroy(transOverflow.gameObject);
1402 }
1404 if ((bool)layer.mini)
1405 {
1407 }
1408 if ((bool)uiMagic)
1409 {
1411 }
1413 };
1414 callback.mold = (UseGrid ? moldButtonGrid : moldButtonGridless);
1416 {
1417 Vector2 sizeDelta = list.Rect().sizeDelta;
1418 foreach (Thing thing3 in owner.Things)
1419 {
1420 if (thing3 != null)
1421 {
1422 thing3.posInvX = EMono.rnd((int)sizeDelta.x - 60) + 30;
1423 thing3.posInvY = EMono.rnd((int)sizeDelta.y - 60) + 30;
1424 }
1425 }
1426 window.saveData.firstSorted = true;
1427 }
1428 list.List();
1429 g.RebuildLayoutTo<Layer>();
1431 if ((bool)list.bgGrid)
1432 {
1433 list.bgGrid.color = style.gridColor;
1434 if (window.saveData.color.a != 0)
1435 {
1436 list.bgGrid.color = window.saveData.color;
1437 }
1438 }
1440 {
1442 }
1443 }
RawImage bgGrid
Definition: BaseList.cs:30
Action onAfterRedraw
Definition: BaseList.cs:19
void SetCardGrid(Card c, InvOwner owner=null)
Definition: ButtonGrid.cs:145
int posInvY
Definition: Card.cs:353
string Name
Definition: Card.cs:2191
virtual int WeightLimit
Definition: Card.cs:2099
ThingContainer things
Definition: Card.cs:39
virtual bool IsPC
Definition: Card.cs:2197
int posInvX
Definition: Card.cs:341
Vector2 sizeContainer
Definition: CoreRef.cs:33
static Game game
Definition: EMono.cs:7
static int rnd(int a)
Definition: EMono.cs:47
int gridIconSize
Definition: Game.cs:79
Config config
Definition: Game.cs:219
static InvOwner Trader
Definition: InvOwner.cs:519
List< Thing > Things
Definition: InvOwner.cs:602
virtual bool UseGuide
Definition: InvOwner.cs:571
Definition: Lang.cs:7
static string _weight(int a, int b, bool showUnit=true, int unitSize=0)
Definition: Lang.cs:171
static void SetDirtyAll(bool immediate=false)
static void TryShowGuide(UIList list)
Definition: Layer.cs:9
List< Window > windows
Definition: Layer.cs:116
List< Thing > grid
Definition: Thing.cs:8
Image icon
Definition: UIButton.cs:110
SubMode subMode
Definition: UIInventory.cs:72
bool firstMouseRightDown
Definition: UIInventory.cs:133
CoreRef.InventoryStyle InvStyle
Definition: UIInventory.cs:165
void Sort(bool redraw=true)
ButtonGrid moldButtonGrid
Definition: UIInventory.cs:121
void RefreshMenu()
Definition: UIInventory.cs:452
Transform transOverflow
Definition: UIInventory.cs:87
bool sortDirty
Definition: UIInventory.cs:111
ButtonGrid moldButtonGridless
Definition: UIInventory.cs:123
Definition: UIList.cs:9
List< ButtonPair > buttons
Definition: UIList.cs:276
override int ItemCount
Definition: UIList.cs:331
override void Clear()
Definition: UIList.cs:404
BGType
Definition: UIList.cs:16
override void Add(object item)
Definition: UIList.cs:357
void OnAfterRedraw()
Definition: UIMagicChest.cs:91
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67
void Refresh(int idTab)
bool alwaysSort
Definition: Window.cs:463
bool firstSorted
Definition: Window.cs:355
Color32 color
Definition: Window.cs:231
List< Tab > tabs
Definition: Window.cs:81
SaveData saveData
Definition: Window.cs:724
Setting setting
Definition: Window.cs:606
int idTab
Definition: Window.cs:694

References Lang._weight(), UIList.buttons, Card.ChildrenAndSelfWeight, Game.config, EMono.game, CoreRef.InventoryStyle.gridColor, Game.Config.gridIconSize, UIButton.icon, Card.posInvX, Card.posInvY, EMono.rnd(), ButtonGrid.SetCardGrid(), LayerInventory.SetDirtyAll(), CoreRef.InventoryStyle.sizeContainer, InvOwner.Trader, LayerInventory.TryShowGuide(), UIButton.TryShowTip(), InvOwner.UseGuide, and Util.

◆ RefreshHighlight()

void UIInventory.RefreshHighlight ( )
inline

Definition at line 1195 of file UIInventory.cs.

1196 {
1197 if (!imageHighlight)
1198 {
1199 return;
1200 }
1201 imageHighlight.SetActive(enable: false);
1202 if (EMono.game.altInv)
1203 {
1205 if (currentTab.mode == Mode.All && thing != null && !thing.isDestroyed)
1206 {
1207 _ = thing.parent;
1208 _ = owner.Container;
1209 }
1210 }
1211 }
bool isDestroyed
Definition: Card.cs:78
ICardParent parent
Definition: Card.cs:56
bool altInv
Definition: Game.cs:270
virtual Thing Thing
Definition: HotItem.cs:38
Image imageHighlight
Definition: UIInventory.cs:115

References Game.altInv, Player.currentHotItem, EMono.game, Card.isDestroyed, Card.parent, EMono.player, and HotItem.Thing.

◆ RefreshList()

void UIInventory.RefreshList ( )
inline

Definition at line 1108 of file UIInventory.cs.

1109 {
1110 Mode mode = currentTab.mode;
1111 _ = currentTab.subMode;
1112 RefreshMenu();
1113 list.Clear();
1115 {
1116 onClick = delegate(Thing a, ButtonGrid b)
1117 {
1118 if (destNum != 0)
1119 {
1120 if (destNum != -1)
1121 {
1122 _ = destNum;
1123 }
1124 else
1125 {
1126 _ = a.Num;
1127 }
1128 }
1129 if (actionClick != null)
1130 {
1131 actionClick(a);
1132 Close();
1133 }
1134 else
1135 {
1136 EMono.pc.HoldCard(a);
1137 SE.SelectHotitem();
1138 }
1139 },
1140 onInstantiate = delegate(Thing a, ButtonGrid b)
1141 {
1142 _ = a.Name;
1143 bool flag = mode == Mode.Buy || mode == Mode.Sell || mode == Mode.Identify;
1144 int num = ((destNum != -1) ? 1 : a.Num);
1145 int cost = (flag ? (a.GetPrice(CurrencyType, mode == Mode.Sell) * num) : 0);
1146 bool canPay = cost < EMono.pc.GetCurrency(IDCurrency);
1147 if (mode == Mode.Identify)
1148 {
1149 cost = 100;
1150 }
1151 b.SetCard(a, ButtonGrid.Mode.Default, delegate(UINote n)
1152 {
1153 Mode mode2 = mode;
1154 if ((uint)(mode2 - 2) <= 1u)
1155 {
1156 n.Space(8);
1157 UIItem uIItem = n.AddExtra<UIItem>("costPrice");
1158 uIItem.text1.SetText(Lang._currency(cost), canPay ? FontColor.Good : FontColor.Bad);
1159 uIItem.image1.sprite = SpriteSheet.Get("icon_" + IDCurrency);
1160 }
1161 });
1162 if (flag && (bool)b.subText)
1163 {
1164 b.subText.SetText((cost.ToString() ?? "").TagColorGoodBad(() => mode == Mode.Sell || cost <= EMono.pc.GetCurrency(IDCurrency)));
1165 }
1166 },
1167 onList = delegate
1168 {
1169 dirty = false;
1170 List<Thing> list = new List<Thing>();
1171 foreach (Thing thing in owner.Things)
1172 {
1173 if (thing != null && (funcList == null || funcList(thing)) && !thing.HasTag(CTAG.noDrop) && (thing.c_equippedSlot == 0 || mode == Mode.Equip || mode == Mode.Identify) && (!(thing.category.id == "currency") || (mode != Mode.Buy && mode != Mode.Sell)))
1174 {
1175 list.Add(thing);
1176 }
1177 }
1178 int num = 0;
1179 _ = this.list;
1180 foreach (Thing item in list)
1181 {
1182 num += item.ChildrenAndSelfWeight;
1183 this.list.Add(item);
1184 }
1185 string text = "";
1186 text = "statsInv".lang(owner.Container.things.Count.ToString() ?? "", this.list.ItemCount.ToString() ?? "", Lang._weight(num));
1187 layer.windows[0].textStats.SetText(text);
1188 },
1189 onSort = null
1190 };
1191 list.callbacks = callbacks;
1192 list.List();
1193 }
CTAG
Definition: CTAG.cs:2
CurrencyType
Definition: CurrencyType.cs:2
FontColor
Definition: FontColor.cs:2
void SetCard(Card c, Mode mode=Mode.Default, Action< UINote > onWriteNote=null)
Definition: ButtonGrid.cs:184
int c_equippedSlot
Definition: Card.cs:979
int GetCurrency(string id="money")
Definition: Card.cs:4156
bool HasTag(CTAG tag)
Definition: Card.cs:2728
int Num
Definition: Card.cs:161
SourceCategory.Row category
Definition: Card.cs:2101
void HoldCard(Card t, int num=-1)
Definition: Chara.cs:4776
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:161
static Sprite Get(string id)
Definition: SpriteSheet.cs:28
override int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Definition: Thing.cs:833
UIText subText
Definition: UIButton.cs:104
string IDCurrency
Definition: UIInventory.cs:193
Func< Thing, bool > funcList
Definition: UIInventory.cs:91
Action< Thing > actionClick
Definition: UIInventory.cs:93
Definition: UIItem.cs:5
UIText text1
Definition: UIItem.cs:6
Definition: UINote.cs:6
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62
void SetText(string s)
Definition: UIText.cs:163

References Lang._currency(), Lang._weight(), Card.c_equippedSlot, Card.category, SpriteSheet.Get(), Card.GetCurrency(), Thing.GetPrice(), Card.HasTag(), Chara.HoldCard(), item, Card.Name, Card.Num, EMono.pc, ButtonGrid.SetCard(), UIText.SetText(), UINote.Space(), UIButton.subText, and UIItem.text1.

◆ RefreshMenu()

void UIInventory.RefreshMenu ( )
inline

Definition at line 452 of file UIInventory.cs.

453 {
456 if ((bool)b)
457 {
458 b.onClick.RemoveAllListeners();
459 b.onClick.AddListener(delegate
460 {
461 UIContextMenu uIContextMenu = EMono.ui.CreateContextMenuInteraction();
462 uIContextMenu.layoutGroup.childAlignment = TextAnchor.UpperLeft;
463 uIContextMenu.alwaysPopLeft = true;
464 UIContextMenu uIContextMenu2 = uIContextMenu.AddChild("sort", TextAnchor.UpperRight);
465 UIList.SortMode[] sorts = list.sorts;
466 foreach (UIList.SortMode sortMode in sorts)
467 {
468 UIList.SortMode _sort = sortMode;
469 uIContextMenu2.AddButton((((IsShop ? EMono.player.pref.sortInvShop : (IsAdvSort ? data.sortMode : EMono.player.pref.sortInv)) == _sort) ? "context_checker".lang() : "") + _sort.ToString().lang(), delegate
470 {
471 if (IsShop)
472 {
473 EMono.player.pref.sortInvShop = _sort;
474 }
475 else
476 {
477 EMono.player.pref.sortInv = _sort;
478 }
479 data.sortMode = _sort;
480 Sort();
481 SE.Click();
482 });
483 }
484 uIContextMenu2.AddToggle("sort_ascending", IsShop ? EMono.player.pref.sort_ascending_shop : (IsAdvSort ? data.sort_ascending : EMono.player.pref.sort_ascending), delegate(bool a)
485 {
486 if (IsShop)
487 {
488 EMono.player.pref.sort_ascending_shop = a;
489 }
490 else
491 {
492 EMono.player.pref.sort_ascending = a;
493 }
494 data.sort_ascending = a;
495 Sort();
496 SE.Click();
497 });
498 if (!IsMagicChest)
499 {
500 uIContextMenu2.AddToggle("sort_always", data.alwaysSort, delegate(bool a)
501 {
502 data.alwaysSort = a;
503 if (data.alwaysSort)
504 {
505 Sort();
506 }
507 SE.Click();
508 });
509 }
510 if (IsMagicChest)
511 {
512 UIContextMenu uIContextMenu3 = uIContextMenu.AddChild("catFilterType", TextAnchor.UpperRight);
514 {
516 uIContextMenu3.AddButton(((data.category == item) ? "context_checker".lang() : "") + ("catFilterType_" + _c).lang(), delegate
517 {
518 data.category = _c;
519 uiMagic.idCat = "";
520 list.Redraw();
521 SE.Click();
522 });
523 }
524 }
525 Card con2 = owner.Container;
526 bool flag2 = (!con2.isNPCProperty && !con2.isChara && (con2.trait is TraitShippingChest || (con2.GetRoot() is Zone && EMono._zone.IsPCFaction) || con2.GetRootCard() == EMono.pc)) || EMono._zone is Zone_Tent;
527 if (con2.IsPC)
528 {
529 flag2 = false;
530 }
531 if (con2.trait is TraitChestMerchant)
532 {
533 flag2 = false;
534 }
535 UIContextMenu dis;
536 Transform dist;
537 Transform distAdv;
538 if (flag2)
539 {
540 dis = uIContextMenu.AddChild("distribution", TextAnchor.UpperRight);
541 dis.AddSlider("priority_hint", (float a) => a.ToString() ?? "", data.priority, delegate(float a)
542 {
543 data.priority = (int)a;
544 }, -5f, 20f, isInt: true, hideOther: false);
545 dist = ShowDistribution(dis, data);
546 distAdv = ShowAdvDistribution(dis, data);
547 RefreshDist();
549 {
550 dis.AddToggle("onlyRottable", data.onlyRottable, delegate(bool a)
551 {
552 data.onlyRottable = a;
553 SE.ClickOk();
554 });
555 }
556 dis.AddToggle("noRotten", data.noRotten, delegate(bool a)
557 {
558 data.noRotten = a;
559 SE.ClickOk();
560 });
561 dis.AddToggle("advDistribution", data.advDistribution, delegate(bool a)
562 {
563 data.advDistribution = a;
564 RefreshDist();
565 SE.ClickOk();
566 });
568 {
569 dis.AddButton(data.filter.IsEmpty() ? "distFilter" : "distFilter2".lang(data.filter), delegate
570 {
571 Dialog.InputName("distFilter3", data.filter.IsEmpty(""), delegate(bool cancel, string s)
572 {
573 if (!cancel)
574 {
575 data._filterStrs = null;
576 data.filter = s;
577 }
578 }, Dialog.InputType.DistributionFilter);
579 });
580 }
581 }
582 Window.SaveData data2;
583 UIContextMenu dis2;
584 Transform dist2;
585 Transform distAdv2;
587 {
588 data2 = EMono.player.dataPick;
589 dis2 = uIContextMenu.AddChild("autopick", TextAnchor.UpperRight);
590 dist2 = ShowDistribution(dis2, data2);
591 distAdv2 = ShowAdvDistribution(dis2, data2);
592 RefreshDist2();
593 dis2.AddToggle("noRotten", data2.noRotten, delegate(bool a)
594 {
595 data2.noRotten = a;
596 SE.ClickOk();
597 });
598 dis2.AddToggle("advDistribution", data2.advDistribution, delegate(bool a)
599 {
600 data2.advDistribution = a;
601 RefreshDist2();
602 SE.ClickOk();
603 });
605 {
606 dis2.AddButton(data2.filter.IsEmpty() ? "distFilter" : "distFilter2".lang(data2.filter), delegate
607 {
608 Dialog.InputName("distFilter3", data2.filter.IsEmpty(""), delegate(bool cancel, string s)
609 {
610 if (!cancel)
611 {
612 data2._filterStrs = null;
613 data2.filter = s;
614 }
615 }, Dialog.InputType.DistributionFilter);
616 });
617 }
618 }
620 {
621 UIContextMenu uIContextMenu4 = uIContextMenu.AddChild("autodump", TextAnchor.UpperRight);
622 foreach (AutodumpFlag item2 in new List<AutodumpFlag>
623 {
624 AutodumpFlag.existing,
625 AutodumpFlag.sameCategory,
626 AutodumpFlag.distribution,
627 AutodumpFlag.none
628 })
629 {
630 string text = ((data.autodump == item2) ? "context_checker".lang() : "");
631 AutodumpFlag _e = item2;
632 UIButton uIButton = uIContextMenu4.AddButton(text + ("dump_" + item2).lang(), delegate
633 {
634 SE.Click();
635 data.autodump = _e;
636 });
637 if (item2 != AutodumpFlag.none)
638 {
639 uIButton.SetTooltipLang("dump_" + item2.ToString() + "_tip");
640 }
641 }
642 }
643 if (con2.IsPC || (con2.isThing && !(con2.trait is TraitChestMerchant) && !con2.isNPCProperty))
644 {
645 UIContextMenu uIContextMenu5 = uIContextMenu.AddChild("config", TextAnchor.UpperRight);
646 uIContextMenu5.AddToggle("toggleExcludeCraft", data.excludeCraft, delegate(bool a)
647 {
648 data.excludeCraft = a;
649 SE.ClickOk();
650 });
651 if (con2.GetRootCard() == EMono.pc)
652 {
653 uIContextMenu5.AddToggle("toggleDump", data.excludeDump, delegate(bool a)
654 {
655 data.excludeDump = a;
656 SE.ClickOk();
657 });
658 }
660 {
661 if (!con2.IsPC)
662 {
663 uIContextMenu5.AddToggle("noRightClickClose", data.noRightClickClose, delegate(bool a)
664 {
665 data.noRightClickClose = a;
666 SE.ClickOk();
667 });
668 }
669 uIContextMenu5.AddToggle("fixedPos", data.fixedPos, delegate(bool a)
670 {
671 data.fixedPos = a;
673 SE.ClickOk();
674 });
675 uIContextMenu5.AddToggle("toggleItemCompress", data.compress, delegate(bool a)
676 {
677 data.compress = a;
678 SE.ClickOk();
679 });
680 if (!con2.IsPC)
681 {
682 uIContextMenu5.AddToggle("toggleShiftToShowMenu", data.shiftToShowMenu, delegate(bool a)
683 {
684 data.shiftToShowMenu = a;
685 SE.ClickOk();
686 });
687 }
688 }
689 if (con2.IsPC)
690 {
691 uIContextMenu5.AddToggle("placeContainerCenter", EMono.player.openContainerCenter, delegate(bool a)
692 {
693 EMono.player.openContainerCenter = a;
694 SE.ClickOk();
695 });
696 }
697 if (!con2.isChara && (IsMagicChest || !con2.trait.IsSpecialContainer))
698 {
699 uIContextMenu5.AddButton("changeName", delegate
700 {
701 Dialog.InputName("dialogChangeName", con2.c_altName.IsEmpty(""), delegate(bool cancel, string c_altName)
702 {
703 if (!cancel)
704 {
705 con2.c_altName = c_altName;
706 }
707 }, Dialog.InputType.Item);
708 });
709 }
711 {
712 uIContextMenu5.AddButton("copyContainer", delegate
713 {
714 SE.ClickOk();
715 EMono.player.windowDataCopy = IO.DeepCopy(data);
716 EMono.player.windowDataName = con2.Name;
717 });
718 if (EMono.player.windowDataCopy != null && !con2.IsPC)
719 {
720 uIContextMenu5.AddButton("pasteContainer".lang(EMono.player.windowDataName), delegate
721 {
722 SE.ClickOk();
725 RefreshGrid();
726 });
727 }
728 }
729 }
730 UIContextMenu uIContextMenu6 = uIContextMenu.AddChild("appearanceWindow", TextAnchor.UpperRight);
731 uIContextMenu6.AddToggle("toggleBG", data.useBG, delegate(bool a)
732 {
733 data.useBG = a;
734 data.color = InvStyle.gridColor;
736 RefreshGrid();
737 SE.ClickOk();
738 });
739 uIContextMenu6.AddSlider("size", (float a) => a.ToString() ?? "", data.size, delegate(float num)
740 {
741 data.size = (int)num;
742 RefreshGrid();
743 }, -25f, 25f, isInt: true, hideOther: false);
745 {
746 uIContextMenu6.AddSlider("columns", (float a) => a.ToString() ?? "", data.columns, delegate(float num)
747 {
748 data.columns = (int)num;
749 RefreshGrid();
750 }, 0f, EMono.core.config.ui.maxInvColumn, isInt: true, hideOther: false);
751 }
752 uIContextMenu6.AddButton("colorGrid", delegate
753 {
754 EMono.ui.AddLayer<LayerColorPicker>().SetColor(data.color, InvStyle.gridColor, delegate(PickerState state, Color color)
755 {
756 data.color = color;
757 list.bgGrid.color = color;
758 if (data.color.a == 0)
759 {
760 list.bgGrid.color = InvStyle.gridColor;
761 }
762 });
763 });
764 if (!con2.isChara)
765 {
766 uIContextMenu6.AddButton("changeIcon", delegate
767 {
768 EMono.ui.contextMenu.currentMenu.Hide();
769 UIContextMenu uIContextMenu9 = EMono.ui.CreateContextMenuInteraction();
770 GridLayoutGroup parent = uIContextMenu9.AddGridLayout();
771 int num = 0;
772 foreach (Sprite item3 in EMono.core.refs.spritesContainerIcon)
773 {
774 _ = item3;
775 UIButton uIButton2 = Util.Instantiate<UIButton>("UI/Element/Button/ButtonContainerIcon", parent);
776 int _i = num;
777 uIButton2.icon.sprite = EMono.core.refs.spritesContainerIcon[_i];
778 uIButton2.SetOnClick(delegate
779 {
780 SE.Click();
781 owner.Container.c_indexContainerIcon = _i;
783 EMono.ui.contextMenu.currentMenu.Hide();
784 });
785 num++;
786 }
787 uIContextMenu9.Show();
788 });
789 }
791 {
792 UIContextMenu uIContextMenu7 = uIContextMenu.AddChild("anchor");
793 foreach (RectPosition p in Util.EnumToList<RectPosition>())
794 {
795 uIContextMenu7.AddButton(((data.customAnchor == p) ? "★ " : "") + p.ToString().lang(), delegate
796 {
797 data.customAnchor = p;
799 SE.ClickGeneral();
800 });
801 }
802 }
803 if (EMono.debug.enable)
804 {
805 UIContextMenu uIContextMenu8 = uIContextMenu.AddChild("debug", TextAnchor.UpperRight);
806 uIContextMenu8.AddToggle("toggleGrid", EMono.core.config.game.useGrid, delegate(bool a)
807 {
808 EMono.core.config.game.useGrid = a;
809 foreach (LayerInventory item4 in LayerInventory.listInv)
810 {
811 item4.invs[0].RefreshWindow();
812 item4.invs[0].RefreshGrid();
813 }
814 });
815 uIContextMenu8.AddSlider("iconSize", (float a) => a.ToString() ?? "", EMono.game.config.gridIconSize, delegate(float num)
816 {
817 EMono.game.config.gridIconSize = (int)num;
818 RefreshGrid();
819 }, 100f, 150f, isInt: true, hideOther: false);
820 }
821 uIContextMenu.Show();
822 uIContextMenu.hideOnMouseLeave = false;
823 void RefreshDist()
824 {
825 dist.SetActive(!data.advDistribution);
826 distAdv.SetActive(data.advDistribution);
827 dis.layoutGroup.RebuildLayout();
828 }
829 void RefreshDist2()
830 {
831 dist2.SetActive(!data2.advDistribution);
832 distAdv2.SetActive(data2.advDistribution);
833 dis2.layoutGroup.RebuildLayout();
834 }
835 });
836 }
838 if ((bool)b)
839 {
840 b.onClick.RemoveAllListeners();
841 b.onClick.AddListener(delegate
842 {
843 Sort();
844 SE.Click();
845 });
846 }
848 if ((bool)b)
849 {
850 b.SetActive(owner.Container.IsPC);
851 b.onClick.RemoveAllListeners();
852 b.onClick.AddListener(delegate
853 {
855 });
856 }
858 if ((bool)b)
859 {
860 Card con = owner.Container;
861 bool flag = !con.isChara && ((con.IsInstalled && EMono._zone.IsPCFaction) || owner.owner.IsPC);
862 b.SetActive(flag);
863 if (flag)
864 {
865 RefreshShareButton();
866 b.SetOnClick(delegate
867 {
868 bool flag2 = data.sharedType == ContainerSharedType.Shared;
869 SE.ClickOk();
870 Msg.Say("changePermission", con, (flag2 ? "stPersonal" : "stShared").lang());
871 data.sharedType = ((!flag2) ? ContainerSharedType.Shared : ContainerSharedType.Personal);
872 RefreshShareButton();
873 });
874 }
875 }
876 Mode mode = currentTab.mode;
877 WindowMenu menuBottom = window.menuBottom;
878 menuBottom.Clear();
879 switch (mode)
880 {
881 case Mode.Take:
883 {
884 break;
885 }
886 buttonTakeAll = menuBottom.AddButton("takeAll".lang(EInput.keys.getAll.key.ToString().ToLower()), delegate
887 {
888 owner.Container.things.ForeachReverse(delegate(Thing t)
889 {
890 if (!EMono.pc.things.IsFull(t))
891 {
892 EMono.pc.Pick(t, msg: false);
893 }
894 });
895 if (owner.Container.things.Count > 0)
896 {
897 SE.Beep();
898 }
899 else
900 {
901 SE.Play("pick_thing");
902 Close();
903 }
904 });
905 break;
906 case Mode.Buy:
907 {
908 Card _owner = owner.owner;
909 int cost = _owner.trait.CostRerollShop;
910 if (cost <= 0)
911 {
912 break;
913 }
914 menuBottom.AddButton("rerollShop".lang(cost.ToString() ?? "", (_owner.trait.CurrencyRerollShop == CurrencyType.BlueCapsule) ? EMono.sources.things.map["drug_blue"].GetName() : "influence".lang()), delegate
915 {
916 if (_owner.trait.CurrencyRerollShop == CurrencyType.BlueCapsule)
917 {
918 if (!EMono.debug.enable && EMono.pc.GetCurrency("drug_blue") < cost)
919 {
920 SE.Beep();
921 Msg.Say("notEnoughSomething", EMono.sources.things.map["drug_blue"].GetName());
922 return;
923 }
924 EMono.pc.ModCurrency(-1, "drug_blue");
925 }
926 else
927 {
928 if (EMono._zone.influence < cost)
929 {
930 SE.Beep();
931 Msg.Say("notEnoughInfluence");
932 return;
933 }
934 EMono._zone.influence -= cost;
935 }
936 SE.Dice();
937 _owner.c_dateStockExpire = 0;
938 _owner.trait.OnBarter(reroll: true);
939 RefreshGrid();
940 Sort();
941 SE.Play("shop_open");
942 TooltipManager.Instance.HideTooltips(immediate: true);
943 }, null, "DefaultContentFit").RebuildLayout();
944 break;
945 }
946 }
947 void RefreshShareButton()
948 {
949 bool flag2 = data.sharedType == ContainerSharedType.Shared;
950 b.image.sprite = (flag2 ? EMono.core.refs.icons.shared : EMono.core.refs.icons.personal);
951 b.tooltip.lang = (flag2 ? "hintShared" : "hintPrivate");
953 }
954 }
AutodumpFlag
Definition: AutodumpFlag.cs:2
ContainerSharedType
PickerState
Definition: PickerState.cs:2
RectPosition
Definition: RectPosition.cs:2
UIList.SortMode[] sorts
Definition: BaseList.cs:15
Definition: Card.cs:11
virtual bool isThing
Definition: Card.cs:2133
bool isNPCProperty
Definition: Card.cs:557
ICardParent GetRoot()
Definition: Card.cs:3598
string c_altName
Definition: Card.cs:1633
Trait trait
Definition: Card.cs:54
void ModCurrency(int a, string id="money")
Definition: Card.cs:4142
bool IsInstalled
Definition: Card.cs:2451
virtual Thing Thing
Definition: Card.cs:2110
Card GetRootCard()
Definition: Card.cs:3607
new GameConfig game
Definition: CoreConfig.cs:629
new UISetting ui
Definition: CoreConfig.cs:621
bool enable
Definition: CoreDebug.cs:302
Sprite personal
Definition: CoreRef.cs:133
List< Sprite > spritesContainerIcon
Definition: CoreRef.cs:382
CoreConfig config
Definition: Core.cs:70
Definition: Dialog.cs:7
static Dialog InputName(string langDetail, string text, Action< bool, string > onClose, InputType inputType=InputType.Default)
Definition: Dialog.cs:536
InputType
Definition: Dialog.cs:9
KeyCode key
Definition: EInput.cs:14
static KeyMapManager keys
Definition: EInput.cs:378
static CoreDebug debug
Definition: EMono.cs:45
static SourceManager sources
Definition: EMono.cs:41
Definition: IO.cs:10
Card owner
Definition: InvOwner.cs:533
List< UIInventory > invs
static void SetDirty(Thing t)
static List< LayerInventory > listInv
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
bool sort_ascending
Definition: Player.cs:39
bool sort_ascending_shop
Definition: Player.cs:41
Window.SaveData dataPick
Definition: Player.cs:1113
Window.SaveData windowDataCopy
Definition: Player.cs:1221
bool openContainerCenter
Definition: Player.cs:1077
string windowDataName
Definition: Player.cs:1223
SourceThing things
int influence
Definition: Spatial.cs:214
static void TryPerform()
Definition: TaskDump.cs:6
bool IsFull(int y=0)
static TooltipManager Instance
void HideTooltips(bool immediate=false)
virtual int CostRerollShop
Definition: Trait.cs:562
virtual void OnBarter(bool reroll=false)
Definition: Trait.cs:1710
virtual CurrencyType CurrencyRerollShop
Definition: Trait.cs:573
virtual bool IsSpecialContainer
Definition: Trait.cs:257
virtual bool IsFridge
Definition: Trait.cs:129
void ShowTooltipForced(bool ignoreWhenRightClick=true)
Definition: UIButton.cs:387
void SetTooltipLang(string lang=null)
Definition: UIButton.cs:373
UIContextMenuItem AddToggle(string idLang="", bool isOn=false, UnityAction< bool > action=null)
void Show(UIItem i)
VerticalLayoutGroup layoutGroup
UIContextMenuItem AddSlider(string text, Func< float, string > textFunc, float value, Action< float > action, float min=0f, float max=1f, bool isInt=false, bool hideOther=true, bool useInput=false)
void AddButton(Func< string > funcText, UnityAction action=null)
GridLayoutGroup AddGridLayout()
UIContextMenu AddChild(string idLang, TextAnchor anchor)
UIButton buttonTakeAll
Definition: UIInventory.cs:125
void RefreshGrid()
Transform ShowAdvDistribution(UIContextMenu dis, Window.SaveData data)
void RefreshWindow()
Definition: UIInventory.cs:273
Transform ShowDistribution(UIContextMenu dis, Window.SaveData data)
Definition: UIInventory.cs:956
bool IsAdvSort
Definition: UIInventory.cs:163
SortMode
Definition: UIList.cs:27
void Clear()
Definition: WindowMenu.cs:44
UIButton AddButton(string idLang, Action< UIButton > onClick, Sprite sprite=null, string idButton="Default")
Definition: WindowMenu.cs:67
CategoryType category
Definition: Window.cs:303
bool shiftToShowMenu
Definition: Window.cs:487
bool excludeDump
Definition: Window.cs:367
bool sort_ascending
Definition: Window.cs:475
RectPosition customAnchor
Definition: Window.cs:291
bool excludeCraft
Definition: Window.cs:379
string filter
Definition: Window.cs:122
bool noRightClickClose
Definition: Window.cs:391
bool compress
Definition: Window.cs:415
bool noRotten
Definition: Window.cs:439
bool fixedPos
Definition: Window.cs:403
bool onlyRottable
Definition: Window.cs:451
bool advDistribution
Definition: Window.cs:427
void CopyFrom(SaveData data)
Definition: Window.cs:578
Definition: Window.cs:13
UIButton buttonExtra
Definition: Window.cs:632
UIButton buttonShared
Definition: Window.cs:634
UIButton buttonSort
Definition: Window.cs:628
UIButton buttonQuickSort
Definition: Window.cs:630
void UpdateSaveData()
Definition: Window.cs:1093
WindowMenu menuBottom
Definition: Window.cs:706
Definition: Zone.cs:12
bool IsPCFaction
Definition: Zone.cs:480

References EMono._zone, UIContextMenu.AddButton(), UIContextMenu.AddChild(), UIContextMenu.AddGridLayout(), UIContextMenu.AddSlider(), UIContextMenu.AddToggle(), CoreConfig.GameConfig.advancedMenu, Window.SaveData.advDistribution, Window.SaveData.alwaysSort, Card.c_altName, Window.SaveData.category, Color, Window.SaveData.color, Window.SaveData.columns, Window.SaveData.compress, Core.config, Game.config, EMono.core, Window.SaveData.customAnchor, Player.dataPick, EMono.debug, CoreDebug.enable, Window.SaveData.excludeCraft, Window.SaveData.excludeDump, Window.SaveData.filter, Window.SaveData.fixedPos, CoreConfig.game, EMono.game, Card.GetRoot(), Card.GetRootCard(), Game.Config.gridIconSize, Dialog.InputName(), LayerInventory.invs, Card.isChara, Trait.IsFridge, Card.IsInstalled, Card.isNPCProperty, Card.IsPC, Zone.IsPCFaction, Trait.IsSpecialContainer, Card.isThing, item, UIContextMenu.layoutGroup, LayerInventory.listInv, CoreConfig.UISetting.maxInvColumn, Card.Name, Window.SaveData.noRightClickClose, Window.SaveData.noRotten, Window.SaveData.onlyRottable, Player.openContainerCenter, EMono.pc, EMono.player, Player.pref, Window.SaveData.priority, Core.refs, LayerInventory.SetDirty(), UIButton.SetTooltipLang(), Window.SaveData.shiftToShowMenu, Window.SaveData.size, Player.Pref.sort_ascending, Window.SaveData.sort_ascending, Player.Pref.sort_ascending_shop, CoreRef.spritesContainerIcon, Card.trait, CoreConfig.ui, EMono.ui, Window.SaveData.useBG, CoreConfig.GameConfig.useGrid, Util, Player.windowDataCopy, and Player.windowDataName.

◆ RefreshWindow()

void UIInventory.RefreshWindow ( )
inline

Definition at line 273 of file UIInventory.cs.

274 {
275 if (window.saveData == null)
276 {
277 window.saveData = Window.dictData.TryGetValue(window.idWindow) ?? new Window.SaveData
278 {
279 useBG = EMono.core.config.game.showInvBG
280 };
281 }
282 window.setting.allowMove = !window.saveData.fixedPos;
283 window.bgCollider.raycastTarget = !window.saveData.fixedPos || window.saveData.useBG;
284 window.imageBG.SetActive(UseBG);
286 if (UseBG)
287 {
288 window.imageBG.sprite = inventoryStyle.bg;
289 window.imageBG.rectTransform.anchoredPosition = inventoryStyle.posFix;
290 window.imageBG.rectTransform.sizeDelta = inventoryStyle.sizeDelta;
291 window.imageBG.alphaHitTestMinimumThreshold = 1f;
292 }
293 if (IsToolbelt)
294 {
295 window.cgFloatMenu.SetActive(enable: false);
296 window.cgFloatMenu = null;
297 window.bgCollider.rectTransform.anchoredPosition = new Vector2(-2.5f, 0f);
298 window.bgCollider.rectTransform.sizeDelta = new Vector2(-20f, -20f);
299 }
301 {
302 window.cgFloatMenu.alpha = 1f;
303 window.cgFloatMenu.enabled = false;
304 window.cgFloatMenu.SetActive(enable: true);
305 }
306 }
UDInvStyle invStyle
Definition: CoreRef.cs:390
virtual string IDInvStyle
Definition: Trait.cs:185
bool IsToolbelt
Definition: UIInventory.cs:159
CanvasGroup cgFloatMenu
Definition: Window.cs:668
static Dictionary< string, SaveData > dictData
Definition: Window.cs:594
string idWindow
Definition: Window.cs:775
UIImage imageBG
Definition: Window.cs:620

References CoreRef.InventoryStyle.bg, Core.config, EMono.core, Window.dictData, Window.SaveData.fixedPos, CoreRef.invStyle, CoreRef.InventoryStyle.posFix, Core.refs, CoreConfig.UISetting.showFloatButtons, CoreRef.InventoryStyle.sizeDelta, and CoreConfig.ui.

◆ SetHeader()

void UIInventory.SetHeader ( string  s)
inline

Definition at line 210 of file UIInventory.cs.

211 {
212 window.SetCaption(s.lang());
213 }
void SetCaption(string text)
Definition: Window.cs:1289

Referenced by LayerInventory.CreatePCBackpack().

◆ ShowAdvDistribution()

Transform UIInventory.ShowAdvDistribution ( UIContextMenu  dis,
Window::SaveData  data 
)
inline

Definition at line 1015 of file UIInventory.cs.

1016 {
1017 UIDistribution uIDistribution = Util.Instantiate<UIDistribution>("UI/Layer/UIDistribution");
1018 uIDistribution.SetContainer(owner.Container, data);
1019 return dis.AddGameObject(uIDistribution).transform;
1020 }
void SetContainer(Card t, Window.SaveData d)

References UIDistribution.SetContainer(), and Util.

◆ ShowDistribution()

Transform UIInventory.ShowDistribution ( UIContextMenu  dis,
Window::SaveData  data 
)
inline

Definition at line 956 of file UIInventory.cs.

957 {
958 List<UIContextMenuItem> items = new List<UIContextMenuItem>();
959 UIContextMenuItem itemAll = null;
960 List<ContainerFlag> obj = Util.EnumToList<ContainerFlag>();
961 obj.Remove(ContainerFlag.none);
962 GridLayoutGroup gridLayoutGroup = dis.AddGridLayout("Context_LayoutDistribution");
963 itemAll = dis.AddToggle("all", isOn: false, delegate(bool a)
964 {
965 foreach (UIContextMenuItem item in items)
966 {
967 item.toggle.isOn = a;
968 }
969 Refresh();
970 SE.ClickOk();
971 });
972 foreach (ContainerFlag f in obj)
973 {
974 SourceCategory.Row row = EMono.sources.categories.map[f.ToString()];
975 items.Add(dis.AddToggle(row.GetName(), !data.flag.HasFlag(f), delegate(bool a)
976 {
977 SetOn(f, !a);
978 Refresh();
979 SE.ClickOk();
980 }));
981 }
982 itemAll.transform.SetParent(gridLayoutGroup.transform);
983 itemAll.GetComponentInChildren<UIText>().SetText("all".lang(), FontColor.Topic);
984 foreach (UIContextMenuItem item2 in items)
985 {
986 item2.transform.SetParent(gridLayoutGroup.transform);
987 }
988 Refresh();
989 return gridLayoutGroup.transform;
990 void Refresh()
991 {
992 bool isOnWithoutNotify = true;
993 foreach (UIContextMenuItem item3 in items)
994 {
995 if (!item3.toggle.isOn)
996 {
997 isOnWithoutNotify = false;
998 }
999 }
1000 itemAll.toggle.SetIsOnWithoutNotify(isOnWithoutNotify);
1001 }
1002 void SetOn(ContainerFlag containerFlag, bool on)
1003 {
1004 if (!on && data.flag.HasFlag(containerFlag))
1005 {
1006 data.flag &= ~containerFlag;
1007 }
1008 else if (on && !data.flag.HasFlag(containerFlag))
1009 {
1010 data.flag |= containerFlag;
1011 }
1012 }
1013 }
ContainerFlag
Definition: ContainerFlag.cs:5
SourceCategory categories
Definition: UIText.cs:6
ContainerFlag flag
Definition: Window.cs:267

References UIContextMenu.AddGridLayout(), UIContextMenu.AddToggle(), SourceManager.categories, SourceCategory.Row.flag, item, EMono.sources, UIContextMenuItem.toggle, and Util.

◆ Sort()

void UIInventory.Sort ( bool  redraw = true)
inline

Definition at line 1022 of file UIInventory.cs.

1023 {
1024 UIList.SortMode m = (IsShop ? EMono.player.pref.sortInvShop : (IsAdvSort ? window.saveData.sortMode : EMono.player.pref.sortInv));
1026 bool flag = true;
1027 while (flag)
1028 {
1029 flag = false;
1030 Dictionary<string, List<Thing>> dict = new Dictionary<string, List<Thing>>();
1031 foreach (Thing t in owner.Container.things.Copy())
1032 {
1033 if (t.invY == 1 || ((bool)instance && (bool)instance.buttons.Find((ButtonGrid b) => b.card == t)))
1034 {
1035 continue;
1036 }
1037 List<Thing> orCreate = dict.GetOrCreate(t.id + t.GetStr(53));
1038 bool flag2 = false;
1039 for (int num = 0; num < orCreate.Count; num++)
1040 {
1041 if (orCreate[num].TryStackTo(t))
1042 {
1043 orCreate[num] = t;
1044 flag2 = true;
1045 break;
1046 }
1047 if (t.TryStackTo(orCreate[num]))
1048 {
1049 flag2 = true;
1050 break;
1051 }
1052 }
1053 if (flag2)
1054 {
1055 flag = true;
1056 }
1057 else
1058 {
1059 orCreate.Add(t);
1060 }
1061 }
1062 }
1063 int num2 = 0;
1064 foreach (Thing thing in owner.Container.things)
1065 {
1066 if (thing.invY != 1)
1067 {
1068 thing.invY = 0;
1069 thing.invX = -1;
1070 }
1071 num2++;
1072 }
1074 if (!UseGrid)
1075 {
1076 int num3 = 0;
1077 int num4 = 0;
1078 Vector2 sizeDelta = list.Rect().sizeDelta;
1079 sizeDelta.x -= 60f;
1080 sizeDelta.y -= 60f;
1081 foreach (Thing thing2 in owner.Container.things)
1082 {
1083 if (thing2.invY != 0)
1084 {
1085 continue;
1086 }
1087 thing2.posInvX = num3 + 30;
1088 thing2.posInvY = (int)sizeDelta.y - num4 + 30;
1089 num3 += 40;
1090 if ((float)num3 > sizeDelta.x)
1091 {
1092 num3 = 0;
1093 num4 += 40;
1094 if ((float)num4 > sizeDelta.y)
1095 {
1096 num4 = 20;
1097 }
1098 }
1099 }
1100 }
1101 sortDirty = false;
1102 if (redraw)
1103 {
1104 list.Redraw();
1105 }
1106 }
if(!match.Success)
string id
Definition: Card.cs:36
int invY
Definition: Card.cs:2007
string GetStr(string id, string defaultStr=null)
Definition: Card.cs:2595
bool TryStackTo(Thing to)
Definition: Card.cs:3578
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:3257
CurrencyType currency
Definition: InvOwner.cs:527
List< ButtonGrid > buttons
static LayerDragGrid Instance
UIList.SortMode sortInv
Definition: Player.cs:49

References Card.Add(), LayerDragGrid.buttons, Card.GetStr(), Card.id, if(), LayerDragGrid.Instance, Card.invY, EMono.player, Player.pref, Player.Pref.sort_ascending, Player.Pref.sort_ascending_shop, Player.Pref.sortInv, Card.things, and Card.TryStackTo().

◆ SwitchTab()

void UIInventory.SwitchTab ( Tab  tab)
inline

Definition at line 316 of file UIInventory.cs.

317 {
318 if (currentTab == tab)
319 {
320 return;
321 }
322 currentTab = tab;
324 destNum = (lastNum = (DestNumIsMax() ? (-1) : 0));
325 if (isList)
326 {
327 RefreshList();
328 }
329 else
330 {
331 RefreshGrid();
332 }
334 {
335 Sort();
336 }
337 if ((bool)layer.uiCurrency)
338 {
339 tab.owner.BuildUICurrency(layer.uiCurrency, tab.owner.owner.trait.CostRerollShop != 0 || EMono.debug.enable);
340 }
341 if ((bool)headerRow)
342 {
343 UIHeader[] componentsInChildren = headerRow.GetComponentsInChildren<UIHeader>(includeInactive: true);
344 componentsInChildren[0].SetText("headerItem");
345 switch (tab.mode)
346 {
347 case Mode.Buy:
348 case Mode.Sell:
349 case Mode.Identify:
350 componentsInChildren[1].SetText("headerPrice".lang(IDCurrency.lang()));
351 break;
352 default:
353 componentsInChildren[1].SetText("headerWeight");
354 break;
355 case Mode.Recycle:
356 componentsInChildren[1].SetText("headerRecycle");
357 break;
358 }
359 }
360 }
UICurrency uiCurrency
void SetText(string s)
Definition: UIHeader.cs:24
void RefreshList()
Transform headerRow
Definition: UIInventory.cs:85

References InvOwner.BuildUICurrency(), Trait.CostRerollShop, EMono.debug, CoreDebug.enable, UIInventory.Tab.mode, InvOwner.owner, UIInventory.Tab.owner, UIHeader.SetText(), and Card.trait.

◆ Update()

void UIInventory.Update ( )
inlineprivate

Definition at line 384 of file UIInventory.cs.

385 {
387 {
388 Close();
389 return;
390 }
392 CheckDirty();
393 if (EInput.action == EAction.GetAll && (bool)buttonTakeAll && !IsMagicChest)
394 {
395 buttonTakeAll.onClick.Invoke();
396 }
397 if ((IsMagicChest || window.saveData.alwaysSort) && wasDirty && (Input.GetMouseButtonUp(1) || Input.GetKeyUp(KeyCode.LeftShift) || Input.GetKeyUp(KeyCode.RightShift)))
398 {
399 list.Redraw();
400 if (!Input.GetMouseButton(1) && !Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift))
401 {
402 wasDirty = false;
404 }
405 }
406 if (Input.GetMouseButtonDown(1))
407 {
408 firstMouseRightDown = true;
409 }
410 }
EAction
Definition: EAction.cs:2
static EAction action
Definition: EInput.cs:270
static InvOwner highlightInv
Image imageHighlightGrid
Definition: UIInventory.cs:117
void CheckDirty()
Definition: UIInventory.cs:412

References EInput.action, LayerInventory.highlightInv, and UIButton.TryShowTip().

Member Data Documentation

◆ actionClick

Action<Thing> UIInventory.actionClick

Definition at line 93 of file UIInventory.cs.

◆ bodySlot

BodySlot UIInventory.bodySlot

Definition at line 81 of file UIInventory.cs.

◆ buttonTakeAll

UIButton UIInventory.buttonTakeAll

Definition at line 125 of file UIInventory.cs.

◆ content

UIContent UIInventory.content

Definition at line 97 of file UIInventory.cs.

◆ currentAct

AIAct UIInventory.currentAct

Definition at line 101 of file UIInventory.cs.

◆ currentTab

Tab UIInventory.currentTab

Definition at line 99 of file UIInventory.cs.

◆ destNum

int UIInventory.destNum
private

Definition at line 129 of file UIInventory.cs.

◆ dirty

bool UIInventory.dirty

Definition at line 107 of file UIInventory.cs.

◆ firstMouseRightDown

bool UIInventory.firstMouseRightDown
private

Definition at line 133 of file UIInventory.cs.

◆ floatMode

bool UIInventory.floatMode

Definition at line 105 of file UIInventory.cs.

◆ funcList

Func<Thing, bool> UIInventory.funcList

Definition at line 91 of file UIInventory.cs.

◆ headerRow

Transform UIInventory.headerRow

Definition at line 85 of file UIInventory.cs.

◆ idMold

string UIInventory.idMold

Definition at line 89 of file UIInventory.cs.

◆ imageHighlight

Image UIInventory.imageHighlight

Definition at line 115 of file UIInventory.cs.

◆ imageHighlightGrid

Image UIInventory.imageHighlightGrid

Definition at line 117 of file UIInventory.cs.

◆ interactMode

InteractMode UIInventory.interactMode

Definition at line 103 of file UIInventory.cs.

◆ isList

bool UIInventory.isList

Definition at line 109 of file UIInventory.cs.

◆ lastNum

int UIInventory.lastNum
private

Definition at line 131 of file UIInventory.cs.

◆ lastTransaction

Transaction UIInventory.lastTransaction

Definition at line 113 of file UIInventory.cs.

◆ layer

LayerInventory UIInventory.layer

Definition at line 83 of file UIInventory.cs.

◆ list

UIList UIInventory.list

◆ moldButtonGrid

ButtonGrid UIInventory.moldButtonGrid

Definition at line 121 of file UIInventory.cs.

◆ moldButtonGridless

ButtonGrid UIInventory.moldButtonGridless

Definition at line 123 of file UIInventory.cs.

◆ moldSmallTab

UIButton UIInventory.moldSmallTab

Definition at line 119 of file UIInventory.cs.

◆ sortDirty

bool UIInventory.sortDirty = true

Definition at line 111 of file UIInventory.cs.

◆ tabs

List<Tab> UIInventory.tabs = new List<Tab>()

◆ transOverflow

Transform UIInventory.transOverflow

Definition at line 87 of file UIInventory.cs.

◆ uiMagic

UIMagicChest UIInventory.uiMagic

Definition at line 127 of file UIInventory.cs.

◆ wasDirty

bool UIInventory.wasDirty

Definition at line 137 of file UIInventory.cs.

◆ window

Window UIInventory.window

Definition at line 95 of file UIInventory.cs.

Property Documentation

◆ CurrencyType

CurrencyType UIInventory.CurrencyType
get

Definition at line 191 of file UIInventory.cs.

◆ dest

Card UIInventory.dest
get

Definition at line 141 of file UIInventory.cs.

◆ IDCurrency

string UIInventory.IDCurrency
get

Definition at line 193 of file UIInventory.cs.

◆ InvStyle

CoreRef.InventoryStyle UIInventory.InvStyle
get

Definition at line 165 of file UIInventory.cs.

◆ IsAdvSort

bool UIInventory.IsAdvSort
get

Definition at line 163 of file UIInventory.cs.

◆ IsMagicChest

bool UIInventory.IsMagicChest
get

Definition at line 157 of file UIInventory.cs.

◆ IsMainMode

bool UIInventory.IsMainMode
get

Definition at line 167 of file UIInventory.cs.

168 {
169 get
170 {
171 switch (currentTab.mode)
172 {
173 case Mode.Gear:
174 case Mode.Food:
175 case Mode.Item:
176 case Mode.Resource:
177 case Mode.Read:
178 case Mode.Hold:
179 case Mode.Tool:
180 case Mode.All:
181 case Mode.Drink:
182 case Mode.HoldFurniture:
183 case Mode.HoldBlock:
184 return true;
185 default:
186 return false;
187 }
188 }
189 }

◆ IsShop

bool UIInventory.IsShop
get

Definition at line 161 of file UIInventory.cs.

◆ IsToolbelt

bool UIInventory.IsToolbelt
get

Definition at line 159 of file UIInventory.cs.

◆ owner

InvOwner UIInventory.owner
get

Definition at line 139 of file UIInventory.cs.

◆ UseBG

bool UIInventory.UseBG
get

Definition at line 143 of file UIInventory.cs.

144 {
145 get
146 {
147 if (!window.saveData.useBG)
148 {
149 return !UseGrid;
150 }
151 return true;
152 }
153 }

◆ UseGrid

bool UIInventory.UseGrid
get

Definition at line 155 of file UIInventory.cs.


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