Elin Decompiled Documentation EA 23.345.1 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< ThingactionClick
 
Window window
 
UIContent content
 
Tab currentTab
 
AIAct currentAct
 
InteractMode interactMode
 
bool floatMode
 
bool dirty
 
bool isList
 
Transaction lastTransaction
 
Image imageHighlight
 
Image imageHighlightGrid
 
UIButton moldSmallTab
 
ButtonGrid moldButtonGrid
 
ButtonGrid moldButtonGridless
 
UIButton buttonTakeAll
 
UIMagicChest uiMagic
 
List< Tabtabs = 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 217 of file UIInventory.cs.

218 {
219 owner.Init();
220 Tab tab = new Tab
221 {
222 mode = mode,
223 owner = owner
224 };
225 tabs.Add(tab);
226 return tab;
227 }
void Init()
Definition: InvOwner.cs:745
InvOwner owner
Definition: UIInventory.cs:137
List< Tab > tabs
Definition: UIInventory.cs:133

References InvOwner.Init().

◆ CheckDirty()

void UIInventory.CheckDirty ( )
inline

Definition at line 409 of file UIInventory.cs.

410 {
411 if (dirty)
412 {
413 wasDirty = true;
414 if (UseGrid)
415 {
416 list.Redraw();
417 }
418 else
419 {
420 list.List();
421 }
423 }
424 }
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:793
override void List()
Definition: UIList.cs:770

References UIButton.TryShowTip().

◆ Close()

void UIInventory.Close ( )
inline

Definition at line 305 of file UIInventory.cs.

306 {
307 if (!floatMode)
308 {
309 layer.Close();
310 }
311 }
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 439 of file UIInventory.cs.

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

◆ DoAct()

void UIInventory.DoAct ( Act  act)
inline

Definition at line 359 of file UIInventory.cs.

360 {
361 if (!EMono.pc.HasNoGoal || (act.LocalAct && EMono._zone.IsRegion))
362 {
363 SE.Beep();
364 return;
365 }
366 EMono.player.hotItemToRestore = EMono.player.currentHotItem;
367 if (act.IsAct)
368 {
369 act.Perform(EMono.pc);
370 return;
371 }
372 currentAct = act as AIAct;
375 if (!floatMode)
376 {
377 Close();
378 }
379 }
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:9486
bool HasNoGoal
Definition: Chara.cs:1047
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:1170
virtual bool IsRegion
Definition: Spatial.cs:515
void Close()
Definition: UIInventory.cs:305
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 229 of file UIInventory.cs.

230 {
232 foreach (Tab t in tabs)
233 {
234 string text = t.textTab.IsEmpty("inv" + t.mode);
235 if (!floatMode)
236 {
237 text = text.lang() + " - " + (t.owner.owner.IsPC ? "you".lang().ToTitleCase() : (t.owner.Chara?.Name ?? t.owner.Container.Name));
238 }
239 Window.Setting.Tab tab = window.AddTab(text, content, delegate
240 {
241 SwitchTab(t);
242 }, EMono.core.refs.icons.invTab.TryGetValue(t.mode), text);
243 if (t.smallTab)
244 {
245 tab.customTab = moldSmallTab;
246 }
247 }
248 if ((bool)layer.mini)
249 {
250 layer.mini.SetActive(owner.Container.isChara);
252 {
254 }
255 }
256 if ((bool)uiMagic)
257 {
258 uiMagic.SetActive(IsMagicChest);
259 if (IsMagicChest)
260 {
261 uiMagic.Init();
262 }
263 }
264 if (IsMagicChest)
265 {
266 TooltipManager.Instance.disableTimer = 0.1f;
267 }
268 }
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:1083
bool TryGetValue(TKey key, out TValue value)
Definition: UDictionary.cs:178
bool IsMagicChest
Definition: UIInventory.cs:155
InteractMode interactMode
Definition: UIInventory.cs:103
void SwitchTab(Tab tab)
Definition: UIInventory.cs:313
UIButton moldSmallTab
Definition: UIInventory.cs:117
UIMagicChest uiMagic
Definition: UIInventory.cs:125
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 198 of file UIInventory.cs.

199 {
200 UIInventory[] componentsInChildren = EMono.ui.rectLayers.GetComponentsInChildren<UIInventory>();
201 for (int i = 0; i < componentsInChildren.Length; i++)
202 {
203 componentsInChildren[i].list.Redraw();
204 }
205 }
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 426 of file UIInventory.cs.

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

References EInput.isShiftDown.

◆ RefreshGrid()

void UIInventory.RefreshGrid ( )
inline

Definition at line 1195 of file UIInventory.cs.

