public void SetGrey(bool isGrey) { mIsGrey = isGrey; if (mShowingInfo != null) { mShowingInfo.SetGrey(isGrey); } }
IEnumerator Load(string fileName) { RemovePhotoFrame(); ObjectWrapper ow = new ObjectWrapper(); yield return(ResourceLoader.Instance.StartCoroutine(ObjCachePoolMgr.Instance.LoadPrefab(fileName, ObjCachePoolType.UI_PREFAB, fileName, ow))); GameObject photoFrameGO = ow.obj as GameObject; if (photoFrameGO == null) { //Debug.Log("UIPhotoFrameWidget photoFrameGO null "); yield break; } RectTransform rect = photoFrameGO.GetComponent <RectTransform>(); if (rect == null) { //Debug.Log("UIPhotoFrameWidget photoFrameGO rect "); yield break; } GameObject.DontDestroyOnLoad(photoFrameGO); if (this == null || gameObject == null || transform == null || fileName != mShowingFileName) { //Debug.Log("UIPhotoFrameWidget photoFrameGO return "); ObjCachePoolMgr.Instance.RecyclePrefab(photoFrameGO, ObjCachePoolType.UI_PREFAB, fileName); yield break; } RemovePhotoFrame(); rect.parent = transform; rect.SetAsFirstSibling(); rect.localEulerAngles = Vector3.zero; float scale = mRect.sizeDelta.x / DefaultSize; rect.localScale = new Vector3(scale, scale, 1); //rect.anchorMin = new Vector2(0, 1); //rect.anchorMax = new Vector2(0, 1); //rect.pivot = new Vector2(0.5f, 0.5f); rect.anchoredPosition3D = Vector3.zero; mShowingInfo = new PhotoFrameInfo(fileName, photoFrameGO); mShowingInfo.SetGrey(mIsGrey); StopLoadCoroutine(); }