1- #if ! FISHNET_STABLE_REPLICATESTATES
2- using System ;
1+ using System ;
32using FishNet . Utility ;
43using System . Runtime . CompilerServices ;
54
@@ -88,90 +87,3 @@ public static class ReplicateStateExtensions
8887 public static bool FastContains ( this ReplicateState whole , ReplicateState part ) => ( whole & part ) == part ;
8988 }
9089}
91- #else
92- using FishNet . Utility ;
93- using System . Runtime . CompilerServices ;
94-
95- [ assembly: InternalsVisibleTo ( UtilityConstants . CODEGEN_ASSEMBLY_NAME ) ]
96-
97- namespace FishNet . Object
98- {
99- public enum ReplicateState : byte
100- {
101- /// <summary>
102- /// The default value of this state.
103- /// This value should never occur when a replicate runs.
104- /// </summary>
105- Invalid = 0 ,
106- /// <summary>
107- /// Value is seen on server and clients.
108- /// Client or server has data on the object for the tick.
109- /// Clients will only see this value on spectated objects when PredictionManager is using Appended state order.
110- /// </summary>
111- CurrentCreated = 1 ,
112- /// <summary>
113- /// Value is only seen on server when they do not own the object.
114- /// Server does not have data on this non-owned object for the tick but expected to, such as a state should have arrived but did not.
115- /// </summary>
116- [ System . Obsolete ( "This is currently not used but may be in a later release. Please read summary for value." ) ]
117- CurrentPredicted = 2 ,
118- /// <summary>
119- /// Value is only seen on clients when they do not own the object.
120- /// Client does not have data for the tick but expected to, such as a state should have arrived but did not.
121- /// Client is currently reconciling.
122- /// </summary>
123- [ System . Obsolete ( "This is currently not used but may be in a later release. Please read summary for value." ) ]
124- ReplayedPredicted = 3 ,
125- /// <summary>
126- /// Value is only seen on clients.
127- /// Client has data on the object for the tick.
128- /// Client is currently reconciling.
129- /// </summary>
130- ReplayedCreated = 4 ,
131- /// <summary>
132- /// Value is only seen on clients when they do not own the object.
133- /// Tick is in the future and data cannot yet be known.
134- /// This can be used to exit replicate early to not process actions, or create actions based on previous datas.
135- /// </summary>
136- CurrentFuture = 5 ,
137- /// <summary>
138- /// Value is only seen on clients when they do not own the object.
139- /// Tick is in the future and data cannot yet be known.
140- /// Client is currently reconciling.
141- /// This can be used to exit replicate early to not process actions, or create actions based on previous datas.
142- /// </summary>
143- ReplayedFuture = 6 ,
144- }
145-
146- public static class ReplicateStateExtensions
147- {
148- /// <summary>
149- /// Returns if value is valid.
150- /// This should never be false.
151- /// </summary>
152- public static bool IsValid ( this ReplicateState value ) => ( value != ReplicateState . Invalid ) ;
153-
154- /// <summary>
155- /// Returns if value is replayed.
156- /// </summary>
157- #pragma warning disable CS0618 // Type or member is obsolete
158- public static bool IsReplayed ( this ReplicateState value ) => ( value == ReplicateState . ReplayedPredicted || value == ReplicateState . ReplayedCreated || value == ReplicateState . ReplayedFuture ) ;
159- #pragma warning restore CS0618 // Type or member is obsolete
160- /// <summary>
161- /// Returns if value is user created.
162- /// </summary>
163- public static bool IsCreated ( this ReplicateState value ) => ( value == ReplicateState . CurrentCreated || value == ReplicateState . ReplayedCreated ) ;
164-
165- /// <summary>
166- /// Returns if value is predicted.
167- /// </summary>
168- #pragma warning disable CS0618 // Type or member is obsolete
169- public static bool IsPredicted ( this ReplicateState value ) => ( value == ReplicateState . ReplayedPredicted ) ;
170- #pragma warning restore CS0618 // Type or member is obsolete
171- /// <summary>
172- /// Returns if value is in the future.
173- /// </summary>
174- public static bool IsFuture ( this ReplicateState value ) => ( value == ReplicateState . CurrentFuture || value == ReplicateState . ReplayedFuture ) ;
175- }
176- }
177- #endif
0 commit comments