private void SetSysInfo(GameObject sysobj, string sys_mes) { GameObject txtobj = sysobj.transform.Find("mes").gameObject; txtobj.GetComponentDefault <Chathyperlink>().gettxt = sys_mes; Chathyperlink Pic = txtobj.GetComponentDefault <Chathyperlink>(); Pic.gameObject.SetActive(true); Pic.text = sys_mes; Pic.Set(); Pic.text = Pic.gettxt; float width = Pic.preferredWidth; float height = Pic.preferredHeight; RectTransform sysobj_height = sysobj.GetComponent <RectTransform>(); if (width <= 423f) { sysobj_height.sizeDelta = new Vector2(sysobj_height.sizeDelta.x, 33f);//设置图片的宽高 } else { ContentSizeFitter a = Pic.gameObject.GetComponent <ContentSizeFitter>(); a.horizontalFit = ContentSizeFitter.FitMode.Unconstrained; sysobj_height.sizeDelta = new Vector2(sysobj_height.sizeDelta.x, height + 8f);//设置图片的宽高 } SetPostion(sysobj); }
private DataSource <PBulletin> m_noticeInfo; //公告提醒 protected override void OnOpen() { anmounttext = ConfigManager.Get <ConfigText>((int)TextForMatType.NoticeUIText); if (anmounttext == null) { anmounttext = ConfigText.emptey; Logger.LogError("this id can not"); } SetText(); m_rectContent = GetComponent <RectTransform>("right_iteminfo_panel/Scroll View/Viewport/content"); Infoplane = GetComponent <RectTransform>("right_iteminfo_panel").gameObject; Notice_item = GetComponent <RectTransform>("Notic_ScrollView").gameObject; Active_item = GetComponent <RectTransform>("Active_ScrollView").gameObject; Active_btn = GetComponent <Toggle>("right_labelgroup/active"); Annount_btn = GetComponent <Toggle>("right_labelgroup/announcement"); Active_hint = GetComponent <Image>("right_labelgroup/active/new_img"); Annount_hint = GetComponent <Image>("right_labelgroup/announcement/new_img"); Title_back_img = GetComponent <Image>("right_iteminfo_panel/Scroll View/Viewport/content/title_bg_img"); Subtitle_txt = GetComponent <Text>("right_iteminfo_panel/Scroll View/Viewport/content/subtitle_text"); Contxt_one = GetComponent <Chathyperlink>("right_iteminfo_panel/Scroll View/Viewport/content/content_text_1"); ConImg = GetComponent <Image>("right_iteminfo_panel/Scroll View/Viewport/content/noticecontent_img"); conTmgTxt = GetComponent <Text>("right_iteminfo_panel/Scroll View/Viewport/content/title_bg_img/bg_txt"); Contxt_two = GetComponent <Chathyperlink>("right_iteminfo_panel/Scroll View/Viewport/content/content_txt2"); Go_btn = GetComponent <Button>("right_iteminfo_panel/go_btn"); ConImg.SafeSetActive(false); Contxt_two.SafeSetActive(false); Active_btn.onValueChanged.AddListener(delegate { if (Active_btn.isOn) { SetBtnClick(0, moduleAnnouncement.ActiveList); } }); Annount_btn.onValueChanged.AddListener(delegate { if (Annount_btn.isOn) { SetBtnClick(1, moduleAnnouncement.NoticeList); } }); m_activeInfo = new DataSource <PBulletin>(moduleAnnouncement.ActiveList, GetComponent <ScrollView>("Active_ScrollView"), SetAllInfo, Onclick); m_noticeInfo = new DataSource <PBulletin>(moduleAnnouncement.NoticeList, GetComponent <ScrollView>("Notic_ScrollView"), SetAllInfo, Onclick); HintShow(); }
void Get() { generalInfo = GeneralConfigInfo.defaultConfig; obj = transform.Find("GameObject").gameObject; headbgmask = obj.transform.Find("head_img/mask").gameObject; head_btn = obj.transform.Find("head_img").GetComponent <Button>(); chatname = obj.transform.Find("name").GetComponent <Text>(); img_txt = obj.transform.Find("mes_img").GetComponent <Image>(); mes_txt = img_txt.gameObject.transform.Find("mes").GetComponent <Chathyperlink>(); img_img = obj.transform.Find("img_bg").GetComponent <Image>(); //img_voice = obj.transform.Find("Sound recording").GetComponent<Image>(); // mes_btn = obj.transform.Find("Sound recording").GetComponent<Button>(); // mes_btn_txt = img_voice.transform.Find("Text").GetComponent<Text>(); ID = obj.transform.Find("ID").GetComponent <Text>(); id_key = obj.transform.Find("key").GetComponent <Text>(); img_txt?.SafeSetActive(false); img_img?.SafeSetActive(false); }
protected override void Start() { sendtxt = transform.Find("clone").GetComponent <Chathyperlink>(); }
private void Get() { not_pos = gameObject.GetComponent <RectTransform>(); text_notice = gameObject.GetComponent <Chathyperlink>(); }