1196 {
1197 _ = currentTab.mode;
1198 _ = currentTab.subMode;
1200 RefreshMenu();
1201 GridLayoutGroup g = list.GetComponent<GridLayoutGroup>();
1202 ContentSizeFitter component = list.GetComponent<ContentSizeFitter>();
1203 if (UseGrid)
1204 {
1205 g.constraintCount = ((window.saveData.columns == 0) ? owner.Container.things.width : window.saveData.columns);
1206 Vector2 cellSize = style.gridSize * (100 + window.saveData.size) / 100f;
1207 g.cellSize = cellSize;
1208 GridLayoutGroup gridLayoutGroup = g;
1209 bool flag = (component.enabled = true);
1210 gridLayoutGroup.enabled = flag;
1211 }
1212 else
1213 {
1214 GridLayoutGroup gridLayoutGroup2 = g;
1215 bool flag = (component.enabled = false);
1216 gridLayoutGroup2.enabled = flag;
1217 list.Rect().sizeDelta = style.sizeContainer;
1218 }
1219 list.Clear();
1220 int maxCapacity = (IsMagicChest ? owner.Container.things.MaxCapacity : 0);
1222 {
1223 onRedraw = delegate(Thing a, ButtonGrid b, int i)
1224 {
1225 b.index = i;
1226 bool flag4 = i >= owner.Things.Count;
1227 if (IsMagicChest)
1228 {
1229 flag4 = uiMagic.page * uiMagic.GridSize + i >= maxCapacity;
1230 }
1231 if (UseGrid)
1232 {
1233 b.SetCardGrid(a, flag4 ? null : owner);
1234 }
1235 else
1236 {
1237 b.SetCardGrid(a, owner);
1238 if (a != null)
1239 {
1240 b.Rect().anchoredPosition = new Vector2(a.posInvX, a.posInvY);
1241 }
1242 float num = 0.01f * (float)EMono.game.config.gridIconSize;
1243 b.icon.Rect().localScale = new Vector3(num, num, 1f);
1244 b.Rect().sizeDelta = b.icon.rectTransform.sizeDelta;
1245 }
1246 if (flag4)
1247 {
1248 b.interactable = false;
1249 b.image.sprite = null;
1250 b.image.color = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, 120);
1251 b.image.raycastTarget = true;
1252 }
1253 else
1254 {
1255 b.image.raycastTarget = true;
1256 }
1257 },
1258 onList = delegate
1259 {
1260 list.bgType = (UseGrid ? UIList.BGType.grid : UIList.BGType.none);
1261 if ((bool)list.bgGrid)
1262 {
1263 list.bgGrid.SetActive(UseGrid);
1264 list.bgGrid.color = style.gridColor;
1265 if (window.saveData.color.a != 0)
1266 {
1267 list.bgGrid.color = window.saveData.color;
1268 }
1269 }
1270 if (IsMagicChest)
1271 {
1273 }
1274 else
1275 {
1277 }
1278 if (UseGrid)
1279 {
1280 if (IsMagicChest)
1281 {
1282 for (int i = 0; i < owner.Container.things.GridSize; i++)
1283 {
1284 list.Add(owner.Things[i]);
1285 }
1286 }
1287 else
1288 {
1289 int count = owner.Things.Count;
1290 int num = (int)Mathf.Ceil(count / g.constraintCount + ((count % g.constraintCount != 0) ? 1 : 0)) * g.constraintCount;
1291 for (int j = 0; j < num; j++)
1292 {
1293 list.Add((j < count) ? owner.Things[j] : null);
1294 }
1295 }
1296 }
1297 else
1298 {
1299 Vector2 sizeDelta2 = list.Rect().sizeDelta;
1300 foreach (Thing thing2 in owner.Things)
1301 {
1302 if (thing2 != null)
1303 {
1304 list.Add(thing2);
1305 if (thing2.posInvX == 0 && thing2.posInvY == 0)
1306 {
1307 thing2.posInvX = EMono.rnd((int)sizeDelta2.x - 60) + 30;
1308 thing2.posInvY = EMono.rnd((int)sizeDelta2.y - 60) + 30;
1309 }
1310 }
1311 }
1312 }
1313 if (floatMode)
1314 {
1315 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"));
1316 }
1317 }
1318 };
1319 bool sorted = false;
1320 list.callbacks = callback;
1321 list.onBeforeRedraw = delegate
1322 {
1323 if (IsMagicChest)
1324 {
1325 if (firstMouseRightDown || (!Input.GetMouseButton(1) && !Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift)))
1326 {
1327 Sort(redraw: false);
1328 firstMouseRightDown = false;
1330 }
1331 }
1332 else
1333 {
1334 if (window.saveData.alwaysSort && !sorted && (firstMouseRightDown || (!Input.GetMouseButton(1) && !Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift))))
1335 {
1336 sorted = true;
1337 Sort();
1338 sorted = false;
1339 firstMouseRightDown = false;
1340 }
1342 }
1343 dirty = false;
1344 if (UseGrid)
1345 {
1346 UIList uIList = list;
1347 for (int i = 0; i < uIList.buttons.Count; i++)
1348 {
1349 UIList.ButtonPair value = uIList.buttons[i];
1350 value.obj = ((i < owner.Container.things.grid.Count) ? owner.Container.things.grid[i] : null);
1351 uIList.buttons[i] = value;
1352 }
1353 }
1354 };
1355 list.onAfterRedraw = delegate
1356 {
1357 if (!layer.floatInv)
1358 {
1359 int num = 0;
1360 foreach (UIList.ButtonPair button in list.buttons)
1361 {
1362 if ((button.component as ButtonGrid).card is Thing thing)
1363 {
1364 num += thing.ChildrenAndSelfWeight;
1365 }
1366 }
1367 string text = "";
1368 text = "statsInv2".lang(owner.Container.things.Count.ToString() ?? "", list.ItemCount.ToString() ?? "", Lang._weight(num) + "/" + Lang._weight(owner.Container.WeightLimit));
1369 layer.windows[0].textStats.SetText(text);
1370 }
1372 {
1373 if (!transOverflow)
1374 {
1375 transOverflow = Util.Instantiate("UI/Element/Other/InvOverflow", window.transform);
1376 }
1377 }
1378 else if ((bool)transOverflow)
1379 {
1380 UnityEngine.Object.Destroy(transOverflow.gameObject);
1381 }
1383 if ((bool)layer.mini)
1384 {
1386 }
1387 if ((bool)uiMagic)
1388 {
1390 }
1392 };
1393 callback.mold = (UseGrid ? moldButtonGrid : moldButtonGridless);
1395 {
1396 Vector2 sizeDelta = list.Rect().sizeDelta;
1397 foreach (Thing thing3 in owner.Things)
1398 {
1399 if (thing3 != null)
1400 {
1401 thing3.posInvX = EMono.rnd((int)sizeDelta.x - 60) + 30;
1402 thing3.posInvY = EMono.rnd((int)sizeDelta.y - 60) + 30;
1403 }
1404 }
1405 window.saveData.firstSorted = true;
1406 }
1407 list.List();
1408 g.RebuildLayoutTo<Layer>();
1410 if ((bool)list.bgGrid)
1411 {
1412 list.bgGrid.color = style.gridColor;
1413 if (window.saveData.color.a != 0)
1414 {
1415 list.bgGrid.color = window.saveData.color;
1416 }
1417 }
1419 {
1421 }
1422 }
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:131
CoreRef.InventoryStyle InvStyle
Definition: UIInventory.cs:163
void Sort(bool redraw=true)
ButtonGrid moldButtonGrid
Definition: UIInventory.cs:119
void RefreshMenu()
Definition: UIInventory.cs:449
Transform transOverflow
Definition: UIInventory.cs:87
ButtonGrid moldButtonGridless
Definition: UIInventory.cs:121
Definition: UIList.cs:9
List< ButtonPair > buttons
Definition: UIList.cs:276
override int ItemCount
Definition: UIList.cs:328
override void Clear()
Definition: UIList.cs:401
BGType
Definition: UIList.cs:16
override void Add(object item)
Definition: UIList.cs:354
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, 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 1177 of file UIInventory.cs.

