Code optimisations - UQdeco2800/2022-studio-2 GitHub Wiki

Introduction

This wiki page will briefly

Re structure of inventory display methods

Before sprint 4, inventory's display function was complex and had too many event listners defined in one function.

Changes Before Sprint 4 After
Code Lines 98 26
Code Complexity 27 <15

After sprint 4, all the unique operations in the inventory are handled by the methods listed below and reduced cognitive complexity significantly.

private Button createInventoryButton();
private ImageButton createImageButton();
private void addDropListener();
private void addEquipableListner();

Function optimisations

All methods in the inventory component have been reviewed and simplified. The decision trees are much cleaner.

Display

Display functions now clear caches every time when they are closed. Drastically increased performance.

The legacy code in QuickBarDisplay is cleaned properly and display updates will not be called on every frame rendered


Back to Inventory Page

Author

  • Li-Sung Ou
  • GitHub: @PeterOu8
  • Discord: Secret Agent Randy Beans#6754
  • Slack: Li-Sung Ou
⚠️ **GitHub.com Fallback** ⚠️