123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- 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;
- }
- public void CloseShowUI()
- {
- image.color = Color.white;
- }
- }
|