snozbot / fungus

An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
MIT License
1.63k stars 290 forks source link

Implemented SaveSlotView system for more flexible SaveSlot displays #920

Closed CG-Tespy closed 3 years ago

CG-Tespy commented 3 years ago

Description

An improvement to how SaveSlots work.

What is the current behavior?

The SaveSlotController manages the visual aspects in a restrictive way, requiring users to alter it if they want a more custom look for their SaveSlots. This violates the Open-Closed Principle of software design.

What is the new behavior?

The SaveSlotController has been refactored to delegate the visual display aspects to subclasses of a new class this PR adds: SaveSlotView. This way, if the user wants to do something like display a chapter title on a slot, they can just add to the slot prefab, and add (let's say...) a SaveSlotChapterView component.

This removes the Open-Closed Principle violation, while making the design cleaner and more extensible.

Important Notes

Other information