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); }
public void Delay(string notice) { Get(); times = 0; text_notice.text = notice; text_notice.Set(); text_notice.text = text_notice.gettxt; m_width = text_notice.preferredWidth; not_pos.anchoredPosition = Vector3.zero;//固定起始位置 GeneralConfigInfo generalInfo = GeneralConfigInfo.defaultConfig; float multiple = (m_width + generalInfo.strat_diatance) / generalInfo.move_diatance; float thistime = multiple * generalInfo.move_time; Vector3 newvalue = Vector3.zero; Tweener tween = not_pos.DOLocalMoveX(-(m_width + generalInfo.strat_diatance), thistime);//公告移动速度 tween.SetUpdate(true); tween.SetEase(Ease.Linear); Maxtime = (m_width / (m_width + generalInfo.strat_diatance)) * thistime; istrue = false; tween.OnComplete(() => { if (!istrue) { istrue = true; times = 0; Module_Global.instance.DelayNext(); } Module_Global.instance.CloseNotice(); GameObject.Destroy(gameObject); }); }
private void SetPlaneInfo(PBulletin info)//获取所有信息 传进plane 显示具体信息 { if (info == null) { return; } foreach (Transform item in Title_back_img.transform) { item.SafeSetActive(false); } UIDynamicImage.LoadImage(Title_back_img.transform, info.icon, null, true); conTmgTxt.SafeSetActive(!string.IsNullOrEmpty(info.icon)); Util.SetText(Subtitle_txt, string.Format(" {0}", info.conTitle)); Util.SetText(conTmgTxt, info.iconDesc); Contxt_one.text = info.content; Contxt_one.Set(); RectTransform rt = conTmgTxt.GetComponentDefault <RectTransform>(); rt.anchoredPosition = new Vector3(info.positionX, info.positionY, 0); var openWindow = -1; var openLable = -1; if (!info.turnPage.Contains("-")) { var type = Util.Parse <int>(info.turnPage); Go_btn.gameObject.SetActive(type > 0); openWindow = Util.Parse <int>(info.turnPage); } else { Go_btn.SafeSetActive(true); string[] str = info.turnPage.Split('-'); openWindow = Util.Parse <int>(str[0]); openLable = Util.Parse <int>(str[1]); } Go_btn.onClick.RemoveAllListeners(); Go_btn.onClick.AddListener(delegate { moduleAnnouncement.OpenWindow(openWindow, openLable); }); }
private void SetOtherTxt(string content) { string[] split = new string[1] { "[sprit=" }; string[] txt = content.Split(split, StringSplitOptions.RemoveEmptyEntries); if (txt.Length > 1) { Contxt_one.text = txt[0]; Contxt_one.Set(); string[] txt1 = txt[1].Split(']'); if (txt1.Length > 1) { Contxt_two.text = txt1[1]; Contxt_two.Set(); } string Imgname = txt1[0]; if (Imgname == "0") { ConImg.gameObject.SetActive(false); } else { string[] NameId = Imgname.Split(':'); ConImg.gameObject.SetActive(true); AtlasHelper.SetIcons(ConImg, NameId[0]); if (NameId.Length > 1) { Button Click = ConImg.gameObject.GetComponentDefault <Button>(); Click.onClick.AddListener(delegate { moduleGlobal.UpdateGlobalTip(ushort.Parse(NameId[1]), true); }); } } } }
public void caht_show(int type, string content, bool Isme, int headboxid, int playerSend = 0)//接收的还是自己的世界的还是好友的,那个类型的,信息 { //0 世界的接受的 //1世界我发的 2好友接收的 3 好友我发的 只有在0的情况下头像才可以点击(isshow) //type 0,文本 1,图片 2 语音 headBoxFriend headBoxa = head_btn.gameObject.GetComponentDefault <headBoxFriend>(); headBoxa.HeadBox(headboxid); if (!Isme) { Module_Avatar.SetClassAvatar(headbgmask, m_proto, false, Gender); } if (type == 0) { img_txt.gameObject.SetActive(true); if (playerSend == 0) { mes_txt.supportRichText = false; mes_txt.text = content; mes_txt.Set(); } else { mes_txt.supportRichText = true; mes_txt.text = content; mes_txt.Set(); mes_txt.text = mes_txt.gettxt; } float width = mes_txt.preferredWidth; float height = mes_txt.preferredHeight; if (width <= generalInfo.ChatMax) { img_txt.rectTransform.sizeDelta = new Vector2(width + generalInfo.ChatTxtWidth, generalInfo.ChatTxtHeight); //设置图片的宽高 RectTransform my_height = gameObject.GetComponent <RectTransform>(); my_height.sizeDelta = new Vector2(my_height.sizeDelta.x, generalInfo.ChatAllHeight); //设置整个背景的高度 This_height = generalInfo.ChatAllHeight; } else { ContentSizeFitter a = mes_txt.gameObject.GetComponentDefault <ContentSizeFitter>(); a.horizontalFit = ContentSizeFitter.FitMode.Unconstrained; img_txt.rectTransform.sizeDelta = new Vector2(generalInfo.OverChatTxtWidth, height + generalInfo.OverChatTxtHeight); //设置图片的宽高 RectTransform my_height = gameObject.GetComponent <RectTransform>(); my_height.sizeDelta = new Vector2(my_height.sizeDelta.x, height + generalInfo.OverChatBackHeight); //设置整个背景的高度 This_height = height + generalInfo.OverChatBackHeight; } } else if (type == 1) { id_key.text = content; mes_txt.text = string.Empty; img_img.gameObject.SetActive(true); //FaceName icon = ConfigManager.Get<FaceName>(Int32.Parse(content));//用id获取图片名称 GameObject a = Level.GetPreloadObject(content); if (a != null) { a.transform.SetParent(img_img.transform); a.transform.localScale = new Vector3(1, 1, 1); RectTransform sss = a.GetComponent <RectTransform>(); sss.anchoredPosition = new Vector3(0, 0, 0); sss.localPosition = new Vector3(0, 0, 0); } RectTransform my_heightimg = gameObject.GetComponent <RectTransform>(); my_heightimg.sizeDelta = new Vector2(my_heightimg.sizeDelta.x, generalInfo.ChatImgAllHeight);//设置整个背景的高度 This_height = generalInfo.ChatImgAllHeight; } else { This_height = 75f; } // mes_btn_txt.text = Util.Format("语音", time.ToString()); // mes_btn.onClick.AddListener(aa); }