using UnityEngine; using System.Collections; using UnityEngine.UI; using UnityEngine.EventSystems; using System; using System.Collections.Generic; public class EquipmentSelectedCtrl : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler { public GameObject viewEquipmentImg;//查看装备UI public GameObject viewEquipmentImgSprite;//查看装备UI的图片精灵 public GameObject equipmentSelectedImg;//标识选中装备的UI private string equipmentSpriteName;//装备精灵名 public string viewEquipmentImgSpriteName;//查看装备时装备精灵名 private RectTransform rectTransform; private Vector2 pos; private Vector2 offset = new Vector2(8f,8f); bool equipSelected; private GameObject selectEquipNum; private int pipeLineUnit = 25;//管线单位(每盘多少米) private int lifeSaveLightLineUnit = 100;//救生照明线单位(每盘多少米) private UnCostEquip unCstEquip = new UnCostEquip(); private CostEquip cstEquip = new CostEquip(); // Use this for initialization void Start () { selectEquipNum = transform.parent.parent.parent.parent.parent.Find("SelectEquipNumImage").gameObject; viewEquipmentImg = transform.parent.parent.Find("Image").gameObject; equipmentSelectedImg = Resources.Load("UIPrefab/Equipment/EquipmentSelected"); equipmentSpriteName = this.GetComponent().sprite.name; viewEquipmentImgSpriteName = equipmentSpriteName.Substring(0, equipmentSpriteName.Length - 1) + "D"; viewEquipmentImgSprite = Resources.Load("UIPrefab/Equipment/" + viewEquipmentImgSpriteName); rectTransform = viewEquipmentImg.transform as RectTransform; this.GetComponent