Initial commit
This commit is contained in:
37
Assets/Resources/Scripts/UI/AverageDataDisplay.cs
Normal file
37
Assets/Resources/Scripts/UI/AverageDataDisplay.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class AverageDataDisplay : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private List<Answer> data = new List<Answer>();
|
||||
[SerializeField] private List<float> responseTimeList = new List<float>();
|
||||
|
||||
[SerializeField] private TextMeshProUGUI stageText;
|
||||
[SerializeField] private TextMeshProUGUI jumlahSalahText;
|
||||
[SerializeField] private TextMeshProUGUI responseTimeText;
|
||||
|
||||
public void SetData(List<Answer> data, Level level)
|
||||
{
|
||||
int jumlahSalah = 0;
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
if (data[i].level == level)
|
||||
{
|
||||
this.data.Add(data[i]);
|
||||
responseTimeList.Add(data[i].responseTime);
|
||||
if (!data[i].correct)
|
||||
{
|
||||
jumlahSalah++;
|
||||
}
|
||||
}
|
||||
}
|
||||
float average = responseTimeList.Average();
|
||||
stageText.text = "Stage : " + level.ToString();
|
||||
jumlahSalahText.text = "Jumlah Salah : " + jumlahSalah.ToString();
|
||||
responseTimeText.text = "Rata Rata Response Time : " + average.ToString("F1") + "s";
|
||||
}
|
||||
}
|
11
Assets/Resources/Scripts/UI/AverageDataDisplay.cs.meta
Normal file
11
Assets/Resources/Scripts/UI/AverageDataDisplay.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 104d6574fb136aa46b03339eb07ed2c5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
39
Assets/Resources/Scripts/UI/CameraColorController.cs
Normal file
39
Assets/Resources/Scripts/UI/CameraColorController.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraColorController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Camera cam;
|
||||
[SerializeField] private Color menuColor;
|
||||
[SerializeField] private Color colorProtan;
|
||||
[SerializeField] private Color colorDeutan;
|
||||
[SerializeField] private Color colorTritan;
|
||||
[SerializeField] private float duration;
|
||||
|
||||
public void ChangeColor(Level level)
|
||||
{
|
||||
if (level == Level.Protan)
|
||||
{
|
||||
LeanTween.value(gameObject, UpdateColor, menuColor, colorProtan, duration)
|
||||
.setEase(LeanTweenType.easeInOutQuad);
|
||||
} else if (level == Level.Deutan)
|
||||
{
|
||||
LeanTween.value(gameObject, UpdateColor, colorProtan, colorDeutan, duration)
|
||||
.setEase(LeanTweenType.easeInOutQuad);
|
||||
} else if (level == Level.Tritan)
|
||||
{
|
||||
LeanTween.value(gameObject, UpdateColor, colorDeutan, colorTritan, duration)
|
||||
.setEase(LeanTweenType.easeInOutQuad);
|
||||
}
|
||||
}
|
||||
public void ChangeColorToMenu()
|
||||
{
|
||||
LeanTween.value(gameObject, UpdateColor, colorTritan, menuColor, duration)
|
||||
.setEase(LeanTweenType.easeInOutQuad);
|
||||
}
|
||||
public void UpdateColor(Color color)
|
||||
{
|
||||
cam.backgroundColor = color;
|
||||
}
|
||||
}
|
11
Assets/Resources/Scripts/UI/CameraColorController.cs.meta
Normal file
11
Assets/Resources/Scripts/UI/CameraColorController.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1141b8ce6e53e2a499ea762a5349fb7d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
40
Assets/Resources/Scripts/UI/DetailDataDisplay.cs
Normal file
40
Assets/Resources/Scripts/UI/DetailDataDisplay.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DetailDataDisplay : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Answer data;
|
||||
[SerializeField] private TextMeshProUGUI levelText;
|
||||
[SerializeField] private TextMeshProUGUI stageText;
|
||||
[SerializeField] private TextMeshProUGUI isCorrectText;
|
||||
[SerializeField] private TextMeshProUGUI responseTimeText;
|
||||
[SerializeField] private Image bg;
|
||||
[SerializeField] private Color differentColorModeColor;
|
||||
[SerializeField] private Color sameColorModeColor;
|
||||
|
||||
public void SetData(Answer data)
|
||||
{
|
||||
this.data = data;
|
||||
levelText.text = "Level " +data.globalStage.ToString();
|
||||
stageText.text = "Stage " +data.level.ToString();
|
||||
if (data.correct)
|
||||
{
|
||||
isCorrectText.text = "Menjawab Benar";
|
||||
}
|
||||
else {
|
||||
isCorrectText.text = "Menjawab Salah ";
|
||||
}
|
||||
responseTimeText.text = "Response Time :" + data.responseTime.ToString("F1")+"s";
|
||||
if (data.stageLevel == Stage.Differentcolor)
|
||||
{
|
||||
bg.color = differentColorModeColor;
|
||||
}
|
||||
else {
|
||||
bg.color = sameColorModeColor;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
11
Assets/Resources/Scripts/UI/DetailDataDisplay.cs.meta
Normal file
11
Assets/Resources/Scripts/UI/DetailDataDisplay.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50fcd948d6d41284193f80addb075a3c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
27
Assets/Resources/Scripts/UI/ExampleDisplay.cs
Normal file
27
Assets/Resources/Scripts/UI/ExampleDisplay.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class ExampleDisplay : UIManager
|
||||
{
|
||||
[SerializeField] private Image image;
|
||||
[SerializeField] private Image mascotImage;
|
||||
[SerializeField] private Image thumbsImage;
|
||||
[SerializeField] private TextMeshProUGUI displayText;
|
||||
public void Display(Sprite sprite,string displayString)
|
||||
{
|
||||
Show();
|
||||
LeanTween.scale(image.gameObject, new Vector3(1.5f,1.5f,1.5f), 0.25f).setEaseInOutCubic();
|
||||
//LeanTween.scale(mascotImage.gameObject, new Vector3(0.75f, 0.75f, 0.75f), 0.25f).setEaseInOutCubic();
|
||||
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0,0,30), 0.25f).setEaseInOutCubic();
|
||||
LeanTween.rotate(mascotImage.gameObject, new Vector3(0,0,30), 0.25f).setEaseInOutCubic();
|
||||
LeanTween.scale(image.gameObject, new Vector3(1,1,1), 0.5f).setDelay(0.2f).setEaseInOutCubic();
|
||||
LeanTween.scale(displayText.gameObject, new Vector3(0.75f, 0.75f, 0.75f), 0.25f).setEaseInOutCubic();
|
||||
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, 0), 0.25f).setDelay(0.2f).setEaseInOutCubic();
|
||||
LeanTween.rotate(mascotImage.gameObject, new Vector3(0, 0, 0), 0.25f).setDelay(0.2f).setEaseInOutCubic();
|
||||
LeanTween.scale(displayText.gameObject, new Vector3(1,1,1), 0.5f).setDelay(0.2f).setEaseInOutCubic();
|
||||
//LeanTween.scale(mascotImage.gameObject, new Vector3(1,1,1), 0.5f).setDelay(0.2f).setEaseInOutCubic();
|
||||
image.sprite = sprite;
|
||||
displayText.text = displayString;
|
||||
}
|
||||
}
|
11
Assets/Resources/Scripts/UI/ExampleDisplay.cs.meta
Normal file
11
Assets/Resources/Scripts/UI/ExampleDisplay.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21f171aa80bb06041b97cb6bfcb0c676
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
139
Assets/Resources/Scripts/UI/GameUI.cs
Normal file
139
Assets/Resources/Scripts/UI/GameUI.cs
Normal file
@ -0,0 +1,139 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GameUI : UIManager
|
||||
{
|
||||
[SerializeField] private GameManager gameManager;
|
||||
[SerializeField] private DotsManager dotsManager;
|
||||
[SerializeField] private TextMeshProUGUI levelText;
|
||||
[SerializeField] private TextMeshProUGUI stageText;
|
||||
[SerializeField] private TextMeshProUGUI resultText;
|
||||
[SerializeField] private TextMeshProUGUI rankText;
|
||||
[SerializeField] private TextMeshProUGUI correctText;
|
||||
[SerializeField] private GameObject mainMenuButton;
|
||||
[SerializeField] private GameObject showSummaryButton;
|
||||
[SerializeField] private Slider progressBar;
|
||||
|
||||
[SerializeField] private float targetProgress;
|
||||
private float fillspeed = 1f;
|
||||
|
||||
[SerializeField] private SummaryDisplay summaryDisplay;
|
||||
|
||||
[SerializeField] private SalahDisplay salahDisplay;
|
||||
[SerializeField] private ExampleDisplay exampleDisplay;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
gameManager.OnShowResult += ShowResult;
|
||||
gameManager.OnAnswer += ShowCorrect;
|
||||
gameManager.OnNext += Next;
|
||||
gameManager.OnGlobalStageAdded += DisplayProgressBar;
|
||||
}
|
||||
private void DisplayProgressBar(int val)
|
||||
{
|
||||
float progress = (float)((float)val / 33f);
|
||||
targetProgress = progress;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
progressBar.value = Mathf.Lerp(progressBar.value, targetProgress, fillspeed * Time.deltaTime);
|
||||
}
|
||||
public void OpenSummary()
|
||||
{
|
||||
summaryDisplay.Show();
|
||||
}
|
||||
public void CloseSummary()
|
||||
{
|
||||
summaryDisplay.Hide();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
ToggleMainMenuButton(false);
|
||||
ToggleSummaryButton(false);
|
||||
}
|
||||
public void ToggleMainMenuButton(bool val)
|
||||
{
|
||||
mainMenuButton.SetActive(val);
|
||||
}
|
||||
public void ToggleSummaryButton(bool val)
|
||||
{
|
||||
showSummaryButton.SetActive(val);
|
||||
}
|
||||
public void Next()
|
||||
{
|
||||
ResetCorrect();
|
||||
AudioManager.Instance.PlaySfx("Mulai Game");
|
||||
}
|
||||
public void GoToMainMenu()
|
||||
{
|
||||
ToggleSummaryButton(false);
|
||||
ToggleMainMenuButton(false);
|
||||
resultText.text = "";
|
||||
rankText.text = "";
|
||||
GameManager.Instance.GoToMenu();
|
||||
}
|
||||
public void ShowCorrect(bool val,int currentStage)
|
||||
{
|
||||
levelText.text = "";
|
||||
stageText.text = "";
|
||||
if (val)
|
||||
{
|
||||
exampleDisplay.Display(dotsManager.GetCurrentLevel().displaySprite[currentStage], dotsManager.GetCurrentLevel().displayString[currentStage]);
|
||||
}
|
||||
else {
|
||||
salahDisplay.Display();
|
||||
}
|
||||
}
|
||||
public void ResetCorrect()
|
||||
{
|
||||
salahDisplay.Hide();
|
||||
exampleDisplay.Hide();
|
||||
correctText.text = "";
|
||||
}
|
||||
public void ShowResult(float result)
|
||||
{
|
||||
ResetCorrect();
|
||||
ToggleMainMenuButton(true);
|
||||
ToggleSummaryButton(true);
|
||||
levelText.text = "";
|
||||
stageText.text = "";
|
||||
string rank;
|
||||
if (result > 2.8f)
|
||||
{
|
||||
rank = "A";
|
||||
}
|
||||
else if (result > 2.4f)
|
||||
{
|
||||
rank = "B";
|
||||
}
|
||||
else if (result > 1.8f)
|
||||
{
|
||||
rank = "C";
|
||||
}
|
||||
else if (result > 1f)
|
||||
{
|
||||
rank = "D";
|
||||
}
|
||||
else {
|
||||
rank = "E";
|
||||
}
|
||||
rankText.text = rank.ToString();
|
||||
float finalScore = (result / 3f) * 100f;
|
||||
resultText.text = "Kamu Dapat " +rank +" , dengan skor "+ finalScore.ToString("F0");
|
||||
//fuzzy logic
|
||||
if (result > 2.4f)
|
||||
{
|
||||
resultText.text += "\n(Tinggi, Mata aman)";
|
||||
}
|
||||
else if (result > 1.5f)
|
||||
{
|
||||
resultText.text += "\n(Sedang, Zona Abu Abu)";
|
||||
}
|
||||
else {
|
||||
resultText.text += "\n(Rendah, Buta Warna)";
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Resources/Scripts/UI/GameUI.cs.meta
Normal file
11
Assets/Resources/Scripts/UI/GameUI.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0978fda385cc544188a2090dbc29a5a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
53
Assets/Resources/Scripts/UI/GuideManager.cs
Normal file
53
Assets/Resources/Scripts/UI/GuideManager.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class GuideManager : UIManager
|
||||
{
|
||||
[SerializeField] private Image imageDisplay;
|
||||
[SerializeField] private TextMeshProUGUI textDisplay;
|
||||
[SerializeField] private TextMeshProUGUI indexDisplay;
|
||||
|
||||
[TextArea]
|
||||
[SerializeField] private string[] textList;
|
||||
[SerializeField] private Sprite[] imageList;
|
||||
|
||||
[SerializeField] private int currentIndex;
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
currentIndex = 0;
|
||||
DisplayGuide();
|
||||
}
|
||||
public void Next()
|
||||
{
|
||||
if (currentIndex < imageList.Length - 1)
|
||||
{
|
||||
currentIndex++;
|
||||
AudioManager.Instance.PlaySfx("Click");
|
||||
DisplayGuide();
|
||||
}
|
||||
}
|
||||
public void Prev()
|
||||
{
|
||||
if (currentIndex > 0)
|
||||
{
|
||||
currentIndex--;
|
||||
DisplayGuide();
|
||||
AudioManager.Instance.PlaySfx("Click");
|
||||
}
|
||||
}
|
||||
private void DisplayGuide()
|
||||
{
|
||||
imageDisplay.sprite = imageList[currentIndex];
|
||||
textDisplay.text = textList[currentIndex];
|
||||
indexDisplay.text = "(" + (currentIndex + 1) + " / " + imageList.Length + " )";
|
||||
}
|
||||
public void Close()
|
||||
{
|
||||
AudioManager.Instance.PlaySfx("Click");
|
||||
Hide();
|
||||
}
|
||||
}
|
11
Assets/Resources/Scripts/UI/GuideManager.cs.meta
Normal file
11
Assets/Resources/Scripts/UI/GuideManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07ee3511a775cd24a8552dfe9196db35
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
24
Assets/Resources/Scripts/UI/GuideUI.cs
Normal file
24
Assets/Resources/Scripts/UI/GuideUI.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
public class GuideUI : UIManager
|
||||
{
|
||||
[SerializeField] private TextMeshProUGUI guideText;
|
||||
|
||||
|
||||
|
||||
public void Show(string theText)
|
||||
{
|
||||
base.Show();
|
||||
guideText.text = theText;
|
||||
guideText.transform.localScale = new Vector3(1, 1, 1);
|
||||
LeanTween.scale(guideText.gameObject, new Vector3(1.25f, 1.25f, 1.25f), 1).setLoopPingPong();
|
||||
}
|
||||
public override void Hide()
|
||||
{
|
||||
base.Hide();
|
||||
LeanTween.cancel(guideText.gameObject);
|
||||
}
|
||||
}
|
11
Assets/Resources/Scripts/UI/GuideUI.cs.meta
Normal file
11
Assets/Resources/Scripts/UI/GuideUI.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9476eb98d272a16419b46074ff30078a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Resources/Scripts/UI/MainMenuUI.cs
Normal file
8
Assets/Resources/Scripts/UI/MainMenuUI.cs
Normal file
@ -0,0 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MainMenuUI : UIManager
|
||||
{
|
||||
|
||||
}
|
11
Assets/Resources/Scripts/UI/MainMenuUI.cs.meta
Normal file
11
Assets/Resources/Scripts/UI/MainMenuUI.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d48241b288895b64ba70bb09c4843044
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Resources/Scripts/UI/PauseUI.cs
Normal file
8
Assets/Resources/Scripts/UI/PauseUI.cs
Normal file
@ -0,0 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PauseUI : UIManager
|
||||
{
|
||||
|
||||
}
|
11
Assets/Resources/Scripts/UI/PauseUI.cs.meta
Normal file
11
Assets/Resources/Scripts/UI/PauseUI.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04c18e6eaf4774447b6c5917e9655ade
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
31
Assets/Resources/Scripts/UI/SalahDisplay.cs
Normal file
31
Assets/Resources/Scripts/UI/SalahDisplay.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using UnityEngine.UI;
|
||||
public class SalahDisplay : UIManager
|
||||
{
|
||||
[SerializeField] private TextMeshProUGUI salahText;
|
||||
[SerializeField] private Image mascotImage;
|
||||
[SerializeField] private Image thumbsImage;
|
||||
[SerializeField] private List<string> variasiText = new List<string>();
|
||||
public void Display()
|
||||
{
|
||||
Show();
|
||||
salahText.text = "Kamu Salah";
|
||||
LeanTween.scale(salahText.gameObject, new Vector3(1.5f, 1.5f, 1.5f), 0.25f).setEaseInOutCubic();
|
||||
LeanTween.scale(salahText.gameObject, new Vector3(1, 1, 1), 0.5f).setDelay(0.2f).setEaseInOutCubic();
|
||||
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, -30), 0.25f).setEaseInOutCubic();
|
||||
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, 0), 0.25f).setDelay(0.2f).setEaseInOutCubic();
|
||||
StartCoroutine(SalahDelay());
|
||||
}
|
||||
private IEnumerator SalahDelay()
|
||||
{
|
||||
yield return new WaitForSeconds(1f);
|
||||
LeanTween.scale(salahText.gameObject, new Vector3(1.5f, 1.5f, 1.5f), 0.25f).setEaseInOutCubic();
|
||||
LeanTween.scale(salahText.gameObject, new Vector3(1, 1, 1), 0.5f).setDelay(0.2f).setEaseInOutCubic();
|
||||
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, -30), 0.25f).setEaseInOutCubic();
|
||||
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, 0), 0.25f).setDelay(0.2f).setEaseInOutCubic();
|
||||
salahText.text = variasiText[Random.Range(0, variasiText.Count)];
|
||||
}
|
||||
}
|
11
Assets/Resources/Scripts/UI/SalahDisplay.cs.meta
Normal file
11
Assets/Resources/Scripts/UI/SalahDisplay.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35b8222270fb18b42a6aded426356fa9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
32
Assets/Resources/Scripts/UI/SameDotsBenarDisplay.cs
Normal file
32
Assets/Resources/Scripts/UI/SameDotsBenarDisplay.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class SameDotsBenarDisplay : UIManager
|
||||
{
|
||||
[SerializeField] private TextMeshProUGUI salahText;
|
||||
[SerializeField] private Image mascotImage;
|
||||
[SerializeField] private Image thumbsImage;
|
||||
//[SerializeField] private List<string> variasiText = new List<string>();
|
||||
public void Display()
|
||||
{
|
||||
Show();
|
||||
//salahText.text = "Kamu Salah";
|
||||
//LeanTween.scale(salahText.gameObject, new Vector3(1.5f, 1.5f, 1.5f), 0.25f).setEaseInOutCubic();
|
||||
//LeanTween.scale(salahText.gameObject, new Vector3(1, 1, 1), 0.5f).setDelay(0.2f).setEaseInOutCubic();
|
||||
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, -30), 0.25f).setEaseInOutCubic();
|
||||
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, 0), 0.25f).setDelay(0.2f).setEaseInOutCubic();
|
||||
StartCoroutine(SalahDelay());
|
||||
}
|
||||
private IEnumerator SalahDelay()
|
||||
{
|
||||
yield return new WaitForSeconds(1f);
|
||||
//LeanTween.scale(salahText.gameObject, new Vector3(1.5f, 1.5f, 1.5f), 0.25f).setEaseInOutCubic();
|
||||
//LeanTween.scale(salahText.gameObject, new Vector3(1, 1, 1), 0.5f).setDelay(0.2f).setEaseInOutCubic();
|
||||
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, -30), 0.25f).setEaseInOutCubic();
|
||||
LeanTween.rotate(thumbsImage.gameObject, new Vector3(0, 0, 0), 0.25f).setDelay(0.2f).setEaseInOutCubic();
|
||||
// salahText.text = variasiText[Random.Range(0, variasiText.Count)];
|
||||
}
|
||||
}
|
11
Assets/Resources/Scripts/UI/SameDotsBenarDisplay.cs.meta
Normal file
11
Assets/Resources/Scripts/UI/SameDotsBenarDisplay.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b11ee3b5d37a2a46a5a361a943d9093
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
64
Assets/Resources/Scripts/UI/SummaryDisplay.cs
Normal file
64
Assets/Resources/Scripts/UI/SummaryDisplay.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
public class SummaryDisplay : UIManager
|
||||
{
|
||||
|
||||
[SerializeField] private Transform parent;
|
||||
[SerializeField] private DetailDataDisplay detailDataDisplayPrefab;
|
||||
[SerializeField] private AverageDataDisplay averageDataDisplayPrefab;
|
||||
[SerializeField] private TextMeshProUGUI showText;
|
||||
|
||||
[SerializeField] private bool isShowingAverage;
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
isShowingAverage = true;
|
||||
ShowAverage();
|
||||
}
|
||||
public void ToggleShow()
|
||||
{
|
||||
if (isShowingAverage)
|
||||
{
|
||||
isShowingAverage = false;
|
||||
ShowDetail();
|
||||
showText.text = "Tampilkan Rata-Rata";
|
||||
}
|
||||
else {
|
||||
isShowingAverage = true;
|
||||
ShowAverage();
|
||||
showText.text = "Tampilkan Detail";
|
||||
}
|
||||
}
|
||||
private void ShowAverage()
|
||||
{
|
||||
foreach (Transform t in parent)
|
||||
{
|
||||
Destroy(t.gameObject);
|
||||
}
|
||||
List<Answer> answers = GameManager.Instance.GetAnswers();
|
||||
AverageDataDisplay Protan = Instantiate(averageDataDisplayPrefab, parent);
|
||||
Protan.SetData(answers, Level.Protan);
|
||||
AverageDataDisplay Deutan = Instantiate(averageDataDisplayPrefab, parent);
|
||||
Deutan.SetData(answers, Level.Deutan);
|
||||
AverageDataDisplay Tritan = Instantiate(averageDataDisplayPrefab, parent);
|
||||
Tritan.SetData(answers, Level.Tritan);
|
||||
}
|
||||
private void ShowDetail()
|
||||
{
|
||||
foreach (Transform t in parent)
|
||||
{
|
||||
Destroy(t.gameObject);
|
||||
}
|
||||
List<Answer> answers = GameManager.Instance.GetAnswers();
|
||||
for (int i = 0; i < answers.Count; i++)
|
||||
{
|
||||
DetailDataDisplay p = Instantiate(detailDataDisplayPrefab, parent);
|
||||
p.SetData(answers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
11
Assets/Resources/Scripts/UI/SummaryDisplay.cs.meta
Normal file
11
Assets/Resources/Scripts/UI/SummaryDisplay.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 234d71201bdfd03479285497530226b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
16
Assets/Resources/Scripts/UI/UIManager.cs
Normal file
16
Assets/Resources/Scripts/UI/UIManager.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Canvas canvas;
|
||||
public virtual void Show()
|
||||
{
|
||||
canvas.enabled = true;
|
||||
}
|
||||
public virtual void Hide()
|
||||
{
|
||||
canvas.enabled = false;
|
||||
}
|
||||
}
|
11
Assets/Resources/Scripts/UI/UIManager.cs.meta
Normal file
11
Assets/Resources/Scripts/UI/UIManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f946136b507d30f44a44263cafd89a33
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user