/// <summary> /// 更新位置 /// </summary> private void UpdateItem() { for (int i = 0; i < TextImage.Length; i++) { TextClass TmpScript = ScrollViewItems[i]; float TmpY; if (TmpScript.ItemLocalPosition.y >= -35 - 4 * ItemDistance && TmpScript.ItemLocalPosition.y <= -35 + 4 * ItemDistance) { TmpY = (TmpScript.ItemLocalPosition.y - (-35 + 4 * ItemDistance)) / (-8 * ItemDistance); } else if (TmpScript.ItemLocalPosition.y < (-35 - 4 * ItemDistance)) { TmpY = 1; } else { TmpY = 0; } float XValue = PositionXFactor + GetXPositionValue(TmpY); float YValue = TmpScript.ItemLocalPosition.y + Distance; if (YValue > -62.5f && YValue < 17.5f) { CenterIndex = i; } TmpScript.UpdateScrollViewItems(XValue, YValue); } }
private static SpanTagType GetSpanTagType(HtmlTokenizer.Token token, out TextClass tc) { tc = TextClass.Unknown; if (token.TagName != "span") { return(SpanTagType.NotSpanTag); } else if (token.TokenType == HtmlTokenizer.TokenType.EndTag) { return(SpanTagType.ClosingSpanTag); } else if (token.TokenType == HtmlTokenizer.TokenType.EmptyTag) { return(SpanTagType.OpeningAndClosingSpanTag); } Match m = annotRegex.Match(token.TokenStr); if (!m.Success) { return(SpanTagType.UnknownOpeningSpanTag); } int bcid = Convert.ToInt32(m.Result("${blockClassID}")); if ((bcid > 5) || (bcid < 0)) { return(SpanTagType.UnknownOpeningSpanTag); } tc = (TextClass)Math.Pow(2, bcid); return(SpanTagType.KnownOpeningSpanTag); }
/// <summary> /// 复位 /// </summary> private void ReturnItem(int Index) { TextClass TmpScript = ScrollViewItems[Index]; float TmpY = TmpScript.ItemLocalPosition.y; //Debug.Log(TmpY); if (TmpY > -34.85f && TmpY < -9f) { Distance = -0.3f; UpdateItem(); UpdateBackground(); } else if (TmpY < -35.15f && TmpY > -61f) { Distance = 0.5f; UpdateItem(); UpdateBackground(); } else if (TmpY > -19f) { Distance = -3; UpdateItem(); UpdateBackground(); } else if (TmpY < -51f) { Distance = 3; UpdateItem(); UpdateBackground(); } else { Distance = 0; } }
private void SetFadePositionLevel(int frame) { _directionPosition = (GetEffectTimeIntervalPosition(frame) * Speed) % 1; _fade = 1; if (TextSource != TextSource.None) { bool clearText = true; for (var i = 0; i < _textClass.Count; i++) { TextClass text = _textClass[i]; if (frame >= text.StartFrame && frame < text.EndFrame) { _wordIteration = i; _text = new List <string>(text.Text); switch (TextFade) { case TextFade.In: _fade = TextDuration != TextDuration.MarkDuration ? (double)(frame - text.StartFrame) / (text.Frame - text.StartFrame) : (double)(frame - text.Frame) / (text.EndFrame - text.Frame); break; case TextFade.Out: _fade = 1 - (double)(frame - text.Frame) / (text.EndFrame - text.Frame); break; case TextFade.InOut: if (TextDuration != TextDuration.MarkDuration) { _fade = frame < text.Frame ? (double)(frame - text.StartFrame) / (text.Frame - text.StartFrame) : 1 - (double)(frame - text.Frame) / (text.EndFrame - text.Frame); } else { _fade = frame < text.Frame + (text.EndFrame - text.Frame) / 2 ? (double)(frame - text.Frame) / (text.EndFrame - text.Frame) : 1 - (double)(frame - text.Frame) / (text.EndFrame - text.Frame); } break; case TextFade.None: _fade = 1; break; } if (DirectionPerWord) { _directionPosition = (double)(frame - text.StartFrame) / (text.EndFrame - text.StartFrame); } clearText = false; break; } } if (clearText) { _text.Clear(); } } }
// Use this for initialization void Start() { for (int l = 0; l < 100; l++) { message[l] = new TextClass(); } //テキストを代入 MessageText(); }
public HtmlBlock(HtmlBlock b, bool isInAnchor, double pos) { if (isInAnchor) { numTokensInsideAnchors = b.numTokensInsideAnchors; } textClass = b.textClass; relPosition = pos; }
public Node(Node parent, string featureName, Operator op, FeatureValue threshold, TextClass textClass, List <double> classDist) { this.parent = parent; this.featureName = featureName; this.op = op; this.threshold = threshold; this.textClass = textClass; this.classDist = classDist; }
public static void Start() { MathClass math = new MathClass(); System.Console.WriteLine(math.Addition(2, 3)); TextClass text = new TextClass(); System.Console.WriteLine(@"Hello World"); }
private void button6_Click(object sender, EventArgs e) { this.button6.Enabled = false; string yEn = this.textBox3.Text; string text = this.textBox5.Text; TextClass textClass1 = this.xmlHelper.TextsOK.Where <TextClass>((Func <TextClass, bool>)(x => x.Name == yEn)).FirstOrDefault <TextClass>(); if (textClass1 != null) { textClass1.Value = text; this.xmlHelper.TextsOK[textClass1.Index] = textClass1; this.listView1.Items[textClass1.Index].SubItems[2].Text = textClass1.Value; } else { TextClass textClass2 = this.xmlHelper.TextsNo.Where <TextClass>((Func <TextClass, bool>)(x => x.Name == yEn)).FirstOrDefault <TextClass>(); if (textClass2 != null) { this.xmlHelper.TextsNo.Remove(textClass2); this.listView2.Items.Remove(this.listView2.SelectedItems[0]); textClass2.Value = text; textClass2.Index = this.xmlHelper.TextsOK.Count; this.xmlHelper.TextsOK.Add(textClass2); } else { textClass2 = new TextClass(); textClass2.Name = yEn; textClass2.Value = text; textClass2.IsValue = true; textClass2.Index = this.xmlHelper.TextsOK.Count; this.xmlHelper.TextsOK.Add(textClass2); } ListViewItem listViewItem = this.listView1.Items.Add(textClass2.Index.ToString()); listViewItem.SubItems.Add(textClass2.Name); listViewItem.SubItems.Add(textClass2.Value); } try { if (this.listView2.Items.Count - 1 > this.listView2.SelectedItems[0].Index) { this.listView2.Items[this.listView2.SelectedItems[0].Index].Selected = true; this.listView2.Items[this.listView2.SelectedItems[0].Index].EnsureVisible(); } } catch (Exception ex) { Console.WriteLine((object)ex); } this.button6.Enabled = true; }
public void ReadSign(TextClass dialog) { Time.timeScale = 0; inDialog = true; AudioManager.instance.PlaySound("UIActive"); animate.SetBool("SignActive", true); blackAnimate.Play("BFadeIN"); GameObject.Find("ActionPopUp").SetActive(false); titleText.text = dialog.title; informationText.text = dialog.lines[0]; }
public void ClassMangle() { int m; var o1 = new TestClass1() { Text1 = " a ", Text2 = " b ", }; m = Energy.Base.Class.Mangle <string>(o1, delegate(string _) { return((_ as string ?? "").Trim()); }); Assert.AreEqual(2, m); Assert.AreEqual("a", o1.Text1); Assert.AreEqual("b", o1.Text2); var o2 = new { Text = "READ ONLY" }; m = Energy.Base.Class.Mangle <string>(o2, delegate(string _) { return((_ as string ?? "").Trim()); }); Assert.AreEqual(0, m); var o3 = new TestClass1() { Decimal1 = 1.2345m }; m = Energy.Base.Class.Mangle <decimal>(o3, delegate(decimal _) { return(_ - 1m); }); Assert.AreEqual(1, m); Assert.AreEqual(0.2345m, o3.Decimal1); var msg = new TextClass() { Text = "" }; if (1 == Energy.Base.Class.Mangle <string>(msg, "Text", delegate { return("Hello"); })) { Debug.WriteLine("I just set Text field or property to " + msg.Text); } var anon = new { Text = (string)null }; if (0 == Energy.Base.Class.Mangle <string>(anon, "Text", delegate { return("Hello"); })) { Debug.WriteLine("I can't change anything in anonymous object"); } m = Energy.Base.Class.Mangle <string>(o3, "Text1", delegate(string x) { return("Value1"); }); Assert.AreEqual(1, m); Assert.AreEqual("Value1", o3.Text1); }
private string GetColorName(TextClass textClass) { switch (textClass) { case TextClass.Boilerplate: return("gray"); case TextClass.FullText: return("yellow"); case TextClass.Headline: return("red"); default: return("lime"); } }
private static void addTexts(Result r, string[] lines, bool isReversed) { r.texts = new List <TextClass>(lines.Length >> 1); for (int i = 1; i < lines.Length; i++) { var t = lines[i].Trim(); if (t.Length <= 0 || t.StartsWith("#")) { continue; } var txt = new TextClass(r, t, lines[i + 1].Trim(), isReversed, Program.mainForm.WithoutPrioritiesBox.Checked); r.texts.Add(txt); i++; } }
public void StartDialog(TextClass dialog) { inDialog = true; animate.SetBool("DialogActive", true); GameObject.Find("ActionPopUp").SetActive(false); titleText.text = dialog.title; lines.Clear(); foreach (string sentence in dialog.lines) { lines.Enqueue(sentence); } DisplaySentence(); }
public string ExtractText(TextReader reader, TextClass textClass, out List <HtmlBlock> blocks) { blocks = GetHtmlBlocks(reader, false); StringBuilder sb = new StringBuilder(); TextClass tc = TextClass.Unknown; for (int i = 1; i < blocks.Count - 1; i++) { if ((tc = decisionTree.Predict(blocks[i - 1], blocks[i], blocks[i + 1])) != TextClass.Unknown) { if ((tc & textClass) > 0) { sb.Append(blocks[i].text + " "); } } } return(sb.Length == 0 ? "" : sb.ToString().Remove(sb.Length - 1)); }
public string AnnotateHtml(TextReader reader, bool encode) { List <HtmlBlock> blocks = GetHtmlBlocks(reader, false); StringBuilder sb = new StringBuilder(); TextClass tc = TextClass.Unknown; int currentIdx = 0; for (int i = 1; i < blocks.Count - 1; i++) { if ((tc = decisionTree.Predict(blocks[i - 1], blocks[i], blocks[i + 1])) != TextClass.Unknown) { int startListIdx = blocks[i].startListIdx; int startTextIdx = 0; if (tokenizer.Tokens[startListIdx].IsTag) { startTextIdx = tokenizer.Tokens[startListIdx].StartIndex; } else if (startListIdx - 1 >= 0) { startTextIdx = tokenizer.Tokens[startListIdx - 1].StartIndex + tokenizer.Tokens[startListIdx - 1].Length; } int endListIdx = blocks[i].endListIdx; int endTextIdx = tokenizer.Text.Length; if (endListIdx < tokenizer.Tokens.Count) { endTextIdx = tokenizer.Tokens[endListIdx].StartIndex; } if (currentIdx < startTextIdx) { sb.Append(encode ? HttpUtility.HtmlEncode(tokenizer.Text.Substring(currentIdx, startTextIdx - currentIdx)) : tokenizer.Text.Substring(currentIdx, startTextIdx - currentIdx)); } sb.Append(string.Format("<span title=\"{0}\" style=\"background-color:{1}\">", tc, GetColorName(tc))); sb.Append(encode ? HttpUtility.HtmlEncode(tokenizer.Text.Substring(startTextIdx, endTextIdx - startTextIdx)) : tokenizer.Text.Substring(startTextIdx, endTextIdx - startTextIdx)); sb.Append("</span>"); currentIdx = endTextIdx; } } sb.Append(encode ? HttpUtility.HtmlEncode(tokenizer.Text.Substring(currentIdx, tokenizer.Text.Length - currentIdx)) : tokenizer.Text.Substring(currentIdx, tokenizer.Text.Length - currentIdx)); return(sb.ToString()); }
private void AddList(TextClass text) { listText.Add(text); if (listText.Count > 50) { listText.RemoveAt(0); } if (listTabel != null) { if (listTabel.NowPage == 1 || listTabel.NowPage == 0) { //listTabel.SetPageGeneric (0); listTabel.SetFrist(listText, RefrshText, 10); } else { if (objHasNewMessage != null) { objHasNewMessage.SetActive(true); } } } }
protected override void init() { GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f); boxLimitLow = new Vector3(); boxLimitLow = ballLimitLow - new Vector3(ballRadius, ballRadius, ballRadius); boxLimitHigh = new Vector3(); boxLimitHigh = ballLimitHigh + new Vector3(ballRadius, ballRadius, ballRadius); paintBox = new PaintBox(); ball = new Ball(ballRadius); ball.SetLimits(ballLimitLow, ballLimitHigh); ballSpeed = new Vector3(0f, 0f, 0f); ball.SetSpeed(ballSpeed); ball.SetLightPosition(new Vector3(0f, 0f, -1f)); paintBox.SetLimits(boxLimitLow, boxLimitHigh, new Vector3(epsilon, epsilon, epsilon)); paintBox.Move(new Vector3(0f, 0f, -1f)); ball.MoveLimits(new Vector3(0f, 0f, -1f)); SetupDepthAndCull(); GL.Disable(EnableCap.CullFace); Textures.EnableTextures(); g_fzNear = 0.5f; g_fzFar = 100f; reshape(); paddles = new List<Paddle2>(); Paddle2 paddle = new Paddle2(); paddle.SetLimits(new Vector3(-1f, -1f, -0.5f), new Vector3(1f, 1f, -0.5f)); paddle.SetKeyboardControl(); paddles.Add(paddle); mousePostion = new TextClass("MousePosition", 0.4f, 0.04f, staticText); mousePostion.SetOffset(new Vector3(-0.75f, -0.75f, -0.5f)); updateProgram(); }
public HtmlBlock(HtmlBlock b, bool isInAnchor, double pos) { if (isInAnchor) numTokensInsideAnchors = b.numTokensInsideAnchors; textClass = b.textClass; relPosition = pos; }
private List <HtmlBlock> GetHtmlBlocks(TextReader reader, bool isAnnotated) { HtmlTokenizer.Enumerator tokensEnum = TokenizeHtml(reader); if (tokensEnum == null) { return(null); } int pos = 0; bool isInAnchor = false; bool isInP = false; bool isInH = false; List <HtmlBlock> blocks = new List <HtmlBlock>(); HtmlBlock prevBlock = new HtmlBlock(pos, -1); blocks.Add(prevBlock); HtmlBlock currentBlock = new HtmlBlock(++pos, 0); Stack <TextClass> textClasses = new Stack <TextClass>(); textClasses.Push(TextClass.Boilerplate); TextClass currentClass = TextClass.Boilerplate; TextClass textClass = TextClass.Unknown; while (tokensEnum.MoveNext()) { string t = tokensEnum.Current; //Console.WriteLine(t + " " + tokensEnum.CurrentToken.TokenType); if (tokensEnum.CurrentToken.IsTag) { if (mIgnoreDecorativeTags && ignorableTags.Contains(tokensEnum.CurrentToken.TagName)) { continue; } if (IsTagOpening("a", tokensEnum.CurrentToken)) { isInAnchor = true; currentBlock.Add(t, tokensEnum.CurrentToken.TokenType, false, true); } else if (IsTagClosing("a", tokensEnum.CurrentToken)) { isInAnchor = false; currentBlock.Add(t, tokensEnum.CurrentToken.TokenType, false, true); } else { if (IsTagOpening("p", tokensEnum.CurrentToken)) { isInP = true; } else if (IsTagOpening("h", tokensEnum.CurrentToken)) { isInH = true; } if (isAnnotated) { SpanTagType spanType = GetSpanTagType(tokensEnum.CurrentToken, out textClass); if (spanType != SpanTagType.NotSpanTag && spanType != SpanTagType.OpeningAndClosingSpanTag) { if ((spanType == SpanTagType.ClosingSpanTag) && (textClasses.Count > 1)) { textClasses.Pop(); } else if (spanType != SpanTagType.ClosingSpanTag) { textClasses.Push(textClass); } foreach (TextClass c in textClasses) { if (c != TextClass.Unknown) { currentClass = c; break; } } continue; } } if (currentBlock.HasWords) { currentBlock.isInP = isInP; currentBlock.isInH = isInH; currentBlock.endListIdx = tokensEnum.CurrentTokenListIdx; CalcBlockFeatures(currentBlock, prevBlock); prevBlock = currentBlock; blocks.Add(currentBlock); currentBlock = new HtmlBlock(++pos, tokensEnum.CurrentTokenListIdx + 1); } else { currentBlock.startListIdx = tokensEnum.CurrentTokenListIdx + 1; currentBlock.endListIdx = -1; } if (IsTagClosing("p", tokensEnum.CurrentToken)) { isInP = false; } else if (IsTagClosing("h", tokensEnum.CurrentToken)) { isInH = false; } } } else { currentBlock.Add(t, tokensEnum.CurrentToken.TokenType, isInAnchor, false); if (isAnnotated) { currentBlock.textClass = currentClass; } } } // flush if (currentBlock.HasWords) { currentBlock.endListIdx = tokenizer.Tokens.Count; CalcBlockFeatures(currentBlock, prevBlock); blocks.Add(currentBlock); } // dummy blocks.Add(new HtmlBlock(++pos, -1)); // calc relative position foreach (HtmlBlock b in blocks) { b.relPosition = b.relPosition / (double)(blocks.Count - 2); } return(blocks); }
public string ExtractText(TextReader reader, TextClass textClass, out List<HtmlBlock> blocks) { blocks = GetHtmlBlocks(reader, false); StringBuilder sb = new StringBuilder(); TextClass tc = TextClass.Unknown; for (int i = 1; i < blocks.Count - 1; i++) { if ((tc = decisionTree.Predict(blocks[i - 1], blocks[i], blocks[i + 1])) != TextClass.Unknown) { if ((tc & textClass) > 0) { sb.Append(blocks[i].text + " "); } } } return sb.Length == 0 ? "" : sb.ToString().Remove(sb.Length - 1); }
private int ParseLine(string line, out string featureName, out Operator op, out FeatureValue threshold, out TextClass textClass, out List <double> classDist) { featureName = null; op = Operator.Unknown; threshold = null; textClass = TextClass.Unknown; classDist = null; if (line.StartsWith("#") || String.IsNullOrEmpty(line)) { return(-1); } int level = line.Split(new char[] { '|' }, StringSplitOptions.None).Length; Match m = nodeRegex.Match(line); if (m.Success == true) { featureName = m.Result("${feature}"); string opStr = m.Result("${op}"); if (opStr == ">") { op = Operator.G; } else if (opStr == ">=") { op = Operator.GE; } else if (opStr == "<") { op = Operator.L; } else if (opStr == "<=") { op = Operator.LE; } else if (opStr == "=") { op = Operator.E; } else if (opStr == "!=") { op = Operator.NE; } else { op = Operator.Unknown; } string strThreshold = m.Result("${threshold}"); double numThreshold = 0.0; if (Double.TryParse(strThreshold, out numThreshold)) { threshold = new FeatureValue(numThreshold); } else { threshold = new FeatureValue(strThreshold); } string strClass = m.Result("${class}"); if (strClass.Length > 0) { int intTextClass = Convert.ToInt32(strClass); if ((intTextClass > 5) || (intTextClass < 0)) { textClass = TextClass.Unknown; } else { textClass = (TextClass)Math.Pow(2, intTextClass); } } else { textClass = TextClass.Unknown; } string distribution = m.Result("${distribution}"); if (distribution.Length > 0) { classDist = new List <double>(); foreach (string cd in distribution.Split(new char[1] { '/' })) { classDist.Add(Double.Parse(cd)); } } } return(level); }
private string GetColorName(TextClass textClass) { switch (textClass) { case TextClass.Boilerplate: return "gray"; case TextClass.FullText: return "yellow"; case TextClass.Headline: return "red"; default: return "lime"; } }
private static SpanTagType GetSpanTagType(HtmlTokenizer.Token token, out TextClass tc) { tc = TextClass.Unknown; if (token.TagName != "span") return SpanTagType.NotSpanTag; else if (token.TokenType == HtmlTokenizer.TokenType.EndTag) return SpanTagType.ClosingSpanTag; else if (token.TokenType == HtmlTokenizer.TokenType.EmptyTag) return SpanTagType.OpeningAndClosingSpanTag; Match m = annotRegex.Match(token.TokenStr); if (!m.Success) return SpanTagType.UnknownOpeningSpanTag; int bcid = Convert.ToInt32(m.Result("${blockClassID}")); if ((bcid > 5) || (bcid < 0)) return SpanTagType.UnknownOpeningSpanTag; tc = (TextClass)Math.Pow(2, bcid); return SpanTagType.KnownOpeningSpanTag; }
public static void Init(AppPressDemo p, TextClass Text) { Text.Help.val = "<a href='https://docs.google.com/document/d/1goW6BxoZp1WK12ZCcmg8RqVgADifn8yYZSZoGjpUeRo/edit#heading=h.a24q3ds594fi' target='_blank'><i class=\"fa fa-question-circle\"></i></a>"; Text.TextWithValidation.Help = "Regex, TitleCase, MinChars and MaxChars for First Name"; }
private int ParseLine(string line, out string featureName, out Operator op, out FeatureValue threshold, out TextClass textClass, out List<double> classDist) { featureName = null; op = Operator.Unknown; threshold = null; textClass = TextClass.Unknown; classDist = null; if (line.StartsWith("#") || String.IsNullOrEmpty(line)) return -1; int level = line.Split(new char[] { '|' }, StringSplitOptions.None).Length; Match m = nodeRegex.Match(line); if (m.Success == true) { featureName = m.Result("${feature}"); string opStr = m.Result("${op}"); if (opStr == ">") op = Operator.G; else if (opStr == ">=") op = Operator.GE; else if (opStr == "<") op = Operator.L; else if (opStr == "<=") op = Operator.LE; else if (opStr == "=") op = Operator.E; else if (opStr == "!=") op = Operator.NE; else op = Operator.Unknown; string strThreshold = m.Result("${threshold}"); double numThreshold = 0.0; if (Double.TryParse(strThreshold, out numThreshold)) threshold = new FeatureValue(numThreshold); else threshold = new FeatureValue(strThreshold); string strClass = m.Result("${class}"); if (strClass.Length > 0) { int intTextClass = Convert.ToInt32(strClass); if ((intTextClass > 5) || (intTextClass < 0)) textClass = TextClass.Unknown; else textClass = (TextClass)Math.Pow(2, intTextClass); } else textClass = TextClass.Unknown; string distribution = m.Result("${distribution}"); if (distribution.Length > 0) { classDist = new List<double>(); foreach (string cd in distribution.Split(new char[1] { '/' })) classDist.Add(Double.Parse(cd)); } } return level; }
private void SetupMarks() { IMarkCollection mc = MarkCollections.FirstOrDefault(x => x.Id == _data.MarkCollectionId); _marks = mc?.MarksInclusiveOfTime(StartTime, StartTime + TimeSpan); // Populate TextClass with start frame, mark frame and endframe if ((_text.Count > 0 || TextSource == TextSource.MarkCollectionLabels) && _marks != null) { var i = 0; var currentMark = 0; foreach (var mark in _marks) { TextClass t = new TextClass(); if (TextSource == TextSource.MarkCollectionLabels) { t.Text.Add(mark.Text); } else { foreach (string t1 in _text) { if (t1.Split(' ').Length > i) { t.Text.Add(t1.Split(' ')[i]); } } } double markTime = mark.StartTime.TotalMilliseconds - StartTime.TotalMilliseconds; t.Frame = (int)markTime / 50; t.EndFrame = (int)(mark.EndTime.TotalMilliseconds - StartTime.TotalMilliseconds) / 50; if (_textClass.Count == 0) { t.StartFrame = 0; } else { t.StartFrame = ((t.Frame - _textClass[_textClass.Count - 1].Frame) / 2) + _textClass[_textClass.Count - 1].Frame; if (TextDuration != TextDuration.MarkDuration) { _textClass[_textClass.Count - 1].EndFrame = t.StartFrame; } } if (_marks.Count() == currentMark + 1 && TextDuration != TextDuration.MarkDuration) { t.EndFrame = GetNumberFrames(); } i++; if (t.Text.Count == 0 && RepeatText) { t.Text = _textClass[0].Text; i = 1; } _textClass.Add(t); currentMark++; } } // Adjusts start and end frames for each mark depending on fade settings. for (var i = 0; i < _textClass.Count; i++) { TextClass text = _textClass[i]; if (text.Text.Count == 0) { text.Text.Add(" "); } else if (text.Text[0] == "") { text.Text[0] = " "; } switch (TextFade) { case TextFade.In: switch (TextDuration) { case TextDuration.AutoFit: if (i != 0) { text.StartFrame = _textClass[i - 1].Frame; } text.EndFrame = text.Frame; break; case TextDuration.MarkDuration: text.StartFrame = text.Frame; break; case TextDuration.UserDefined: //Gets max and min frame to compare with users Visual time setting and pick the smallest. int minFrameOffset = i != 0 ? text.Frame - _textClass[i - 1].Frame : text.Frame; text.EndFrame = text.Frame; text.StartFrame = (int)(text.Frame - Math.Min((double)TimeVisibleLength / 50, minFrameOffset)); break; } break; case TextFade.None: case TextFade.Out: switch (TextDuration) { case TextDuration.AutoFit: if (i != _textClass.Count - 1) { text.EndFrame = _textClass[i + 1].Frame; } text.StartFrame = text.Frame; break; case TextDuration.MarkDuration: text.StartFrame = text.Frame; break; case TextDuration.UserDefined: //Gets max and min frame to compare with users Visual time setting and pick the smallest. int maxFrameOffset = i != _textClass.Count - 1 ? _textClass[i + 1].Frame - text.Frame : GetNumberFrames() - text.Frame; text.StartFrame = text.Frame; text.EndFrame = (int)(text.Frame + Math.Min((double)TimeVisibleLength / 50, maxFrameOffset)); break; } break; case TextFade.InOut: switch (TextDuration) { case TextDuration.MarkDuration: text.StartFrame = text.Frame; break; case TextDuration.UserDefined: //Gets max and min frame to compare with users Visual time setting and pick the smallest. int maxFrameOffset = i != _textClass.Count - 1 ? _textClass[i + 1].Frame - text.Frame : GetNumberFrames() - text.Frame; int minFrameOffset = i != 0 ? text.Frame - _textClass[i - 1].Frame : text.Frame; text.EndFrame = (int)(text.Frame + Math.Min((double)TimeVisibleLength / 100, maxFrameOffset)); text.StartFrame = (int)(text.Frame - Math.Min((double)TimeVisibleLength / 100, minFrameOffset)); break; } break; } } }
protected override void init() { quaternionText = new TextClass(QuaternionString(), 0.5f, 0.05f, staticText, reverseRotation); quaternionText.SetOffset(textOffset); axisAngleText = new TextClass(AxisAngeString(), 0.4f, 0.04f, staticText, reverseRotation); axisAngleText.SetOffset(textOffset2); InitializeProgram(); try { meshes.Add(new Mesh("unitcubecolor.xml")); meshes.Add(new Mesh("unitcylinder.xml")); } catch (Exception ex) { throw new Exception("Error " + ex.ToString()); } SetupDepthAndCull(); reshape(); quaternionText.UpdateText(QuaternionString()); axisAngleText.UpdateText(AxisAngeString()); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.One); MatrixStack.rightMultiply = false; }
protected override void init() { GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f); boxLimitLow = new Vector3(); boxLimitLow = ballLimitLow - new Vector3(ballRadius, ballRadius, ballRadius); boxLimitHigh = new Vector3(); boxLimitHigh = ballLimitHigh + new Vector3(ballRadius, ballRadius, ballRadius); paintBox = new PaintBox(); ball = new Ball(ballRadius); ball.SetLimits(ballLimitLow, ballLimitHigh); ball.SetSocketControl(); ballSpeed = new Vector3( ballSpeedFactor + ballSpeedFactor * (float)random.NextDouble(), ballSpeedFactor + ballSpeedFactor * (float)random.NextDouble(), ballSpeedFactor + ballSpeedFactor * (float)random.NextDouble()); ball.SetSpeed(ballSpeed); ball.SetLightPosition(new Vector3(0f, 0f, -1f)); paintBox.SetLimits(boxLimitLow, boxLimitHigh, new Vector3(epsilon, epsilon, epsilon)); paintBox.Move(new Vector3(0f, 0f, -1f)); ball.MoveLimits(new Vector3(0f, 0f, -1f)); SetupDepthAndCull(); GL.Disable(EnableCap.CullFace); Textures.EnableTextures(); g_fzNear = 0.5f; g_fzFar = 100f; reshape(); paddles = new List<Paddle2>(); AddPaddle(new Vector3(-1f, -1f, -1f), new Vector3(1f, 1f, -1f)); paddles[0].SetMouseControl(); AddPaddle(new Vector3(-1f, -1f, -3f), new Vector3(1f, 1f, -3f)); paddles[BACK_PADDLE].SetNormal(new Vector3(0f, 0f, 1f)); paddles[BACK_PADDLE].UseBlock(new Vector3(0.3f, 0.3f, 0.05f)); AddPaddle(new Vector3(-1f, -1f, -3f), new Vector3(-1f, 1f, -1f)); paddles[LEFT_PADDLE].SetNormal(new Vector3(1f, 0f, 0f)); paddles[LEFT_PADDLE].UseBlock(new Vector3(0.05f, 0.3f, 0.3f)); AddPaddle(new Vector3(1f, -1f, -3f), new Vector3(1f, 1f, -1f)); paddles[RIGHT_PADDLE].SetNormal(new Vector3(-1f, 0f, 0f)); paddles[RIGHT_PADDLE].UseBlock(new Vector3(0.05f, 0.3f, 0.3f)); AddPaddle(new Vector3(-1f, 1f, -3f), new Vector3(1f, 1f, -1f)); paddles[TOP_PADDLE].SetNormal(new Vector3(0f, -1f, 0f)); paddles[TOP_PADDLE].UseBlock(new Vector3(0.3f, 0.05f, 0.3f)); AddPaddle(new Vector3(-1f, -1f, -3f), new Vector3(1f, -1f, -1f)); paddles[BOTTOM_PADDLE].SetNormal(new Vector3(0f, 1f, 0f)); paddles[BOTTOM_PADDLE].UseBlock(new Vector3(0.3f, 0.05f, 0.3f)); mousePostion = new TextClass("MousePosition", 0.4f, 0.04f, staticText); mousePostion.SetOffset(new Vector3(-0.75f, -0.75f, -0.5f)); updateProgram(); scores = new List<TextClass>(); AddScore(new Vector3(-0.6f, 0.0f, -1f), new Vector3(0f, 1f, 0f), 45f); AddScore(new Vector3(0.6f, 0.0f, -1f), new Vector3(0f, 1f, 0f), -45f); AddScore(new Vector3(0.0f, -0.45f, -1f), new Vector3(1.0f, -0f, 0f), 0f); AddScore(new Vector3(0.0f, 0.45f, -1f), new Vector3(1.0f, -0f, 0f), 0f); AddScore(new Vector3(0.0f, 0.25f, -1f), new Vector3(1.0f, -0f, 0f), 0f); AddScore(new Vector3(0.0f, -0.85f, -1f), new Vector3(1.0f, -0f, 0f), 0f); }
protected override void init() { blender = new Blender(); blender.ReadFile("test.obj"); blender.Scale(new Vector3(0.05f, 0.05f, 0.05f)); blender2 = new Blender(); blender2.ReadFile("test.obj"); blender2.SetColor(Colors.BLUE_COLOR); blender2.Scale(new Vector3(0.07f, 0.05f, 0.05f)); blender3 = new Blender(); blender3.ReadFile("X_Wing3.obj"); blender3.SetColor(Colors.WHITE_COLOR); blender3.Scale(new Vector3(0.1f, 0.1f, 0.1f)); credit1 = new TextClass("X-Wing Model based on Blender model by", 0.4f, 0.04f, staticText); credit1.SetOffset(new Vector3(-0.75f, -0.65f, 0.0f)); credit2 = new TextClass("Angel David Guzman of PixelOz Designs", 0.4f, 0.04f, staticText); credit2.SetOffset(new Vector3(-0.75f, -0.75f, 0.0f)); SetupDepthAndCull(); }
protected override void init() { ship = new Blender(); ship.ReadBinaryFile("xwng_with_normals.bin"); ship.SetColor(Colors.WHITE_COLOR); ship.Scale(currentScale); enemies = new List<Enemy>(); for (int i = 0; i < 10; i++) { Enemy enemy = new Enemy(); enemies.Add(enemy); } deadenembyText = new TextClass("Dead enemby = " + deadEnemyCount.ToString(), 0.4f, 0.04f, staticText); deadenembyText.SetOffset(new Vector3(-0.75f, +0.8f, 0.0f)); credit1 = new TextClass("X-Wing Model based on Blender model by", 0.4f, 0.04f, staticText); credit1.SetOffset(new Vector3(-0.75f, -0.65f, 0.0f)); credit2 = new TextClass("Angel David Guzman of PixelOz Designs", 0.4f, 0.04f, staticText); credit2.SetOffset(new Vector3(-0.75f, -0.75f, 0.0f)); SetupDepthAndCull(); SetupShaders(); }
public Node(Node parent, string featureName, Operator op, FeatureValue threshold, TextClass textClass, List<double> classDist) { this.parent = parent; this.featureName = featureName; this.op = op; this.threshold = threshold; this.textClass = textClass; this.classDist = classDist; }
private void AddScore(Vector3 offset, Vector3 rotationAxis, float rotationAngle) { TextClass score = new TextClass("1000", 0.4f, 0.04f, staticText); score.RotateShape(rotationAxis, rotationAngle); score.SetOffset(offset); scores.Add(score); }