Elin Decompiled Documentation EA 23.102 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:743
InvOwner owner
Definition: UIInventory.cs:137
List< Tab > tabs
Definition: UIInventory.cs:133

References InvOwner.Init().

◆ CheckDirty()

void UIInventory.CheckDirty ( )
inline

Definition at line 410 of file UIInventory.cs.

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

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

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

◆ DoAct()

void UIInventory.DoAct ( Act  act)
inline

Definition at line 360 of file UIInventory.cs.

361 {
362 if (!EMono.pc.HasNoGoal || (act.LocalAct && EMono._zone.IsRegion))
363 {
364 SE.Beep();
365 return;
366 }
367 EMono.player.hotItemToRestore = EMono.player.currentHotItem;
368 if (act.IsAct)
369 {
370 act.Perform(EMono.pc);
371 return;
372 }
373 currentAct = act as AIAct;
376 if (!floatMode)
377 {
378 Close();
379 }
380 }
Definition: AIAct.cs:6
void SetTurbo(int mtp=-1)
Definition: AM_Adv.cs:1040
virtual bool Perform()
Definition: ACT.cs:264
virtual bool LocalAct
Definition: ACT.cs:169
virtual bool IsAct
Definition: ACT.cs:99
static AM_Adv Adv
Definition: ActionMode.cs:15
AIAct SetAI(AIAct g)
Definition: Chara.cs:8045
bool HasNoGoal
Definition: Chara.cs:821
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:901
virtual bool IsRegion
Definition: Spatial.cs:501
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:1946
virtual bool isChara
Definition: Card.cs:1959
UDInvTab invTab
Definition: CoreRef.cs:132
Icons icons
Definition: CoreRef.cs:339
CoreRef refs
Definition: Core.cs:51
static Core core
Definition: EMono.cs:5
Card Container
Definition: InvOwner.cs:540
WindowCharaMini mini
UIInventory.InteractMode interactMode
Definition: Player.cs:57
Pref pref
Definition: Player.cs:814
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 427 of file UIInventory.cs.

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

References EInput.isShiftDown.

◆ RefreshGrid()

void UIInventory.RefreshGrid ( )
inline

Definition at line 1184 of file UIInventory.cs.

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

1167 {
1168 if (!imageHighlight)
1169 {
1170 return;
1171 }
1172 imageHighlight.SetActive(enable: false);
1173 if (EMono.game.altInv)
1174 {
1176 if (currentTab.mode == Mode.All && thing != null && !thing.isDestroyed)
1177 {
1178 _ = thing.parent;
1179 _ = owner.Container;
1180 }
1181 }
1182 }
bool isDestroyed
Definition: Card.cs:71
ICardParent parent
Definition: Card.cs:51
bool altInv
Definition: Game.cs:263
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 1079 of file UIInventory.cs.

