// Adds a point where the blip currently is private void AddPoint(UILine line, Vector3 pos) { Vector3 myPos = new Vector3(pos.x, pos.y, pos.z); line.line.Push(myPos, myPos, Vector3.zero, lineWidth); line.line.EditPoint(line.line.Count - 2, myPos, lineWidth); }
IEnumerator StartRoutine() { m_line = UILine.CreateLine(transform); m_line.transform.SetAsFirstSibling(); m_line.line.option.divideLength = 100; while (m_line.line.Count < list.Count) { m_line.line.Push(); } while (true) { float t = 0f; m_line.line.option.startRatio = 0; m_line.line.option.endRatio = 0; while (t < 1f) { t += Time.deltaTime; m_line.line.option.endRatio = t; yield return(null); } t = 0f; while (t < 1f) { t += Time.deltaTime; m_line.line.option.startRatio = t; yield return(null); } } }
public void LineUnhovered(UILine line) { if (HoveredLine == line) { HideHoveredLine(); } }
// Moves blip up and down in succession to represent a heartbeat private IEnumerator PerformHeartbeat(UILine line) { AddPoint(line, blip.position); yield return(new WaitForSeconds(0.01f)); float max = Random.Range(HalfHeight * 0.8f, HalfHeight); blip.localPosition = new Vector3(blip.localPosition.x, max, 0); // Top point AddPoint(line, blip.position); yield return(new WaitForSeconds(0.03f)); blip.localPosition = new Vector3(blip.localPosition.x, -max, 0); // Bottom point opposite of top point AddPoint(line, blip.position); yield return(new WaitForSeconds(0.02f)); float secondPulse = max * Random.Range(0.4f, 0.7f); blip.localPosition = new Vector3(blip.localPosition.x, secondPulse, 0); AddPoint(line, blip.position); yield return(new WaitForSeconds(0.02f)); blip.localPosition = new Vector3(blip.localPosition.x, secondPulse * 0.8f, 0); AddPoint(line, blip.position); yield return(new WaitForSeconds(0.03f)); blip.localPosition = new Vector3(blip.localPosition.x, 0, 0); AddPoint(line, blip.position); if (bpmText != null) { bpmText.text = beatsPerMinute.ToString("F0") + " BPM"; } }
public void SetChannel(ChannelElement c) { Channel = c; this.ulbChannelName.Text = string.IsNullOrEmpty(c.Text) ? c.Name : c.Text; Channel.ShowOrHideChanged += Channel_ShowOrHideChanged; for (int i = 0; i < this.Controls.Count; i++) { if (this.Controls[i].GetType() == typeof(Sunny.UI.UILabel)) { UILabel label = (UILabel)this.Controls[i]; label.SetStyle(GasMonitorManager.MainForm.Style); label.ForeColor = Color.White; } else if (this.Controls[i].GetType() == typeof(Sunny.UI.UILine)) { UILine line = (UILine)this.Controls[i]; line.SetStyle(GasMonitorManager.MainForm.Style); line.ForeColor = Color.Red; } else if (this.Controls[i].GetType() == typeof(Sunny.UI.UISymbolLabel)) { UISymbolLabel line = (UISymbolLabel)this.Controls[i]; line.SetStyle(GasMonitorManager.MainForm.Style); line.ForeColor = Color.White; line.SymbolColor = Color.Green; } } //设置曲线 }
private void ClearHighlight() { if (HighlightedLine != null) { HighlightedLine.HighlightLine(false); HighlightedLine = null; } }
// Resets a line so it's ready for the next pass private void ResetLine(UILine line) { line.line.Clear(); Vector3 pos = new Vector3(StartWorldX, transform.position.y, 0); line.line.Push(pos, lineWidth); line.line.Push(pos, lineWidth); }
public void HighlightLine(int ln) { ClearHighlight(); var line = Lines.FirstOrDefault(l => l.LineNumber == ln); line.HighlightLine(true); HighlightedLine = line; }
public void LineHovered(UILine line) { HideHoveredLine(); if (!line.ReadOnly) { HoveredLine = line; HoveredLine.ShowNewLine(true); } }
public void StartAndResetUILine(UILine line) { if (activeContext != null) { activeContext.LineExit(); } curUILine = line; _UILineDic.AddOrReplace(line, new UIContext()); activeContext = _UILineDic[line]; }
public void SetChannel(ChannelElement c, ChannelAlarm channelAlarm) { ChannelAlarm = channelAlarm; Channel = c; Channel.ShowOrHideChanged += Channel_ShowOrHideChanged; this.ulbChannelName.Text = string.IsNullOrEmpty(c.Text) ? c.Name : c.Text; for (int i = 0; i < this.Controls.Count; i++) { if (this.Controls[i].GetType() == typeof(Sunny.UI.UILabel)) { UILabel label = (UILabel)this.Controls[i]; label.SetStyle(GasMonitorManager.MainForm.Style); label.ForeColor = Color.White; } else if (this.Controls[i].GetType() == typeof(Sunny.UI.UILine)) { UILine line = (UILine)this.Controls[i]; line.SetStyle(GasMonitorManager.MainForm.Style); line.ForeColor = Color.Red; } else if (this.Controls[i].GetType() == typeof(Sunny.UI.UISymbolLabel)) { UISymbolLabel line = (UISymbolLabel)this.Controls[i]; line.SetStyle(GasMonitorManager.MainForm.Style); line.ForeColor = Color.White; line.SymbolColor = Color.Green; } } //配置报价参数 if (channelAlarm != null) { ParaAlarm O2Alarm = channelAlarm.ParaAlarms.Find(x => x.Name == "O2"); ParaAlarm COAlarm = channelAlarm.ParaAlarms.Find(x => x.Name == "CO"); ParaAlarm CO2Alarm = channelAlarm.ParaAlarms.Find(x => x.Name == "CO2"); ParaAlarm H2SAlarm = channelAlarm.ParaAlarms.Find(x => x.Name == "H2S"); this.ucbO2Enable.Checked = O2Alarm != null && O2Alarm.Enable == "1" ? true : false; this.ucbCO2Enable.Checked = CO2Alarm != null && CO2Alarm.Enable == "1" ? true : false; this.ucbCOEnable.Checked = COAlarm != null && COAlarm.Enable == "1" ? true : false; this.ucbH2SEnable.Checked = H2SAlarm != null && H2SAlarm.Enable == "1" ? true : false; decimal Low = 0; decimal High = 0; uudCOLow.Value = decimal.TryParse(COAlarm.Low, out Low) ? Low : 0; uudCOHigh.Value = decimal.TryParse(COAlarm.High, out High) ? High : 0; uudCO2Low.Value = decimal.TryParse(CO2Alarm.Low, out Low) ? Low : 0; uudCO2High.Value = decimal.TryParse(CO2Alarm.High, out High) ? High : 0; uudH2SLow.Value = decimal.TryParse(H2SAlarm.Low, out Low) ? Low : 0; uudH2SHigh.Value = decimal.TryParse(H2SAlarm.High, out High) ? High : 0; uudO2Low.Value = decimal.TryParse(O2Alarm.Low, out Low) ? Low : 0; uudO2High.Value = decimal.TryParse(O2Alarm.High, out High) ? High : 0; } }
public void BlankLine(UILine line) { int index = Lines.IndexOf(line); UILine blankLine = Instantiate(BlankLinePrefab, LineContainer); blankLine.Init(line.LineNumber, false); Lines[index].gameObject.SetActive(false); DestroyImmediate(Lines[index]); Lines[index] = blankLine; }
public void AddNewLine(UILine line) { int index = Lines.IndexOf(line); var newline = Instantiate(StatementPrefab, LineContainer); newline.Init(line.LineNumber, false); Lines[index].gameObject.SetActive(false); Lines[index].Destroy(); Lines[index] = newline; }
public void StartUILine(UILine line) { if (activeContext != null) { activeContext.LineExit(); } curUILine = line; if (!_UILineDic.ContainsKey(line)) { _UILineDic.Add(line, new UIContext()); } activeContext = _UILineDic[line]; activeContext.LineStart(); }
public void StartAndResetUILine(UILine line) { if (isBlackTrans) { funcQueue.Enqueue(delegate() { StartAndResetUILine(line); }); return; } if (activeContext != null) { activeContext.LineExit(); } _UILineDic.AddOrReplace(line, new UIContext()); activeContext = _UILineDic[line]; }
public void StartUILine(UILine line) { if (isBlackTrans) { funcQueue.Enqueue(delegate() { StartUILine(line); }); return; } if (activeContext != null) { activeContext.LineExit(); } if (!_UILineDic.ContainsKey(line)) { _UILineDic.Add(line, new UIContext()); } activeContext = _UILineDic[line]; activeContext.LineStart(); }
private void Start() { m_line = GetComponent <UILine>(); }
protected void InitUI() { this.SuspendLayout(); //背景 UIImage backImg = new UIImage(); backImg.Padding = new Padding(1); backImg.Dock = DockStyle.Fill; backImg.AnimationRandom = true; backImg.AddFrame(Color.FromArgb(30, 30, 30)); backImg.AddFrame(Color.FromArgb(50, 50, 50)); backImg.AddFrame(Color.FromArgb(70, 70, 70)); this.UIControls.Add(backImg); //标题 this.caption = new UILabel(); this.caption.Height = 25; this.caption.Dock = DockStyle.Top; this.caption.Text = this.Text; this.caption.TextAlign = ContentAlignment.MiddleLeft; backImg.UIControls.Add(this.caption); //分割线 UILine line = new UILine(); line.LineBlendStyle = BlendStyle.FadeInFadeOut; line.LineDashStyle = DashStyle.Dash; line.Dock = DockStyle.Top; backImg.UIControls.Add(line); //标签 UILabel lbl1 = new UILabel(); lbl1.Text = "产品: "; lbl1.Location = new Point(12, 37); lbl1.Size = new Size(39, 17); backImg.UIControls.Add(lbl1); //标签 UILabel lbl2 = new UILabel(); lbl2.Text = "版本: "; lbl2.Location = new Point(12, 70); lbl2.Size = new Size(39, 17); backImg.UIControls.Add(lbl2); //标签 UILabel lbl3 = new UILabel(); lbl3.Text = "秘钥: "; lbl3.Location = new Point(12, 103); lbl3.Size = new Size(39, 17); backImg.UIControls.Add(lbl3); //产品下拉框 this.cboProduct = new ComboBox(); this.cboProduct.Parent = this; this.cboProduct.DropDownStyle = ComboBoxStyle.DropDownList; this.cboProduct.BackColor = this.BackColor; this.cboProduct.ForeColor = this.ForeColor; this.cboProduct.Location = new Point(57, 34); this.cboProduct.Size = new Size(238, 25); ProductCode[] productCodes = (ProductCode[])Enum.GetValues(typeof(ProductCode)); var values = productCodes.Select(a => new { Text = a.ToString().Replace('_', ' '), Value = a }).ToList(); this.cboProduct.DataSource = values; this.cboProduct.DisplayMember = "Text"; this.cboProduct.ValueMember = "Value"; this.cboProduct.SelectedValue = ProductCode.Xmanager_Enterprise; //版本文本框 this.nudVersion = new NumericUpDown(); this.nudVersion.Parent = this; this.nudVersion.BorderStyle = BorderStyle.FixedSingle; this.nudVersion.BackColor = this.BackColor; this.nudVersion.ForeColor = this.ForeColor; this.nudVersion.Location = new Point(57, 68); this.nudVersion.Size = new Size(238, 23); this.nudVersion.Minimum = ProductCollection.Default.Min(a => a.Version); this.nudVersion.Maximum = ProductCollection.Default.Max(a => a.Version); this.nudVersion.Value = this.nudVersion.Maximum; //秘钥文本框 this.txtKey = new TextBox(); this.txtKey.Parent = this; this.txtKey.BorderStyle = BorderStyle.FixedSingle; this.txtKey.BackColor = this.BackColor; this.txtKey.ForeColor = this.ForeColor; this.txtKey.ReadOnly = true; this.txtKey.Location = new Point(57, 100); this.txtKey.Size = new Size(238, 23); //生成秘钥 this.btnGen = new UIButton(); this.btnGen.Location = new Point(57, 132); this.btnGen.Size = new Size(75, 23); this.btnGen.Text = "生成秘钥"; backImg.UIControls.Add(this.btnGen); //关闭 this.btnClose = new UIButton(); this.btnClose.Location = new Point(220, 132); this.btnClose.Size = new Size(75, 23); this.btnClose.Text = "关闭"; backImg.UIControls.Add(this.btnClose); this.ResumeLayout(); }
/// <summary> /// 初始化界面 /// </summary> protected virtual void InitUI() { this.SuspendLayout(); // this.imgBackground = new UIImage(); this.imgBackground.Name = "imgBackground"; this.imgBackground.Dock = DockStyle.Fill; this.imgBackground.AnimationRandom = true; this.imgBackground.AddFrame(Resources.background0); this.imgBackground.AddFrame(Resources.background1); this.imgBackground.AddFrame(Resources.background2); this.imgBackground.AddFrame(Resources.background3); this.imgBackground.AddFrame(Resources.background4); this.imgBackground.AddFrame(Resources.background5); this.imgBackground.AddFrame(Resources.background6); this.imgBackground.AddFrame(Resources.background7); // this.lblHeader = new UILabel(); this.lblHeader.Name = "lblHeader"; this.lblHeader.Dock = DockStyle.Top; this.lblHeader.Height = 75; this.lblHeader.Padding = new Padding(60, 0, 0, 10); this.lblHeader.Font = new Font("微软雅黑", 23F); this.lblHeader.ForeColor = Color.FromArgb(200, 255, 255, 255); this.lblHeader.Text = this.Text; this.lblHeader.TextAlign = ContentAlignment.BottomLeft; this.lblHeader.TextRenderingHint = TextRenderingHint.AntiAlias; // this.lnHeader = new UILine(); this.lnHeader.Name = "lnHeader"; this.lnHeader.Dock = DockStyle.Top; this.lnHeader.Height = 2; this.lnHeader.LineWidth = 2; this.lnHeader.LineColor = Color.FromArgb(40, 255, 255, 255); this.lnHeader.LineDashStyle = DashStyle.Dash; this.lnHeader.Padding = new Padding(1, 0, 1, 0); // this.lblFooter = new UILabel(); this.lblFooter.Name = "lblFooter"; this.lblFooter.Dock = DockStyle.Bottom; this.lblFooter.Height = 75; // this.lnFooter = new UILine(); this.lnFooter.Name = "lnFooter"; this.lnFooter.Dock = DockStyle.Bottom; this.lnFooter.Height = 2; this.lnFooter.LineWidth = 2; this.lnFooter.LineColor = Color.FromArgb(40, 255, 255, 255); this.lnFooter.LineDashStyle = DashStyle.Dash; this.lnFooter.Padding = new Padding(1, 0, 1, 0); // this.lblLog = new UILabel(); this.lblLog.Name = "lblLog"; this.lblLog.Anchor = AnchorStyles.Left | AnchorStyles.Right; this.lblLog.Location = new Point(85, 232); this.lblLog.Size = new Size(830, 40); this.lblLog.Padding = new Padding(4); this.lblLog.Font = new Font("微软雅黑", 15F); this.lblLog.TextAlign = ContentAlignment.MiddleLeft; this.lblLog.ForeColor = Color.FromArgb(200, 255, 255, 255); this.lblLog.TextRenderingHint = TextRenderingHint.AntiAlias; // this.prgPercentage = new UIProgress(); this.prgPercentage.Name = "prgPercentage"; this.prgPercentage.Anchor = AnchorStyles.Left | AnchorStyles.Right; this.prgPercentage.Location = new Point(85, 278); this.prgPercentage.Size = new Size(830, 10); this.prgPercentage.BackColor = Color.FromArgb(20, 255, 255, 255); this.prgPercentage.BorderColor = Color.FromArgb(200, 255, 255, 255); this.prgPercentage.ProgressColor = Color.FromArgb(150, 255, 255, 255); // this.btnRetry = new UIButton(); this.btnRetry.Name = "btnRetry"; this.btnRetry.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; this.btnRetry.Location = new Point(804, 455); this.btnRetry.Size = new Size(70, 30); this.btnRetry.BackColor = Color.Transparent; this.btnRetry.HoveredBackColor = Color.FromArgb(20, 255, 255, 255); this.btnRetry.PressedBackColor = Color.FromArgb(50, 255, 255, 255); this.btnRetry.Font = new Font("微软雅黑", 12F); this.btnRetry.ForeColor = Color.FromArgb(200, 255, 255, 255); this.btnRetry.Text = "重试"; this.btnRetry.TextRenderingHint = TextRenderingHint.AntiAlias; this.btnRetry.Image = Resources.retry; this.btnRetry.ImageSize = new Size(16, 16); this.btnRetry.Visible = false; // this.btnCancel = new UIButton(); this.btnCancel.Name = "btnCancel"; this.btnCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; this.btnCancel.Location = new Point(880, 455); this.btnCancel.Size = new Size(70, 30); this.btnCancel.BackColor = Color.Transparent; this.btnCancel.HoveredBackColor = Color.FromArgb(20, 255, 255, 255); this.btnCancel.PressedBackColor = Color.FromArgb(50, 255, 255, 255); this.btnCancel.Font = new Font("微软雅黑", 12F); this.btnCancel.ForeColor = Color.FromArgb(200, 255, 255, 255); this.btnCancel.Text = "取消"; this.btnCancel.TextRenderingHint = TextRenderingHint.AntiAlias; this.btnCancel.Image = Resources.cancel; this.btnCancel.ImageSize = new Size(16, 16); // this.UIControls.Add(this.imgBackground); this.imgBackground.UIControls.Add(this.lblHeader); this.imgBackground.UIControls.Add(this.lnHeader); this.imgBackground.UIControls.Add(this.lblFooter); this.imgBackground.UIControls.Add(this.lnFooter); this.imgBackground.UIControls.Add(this.lblLog); this.imgBackground.UIControls.Add(this.prgPercentage); this.imgBackground.UIControls.Add(this.btnRetry); this.imgBackground.UIControls.Add(this.btnCancel); // this.ResumeLayout(false); }
public FrmDemo() { InitializeComponent(); image = new UIImage(); image.Dock = DockStyle.Right; image.Width = 400; this.UIControls.Add(image); // line = new UILine(); line.Location = new Point(300, 270); line.Size = new Size(500, 50); line.LineBlendStyle = BlendStyle.FadeInFadeOut; line.LineWidth = 2; line.LineDashStyle = DashStyle.Dash; this.UIControls.Add(line); // label = new UILabel(); label.Location = new Point(250, 200); label.Size = new Size(100, 50); label.Font = new Font("微软雅黑", 13f); label.Text = "测试文本测试文本测试文本测试文本测试文本"; this.UIControls.Add(label); // progress = new UIProgress(); progress.Location = new Point(300, 200); progress.Percentage = 20; progress.Size = new Size(600, 50); progress.Anchor = AnchorStyles.None; this.UIControls.Add(progress); // btnOut = new UIButton(); btnOut.Size = new Size(300, 100); btnOut.Location = new Point(10, 20); btnOut.Dock = DockStyle.None; btnOut.UIParent = this; btnOut.Name = "out"; btnOut.Text = btnOut.Name; btnOut.Font = new Font(btnOut.Font.FontFamily, 45f); btnOut.TextRenderingHint = TextRenderingHint.AntiAlias; btnOut.Click += (sender, e) => Console.WriteLine("单击out"); this.UIControls.Add(btnOut); // btnInner2 = new UIButton(); btnInner2.Size = new Size(50, 20); btnInner2.Location = new Point(55, 55); btnInner2.UIParent = this.btnOut; btnInner2.Name = "in2"; btnInner2.Text = btnInner2.Name; btnInner2.Click += (sender, e) => MessageBox.Show("单击in2"); this.btnOut.UIControls.Add(btnInner2); // btnInner = new UIButton(); btnInner.Size = new Size(50, 20); btnInner.Location = new Point(5, 15); btnInner.UIParent = this.btnOut; btnInner.Name = "in"; btnInner.Text = btnInner.Name; btnInner.Click += (sender, e) => Console.WriteLine("单击in"); this.btnOut.UIControls.Add(btnInner); // marquee = new UIMarquee(); marquee.Size = new Size(801, 4); marquee.Location = new Point(100, 200); marquee.BorderColor = Color.Transparent; this.marquee.BackColor = Color.Transparent; marquee.Dock = DockStyle.Bottom; marquee.ProgressColor = Color.DodgerBlue; this.UIControls.Add(this.marquee); this.marquee.SendToBack(); // link = new UILink(); link.Size = new Size(40, 15); link.Location = new Point(500, 10); this.link.Font = new Font("微软雅黑", 10f, GraphicsUnit.Point); link.Text = "换一张"; this.UIControls.Add(this.link); // link2 = new UILink(); link2.Size = new Size(40, 15); link2.Location = new Point(540, 10); link2.Text = "换一张"; this.UIControls.Add(this.link2); }