Resolve WES-99 "Cc refactor"
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// ChangeUserScreen scene manager
|
||||
/// </summary>
|
||||
public class ChangeUserScreen : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
@@ -58,12 +60,7 @@ public class ChangeUserScreen : MonoBehaviour
|
||||
// Set background color
|
||||
background.color = i == currentUserIndex ? Color.blue : Color.gray;
|
||||
// Find correct component for setting the sprite
|
||||
foreach (Image img in background.GetComponentsInChildren<Image>())
|
||||
if (img != background)
|
||||
{
|
||||
img.sprite = user.avatar;
|
||||
break;
|
||||
}
|
||||
instance.transform.Find("Avatar").GetComponent<Image>().sprite = user.avatar;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +82,14 @@ public class ChangeUserScreen : MonoBehaviour
|
||||
{
|
||||
userList.ChangeCurrentUser(currentUserIndex);
|
||||
userList.Save();
|
||||
SceneManager.LoadScene("Common/Scenes/StartScreen");
|
||||
SystemController.GetInstance().BackToPreviousScene();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback to load the UserCreationScreen scene
|
||||
/// </summary>
|
||||
public void GotoUserCreation()
|
||||
{
|
||||
SystemController.GetInstance().LoadNextScene("Accounts/Scenes/UserCreationScreen");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ public class Progress
|
||||
}
|
||||
}
|
||||
|
||||
// Get the value of type `T` belonging to `key`
|
||||
/// <summary>
|
||||
/// Get the data object of a certain key
|
||||
/// </summary>
|
||||
|
||||
@@ -2,7 +2,6 @@ using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
@@ -80,12 +79,7 @@ public class UserCreationScreen : MonoBehaviour
|
||||
// Set background color
|
||||
background.color = selectedAvatar == i ? Color.blue : Color.gray;
|
||||
// Find correct component for setting the sprite
|
||||
foreach (Image img in background.GetComponentsInChildren<Image>())
|
||||
if (img != background)
|
||||
{
|
||||
img.sprite = sprites[i];
|
||||
break;
|
||||
}
|
||||
instance.transform.Find("Image").GetComponent<Image>().sprite = sprites[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,8 +117,7 @@ public class UserCreationScreen : MonoBehaviour
|
||||
{
|
||||
// Create a new entry in the UserList ScriptableObject
|
||||
users.ChangeCurrentUser(users.CreateAndAddNewUser(username, sprites[selectedAvatar]));
|
||||
// TODO: change scene, for now just change to StartScreen
|
||||
SceneManager.LoadScene("Common/Scenes/StartScreen");
|
||||
SystemController.GetInstance().BackToPreviousScene();
|
||||
}
|
||||
// Warn user that username already exists
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user