1080 {
1081 Mode mode = currentTab.mode;
1082 _ = currentTab.subMode;
1083 RefreshMenu();
1084 list.Clear();
1086 {
1087 onClick = delegate(Thing a, ButtonGrid b)
1088 {
1089 if (destNum != 0)
1090 {
1091 if (destNum != -1)
1092 {
1093 _ = destNum;
1094 }
1095 else
1096 {
1097 _ = a.Num;
1098 }
1099 }
1100 if (actionClick != null)
1101 {
1102 actionClick(a);
1103 Close();
1104 }
1105 else
1106 {
1107 EMono.pc.HoldCard(a);
1108 SE.SelectHotitem();
1109 }
1110 },
1111 onInstantiate = delegate(Thing a, ButtonGrid b)
1112 {
1113 _ = a.Name;
1114 bool flag = mode == Mode.Buy || mode == Mode.Sell || mode == Mode.Identify;
1115 int num2 = ((destNum != -1) ? 1 : a.Num);
1116 int cost = (flag ? (a.GetPrice(CurrencyType, mode == Mode.Sell) * num2) : 0);
1117 bool canPay = cost < EMono.pc.GetCurrency(IDCurrency);
1118 if (mode == Mode.Identify)
1119 {
1120 cost = 100;
1121 }
1122 b.SetCard(a, ButtonGrid.Mode.Default, delegate(UINote n)
1123 {
1124 Mode mode2 = mode;
1125 if ((uint)(mode2 - 2) <= 1u)
1126 {
1127 n.Space(8);
1128 UIItem uIItem = n.AddExtra<UIItem>("costPrice");
1129 uIItem.text1.SetText(Lang._currency(cost), canPay ? FontColor.Good : FontColor.Bad);
1130 uIItem.image1.sprite = SpriteSheet.Get("icon_" + IDCurrency);
1131 }
1132 });
1133 if (flag && (bool)b.subText)
1134 {
1135 b.subText.SetText((cost.ToString() ?? "").TagColorGoodBad(() => mode == Mode.Sell || cost <= EMono.pc.GetCurrency(IDCurrency)));
1136 }
1137 },
1138 onList = delegate
1139 {
1140 dirty = false;
1141 List<Thing> list = new List<Thing>();
1142 foreach (Thing thing in owner.Things)
1143 {
1144 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)))
1145 {
1146 list.Add(thing);
1147 }
1148 }
1149 int num = 0;
1150 _ = this.list;
1151 foreach (Thing item in list)
1152 {
1153 num += item.ChildrenAndSelfWeight;
1154 this.list.Add(item);
1155 }
1156 string text = "";
1157 text = "statsInv".lang(owner.Container.things.Count.ToString() ?? "", this.list.ItemCount.ToString() ?? "", Lang._weight(num));
1158 layer.windows[0].textStats.SetText(text);
1159 },
1160 onSort = null
1161 };
1162 list.callbacks = callbacks;
1163 list.List();
1164 }
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:912
virtual int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Definition: Card.cs:6449
int GetCurrency(string id="money")
Definition: Card.cs:3652
bool HasTag(CTAG tag)
Definition: Card.cs:2455
int Num
Definition: Card.cs:154
SourceCategory.Row category
Definition: Card.cs:1925
void HoldCard(Card t, int num=-1)
Definition: Chara.cs:4084
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:162
static Sprite Get(string id)
Definition: SpriteSheet.cs:28
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:159

References Lang._currency(), Lang._weight(), Card.c_equippedSlot, Card.category, SpriteSheet.Get(), Card.GetCurrency(), Card.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 450 of file UIInventory.cs.

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

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, 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, 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 }
new UISetting ui
Definition: CoreConfig.cs:588
UDInvStyle invStyle
Definition: CoreRef.cs:371
virtual string IDInvStyle
Definition: Trait.cs:165
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 1001 of file UIInventory.cs.

1002 {
1003 UIDistribution uIDistribution = Util.Instantiate<UIDistribution>("UI/Layer/UIDistribution");
1004 uIDistribution.SetContainer(owner.Container, data);
1005 return dis.AddGameObject(uIDistribution).transform;
1006 }
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 942 of file UIInventory.cs.

943 {
944 List<UIContextMenuItem> items = new List<UIContextMenuItem>();
945 UIContextMenuItem itemAll = null;
946 List<ContainerFlag> obj = Util.EnumToList<ContainerFlag>();
947 obj.Remove(ContainerFlag.none);
948 GridLayoutGroup gridLayoutGroup = dis.AddGridLayout("Context_LayoutDistribution");
949 itemAll = dis.AddToggle("all", isOn: false, delegate(bool a)
950 {
951 foreach (UIContextMenuItem item in items)
952 {
953 item.toggle.isOn = a;
954 }
955 Refresh();
956 SE.ClickOk();
957 });
958 foreach (ContainerFlag f2 in obj)
959 {
960 SourceCategory.Row row = EMono.sources.categories.map[f2.ToString()];
961 items.Add(dis.AddToggle(row.GetName(), !data.flag.HasFlag(f2), delegate(bool a)
962 {
963 SetOn(f2, !a);
964 Refresh();
965 SE.ClickOk();
966 }));
967 }
968 itemAll.transform.SetParent(gridLayoutGroup.transform);
969 itemAll.GetComponentInChildren<UIText>().SetText("all".lang(), FontColor.Topic);
970 foreach (UIContextMenuItem item2 in items)
971 {
972 item2.transform.SetParent(gridLayoutGroup.transform);
973 }
974 Refresh();
975 return gridLayoutGroup.transform;
976 void Refresh()
977 {
978 bool isOnWithoutNotify = true;
979 foreach (UIContextMenuItem item3 in items)
980 {
981 if (!item3.toggle.isOn)
982 {
983 isOnWithoutNotify = false;
984 }
985 }
986 itemAll.toggle.SetIsOnWithoutNotify(isOnWithoutNotify);
987 }
988 void SetOn(ContainerFlag f, bool on)
989 {
990 if (!on && data.flag.HasFlag(f))
991 {
992 data.flag &= ~f;
993 }
994 else if (on && !data.flag.HasFlag(f))
995 {
996 data.flag |= f;
997 }
998 }
999 }
ContainerFlag
Definition: ContainerFlag.cs:5
list. Refresh()
static SourceManager sources
Definition: EMono.cs:41
SourceCategory categories
Definition: UIText.cs:6
ContainerFlag flag
Definition: Window.cs:267

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

