public void Replace(HeadFrameView item) { if (item.isOwn) { Frame_img.sprite = ResourceMgr.Instance.LoadSprite(item.id); item.isUse.SetActive(true); for (int i = 0; i < FrameList.Count; i++) { if (FrameList[i].id != item.id) { FrameList[i].isUse.SetActive(false); } } } else { CanvasView.Instance.AddNotice("请解锁头像框!"); } }
/// <summary> /// 初始化头像框 /// </summary> /// <param name="frameid"></param> /// <param name="isopen"></param> public void FrameInit(List <int> frameid, bool isopen) { if (isopen) { if (frameid == null) { Frame_obj.SetActive(true); return; } if (frameid.Count > FrameList.Count) { for (int i = 0; i < frameid.Count; i++) { if (i % 2 == 0) { HeadFrameView head = InitItemInfo(false, HaveClear_trf).GetComponent <HeadFrameView>(); head.Init(); head.isOwn = true; head.Endow(frameid[i]); FrameList.Add(head); } else { HeadFrameView head = InitItemInfo(false, NotClears_trf).GetComponent <HeadFrameView>(); head.Init(); head.isOwn = false; head.Endow(frameid[i]); FrameList.Add(head); } } NotClearRect.anchoredPosition = new Vector2(0, -(HaveClear.cellSize.y * HaveClear_trf.childCount + (HaveRect.offsetMax.y * 2))); } } else { Frame_obj.SetActive(false); } float y = NotClearRect.anchoredPosition.y + -(NotClears_trf.childCount * NotClear.cellSize.y); Control.offsetMin = new Vector2(0, y - HaveRect.offsetMin.y); Control.offsetMax = Vector2.zero; }