using System; using System.Collections; using System.Collections.Generic; using System.Linq; using ScrewsMaster; using DG.Tweening; using DG.Tweening.Core; using DG.Tweening.Plugins.Options; using FairyGUI; using FGUI.G018_GameHome; using Roy.Datas; using Roy.ObjectPool; using SGame; using UnityEngine; using UnityEngine.Serialization; using UnityEngine.UI; using Image = UnityEngine.UI.Image; using Random = UnityEngine.Random; public class ShowScrews : MonoBehaviour, ICanvasRaycastFilter { [FormerlySerializedAs("Cheaps")][SerializeField] private GameObject cheaps;//板子创建的父节点 [FormerlySerializedAs("BoxStartPos")][SerializeField] private Transform boxStartPos;//box的初始创建位置 [FormerlySerializedAs("Panel")][SerializeField] private GameObject panel; [FormerlySerializedAs("AddHole")][SerializeField] private Button addHole; [FormerlySerializedAs("MergeBox")][SerializeField] private Button mergeBox; [FormerlySerializedAs("ClearHole")][SerializeField] private Button clearHole; [FormerlySerializedAs("CacheArea")][SerializeField] public GameObject cacheArea; [FormerlySerializedAs("BoxDestroy")][SerializeField] private Transform boxDestroy; [FormerlySerializedAs("Box1_pay")][SerializeField] private GameObject box1Pay; [FormerlySerializedAs("Box2_pay")][SerializeField] private GameObject box2Pay; public Button errorBtn; //单例 public static ShowScrews Instance; private readonly List _panelTypeColors = new List() { "#F7AB25", "#FAE93F", "#52D0FF", "#87B4FF", "#90F050", "#FF96D4", "#BE9DFF", "#B27388", "#F5716D", }; //板子层级的类型 public Dictionary ScrewsType = new Dictionary() { {1,"lsd1" }, {2,"lsd2" }, {3,"lsd3" }, {4,"lsd4" }, {5,"lsd5" }, {6,"lsd6" }, {7,"lsd7" }, {8,"lsd8" }, {9,"lsd9" }, }; //螺丝的类型对应的颜色集合 public static readonly List ScrewColors = new List() { "#B0661D", "#1E7DAF", "#558C20", "#7456AD", "#BC4542", "#C88D1C", "#4071C3", "#CA579B", "#814559", }; private RectTransform _panelRect; private void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } } public Camera myCamera; void Start() { myCamera = GetComponent().worldCamera; _panelRect = panel.transform as RectTransform; if (Screen.safeArea.y != 0 && topRectTransform != null) { var newPos = topRectTransform.anchoredPosition; newPos.y -= Screen.safeArea.y; topRectTransform.anchoredPosition = newPos; // 获取当前图片距离底部的距离 float topPadding = _panelRect.offsetMax.y; // 设置上部距离 _panelRect.offsetMax = new Vector2(_panelRect.offsetMax.x, topPadding - Screen.safeArea.y); // 保持底部距离不变 // panelTransform.offsetMin = new Vector2(panelTransform.offsetMin.x, bottomPadding); } maskImg.gameObject.SetActive(true); Init(); box1Pay.GetComponent