◆ Sort()

void UIInventory.Sort ( bool  redraw = true)
inline

Definition at line 1008 of file UIInventory.cs.

1009 {
1010 UIList.SortMode m = (IsShop ? EMono.player.pref.sortInvShop : (IsAdvSort ? window.saveData.sortMode : EMono.player.pref.sortInv));
1011 bool flag = true;
1012 while (flag)
1013 {
1014 flag = false;
1015 foreach (Thing thing in owner.Container.things)
1016 {
1017 if (thing.invY == 1)
1018 {
1019 continue;
1020 }
1021 foreach (Thing thing2 in owner.Container.things)
1022 {
1023 if (thing != thing2 && thing2.invY != 1 && thing.TryStackTo(thing2))
1024 {
1025 flag = true;
1026 break;
1027 }
1028 }
1029 if (flag)
1030 {
1031 break;
1032 }
1033 }
1034 }
1035 int num = 0;
1036 foreach (Thing thing3 in owner.Container.things)
1037 {
1038 if (thing3.invY != 1)
1039 {
1040 thing3.invY = 0;
1041 thing3.invX = -1;
1042 }
1043 num++;
1044 }
1046 if (!UseGrid)
1047 {
1048 int num2 = 0;
1049 int num3 = 0;
1050 Vector2 sizeDelta = list.Rect().sizeDelta;
1051 sizeDelta.x -= 60f;
1052 sizeDelta.y -= 60f;
1053 foreach (Thing thing4 in owner.Container.things)
1054 {
1055 if (thing4.invY != 0)
1056 {
1057 continue;
1058 }
1059 thing4.posInvX = num2 + 30;
1060 thing4.posInvY = (int)sizeDelta.y - num3 + 30;
1061 num2 += 40;
1062 if ((float)num2 > sizeDelta.x)
1063 {
1064 num2 = 0;
1065 num3 += 40;
1066 if ((float)num3 > sizeDelta.y)
1067 {
1068 num3 = 20;
1069 }
1070 }
1071 }
1072 }
1073 if (redraw)
1074 {
1075 list.Redraw();
1076 }
1077 }
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
int invY
Definition: Card.cs:1831
bool TryStackTo(Thing to)
Definition: Card.cs:3144
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 layer.TryShowHint("h_inv" + tab.mode);
339 if ((bool)headerRow)
340 {
341 UIHeader[] componentsInChildren = headerRow.GetComponentsInChildren<UIHeader>(includeInactive: true);
342 componentsInChildren[0].SetText("headerItem");
343 switch (tab.mode)
344 {
345 case Mode.Buy:
346 case Mode.Sell:
347 case Mode.Identify:
348 componentsInChildren[1].SetText("headerPrice".lang(IDCurrency.lang()));
349 break;
350 default:
351 componentsInChildren[1].SetText("headerWeight");
352 break;
353 case Mode.Recycle:
354 componentsInChildren[1].SetText("headerRecycle");
355 break;
356 }
357 }
358 }
void TryShowHint(string _langHint=null)
Definition: ELayer.cs:152
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 382 of file UIInventory.cs.

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

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: