public override void OnReceiveRemote() { switch (Value) { case ConversationType.Character: var translated = TextTranslation.Translate(Message).Trim(); translated = Regex.Replace(translated, @"<[Pp]ause=?\d*\.?\d*\s?\/?>", ""); ConversationManager.Instance.DisplayCharacterConversationBox(Id, translated); break; case ConversationType.Player: ConversationManager.Instance.DisplayPlayerConversationBox((uint)Id, Message); break; case ConversationType.CloseCharacter: if (Id == -1) { break; } var tree = QSBWorldSync.OldDialogueTrees[Id]; Object.Destroy(ConversationManager.Instance.BoxMappings[tree]); break; case ConversationType.ClosePlayer: Object.Destroy(QSBPlayerManager.GetPlayer((uint)Id).CurrentDialogueBox); break; } }
private DialogueBoxVer2 DisplayDialogueBox2() { var richText = ""; var listOptions = new List <DialogueOption>(); _currentNode.RefreshConditionsData(); if (_currentNode.HasNext()) { _currentNode.GetNextPage(out richText, ref listOptions); } var requiredComponent = GameObject.FindWithTag("DialogueGui").GetRequiredComponent <DialogueBoxVer2>(); requiredComponent.SetVisible(true); requiredComponent.SetDialogueText(richText, listOptions); if (_characterName == "") { requiredComponent.SetNameFieldVisible(false); } else { requiredComponent.SetNameFieldVisible(true); requiredComponent.SetNameField(TextTranslation.Translate(_characterName)); } return(requiredComponent); }
public override void OnReceiveRemote(bool server, ConversationMessage message) { if (!QSBCore.HasWokenUp) { return; } switch (message.EnumValue) { case ConversationType.Character: var translated = TextTranslation.Translate(message.Message).Trim(); translated = Regex.Replace(translated, @"<[Pp]ause=?\d*\.?\d*\s?\/?>", ""); ConversationManager.Instance.DisplayCharacterConversationBox(message.ObjectId, translated); break; case ConversationType.Player: ConversationManager.Instance.DisplayPlayerConversationBox((uint)message.ObjectId, message.Message); break; case ConversationType.CloseCharacter: if (message.ObjectId == -1) { break; } var tree = QSBWorldSync.OldDialogueTrees[message.ObjectId]; UnityEngine.Object.Destroy(ConversationManager.Instance.BoxMappings[tree]); break; case ConversationType.ClosePlayer: UnityEngine.Object.Destroy(QSBPlayerManager.GetPlayer((uint)message.ObjectId).CurrentDialogueBox); break; } }
static void TopWindow_Load(object sender, EventArgs e) { ToolStripMenuItem svgMenu = new ToolStripMenuItem(); svgMenu.Text = TextTranslation.Translate("Import SVG file(s)"); svgMenu.Click += svgMenu_Click; CamBamUI.MainUI.Menus.mnuPlugins.DropDownItems.Add(svgMenu); }
private static void on_window_shown(object sender, EventArgs e) { ThisApplication.TopWindow.Shown -= on_window_shown; ToolStripButton button; button = new ToolStripButton(); button.ToolTipText = TextTranslation.Translate(profile_mop_name); button.Click += profile_mop_onclick; button.Image = resources.cam_trochoprof1; insert_in_toolbar(button); button = new ToolStripButton(); button.ToolTipText = TextTranslation.Translate(pocket_mop_name); button.Click += pocket_mop_onclick; button.Image = resources.cam_trochopock1; insert_in_toolbar(button); }
public static string ProcXHTML(string html, TextTranslation textTranslation = null) { XmlDocument doc = new XmlDocument(); doc.LoadXml(html); var body = doc.GetElementsByTagName("body")[0]; string comment = ""; string lineTemp = "", rubyTemp = ""; string pureText = "";//for translate XmlNode p = body.FirstChild; bool closingElement = false; List <bool> normalTagOutput = new List <bool>(); while (true) { bool toNext = false; if (closingElement) { closingElement = false; toNext = true; switch (p.Name) { case "p": comment += "##" + lineTemp + rubyTemp + "\n" + RemainSigns(lineTemp) + "\n" + "##————————————————\n"; lineTemp = ""; rubyTemp = ""; pureText += "\n"; break; default: bool tagOutput = normalTagOutput[normalTagOutput.Count - 1]; normalTagOutput.RemoveAt(normalTagOutput.Count - 1); if (tagOutput) { lineTemp += "</" + p.Name + ">"; } break; } } else { switch (p.NodeType) { case XmlNodeType.Text: lineTemp += p.Value; pureText += p.Value; break; case XmlNodeType.Element: switch (p.Name) { case "ruby": string a = "", b = ""; Ruby2Text((XmlElement)p, ref a, ref b); lineTemp += a; pureText += a; rubyTemp += "|" + b; toNext = true; break; case "p": break; case "img": lineTemp += $"<img src=\"{((XmlElement)p).GetAttribute("src")}\" alt={((XmlElement)p).GetAttribute("alt")}>"; break; case "image": lineTemp += $"<image href=\"{((XmlElement)p).GetAttribute("href", "http://www.w3.org/1999/xlink")}\">"; break; default: { string classTemp = ((XmlElement)p).GetAttribute("class"); bool tagOutput = true; foreach (string classname in notOutputClassNames) { if (classTemp == classname) { tagOutput = false; break; } } if (p.HasChildNodes) { normalTagOutput.Add(tagOutput); } if (tagOutput) { if (classTemp.Length > 0) { classTemp = " class=" + classTemp; } if (p.HasChildNodes) { lineTemp += "<" + p.Name + classTemp + ">"; } else { lineTemp += "<" + p.Name + classTemp + "/>"; } } break; } } break; } } //move to next if (p.HasChildNodes && !toNext) { p = p.FirstChild; } else if (p.NextSibling == null) { p = p.ParentNode; closingElement = true; if (p == body) { break; } } else { p = p.NextSibling; } } comment += lineTemp; if (textTranslation != null) { if (Util.Trim(pureText).Length != 0) { string[] commentLines = comment.Split('\n'); while (pureText[pureText.Length - 1] == '\n') { pureText = pureText.Substring(0, pureText.Length - 1); } string[] pureTextLines = pureText.Split('\n'); var s = textTranslation.Translate(pureTextLines); for (int i = 0; i < s.Length; i++) { if (s[i] == "") { continue; } commentLines[i * 3 + 1] = s[i]; } comment = string.Join('\n', commentLines); } } return(comment); }
private void print_toolpath_stats(List <Toolpath> toolpaths, List <Polyline> rapids) { double leadins_len = 0; double spirals_len = 0; double slices_len = 0; double moves_len = 0; double rapids_len = 0; // collect cut lengths foreach (Toolpath path in toolpaths) { if (path.Leadin != null) { leadins_len += path.Leadin.GetPerimeter(); } foreach (Sliced_path_item item in path.Trajectory) { double len = item.GetPerimeter(); switch (item.Item_type) { case Sliced_path_item_type.SPIRAL: spirals_len += len; break; case Sliced_path_item_type.SLICE: slices_len += len; break; case Sliced_path_item_type.CHORD: case Sliced_path_item_type.SMOOTH_CHORD: case Sliced_path_item_type.GUIDE: case Sliced_path_item_type.SLICE_SHORTCUT: moves_len += len; break; } } } // collect rapids lengths foreach (Polyline p in rapids) { rapids_len += p.GetPerimeter(); } double cut_len = leadins_len + spirals_len + slices_len + moves_len; Logger.log(2, TextTranslation.Translate("Toolpath distance '{0}' : {1} + rapids : {2} = total : {3}"), base.Name, cut_len, rapids_len, cut_len + rapids_len); // calculate feedrates double normal_feedrate = base.CutFeedrate.Cached; if (normal_feedrate <= 0) { return; } double chord_feedrate = _chord_feedrate != 0 ? _chord_feedrate : normal_feedrate; double spiral_feedrate = _spiral_feedrate != 0 ? _spiral_feedrate : normal_feedrate; double leadin_feedrate = _leadin.Cached != null && _leadin.Cached.LeadInFeedrate != 0 ? _leadin.Cached.LeadInFeedrate : normal_feedrate; double rapid_feedrate = 600; // something big double cut_time = 0; cut_time += leadins_len / leadin_feedrate; cut_time += spirals_len / spiral_feedrate; cut_time += slices_len / normal_feedrate; cut_time += moves_len / chord_feedrate; double rapid_time = rapids_len / rapid_feedrate; TimeSpan cut_dur = new TimeSpan(0, 0, (int)(cut_time * 60.0)); TimeSpan rapids_dur = new TimeSpan(0, 0, (int)(rapid_time * 60.0)); Logger.log(2, TextTranslation.Translate("Estimated Toolpath '{0}' duration : {1} + rapids : {2} = total : {3}"), base.Name, cut_dur, rapids_dur, cut_dur + rapids_dur); }
public ImportSVG() { InitializeComponent(); label1.Text = TextTranslation.Translate("Drop here the SVG file(s)."); }