void Awake() { FillFullNameData(transform); m_mogoNoticeTitles = transform.FindChild(m_widgetToFullName["MogoNoticeTitles"]).gameObject; m_mogoNoticeContents = transform.FindChild(m_widgetToFullName["MogoNoticeContents"]).gameObject; m_contentsDragCamera = transform.FindChild(m_widgetToFullName["MogoNoticeContentsBG"]).gameObject.AddComponent <SimpleDragCamera>(); m_titleDragCamera = transform.FindChild(m_widgetToFullName["MogoNoticeTitlesBG"]).gameObject.AddComponent <SimpleDragCamera>(); m_contentsDragCamera.RelatedCamera = GetTransformByName("MogoNoticeContentsCamera").GetComponent <Camera>(); m_titleDragCamera.RelatedCamera = GetTransformByName("MogoNoticeTitlesCamera").GetComponent <Camera>(); m_contentsDragCamera.beginTransform = GetTransformByName("MogoNoticeContentsBegin"); m_titleDragCamera.beginTransform = GetTransformByName("MogoNoticeTitlesBegin"); m_contentHeight = (int)GetTransformByName("MogoNoticeContentsBG").localScale.y; m_titleHeight = (int)GetTransformByName("MogoNoticeTitlesBG").localScale.y; GetTransformByName("MogoNoticeMaskBG").gameObject.AddComponent <MogoBgClose>(); Camera camera = GameObject.Find("GlobleUICamera").GetComponent <Camera>(); GetComponent <UIStretch>().uiCamera = camera; GameObject.Find("MogoNoticeContentsCamera").GetComponent <UIViewport>().sourceCamera = camera; GameObject.Find("MogoNoticeTitlesCamera").GetComponent <UIViewport>().sourceCamera = camera; GameObject.Find("MogoNoticeTitlesCamera").GetComponent <UIViewport>().sourceCamera = camera; Instance = GetComponent <MogoNotice>(); AssetCacheMgr.GetUIResource(CONTENT_PREFAB, (obj) => { GameObject go = obj as GameObject; UILabel lable = go.transform.FindChild("MogoNoticeContentText").GetComponent <UILabel>(); m_contentLabel = lable; contentLineWidth = lable.lineWidth; contentFontSize = lable.font.size; } ); Reset(); gameObject.SetActive(false); }
void Awake() { FillFullNameData(transform); m_mogoNoticeTitles = transform.FindChild(m_widgetToFullName["MogoNoticeTitles"]).gameObject; m_mogoNoticeContents = transform.FindChild(m_widgetToFullName["MogoNoticeContents"]).gameObject; m_contentsDragCamera = transform.FindChild(m_widgetToFullName["MogoNoticeContentsBG"]).gameObject.AddComponent<SimpleDragCamera>(); m_titleDragCamera = transform.FindChild(m_widgetToFullName["MogoNoticeTitlesBG"]).gameObject.AddComponent<SimpleDragCamera>(); m_contentsDragCamera.RelatedCamera = GetTransformByName("MogoNoticeContentsCamera").GetComponent<Camera>(); m_titleDragCamera.RelatedCamera = GetTransformByName("MogoNoticeTitlesCamera").GetComponent<Camera>(); m_contentsDragCamera.beginTransform = GetTransformByName("MogoNoticeContentsBegin"); m_titleDragCamera.beginTransform = GetTransformByName("MogoNoticeTitlesBegin"); m_contentHeight = (int)GetTransformByName("MogoNoticeContentsBG").localScale.y; m_titleHeight = (int)GetTransformByName("MogoNoticeTitlesBG").localScale.y; GetTransformByName("MogoNoticeMaskBG").gameObject.AddComponent<MogoBgClose>(); Camera camera = GameObject.Find("GlobleUICamera").GetComponent<Camera>(); GetComponent<UIStretch>().uiCamera = camera; GameObject.Find("MogoNoticeContentsCamera").GetComponent<UIViewport>().sourceCamera = camera; GameObject.Find("MogoNoticeTitlesCamera").GetComponent<UIViewport>().sourceCamera = camera; GameObject.Find("MogoNoticeTitlesCamera").GetComponent<UIViewport>().sourceCamera = camera; Instance = GetComponent<MogoNotice>(); AssetCacheMgr.GetUIResource(CONTENT_PREFAB, (obj) => { GameObject go = obj as GameObject; UILabel lable = go.transform.FindChild("MogoNoticeContentText").GetComponent<UILabel>(); m_contentLabel = lable; contentLineWidth = lable.lineWidth; contentFontSize = lable.font.size; } ); Reset(); gameObject.SetActive(false); }