//生成海报 IEnumerator CreatePosters() { if (PostersManager.GetInstance().type == 1) { var a = PostersManager.GetInstance().outpatientInfoList.FirstOrDefault(t => t.name == PostersManager.GetInstance().theCurrentOpcName); if (a == null) { Debug.Log("指定门诊不存在!"); yield return(null); } else { StartScreenShot(a); Debug.Log("结束!"); } } else { foreach (var item in PostersManager.GetInstance().outpatientInfoList) { StartScreenShot(item); yield return(new WaitUntil(() => true)); } Debug.Log("结束!"); operationView.gameObject.SetActive(true); } }
IEnumerator SaveImage(string path) { ScreenCapture.CaptureScreenshot(path, 5); yield return(new WaitUntil(() => true)); //yield return new WaitForSeconds(1); Debug.Log(path.Split('/')[6] + "--海报生成成功!!"); if (PostersManager.GetInstance().type == 1) { operationView.gameObject.SetActive(true); } }
public void ScreenShot(string outpatientName) { System.DateTime now = System.DateTime.Now; string times = now.ToString(); times = times.Trim(); times = times.Replace("/", "-"); operationView.gameObject.SetActive(false); string pathSave = PostersManager.GetInstance().GetPosterPath(outpatientName) + "/" + PostersManager.GetInstance().index + ".png"; StartCoroutine(SaveImage(pathSave)); }
/// <summary> /// Called on app start if script is enabled. /// </summary> public void Start() { Texture = new Texture2D(128, 128) { filterMode = FilterMode.Point }; Gradient.sprite = Sprite.Create(Texture, new Rect(0f, 0f, Texture.width, Texture.height), new Vector2(0.5f, 0.5f), 100f); SetColor(Color); CompareLook[0].color = Color; sizeSlider.onValueChanged.AddListener((a) => { PostersManager.GetInstance().TextSize = (int)a; sizeText.text = sizeSlider.value.ToString(); }); }
public void StartMake() { if (PostersManager.GetInstance().type == 1 && opcName.text == "") { tips.text = "请输入指定门诊"; return; } PostersManager.GetInstance().theCurrentOpcName = opcName.text; PostersManager.GetInstance().theCurrentFestival = fname.text; PostersManager.GetInstance().CreateInfoPath(); gameObject.SetActive(false); MainView.SetActive(true); PostersManager.GetInstance().index = int.Parse(index.text); }
private void StartScreenShot(OutpatientInfo item) { string logoPath = Application.streamingAssetsPath + "/门诊信息/" + item.name + "/Logo/"; string QrCodePath = Application.streamingAssetsPath + "/门诊信息/" + item.name + "/二维码/"; SetImage(logoPath, logo, item.logoPos.x, item.logoPos.y, item.logoSize.x, item.logoSize.y); SetImage(QrCodePath, qRCode); address.text = (item.phoneNum + "|" + item.address).Replace('|', '\n'); //phoneNum.text = item.phoneNum==""?"": ; if (PostersManager.GetInstance().theCurrentFestival == "营销海报") { content.text = item.content.Replace('|', '\n'); } ScreenShot(item.name); }
private void Update() { sizeSlider.value = float.Parse(sizeText.text); PostersManager.GetInstance().TextColor = Color; }
public void SetType(int a) { PostersManager.GetInstance().type = a; Select.SetActive(false); }