示例#1
0
        // Called after the tab is drawn, we end watching here and if needed manually sync the timetable
        // On top of that, we clear our ThingFilterOwner like the MP
        // https://github.com/rwmt/Multiplayer/blob/7aac8b54727d8626ec39429b97225fc88c807ab8/Source/Client/Sync/SyncHandlers.cs#L978
        private static void FillTabPostfix(ref object[] __state)
        {
            if (MP.IsInMultiplayer)
            {
                var timetable = __state[0];
                var oldTimes  = (bool[])__state[1];
                var newTimes  = (List <bool>)timetableTimesField.GetValue(timetable);

                for (int i = 0; i < 24; i++)
                {
                    if (oldTimes[i] != newTimes[i])
                    {
                        timetableTimesField.SetValue(timetable, new List <bool>(oldTimes));
                        controllerTimesSync.DoSync(restaurantController, newTimes);
                        break;
                    }
                }

                restaurantController = null;
                MP.WatchEnd();
            }
        }