123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityGameFramework.Runtime;
- public class DevicesItemBase : MonoBehaviour
- {
- public MachineMessageData data;
- private Button itemButton;
- public Image burstImage;
- RawImage rawImage;
- Text titleText;
- Text nameText;
- private void Start()
- {
- itemButton = this.GetComponent<Button>();
- itemButton.onClick.AddListener(() =>
- {
- GameMain.Event.Fire( this,ChangeDevicesModelEvent.Create(data));
- });
- }
- public void Init()
- {
- rawImage = this.transform.Find("RawImage").GetComponent<RawImage>();
-
-
- titleText = this.transform.Find("Title1").GetComponent<Text>();
- nameText = this.transform.Find("Name").GetComponent<Text>();
- titleText.text = data.name;
- nameText.text = data.typeId;
- try
- {
- Texture2D tex = Resources.Load<Texture2D>("DevicesPic/" + data.modelName);
- rawImage.texture = tex;
- }
- catch (Exception e)
- {
- Debug.Log(e.Message);
- }
- }
- }
|