Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
PropsManager.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using UnityEngine;
3
4public class PropsManager : EClass
5{
7
9
11
12 public List<Card> deconstructing = new List<Card>();
13
14 public List<Card> sales = new List<Card>();
15
16 private bool dbg => EClass.debug.debugProps;
17
18 public void Init()
19 {
20 stocked.Init();
22 roaming.Init();
23 }
24
25 public void OnCardAddedToZone(Card c)
26 {
27 if (!c.isThing)
28 {
29 if (c.isSale)
30 {
31 sales.Add(c);
32 }
33 return;
34 }
35 switch (c.placeState)
36 {
37 case PlaceState.installed:
38 installed.Add(c);
39 if (c.isSale)
40 {
41 sales.Add(c);
42 }
43 break;
44 case PlaceState.roaming:
45 roaming.Add(c);
46 break;
47 case PlaceState.stocked:
48 stocked.Add(c);
49 break;
50 }
51 }
52
53 public void OnSetPlaceState(Card c, PlaceState? newType, PlaceState? oldType = null)
54 {
55 if (!c.isThing || c.parent != EClass._zone)
56 {
57 return;
58 }
59 if (oldType.HasValue)
60 {
61 switch (oldType)
62 {
63 case PlaceState.roaming:
64 if (dbg && !roaming.all.Contains(c))
65 {
66 Debug.LogError("remove roaming" + c);
67 }
68 roaming.Remove(c);
69 break;
70 case PlaceState.stocked:
71 if (dbg && !stocked.all.Contains(c))
72 {
73 Debug.LogError("remove stocked" + c);
74 }
75 stocked.Remove(c);
76 break;
77 case PlaceState.installed:
78 if (dbg && !installed.all.Contains(c))
79 {
80 Debug.LogError("remove installed" + c);
81 }
83 break;
84 }
85 if (c.isSale)
86 {
87 sales.Remove(c);
88 }
89 }
90 if (!newType.HasValue || !newType.HasValue)
91 {
92 return;
93 }
94 switch (newType.GetValueOrDefault())
95 {
96 case PlaceState.roaming:
97 if (dbg && roaming.all.Contains(c))
98 {
99 Debug.LogError("add roaming" + c);
100 }
101 roaming.Add(c);
102 break;
103 case PlaceState.stocked:
104 if (dbg && stocked.all.Contains(c))
105 {
106 Debug.LogError("add stocked" + c);
107 }
108 stocked.Add(c);
109 break;
110 case PlaceState.installed:
111 if (dbg && installed.all.Contains(c))
112 {
113 Debug.LogError("add installed" + c);
114 }
115 installed.Add(c);
116 if (c.isSale)
117 {
118 sales.Add(c);
119 }
120 break;
121 }
122 }
123}
PlaceState
Definition: PlaceState.cs:2
Definition: Card.cs:11
virtual bool isThing
Definition: Card.cs:1957
bool isSale
Definition: Card.cs:838
ICardParent parent
Definition: Card.cs:51
PlaceState placeState
Definition: Card.cs:79
bool debugProps
Definition: CoreDebug.cs:151
Definition: EClass.cs:5
static Zone _zone
Definition: EClass.cs:20
static CoreDebug debug
Definition: EClass.cs:48
PropsInstalled installed
Definition: PropsManager.cs:8
List< Card > sales
Definition: PropsManager.cs:14
PropsRoaming roaming
Definition: PropsManager.cs:10
void OnCardAddedToZone(Card c)
Definition: PropsManager.cs:25
List< Card > deconstructing
Definition: PropsManager.cs:12
void OnSetPlaceState(Card c, PlaceState? newType, PlaceState? oldType=null)
Definition: PropsManager.cs:53
PropsStocked stocked
Definition: PropsManager.cs:6
void Add(Card t)
Definition: Props.cs:63
void Remove(Card t)
Definition: Props.cs:115
void Init()
Definition: Props.cs:41
PropSet all
Definition: Props.cs:8