1178 {
1179 if (!imageHighlight)
1180 {
1181 return;
1182 }
1183 imageHighlight.SetActive(enable: false);
1184 if (EMono.game.altInv)
1185 {
1187 if (currentTab.mode == Mode.All && thing != null && !thing.isDestroyed)
1188 {
1189 _ = thing.parent;
1190 _ = owner.Container;
1191 }
1192 }
1193 }
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:113

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

◆ RefreshList()

void UIInventory.RefreshList ( )
inline

Definition at line 1090 of file UIInventory.cs.

1091 {
1092 Mode mode = currentTab.mode;
1093 _ = currentTab.subMode;
1094 RefreshMenu();
1095 list.Clear();
1097 {
1098 onClick = delegate(Thing a, ButtonGrid b)
1099 {
1100 if (destNum != 0)
1101 {
1102 if (destNum != -1)
1103 {
1104 _ = destNum;
1105 }
1106 else
1107 {
1108 _ = a.Num;
1109 }
1110 }
1111 if (actionClick != null)
1112 {
1113 actionClick(a);
1114 Close();
1115 }
1116 else
1117 {
1118 EMono.pc.HoldCard(a);
1119 SE.SelectHotitem();
1120 }
1121 },
1122 onInstantiate = delegate(Thing a, ButtonGrid b)
1123 {
1124 _ = a.Name;
1125 bool flag = mode == Mode.Buy || mode == Mode.Sell || mode == Mode.Identify;
1126 int num = ((destNum != -1) ? 1 : a.Num);
1127 int cost = (flag ? (a.GetPrice(CurrencyType, mode == Mode.Sell) * num) : 0);
1128 bool canPay = cost < EMono.pc.GetCurrency(IDCurrency);
1129 if (mode == Mode.Identify)
1130 {
1131 cost = 100;
1132 }
1133 b.SetCard(a, ButtonGrid.Mode.Default, delegate(UINote n)
1134 {
1135 Mode mode2 = mode;
1136 if ((uint)(mode2 - 2) <= 1u)
1137 {
1138 n.Space(8);
1139 UIItem uIItem = n.AddExtra<UIItem>("costPrice");
1140 uIItem.text1.SetText(Lang._currency(cost), canPay ? FontColor.Good : FontColor.Bad);
1141 uIItem.image1.sprite = SpriteSheet.Get("icon_" + IDCurrency);
1142 }
1143 });
1144 if (flag && (bool)b.subText)
1145 {
1146 b.subText.SetText((cost.ToString() ?? "").TagColorGoodBad(() => mode == Mode.Sell || cost <= EMono.pc.GetCurrency(IDCurrency)));
1147 }
1148 },
1149 onList = delegate
1150 {
1151 dirty = false;
1152 List<Thing> list = new List<Thing>();
1153 foreach (Thing thing in owner.Things)
1154 {
1155 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)))
1156 {
1157 list.Add(thing);
1158 }
1159 }
1160 int num = 0;
1161 _ = this.list;
1162 foreach (Thing item in list)
1163 {
1164 num += item.ChildrenAndSelfWeight;
1165 this.list.Add(item);
1166 }
1167 string text = "";
1168 text = "statsInv".lang(owner.Container.things.Count.ToString() ?? "", this.list.ItemCount.ToString() ?? "", Lang._weight(num));
1169 layer.windows[0].textStats.SetText(text);
1170 },
1171 onSort = null
1172 };
1173 list.callbacks = callbacks;
1174 list.List();
1175 }
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:4770
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:829
UIText subText
Definition: UIButton.cs:104
string IDCurrency
Definition: UIInventory.cs:191
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 449 of file UIInventory.cs.

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

271 {
272 if (window.saveData == null)
273 {
274 window.saveData = Window.dictData.TryGetValue(window.idWindow) ?? new Window.SaveData
275 {
276 useBG = EMono.core.config.game.showInvBG
277 };
278 }
279 window.setting.allowMove = !window.saveData.fixedPos;
280 window.bgCollider.raycastTarget = !window.saveData.fixedPos || window.saveData.useBG;
281 window.imageBG.SetActive(UseBG);
283 if (UseBG)
284 {
285 window.imageBG.sprite = inventoryStyle.bg;
286 window.imageBG.rectTransform.anchoredPosition = inventoryStyle.posFix;
287 window.imageBG.rectTransform.sizeDelta = inventoryStyle.sizeDelta;
288 window.imageBG.alphaHitTestMinimumThreshold = 1f;
289 }
290 if (IsToolbelt)
291 {
292 window.cgFloatMenu.SetActive(enable: false);
293 window.cgFloatMenu = null;
294 window.bgCollider.rectTransform.anchoredPosition = new Vector2(-2.5f, 0f);
295 window.bgCollider.rectTransform.sizeDelta = new Vector2(-20f, -20f);
296 }
298 {
299 window.cgFloatMenu.alpha = 1f;
300 window.cgFloatMenu.enabled = false;
301 window.cgFloatMenu.SetActive(enable: true);
302 }
303 }
UDInvStyle invStyle
Definition: CoreRef.cs:390
virtual string IDInvStyle
Definition: Trait.cs:185
bool IsToolbelt
Definition: UIInventory.cs:157
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 207 of file UIInventory.cs.

208 {
209 window.SetCaption(s.lang());
210 }
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 1012 of file UIInventory.cs.

1013 {
1014 UIDistribution uIDistribution = Util.Instantiate<UIDistribution>("UI/Layer/UIDistribution");
1015 uIDistribution.SetContainer(owner.Container, data);
1016 return dis.AddGameObject(uIDistribution).transform;
1017 }
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 953 of file UIInventory.cs.

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

