-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Assets\Sprites\SongSelection and Assets\Scripts\Screens\SongSele…
…ction Oops I forgot this
- Loading branch information
Showing
51 changed files
with
2,491 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -58,7 +58,7 @@ sysinfo.txt | |
# Crashlytics generated file | ||
crashlytics-build.properties | ||
|
||
Songs*/ | ||
Songs/ | ||
|
||
StyleStarLog* | ||
config.toml |
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,27 @@ | ||
using StyleStar; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class CardBase | ||
{ | ||
protected GameObject cardObj; | ||
protected static int instanceNum = 0; | ||
public bool IsActive { get { return cardObj.activeInHierarchy; } } | ||
|
||
public CardBase(GameObject obj) | ||
{ | ||
cardObj = obj; | ||
cardObj.SetActive(true); | ||
} | ||
|
||
public void Shift(int cardIndex, int currentIndex) | ||
{ | ||
cardObj.GetComponent<RectTransform>().anchoredPosition = Globals.CardOrigin + (cardIndex - currentIndex) * Globals.CardOffset; | ||
} | ||
|
||
public void SetActive(bool active) | ||
{ | ||
cardObj.SetActive(active); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using UnityEngine; | ||
|
||
public class CardPoolGenerator : MonoBehaviour | ||
{ | ||
public GameObject SongCard; | ||
public GameObject FolderCard; | ||
public int AmountToPool; | ||
public bool CanExpand; | ||
public GameObject ParentObject; | ||
|
||
private void Awake() | ||
{ | ||
Pools.SongCards = ScriptableObject.CreateInstance<ObjectPooler>(); | ||
Pools.SongCards.SetPool(SongCard, AmountToPool, CanExpand, ParentObject); | ||
|
||
Pools.FolderCards = ScriptableObject.CreateInstance<ObjectPooler>(); | ||
Pools.FolderCards.SetPool(FolderCard, AmountToPool, CanExpand, ParentObject); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Scripts/Screens/SongSelection/CardPoolGenerator.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using StyleStar; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class FolderCard : CardBase | ||
{ | ||
public FolderCard(GameObject obj, string text) : base(obj) | ||
{ | ||
// Set colors | ||
cardObj.SetColor(ThemeColors.GetColor(instanceNum)); | ||
cardObj.transform.Find("StarAccent").gameObject.SetColor(ThemeColors.GetColor(instanceNum).LerpBlackAlpha(0.3f, 0.1f)); | ||
|
||
// Set text | ||
cardObj.transform.Find("Text").gameObject.SetText(text); | ||
|
||
instanceNum++; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
using StyleStar; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
public class SongCard : CardBase | ||
{ | ||
private SongMetadata metadata; | ||
public string SongID { get { return metadata.SongID; } } | ||
|
||
public SongCard(GameObject obj, SongMetadata meta) : base(obj) | ||
{ | ||
metadata = meta; | ||
|
||
// Set colors | ||
cardObj.SetColor(meta.ColorBack.IfNull(ThemeColors.GetColor(instanceNum))); | ||
cardObj.transform.Find("StarAccent").gameObject.SetColor(meta.ColorFore.IfNull(ThemeColors.GetColor(instanceNum).LerpBlackAlpha(0.3f, 0.1f))); | ||
cardObj.transform.Find("AlbumAccent").gameObject.SetColor(meta.ColorFore.IfNull(ThemeColors.GetColor(instanceNum).LerpBlackAlpha(0.3f, 0.1f))); | ||
|
||
// Set album image | ||
if (metadata.AlbumImage != null) | ||
cardObj.transform.Find("AlbumImage").gameObject.GetComponent<Image>().sprite = metadata.AlbumImage; | ||
|
||
// Set title/artist cards or text depending on what's available | ||
if(metadata.TitleImage != null) | ||
{ | ||
cardObj.transform.Find("TitleImage").gameObject.GetComponent<Image>().sprite = metadata.TitleImage; | ||
cardObj.transform.Find("TitleImage").gameObject.SetActive(true); | ||
cardObj.transform.Find("TitleText").gameObject.SetActive(false); | ||
} | ||
else | ||
cardObj.transform.Find("TitleText").gameObject.SetText(meta.Title); | ||
|
||
if(metadata.ArtistImage != null) | ||
{ | ||
cardObj.transform.Find("ArtistImage").gameObject.GetComponent<Image>().sprite = metadata.ArtistImage; | ||
cardObj.transform.Find("ArtistImage").gameObject.SetActive(true); | ||
cardObj.transform.Find("ArtistText").gameObject.SetActive(false); | ||
} | ||
else | ||
cardObj.transform.Find("ArtistText").gameObject.SetText(meta.Artist); | ||
|
||
// Set song difficulty numbers | ||
string[] names = new string[] { "Difficulty", "ActiveDifficulty0", "ActiveDifficulty1", "ActiveDifficulty2" }; | ||
|
||
foreach (var name in names) | ||
{ | ||
for (int i = 0; i < 3; i++) | ||
{ | ||
var difficultyText = cardObj.transform.Find(name).gameObject.transform.Find("Difficulty" + i).gameObject; | ||
|
||
if (meta.ChildMetadata.Count == 0) | ||
{ | ||
if ((int)meta.Difficulty == i) | ||
{ | ||
difficultyText.SetActive(true); | ||
difficultyText.SetText(meta.Level.ToString("D2")); | ||
} | ||
else | ||
difficultyText.SetActive(false); | ||
} | ||
else | ||
{ | ||
var child = meta.ChildMetadata.FirstOrDefault(x => (int)x.Difficulty == i); | ||
if (child != null) | ||
{ | ||
difficultyText.SetActive(true); | ||
difficultyText.SetText(child.Level.ToString("D2")); | ||
} | ||
else | ||
difficultyText.SetActive(false); | ||
} | ||
if (name.Contains("Active")) | ||
cardObj.transform.Find(name).gameObject.SetActive(false); | ||
} | ||
} | ||
|
||
|
||
instanceNum++; | ||
} | ||
|
||
public void SetDifficulty(int difficulty) | ||
{ | ||
for (int i = 0; i < 3; i++) | ||
cardObj.transform.Find("ActiveDifficulty" + i).gameObject.SetActive(i == difficulty); | ||
} | ||
} |
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.