コード例 #1
0
        private void OnEnable()
        {
            if (_runStartUpOnEnable)
            {
                if (!IsInitialized)
                {
                    Initialize();
                }

                if (_fromSave)
                {
                    if (_savedData == null)
                    {
                        ReadySaveData();
                    }

                    ColorManager.SetColorFromSave(_savedData.BodyColor.Vector4ToColor());
                    GaspodCollectorStorage.SetStorageAmount(_savedData.GaspodAmount);
                    PowerManager.LoadSaveData(_savedData.Batteries);
                    DisplayManager.OnStorageAmountChange(_savedData.GaspodAmount);
                    ReattachBeaconAfterLoad();
                    QuickLogger.Info($"Loaded {Mod.FriendlyName}");
                }

                _runStartUpOnEnable = false;
            }
        }
コード例 #2
0
        public override void OnProtoDeserialize(ProtobufSerializer serializer)
        {
            if (_savedData == null)
            {
                ReadySaveData();
                _fromSave = true;
            }

            if (!IsInitialized)
            {
                Initialize();
            }

            GaspodCollectorStorage.SetStorageAmount(_savedData.GaspodAmount);
            PowerManager.LoadSaveData(_savedData.Batteries);
            DisplayManager.OnStorageAmountChange(_savedData.GaspodAmount);
            ReattachBeaconAfterLoad();
            ColorManager.SetColorFromSave(_savedData.BodyColor.Vector4ToColor());
            QuickLogger.Info($"Loaded {Mod.FriendlyName}");
        }