1020 {
1021 UIList.SortMode m = (IsShop ? EMono.player.pref.sortInvShop : (IsAdvSort ? window.saveData.sortMode : EMono.player.pref.sortInv));
1022 bool flag = true;
1023 while (flag)
1024 {
1025 flag = false;
1026 foreach (Thing thing in owner.Container.things)
1027 {
1028 if (thing.invY == 1)
1029 {
1030 continue;
1031 }
1032 foreach (Thing thing2 in owner.Container.things)
1033 {
1034 if (thing != thing2 && thing2.invY != 1 && thing.TryStackTo(thing2))
1035 {
1036 flag = true;
1037 break;
1038 }
1039 }
1040 if (flag)
1041 {
1042 break;
1043 }
1044 }
1045 }
1046 int num = 0;
1047 foreach (Thing thing3 in owner.Container.things)
1048 {
1049 if (thing3.invY != 1)
1050 {
1051 thing3.invY = 0;
1052 thing3.invX = -1;
1053 }
1054 num++;
1055 }
1057 if (!UseGrid)
1058 {
1059 int num2 = 0;
1060 int num3 = 0;
1061 Vector2 sizeDelta = list.Rect().sizeDelta;
1062 sizeDelta.x -= 60f;
1063 sizeDelta.y -= 60f;
1064 foreach (Thing thing4 in owner.Container.things)
1065 {
1066 if (thing4.invY != 0)
1067 {
1068 continue;
1069 }
1070 thing4.posInvX = num2 + 30;
1071 thing4.posInvY = (int)sizeDelta.y - num3 + 30;
1072 num2 += 40;
1073 if ((float)num2 > sizeDelta.x)
1074 {
1075 num2 = 0;
1076 num3 += 40;
1077 if ((float)num3 > sizeDelta.y)
1078 {
1079 num3 = 20;
1080 }
1081 }
1082 }
1083 }
1084 if (redraw)
1085 {
1086 list.Redraw();
1087 }
1088 }
if(!match.Success)
int invY
Definition: Card.cs:2007
bool TryStackTo(Thing to)
Definition: Card.cs:3578
CurrencyType currency
Definition: InvOwner.cs:527
UIList.SortMode sortInv
Definition: Player.cs:49

References if(), 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 313 of file UIInventory.cs.

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

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

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 123 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 127 of file UIInventory.cs.

◆ dirty

bool UIInventory.dirty

Definition at line 107 of file UIInventory.cs.

◆ firstMouseRightDown

bool UIInventory.firstMouseRightDown
private

Definition at line 131 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 113 of file UIInventory.cs.

◆ imageHighlightGrid

Image UIInventory.imageHighlightGrid

Definition at line 115 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 129 of file UIInventory.cs.

◆ lastTransaction

Transaction UIInventory.lastTransaction

Definition at line 111 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 119 of file UIInventory.cs.

◆ moldButtonGridless

ButtonGrid UIInventory.moldButtonGridless

Definition at line 121 of file UIInventory.cs.

◆ moldSmallTab

UIButton UIInventory.moldSmallTab

Definition at line 117 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 125 of file UIInventory.cs.

◆ wasDirty

bool UIInventory.wasDirty

Definition at line 135 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 189 of file UIInventory.cs.

◆ dest

Card UIInventory.dest
get

Definition at line 139 of file UIInventory.cs.

◆ IDCurrency

string UIInventory.IDCurrency
get

Definition at line 191 of file UIInventory.cs.

◆ InvStyle

CoreRef.InventoryStyle UIInventory.InvStyle
get

Definition at line 163 of file UIInventory.cs.

◆ IsAdvSort

bool UIInventory.IsAdvSort
get

Definition at line 161 of file UIInventory.cs.

◆ IsMagicChest

bool UIInventory.IsMagicChest
get

Definition at line 155 of file UIInventory.cs.

◆ IsMainMode

bool UIInventory.IsMainMode
get

Definition at line 165 of file UIInventory.cs.

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

◆ IsShop

bool UIInventory.IsShop
get

Definition at line 159 of file UIInventory.cs.

◆ IsToolbelt

bool UIInventory.IsToolbelt
get

Definition at line 157 of file UIInventory.cs.

◆ owner

InvOwner UIInventory.owner
get

Definition at line 137 of file UIInventory.cs.

◆ UseBG

bool UIInventory.UseBG
get

Definition at line 141 of file UIInventory.cs.

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

◆ UseGrid

bool UIInventory.UseGrid
get

Definition at line 153 of file UIInventory.cs.


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