12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class PageItem : MonoBehaviour
- {
- public int page;
- public Text text;
- public PageBtnControl pageBtnControl;
- public int itemNum;
- public Image image;
- private void Start()
- {
- pageBtnControl = transform.parent.gameObject.GetComponent<PageBtnControl>();
- image = transform.GetComponent<Image>();
- transform.GetComponent<Button>().onClick.AddListener(OnClick);
- page = itemNum;
- }
- public void UpdatePage( int Page)
- {
- this.page = Page;
- text.text = page.ToString();
- image.color = Color.white;
- }
- public void UpdateString( string str)
- {
- text.text = str;
- image.color = Color.white;
- this.page = -1;
- }
- public void OnClick()
- {
- if(text.text !=page.ToString())
- {
- pageBtnControl.UpdateMiddleData(itemNum);
- }
- else
- {
- pageBtnControl.updateData(itemNum, page);
- }
-
- }
- public void ShowUI()
- {
- image.color = Color.blue;
- }
- }
|