public override void OnSave() { DigitalClockBehaviour c = _clock.GetComponent <DigitalClockBehaviour>(); ClockSaveData.Serialize(new ClockSaveData() { Position = this._clock.transform.position, Rotation = this._clock.transform.rotation, AlarmEnabled = c.AlarmEnabled, AlarmHour = c.AlarmHour, AlarmMinute = c.AlarmMinute, DisplayColor = c.DisplayColor }, this._savePath); }
public override void OnLoad() { AssetBundle ab = LoadAssets.LoadBundle(this, "digitalclock.unity3d"); GameObject original = ab.LoadAsset <GameObject>("digitalclock.prefab"); _clock = GameObject.Instantiate <GameObject>(original); _clock.name = "'Atomnyje' clock(Clone)"; _clock.layer = LayerMask.NameToLayer("Parts"); _clock.tag = "PART"; DigitalClockBehaviour c = _clock.AddComponent <DigitalClockBehaviour>(); ClockSaveData save = ClockSaveData.Deserialize(_savePath); _clock.transform.position = save.Position; _clock.transform.rotation = save.Rotation; c.Setup(save); GameObject.Destroy(original); ab.Unload(false); ConsoleCommand.Add(new ClockCommand(this, c)); ModConsole.Print(string.Format("[Clock24] 24-hour clock has loaded.\nThe current time is {0:0}:{1:00}", c.Clock.Hour24, c.Clock.Minute)); }
public ClockCommand(TwentyFourClock mod, DigitalClockBehaviour clock) { this._mod = mod; this._clock = clock; }