44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using DataModel.Model;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
/// <summary>
|
|
/// 科目列表Obj
|
|
/// </summary>
|
|
public class CurrentSubjectObj : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// 自身科目
|
|
/// </summary>
|
|
public Subject subject;
|
|
/// <summary>
|
|
/// 自身科目流程
|
|
/// </summary>
|
|
public List<SubjectStep> subjectSteps = new List<SubjectStep>();
|
|
public Sprite[] sprites;
|
|
public Sprite[] icons;
|
|
|
|
public AudioSource audioSource;
|
|
public AudioClip audioClip;
|
|
|
|
public void Btn_State()
|
|
{
|
|
Color newcolor;
|
|
ColorUtility.TryParseHtmlString("#FFB100", out newcolor);
|
|
Transform subjectParent = transform.parent;
|
|
foreach (var item in subjectParent.GetComponentsInChildren<CurrentSubjectObj>())
|
|
{
|
|
item.GetComponent<Image>().sprite = item.sprites[0];
|
|
item.GetComponentInChildren<Text>().color = Color.white;
|
|
item.transform.Find("icon").GetComponent<Image>().sprite = item.icons[0];
|
|
}
|
|
GetComponent<Image>().sprite = sprites[1];
|
|
GetComponentInChildren<Text>().color = newcolor;
|
|
transform.Find("icon").GetComponent<Image>().sprite = icons[1];
|
|
//audioSource.clip = audioClip;
|
|
audioSource.PlayOneShot(audioClip);
|
|
}
|
|
}
|