-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added cheats categories to cheats gui and definitions.
- Loading branch information
Showing
16 changed files
with
1,322 additions
and
435 deletions.
There are no files selected for viewing
429 changes: 64 additions & 365 deletions
429
BOBCheatsPlugin/Assets/BOBCheats/Resources/GUI/BOBCheatsGUI.prefab
Large diffs are not rendered by default.
Oops, something went wrong.
910 changes: 910 additions & 0 deletions
910
BOBCheatsPlugin/Assets/BOBCheats/Resources/GUI/CheatCategorySection.prefab
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
BOBCheatsPlugin/Assets/BOBCheats/Resources/GUI/CheatCategorySection.prefab.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
...tsPlugin/Assets/BOBCheats/Scripts/GUI/CheatsMenuMVC/Elements/CheatCategoryPanelElement.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
using BOBCheats.Collections; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
namespace BOBCheats.GUI | ||
{ | ||
public class CheatCategoryPanelElement : MonoBehaviour | ||
{ | ||
#region Fields | ||
|
||
[SerializeField] | ||
private Text nameLabel; | ||
[SerializeField] | ||
private RectTransform cheatsParent; | ||
[SerializeField] | ||
private CheatElementController cheatElementPrefab; | ||
|
||
#endregion | ||
|
||
#region Propeties | ||
|
||
public Text NameLabel { get => nameLabel; } | ||
public RectTransform CheatsParent { get => cheatsParent; } | ||
public CheatElementController CheatElementPrefab { get => cheatElementPrefab; } | ||
|
||
private CheatCategory CachedCategory | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
public void Initialize(CheatCategory category) | ||
{ | ||
CachedCategory = category; | ||
|
||
RefreshCategoryLabel(); | ||
SpawnCheats(); | ||
|
||
SetCheatsVisible(false); | ||
|
||
if (CachedCategory.CategoryName.Equals(BOBCheatsSettings.DEFAULT_CATEGORY_NAME) == true) | ||
{ | ||
SetCheatsVisible(true); | ||
} | ||
} | ||
|
||
public void ToggleSection() | ||
{ | ||
if(CheatsParent.gameObject.activeInHierarchy == true) | ||
{ | ||
SetCheatsVisible(false); | ||
} | ||
else | ||
{ | ||
SetCheatsVisible(true); | ||
} | ||
} | ||
|
||
private void RefreshCategoryLabel() | ||
{ | ||
NameLabel.text = CachedCategory.CategoryName; | ||
} | ||
|
||
private void SetCheatsVisible(bool isVisible) | ||
{ | ||
CheatsParent.gameObject.SetActive(isVisible); | ||
} | ||
|
||
private void SpawnCheats() | ||
{ | ||
foreach (CheatInfo cheat in CachedCategory.CheatsCollection) | ||
{ | ||
SpawnCheatSections(cheat); | ||
} | ||
} | ||
|
||
private void SpawnCheatSections(CheatInfo cheat) | ||
{ | ||
CheatElementController cheatElement = Instantiate(CheatElementPrefab); | ||
cheatElement.transform.SetParent(CheatsParent); | ||
cheatElement.transform.localScale = Vector3.one; | ||
cheatElement.gameObject.SetActive(true); | ||
|
||
cheatElement.DrawCheatElement(cheat); | ||
} | ||
|
||
#endregion | ||
|
||
#region Enums | ||
|
||
|
||
|
||
#endregion | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...gin/Assets/BOBCheats/Scripts/GUI/CheatsMenuMVC/Elements/CheatCategoryPanelElement.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
BOBCheatsPlugin/Assets/BOBCheats/Scripts/Logic/Collections/CheatCategory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace BOBCheats.Collections | ||
{ | ||
[Serializable] | ||
public class CheatCategory : IEquatable<string> | ||
{ | ||
#region Fields | ||
|
||
[SerializeField] | ||
private string categoryName; | ||
[SerializeField] | ||
private List<CheatInfo> cheatsCollection = new List<CheatInfo>(); | ||
|
||
#endregion | ||
|
||
#region Propeties | ||
|
||
public string CategoryName | ||
{ | ||
get => categoryName; | ||
private set => categoryName = value; | ||
} | ||
|
||
public List<CheatInfo> CheatsCollection { | ||
get => cheatsCollection; | ||
private set => cheatsCollection = value; | ||
} | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
public CheatCategory() { } | ||
|
||
public CheatCategory(string category) | ||
{ | ||
CategoryName = category; | ||
} | ||
|
||
public void SetCategoryName(string category) | ||
{ | ||
CategoryName = category; | ||
} | ||
|
||
public void AddCheat(CheatInfo cheat) | ||
{ | ||
CheatsCollection.Add(cheat); | ||
} | ||
|
||
public bool Equals(string other) | ||
{ | ||
return other.Equals(CategoryName); | ||
} | ||
|
||
#endregion | ||
|
||
#region Enums | ||
|
||
|
||
|
||
#endregion | ||
} | ||
} | ||
|
11 changes: 11 additions & 0 deletions
11
BOBCheatsPlugin/Assets/BOBCheats/Scripts/Logic/Collections/CheatCategory.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.