You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PlumberUltimateAds/Assets/CustomUI.cs

107 lines
1.8 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CustomUI : MonoBehaviour
{
// Start is called before the first frame update
public GameObject First, Left, Right;
public Sprite Incomplete, Complete, Active,Filled;
public Image CheckPoint;
public bool filledbool;
public int CurrentLevel;
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void SetUi(int level,int completed)
{
if (level == 1)
{
Debug.Log("level is " + level + " and completed count is " + completed);
}
if ((level - 4) % 6 == 0)
{
//Enable Right Here
Right.SetActive(true);
if (level <= completed)
{
Right.transform.GetChild(0).GetComponent<Image>().sprite = Filled;
//Add highLight here
}
}
else if (level % 6 == 1 && level != 1)
{
//Enable Left here
Left.SetActive(true);
if (level <= completed)
{
//Add highLight here
Left.transform.GetChild(0).GetComponent<Image>().sprite = Filled;
}
}
if (level <= completed)
{
First.transform.GetChild(0).GetComponent<Image>().sprite = Filled;
CheckPoint.sprite = Complete;
}
else
{
CheckPoint.sprite = Incomplete;
}
if (level == completed+1)
{
CheckPoint.sprite = Active;
}
}
}
//6,12,18,24,30,36,42
//7,13,19,25,31,37,43
//4,5,6
//10,11,12
//16,17,18
//22,23,24
//28,29,30
//34.35.36
//40,41,42
//46,47,48