35 lines
830 B
C#
35 lines
830 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class UpdateWindowSystem : MonoBehaviour
|
|
{
|
|
[Serializable]
|
|
public class NewsClass
|
|
{
|
|
public Sprite image;
|
|
|
|
public string title;
|
|
|
|
public string contnet;
|
|
}
|
|
|
|
[SerializeField]
|
|
private GameObject newWindowPrefab;
|
|
|
|
public List<NewsClass> classList;
|
|
|
|
private int startIndex;
|
|
|
|
public void ShowUpdate()
|
|
{
|
|
NewsItem component = UnityEngine.Object.Instantiate(newWindowPrefab, UnityEngine.Object.FindObjectOfType<MainGameScene>().gameObject.transform).GetComponent<NewsItem>();
|
|
component.image = classList[startIndex].image;
|
|
component.title = classList[startIndex].title;
|
|
component.content = classList[startIndex].contnet;
|
|
component.actualIndex = startIndex;
|
|
component.listSize = classList.Count;
|
|
component.updateWindowSystem = this;
|
|
}
|
|
}
|