public void start(GameObject root) { LabelComponent label = root.AddComponent <LabelComponent>(); label.setTop(10); label.setText("Modding-API active"); }
public static LabelComponent AddANewLabel(this LabelComponent labelComponent, string labelName, string colorCode) { labelComponent.ClickOnAddLabelButton() .PerformCommonAddOrEditLabelActions(labelName, colorCode); return(labelComponent); }
public static LabelComponent EditLabel(this LabelComponent labelComponent, string oldLabelName, string newLabelName = "", string newColorCode = "") { labelComponent.ClickOnEditLabel(oldLabelName) .PerformCommonAddOrEditLabelActions(newLabelName, newColorCode, true); return(labelComponent); }
public override Control Generete() { GaugeControl gc = new GaugeControl(); gc.BackColor = Color.Transparent; var pathbaseControlXml = string.Format( @"panel de control/basecontrol/{0}", XmlDocument.SelectSingleNode("control").Attributes["baseControl"].Value); gc.RestoreLayoutFromXml(Path.Combine(Application.StartupPath, pathbaseControlXml)); gc.Location = Location; gc.Size = Size; gc.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; gc.Text = DatasourceDetail; var stateIndicador = gc.Gauges[0] as StateIndicatorGauge; foreach (LabelComponent label in stateIndicador.Labels) { if (label.Name.Equals("LabelTitulo")) label.Text = "<b>" + Title + "</b>"; if (label.Name.Equals("LabelNumero")) _labelNumero = label; } // Add the gauge control to the form. Control = gc; return gc; }
public override Control Generete() { GaugeControl gc = new GaugeControl(); gc.BackColor = Color.Transparent; var pathbaseControlXml = string.Format( @"panel de control/basecontrol/{0}", XmlDocument.SelectSingleNode("control").Attributes["baseControl"].Value); gc.RestoreLayoutFromXml(Path.Combine(Application.StartupPath, pathbaseControlXml)); gc.Location = Location; gc.Size = Size; gc.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; gc.Text = DatasourceDetail; var stateIndicador = gc.Gauges[0] as StateIndicatorGauge; foreach (LabelComponent label in stateIndicador.Labels) { if (label.Name.Equals("LabelTitulo")) { label.Text = "<b>" + Title + "</b>"; } if (label.Name.Equals("LabelNumero")) { _labelNumero = label; } } // Add the gauge control to the form. Control = gc; return(gc); }
private void AddLabelTo(EntityUid uid, HandLabelerComponent?handLabeler, IEntity target, out string?result) { if (!Resolve(uid, ref handLabeler)) { result = null; return; } LabelComponent label = target.EnsureComponent <LabelComponent>(); if (label.OriginalName != null) { target.Name = label.OriginalName; } label.OriginalName = null; if (handLabeler.AssignedLabel == string.Empty) { label.CurrentLabel = null; result = Loc.GetString("hand-labeler-successfully-removed"); return; } label.OriginalName = target.Name; target.Name += $" ({handLabeler.AssignedLabel})"; label.CurrentLabel = handLabeler.AssignedLabel; result = Loc.GetString("hand-labeler-successfully-applied"); }
public static LabelComponent ClickOnAddLabelButton(this LabelComponent labelComponent) { Thread.Sleep(1000); labelComponent.AddLabelButton.Click(); return(labelComponent); }
public void Refresh() { var dropdown = DropdownComponent; dropdown.RefreshDropdown(); dropdown.RefreshSelected(); LabelComponent.RefreshText(); }
public static LabelComponent PerformCommonAddOrEditLabelActions(this LabelComponent labelComponent, string newLabelName = "", string newLabelColor = "", bool isUpdate = false) { labelComponent.LabelModalComponent .FillLabelNameField(newLabelName, isUpdate) .ChooseLabelColor(newLabelColor) .ClickOnSaveButton(); return(labelComponent); }
public static LabelComponent ClickOnEditLabel(this LabelComponent labelComponent, string oldLabelName) { IWebElement labelRow = labelComponent .LabelList .FirstOrDefault(x => x.Text.Contains(oldLabelName)); labelRow.WaitUntilElement(ExtendedBy.DataTestId("folders/labels:item-edit")).Click(); return(labelComponent); }
public static LabelComponent DeleteLabel(this LabelComponent labelComponent, string labelToDelete) { IWebElement labelRow = labelComponent .LabelList .FirstOrDefault(x => x.Text.Contains(labelToDelete)); Thread.Sleep(2000); labelRow.WaitUntilElement(ExtendedBy.DataTestId("dropdown:open")).Click(); labelComponent.DeleteButton.WaitUntilElement(ExtendedBy.ButtonText(FoldersAndLabelsConstants.DELETE)).Click(); Thread.Sleep(1000); labelComponent.DeleteButton.WaitUntilElement(ExtendedBy.ButtonText(FoldersAndLabelsConstants.DELETE), 15).Click(); return(labelComponent); }
public static bool IsLabelAddedWithColor(this LabelComponent labelComponent, string labelName, string labelColor) { Thread.Sleep(1000); List <IWebElement> labelsList = labelComponent.LabelList; List <string> labelNames = new List <string>(); Dictionary <string, string> labelNamesAndColors = new Dictionary <string, string>(); foreach (var label in labelsList) { string labelNameText = label.FindElement(By.CssSelector("td > div > span")).Text; string labelNameColor = label.FindElement(By.CssSelector("td > div > svg")).GetCssValue("fill"); labelNamesAndColors.Add(labelNameText, labelNameColor); } return(labelNamesAndColors.FirstOrDefault(x => x.Key.Equals(labelName)).Value?.Equals(labelColor) ?? false); }
public void start(GameObject root) { var harmony = HarmonyInstance.Create("org.owls.modmanager"); harmony.PatchAll(Assembly.GetExecutingAssembly()); LabelComponent label = root.AddComponent <LabelComponent>(); label.setTop(30); if (harmony == null) { return; } label.setText( "Harmony-Plugin loaded: " + (harmony != null) + "\n" + "Harmony-Id: " + (harmony.Id) + "\n" + "Harmony.hasPatches: " + harmony.HasAnyPatches(harmony.Id) ); }
public static void DrawString(SpriteBatch spriteBatch, StateSpaceComponents spaceComponents, SpriteFont font, Camera camera) { Matrix cameraMatrix = camera.GetMatrix(); foreach (Guid id in spaceComponents.Entities.Where(x => (x.ComponentFlags & ComponentMasks.DrawableLabel) == ComponentMasks.DrawableLabel).Select(x => x.Id)) { LabelComponent label = spaceComponents.LabelComponents[id]; Vector2 position = new Vector2(spaceComponents.PositionComponents[id].Position.X, spaceComponents.PositionComponents[id].Position.Y); Vector2 stringSize = font.MeasureString(label.Text); Vector2 bottomRight = Vector2.Transform(new Vector2(position.X + stringSize.X, position.Y + stringSize.Y), cameraMatrix); Vector2 topLeft = Vector2.Transform(new Vector2(position.X, position.Y), cameraMatrix); Rectangle cameraBounds = new Rectangle((int)topLeft.X, (int)topLeft.Y, (int)bottomRight.X - (int)topLeft.X, (int)bottomRight.Y - (int)topLeft.Y); if (camera.IsInView(cameraMatrix, cameraBounds)) { spriteBatch.DrawString(font, label.Text, position, label.Color, label.Rotation, label.Origin, label.Scale, label.SpriteEffect, 0f); } } }
/// <summary>construct a ganeral value selector.</summary> private void selectorLayout(int xBase, int[] selectorOffset, int y, string name, string label, string value) { ClickableTextureButton b; b = new ClickableTextureButton(name, new Rectangle(xBase + selectorOffset[0], y, Game1.tileSize, Game1.tileSize), "", "", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 44), 0.75f) { m_par = -1, m_hoverScale = 0.1f }; m_components.Add(b); LabelComponent l; l = new LabelComponent(new Rectangle(xBase + selectorOffset[1], y, selectorOffset[2] - selectorOffset[1], 1), label) { m_baseX = xBase + selectorOffset[1] }; l.centerLabelX(); m_components.Add(l); l = new LabelComponent(new Rectangle(xBase + selectorOffset[1], y + Game1.tileSize / 2, selectorOffset[2] - selectorOffset[1], 1), value) { m_baseX = xBase + selectorOffset[1] }; if (value.Length > 3) { l.centerLabelX(); } else { l.rightCenterLabelX((int)Game1.smallFont.MeasureString("0").X); } m_selectValueLabels[name] = l; m_components.Add(l); b = new ClickableTextureButton(name, new Rectangle(xBase + selectorOffset[2], y, Game1.tileSize, Game1.tileSize), "", "", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 33), 0.75f) { m_par = 1, m_hoverScale = 0.1f }; m_components.Add(b); }
public FoldersAndLabelsPage(IWebDriver driver) : base(driver) { FolderComponent = new FolderComponent(driver); LabelComponent = new LabelComponent(driver); NotificationComponent = new NotificationComponent(driver); }
private void InitializeComponent() { this.pictureBox2 = new PictureBox(); this.pictureBox1 = new PictureBox(); this.labelControl1 = new LabelControl(); this.labelControl2 = new LabelControl(); this.labelControl3 = new LabelControl(); this.labelControl4 = new LabelControl(); this.labelControl5 = new LabelControl(); this.lbl_Name = new LabelControl(); this.lbl_Number = new LabelControl(); this.lbl_sex = new LabelControl(); this.lbl_age = new LabelControl(); this.lbl_persontype = new LabelControl(); this.lbl_channl = new LabelControl(); this.labelControl7 = new LabelControl(); this.panelControl1 = new PanelControl(); this.lbl_time = new Label(); this.gaugeControl1 = new GaugeControl(); this.circularGauge1 = new CircularGauge(); this.labelComponent1 = new LabelComponent(); this.labelComponent2 = new LabelComponent(); this.arcScaleRangeBarComponent1 = new ArcScaleRangeBarComponent(); this.arcScaleComponent1 = new ArcScaleComponent(); ((ISupportInitialize)this.pictureBox2).BeginInit(); ((ISupportInitialize)this.pictureBox1).BeginInit(); ((ISupportInitialize)this.panelControl1).BeginInit(); this.panelControl1.SuspendLayout(); this.circularGauge1.BeginInit(); this.labelComponent1.BeginInit(); this.labelComponent2.BeginInit(); this.arcScaleRangeBarComponent1.BeginInit(); this.arcScaleComponent1.BeginInit(); base.SuspendLayout(); this.pictureBox2.BackColor = Color.Black; this.pictureBox2.BorderStyle = BorderStyle.FixedSingle; this.pictureBox2.Location = new Point(217, 2); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new Size(211, 226); this.pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage; this.pictureBox2.TabIndex = 0; this.pictureBox2.TabStop = false; this.pictureBox1.BackColor = Color.Black; this.pictureBox1.BorderStyle = BorderStyle.FixedSingle; this.pictureBox1.Location = new Point(3, 2); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new Size(211, 226); this.pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; this.labelControl1.Appearance.Font = new Font("微软雅黑", 10.5f, FontStyle.Bold, GraphicsUnit.Point, 134); this.labelControl1.Appearance.ForeColor = Color.Silver; this.labelControl1.Location = new Point(217, 16); this.labelControl1.Name = "labelControl1"; this.labelControl1.Size = new Size(50, 19); this.labelControl1.TabIndex = 3; this.labelControl1.Text = "姓 名:"; this.labelControl2.Appearance.Font = new Font("微软雅黑", 10.5f, FontStyle.Bold, GraphicsUnit.Point, 134); this.labelControl2.Appearance.ForeColor = Color.Silver; this.labelControl2.Location = new Point(217, 121); this.labelControl2.Name = "labelControl2"; this.labelControl2.Size = new Size(50, 19); this.labelControl2.TabIndex = 3; this.labelControl2.Text = "编 号:"; this.labelControl2.Click += new EventHandler(this.labelControl2_Click); this.labelControl3.Appearance.Font = new Font("微软雅黑", 10.5f, FontStyle.Bold, GraphicsUnit.Point, 134); this.labelControl3.Appearance.ForeColor = Color.Silver; this.labelControl3.Location = new Point(217, 51); this.labelControl3.Name = "labelControl3"; this.labelControl3.Size = new Size(50, 19); this.labelControl3.TabIndex = 3; this.labelControl3.Text = "性 别:"; this.labelControl4.Appearance.Font = new Font("微软雅黑", 10.5f, FontStyle.Bold, GraphicsUnit.Point, 134); this.labelControl4.Appearance.ForeColor = Color.Silver; this.labelControl4.Location = new Point(217, 156); this.labelControl4.Name = "labelControl4"; this.labelControl4.Size = new Size(50, 19); this.labelControl4.TabIndex = 3; this.labelControl4.Text = "年 龄:"; this.labelControl5.Appearance.Font = new Font("微软雅黑", 10.5f, FontStyle.Bold, GraphicsUnit.Point, 134); this.labelControl5.Appearance.ForeColor = Color.Silver; this.labelControl5.Location = new Point(217, 86); this.labelControl5.Name = "labelControl5"; this.labelControl5.Size = new Size(50, 19); this.labelControl5.TabIndex = 3; this.labelControl5.Text = "类 别:"; this.lbl_Name.Appearance.Font = new Font("微软雅黑", 10.5f, FontStyle.Bold, GraphicsUnit.Point, 134); this.lbl_Name.Appearance.ForeColor = Color.Silver; this.lbl_Name.Location = new Point(286, 16); this.lbl_Name.Name = "lbl_Name"; this.lbl_Name.Size = new Size(28, 19); this.lbl_Name.TabIndex = 4; this.lbl_Name.Text = "张三"; this.lbl_Number.Appearance.Font = new Font("微软雅黑", 10.5f, FontStyle.Bold, GraphicsUnit.Point, 134); this.lbl_Number.Appearance.ForeColor = Color.Silver; this.lbl_Number.Location = new Point(286, 121); this.lbl_Number.Name = "lbl_Number"; this.lbl_Number.Size = new Size(117, 19); this.lbl_Number.TabIndex = 4; this.lbl_Number.Text = "2220124555555"; this.lbl_Number.Click += new EventHandler(this.lbl_Number_Click); this.lbl_sex.Appearance.Font = new Font("微软雅黑", 10.5f, FontStyle.Bold, GraphicsUnit.Point, 134); this.lbl_sex.Appearance.ForeColor = Color.Silver; this.lbl_sex.Location = new Point(286, 51); this.lbl_sex.Name = "lbl_sex"; this.lbl_sex.Size = new Size(14, 19); this.lbl_sex.TabIndex = 4; this.lbl_sex.Text = "男"; this.lbl_age.Appearance.Font = new Font("微软雅黑", 10.5f, FontStyle.Bold, GraphicsUnit.Point, 134); this.lbl_age.Appearance.ForeColor = Color.Silver; this.lbl_age.Location = new Point(286, 156); this.lbl_age.Name = "lbl_age"; this.lbl_age.Size = new Size(18, 19); this.lbl_age.TabIndex = 4; this.lbl_age.Text = "19"; this.lbl_persontype.Appearance.Font = new Font("微软雅黑", 10.5f, FontStyle.Bold, GraphicsUnit.Point, 134); this.lbl_persontype.Appearance.ForeColor = Color.Silver; this.lbl_persontype.Location = new Point(286, 86); this.lbl_persontype.Name = "lbl_persontype"; this.lbl_persontype.Size = new Size(52, 19); this.lbl_persontype.TabIndex = 4; this.lbl_persontype.Text = "VIP客户"; this.lbl_channl.Appearance.Font = new Font("微软雅黑", 10.5f, FontStyle.Bold, GraphicsUnit.Point, 134); this.lbl_channl.Appearance.ForeColor = Color.Silver; this.lbl_channl.Location = new Point(286, 191); this.lbl_channl.Name = "lbl_channl"; this.lbl_channl.Size = new Size(37, 19); this.lbl_channl.TabIndex = 3; this.lbl_channl.Text = "通道1"; this.labelControl7.Appearance.Font = new Font("微软雅黑", 10.5f, FontStyle.Bold, GraphicsUnit.Point, 134); this.labelControl7.Appearance.ForeColor = Color.Silver; this.labelControl7.Location = new Point(217, 191); this.labelControl7.Name = "labelControl7"; this.labelControl7.Size = new Size(70, 19); this.labelControl7.TabIndex = 4; this.labelControl7.Text = "识别通道:"; this.panelControl1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right); this.panelControl1.Appearance.BackColor = Color.Transparent; this.panelControl1.Appearance.Options.UseBackColor = true; this.panelControl1.BorderStyle = BorderStyles.Simple; this.panelControl1.Controls.Add(this.lbl_time); this.panelControl1.Controls.Add(this.gaugeControl1); this.panelControl1.Controls.Add(this.labelControl4); this.panelControl1.Controls.Add(this.labelControl7); this.panelControl1.Controls.Add(this.labelControl1); this.panelControl1.Controls.Add(this.lbl_persontype); this.panelControl1.Controls.Add(this.labelControl2); this.panelControl1.Controls.Add(this.lbl_age); this.panelControl1.Controls.Add(this.labelControl3); this.panelControl1.Controls.Add(this.lbl_sex); this.panelControl1.Controls.Add(this.labelControl5); this.panelControl1.Controls.Add(this.lbl_Number); this.panelControl1.Controls.Add(this.lbl_Name); this.panelControl1.Controls.Add(this.lbl_channl); this.panelControl1.Location = new Point(4, 233); this.panelControl1.Name = "panelControl1"; this.panelControl1.Size = new Size(424, 239); this.panelControl1.TabIndex = 5; this.lbl_time.AutoSize = true; this.lbl_time.Font = new Font("微软雅黑", 10.5f, FontStyle.Bold); this.lbl_time.ForeColor = Color.Silver; this.lbl_time.Location = new Point(15, 215); this.lbl_time.Name = "lbl_time"; this.lbl_time.Size = new Size(159, 19); this.lbl_time.TabIndex = 6; this.lbl_time.Text = "2017-12-25 13:18:85"; this.gaugeControl1.set_AutoLayout(false); this.gaugeControl1.BackColor = Color.Transparent; this.gaugeControl1.set_BorderStyle(BorderStyles.NoBorder); this.gaugeControl1.get_Gauges().AddRange(new IGauge[] { this.circularGauge1 }); this.gaugeControl1.Location = new Point(4, 16); this.gaugeControl1.Name = "gaugeControl1"; this.gaugeControl1.Size = new Size(207, 196); this.gaugeControl1.TabIndex = 7; this.circularGauge1.set_Bounds(new Rectangle(2, 3, 195, 184)); this.circularGauge1.get_Labels().AddRange(new LabelComponent[] { this.labelComponent1, this.labelComponent2 }); this.circularGauge1.set_Name("circularGauge1"); this.circularGauge1.get_RangeBars().AddRange(new ArcScaleRangeBarComponent[] { this.arcScaleRangeBarComponent1 }); this.circularGauge1.get_Scales().AddRange(new ArcScaleComponent[] { this.arcScaleComponent1 }); this.labelComponent1.get_AppearanceText().set_Font(new Font("Segoe UI", 27.75f)); this.labelComponent1.set_Name("circularGauge1_Label1"); this.labelComponent1.set_Shader(new StyleShader("Colors[Style1:OrangeRed;Style2:OrangeRed]")); this.labelComponent1.set_Size(new SizeF(140f, 60f)); this.labelComponent1.set_Text("910"); this.labelComponent1.set_UseColorScheme(false); this.labelComponent1.set_ZOrder(-1001); this.labelComponent2.get_AppearanceText().set_Font(new Font("Tahoma", 15f)); this.labelComponent2.get_AppearanceText().set_TextBrush(new SolidBrushObject("Color:Black")); this.labelComponent2.set_Name("circularGauge1_Label2"); this.labelComponent2.set_Position(new PointF2D(125f, 175f)); this.labelComponent2.set_Shader(new StyleShader("Colors[Style1:White;Style2:White]")); this.labelComponent2.set_Text("相似度"); this.labelComponent2.set_ZOrder(-1001); this.arcScaleRangeBarComponent1.set_ArcScale(this.arcScaleComponent1); this.arcScaleRangeBarComponent1.set_Name("circularGauge1_RangeBar2"); this.arcScaleRangeBarComponent1.set_RoundedCaps(true); this.arcScaleRangeBarComponent1.set_Shader(new StyleShader("Colors[Style1:OrangeRed;Style2:OrangeRed]")); this.arcScaleRangeBarComponent1.set_ShowBackground(true); this.arcScaleRangeBarComponent1.set_StartOffset(80f); this.arcScaleRangeBarComponent1.set_ZOrder(-10); this.arcScaleComponent1.get_AppearanceMajorTickmark().set_BorderBrush(new SolidBrushObject("Color:White")); this.arcScaleComponent1.get_AppearanceMajorTickmark().set_ContentBrush(new SolidBrushObject("Color:White")); this.arcScaleComponent1.get_AppearanceMinorTickmark().set_BorderBrush(new SolidBrushObject("Color:White")); this.arcScaleComponent1.get_AppearanceMinorTickmark().set_ContentBrush(new SolidBrushObject("Color:White")); this.arcScaleComponent1.get_AppearanceTickmarkText().set_Font(new Font("Tahoma", 8.5f)); this.arcScaleComponent1.get_AppearanceTickmarkText().set_TextBrush(new SolidBrushObject("Color:#484E5A")); this.arcScaleComponent1.set_Center(new PointF2D(125f, 125f)); this.arcScaleComponent1.set_EndAngle(90f); this.arcScaleComponent1.set_MajorTickCount(0); this.arcScaleComponent1.get_MajorTickmark().set_FormatString("{0:F0}"); this.arcScaleComponent1.get_MajorTickmark().set_ShapeOffset(-14f); this.arcScaleComponent1.get_MajorTickmark().set_ShapeType(67); this.arcScaleComponent1.get_MajorTickmark().set_TextOrientation(3); this.arcScaleComponent1.set_MaxValue(100f); this.arcScaleComponent1.set_MinorTickCount(0); this.arcScaleComponent1.get_MinorTickmark().set_ShapeOffset(-7f); this.arcScaleComponent1.get_MinorTickmark().set_ShapeType(68); this.arcScaleComponent1.set_Name("scale1"); this.arcScaleComponent1.set_StartAngle(-270f); this.arcScaleComponent1.set_Value(20f); base.AutoScaleMode = AutoScaleMode.None; this.BackColor = Color.FromArgb(45, 45, 48); base.Controls.Add(this.panelControl1); base.Controls.Add(this.pictureBox2); base.Controls.Add(this.pictureBox1); this.Font = new Font("微软雅黑", 9f, FontStyle.Regular, GraphicsUnit.Point, 134); base.Name = "FaceCompareUserControl3"; base.Size = new Size(431, 475); ((ISupportInitialize)this.pictureBox2).EndInit(); ((ISupportInitialize)this.pictureBox1).EndInit(); ((ISupportInitialize)this.panelControl1).EndInit(); this.panelControl1.ResumeLayout(false); this.panelControl1.PerformLayout(); this.circularGauge1.EndInit(); this.labelComponent1.EndInit(); this.labelComponent2.EndInit(); this.arcScaleRangeBarComponent1.EndInit(); this.arcScaleComponent1.EndInit(); base.ResumeLayout(false); }
/// <summary>Update the menu layout for a change in the zoom level or viewport size.</summary> public override void updateLayout() { // reset window position this.xPositionOnScreen = (Game1.viewport.Width - this.width) / 2; this.yPositionOnScreen = (Game1.viewport.Height - this.height) / 2; this.yPositionOnScreen += Game1.tileSize / 2; Texture2D menuTextures = Game1.content.Load <Texture2D>(ContentHelper.s_MenuTextureKey); // reset current components ans status m_alerts.Clear(); m_components.Clear(); m_extraFavButtons.Clear(); m_currentFav = -1; //constants const int firstExtraFavIndex = 7; const int nRow = 3, nCol = 10; const float facBtnZoom = 4.5f; const int extraFavTextureW = 8, extraFavTextureH = 8; const int xGapForExtraFav = 50, yGapForExtraFav = 50; const int extraFavBtnW = (int)(facBtnZoom * extraFavTextureW), extraFavBtnH = (int)(facBtnZoom * extraFavTextureH); int xOffset = xPositionOnScreen + IClickableMenu.borderWidth; int yOffset = yPositionOnScreen + IClickableMenu.borderWidth; // portrait m_components.Add(new PortraitComponent(xOffset + Game1.tileSize * 8, yOffset + +Game1.tileSize / 2)); // hint labels m_components.Add(new LabelComponent(new Rectangle(xOffset, yOffset, 1, 1), "You can set up to 30 additional favorite appearance")); m_components.Add(new LabelComponent(new Rectangle(xOffset, yOffset + 25, 1, 1), "configurations for each character.")); m_components.Add(new LabelComponent(new Rectangle(xOffset, yOffset + 110, 1, 1), "Your current appearance is shown on")); m_components.Add(new LabelComponent(new Rectangle(xOffset, yOffset + 135, 1, 1), "the right, select a favorite below to")); m_components.Add(new LabelComponent(new Rectangle(xOffset, yOffset + 160, 1, 1), "save your appearance in it or load the")); m_components.Add(new LabelComponent(new Rectangle(xOffset, yOffset + 185, 1, 1), "appearance saved in it :")); xOffset = this.xPositionOnScreen + (this.width - (nCol - 1) * xGapForExtraFav - extraFavBtnW) / 2; yOffset += Game1.tileSize * 6; // save load buttons m_loadFavButton = new ClickableTextureButton("Load", new Rectangle(xOffset + Game1.tileSize * 6, yOffset - 100, Game1.pixelZoom * 20, Game1.pixelZoom * 10), menuTextures, new Rectangle(0, 207, 26, 11), 3f) { m_hoverScale = 0.25f }; m_loadFavButton.visible = m_currentFav != -1; m_components.Add(m_loadFavButton); m_saveFavButton = new ClickableTextureButton("Save", new Rectangle(xOffset + Game1.tileSize * 6, yOffset - 50, Game1.pixelZoom * 20, Game1.pixelZoom * 10), menuTextures, new Rectangle(0, 193, 26, 11), 3f) { m_hoverScale = 0.25f }; m_saveFavButton.visible = m_currentFav != -1; m_components.Add(m_saveFavButton); m_selectFavLabel = new LabelComponent(new Rectangle(xOffset, yOffset - 100, 1, 1), "Please select a favorite..."); m_selectFavLabel.visible = m_currentFav == -1; m_components.Add(m_selectFavLabel); m_saveLabel = new LabelComponent(new Rectangle(xOffset, yOffset - 100, 1, 1), ""); m_saveLabel.visible = m_currentFav != -1; m_components.Add(m_saveLabel); m_loadLabel = new LabelComponent(new Rectangle(xOffset, yOffset - 50, 1, 1), "Overwrite Fav. Slot"); m_loadLabel.visible = m_currentFav != -1; m_components.Add(m_loadLabel); // extra favorites buttons for (int i = 0; i < nRow; i++) { for (int j = 0; j < nCol; j++) { int y = m_farmerMakeup.m_config.HasFavSlot(i * nCol + j + firstExtraFavIndex) ? 26 : 67; ClickableTextureButton c = new ClickableTextureButton("Fav", new Rectangle(xOffset + j * xGapForExtraFav, yOffset + i * yGapForExtraFav, extraFavBtnW, extraFavBtnH), menuTextures, new Rectangle(0, y, extraFavTextureW, extraFavTextureH), facBtnZoom) { m_par = j + i * nCol }; m_extraFavButtons.Add(c); m_components.Add(c); } } }
/// <summary>Update the menu layout for a change in the zoom level or viewport size.</summary> public override void updateLayout() { // reset window position this.xPositionOnScreen = (Game1.viewport.Width - this.width) / 2; this.yPositionOnScreen = (Game1.viewport.Height - this.height) / 2; this.yPositionOnScreen += Game1.tileSize / 2; m_alerts.Clear(); m_components.Clear(); // info int yOffset = this.yPositionOnScreen + IClickableMenu.borderWidth; int xOffset = this.xPositionOnScreen + IClickableMenu.borderWidth; m_components.Add(new LabelComponent(xOffset, yOffset, "Kisekae") { m_isTitle = true }); yOffset += 50; m_components.Add(new LabelComponent(xOffset, yOffset, "A modified version of Get Dressed to work with SDV 1.3")); m_components.Add(new LabelComponent(xOffset, yOffset + 26, $"You are using version: {m_env.ModManifest.Version}")); yOffset += 60; m_components.Add(new LabelComponent(xOffset, yOffset, "Settings:") { m_isTitle = true }); m_components.Add(new LabelComponent(xOffset, yOffset + 60, "Face Types (M-F): " + m_globalConfig.MaleFaceTypes + "-" + m_globalConfig.FemaleFaceTypes)); m_components.Add(new LabelComponent(xOffset + 300, yOffset + 60, "Nose Types (M-F): " + m_globalConfig.MaleNoseTypes + "-" + m_globalConfig.FemaleNoseTypes)); m_components.Add(new LabelComponent(xOffset, yOffset + 110, "Shoes Types (M-F): " + m_globalConfig.MaleShoeTypes + "-" + m_globalConfig.FemaleShoeTypes)); m_bottomNumberLabel = new LabelComponent(xOffset + 300, yOffset + 110, "Bottoms Types (M-F): " + (m_globalConfig.HideMaleSkirts ? 2 : m_globalConfig.MaleBottomsTypes) + "-" + m_globalConfig.FemaleBottomsTypes); m_components.Add(m_bottomNumberLabel); m_components.Add(new LabelComponent(xOffset, yOffset + 160, "Stove in Corner: " + m_globalConfig.StoveInCorner)); m_showDresserLabel = new LabelComponent(xOffset + 300, yOffset + 160, "Show Dresser: " + m_globalConfig.ShowDresser); m_components.Add(m_showDresserLabel); m_components.Add(new ClickableTextureButton("SetDresser", new Rectangle(xOffset + 560, yOffset + 160, Game1.pixelZoom * 15, Game1.pixelZoom * 10), Game1.mouseCursors, new Rectangle(294, 428, 21, 11), 3f) { m_hoverScale = 0.25f }); // set menu access key m_accessKeyLabel = new LabelComponent(xOffset, yOffset + 210, "Open Menu Key: " + m_globalConfig.MenuAccessKey); m_components.Add(m_accessKeyLabel); m_components.Add(new ClickableTextureButton("ClearAccessKey", new Rectangle(xOffset + 510, yOffset + 208, 30, 30), m_menuTextures, new Rectangle(50, 146, 12, 12), 3f) { m_hoverScale = 0.25f }); m_components.Add(new ClickableTextureButton("SetAccessKey", new Rectangle(xOffset + 560, yOffset + 210, 21 * 3, 11 * 3), Game1.mouseCursors, new Rectangle(294, 428, 21, 11), 3f) { m_hoverScale = 0.25f }); // toggle skirs for male characters m_components.Add(new LabelComponent(xOffset, yOffset + 260, "Toggle Skirts for Male Characters")); m_components.Add(new ClickableTextureButton("SetMaleShirt", new Rectangle(xOffset + 560, yOffset + 260, Game1.pixelZoom * 15, Game1.pixelZoom * 10), Game1.mouseCursors, new Rectangle(294, 428, 21, 11), 3f) { m_hoverScale = 0.25f }); // set gender change m_components.Add(new LabelComponent(xOffset, yOffset + 310, "Can Change Gender")); m_components.Add(new ClickableTextureButton("SetGenderButton", new Rectangle(xOffset + 560, yOffset + 310, Game1.pixelZoom * 15, Game1.pixelZoom * 10), Game1.mouseCursors, new Rectangle(294, 428, 21, 11), 3f) { m_hoverScale = 0.25f }); // set zoom level int zoomValue = (int)Math.Round((double)Game1.options.zoomLevel * 100.0); bool canZoomOut = (m_globalConfig.MenuZoomLock && !m_globalConfig.MenuZoomOut) || (!m_globalConfig.MenuZoomLock && zoomValue > 75); bool canZoomIn = (m_globalConfig.MenuZoomLock && m_globalConfig.MenuZoomOut) || (!m_globalConfig.MenuZoomLock && zoomValue < 125); m_zoomLevelLabel = new LabelComponent(xOffset, yOffset + 360, (m_globalConfig.MenuZoomLock ? "Independent Zoom Level: ": "Game Zoom Level: ") + (zoomValue) + "%"); m_components.Add(m_zoomLevelLabel); m_zoomOutButton = new ClickableTextureButton("ZoomOut", new Rectangle(xOffset + 530, yOffset + 360, Game1.pixelZoom * 10, Game1.pixelZoom * 10), m_menuTextures, new Rectangle(0, canZoomOut ? 167 : 177, 7, 9), 3f) { m_hoverScale = canZoomOut ? 0.25f : 0f }; m_zoomLockButton = new ClickableTextureButton("ZoomLock", new Rectangle(xOffset + 575, yOffset + 360 - 4, (int)(12 * 2.5), (int)(14 * 2.5)), m_menuTextures, new Rectangle(m_globalConfig.MenuZoomLock ? 178:162, m_globalConfig.MenuZoomLock ? 145 : 161, 12, 14), 2.5f) { m_hoverScale = 0.25f }; m_zoomInButton = new ClickableTextureButton("ZoomIn", new Rectangle(xOffset + 630, yOffset + 360, Game1.pixelZoom * 10, Game1.pixelZoom * 10), m_menuTextures, new Rectangle(10, canZoomIn ? 167 : 177, 7, 9), 3f) { m_hoverScale = canZoomIn ? 0.25f : 0f }; m_components.Add(m_zoomOutButton); m_components.Add(m_zoomInButton); m_components.Add(m_zoomLockButton); // reset config options m_components.Add(new LabelComponent(xOffset, yOffset + 410, "Reset Options to Default")); m_components.Add(new ClickableTextureButton("Reset", new Rectangle(xOffset + 560, yOffset + 410, Game1.pixelZoom * 15, Game1.pixelZoom * 10), Game1.mouseCursors, new Rectangle(294, 428, 21, 11), 3f) { m_hoverScale = 0.25f }); }
public static bool IsNoLabelsAvailableTextPresent(this LabelComponent labelComponent) { Thread.Sleep(1000); return(labelComponent.NoLabelsAvailableText.FirstOrDefault(x => x.Text.Equals(FoldersAndLabelsConstants.NO_LABELS_AVAILABLE)) != null); }
private void TryCreatePackage(EntityUid user, UiAction action, string label, int pillAmount, int bottleAmount) { if (BufferSolution.TotalVolume == 0) { user.PopupMessageCursor(Loc.GetString("chem-master-window-buffer-empty-text")); return; } if (action == UiAction.CreateBottles) { var individualVolume = BufferSolution.TotalVolume / FixedPoint2.New(bottleAmount); if (individualVolume < FixedPoint2.New(1)) { user.PopupMessageCursor(Loc.GetString("chem-master-window-buffer-low-text")); return; } var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(30)); for (int i = 0; i < bottleAmount; i++) { var bottle = _entities.SpawnEntity("ChemistryEmptyBottle01", _entities.GetComponent <TransformComponent>(Owner).Coordinates); //Adding label LabelComponent labelComponent = bottle.EnsureComponent <LabelComponent>(); labelComponent.OriginalName = _entities.GetComponent <MetaDataComponent>(bottle).EntityName; string val = _entities.GetComponent <MetaDataComponent>(bottle).EntityName + $" ({label})"; _entities.GetComponent <MetaDataComponent>(bottle).EntityName = val; labelComponent.CurrentLabel = label; var bufferSolution = BufferSolution.SplitSolution(actualVolume); var bottleSolution = EntitySystem.Get <SolutionContainerSystem>().EnsureSolution(bottle, "drink"); EntitySystem.Get <SolutionContainerSystem>().TryAddSolution(bottle, bottleSolution, bufferSolution); //Try to give them the bottle if (_entities.TryGetComponent <HandsComponent?>(user, out var hands) && _entities.TryGetComponent <SharedItemComponent?>(bottle, out var item)) { if (hands.CanPutInHand(item)) { hands.PutInHand(item); continue; } } //Put it on the floor _entities.GetComponent <TransformComponent>(bottle).Coordinates = _entities.GetComponent <TransformComponent>(user).Coordinates; //Give it an offset bottle.RandomOffset(0.2f); } } else //Pills { var individualVolume = BufferSolution.TotalVolume / FixedPoint2.New(pillAmount); if (individualVolume < FixedPoint2.New(1)) { user.PopupMessageCursor(Loc.GetString("chem-master-window-buffer-low-text")); return; } var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(50)); for (int i = 0; i < pillAmount; i++) { var pill = _entities.SpawnEntity("pill", _entities.GetComponent <TransformComponent>(Owner).Coordinates); //Adding label LabelComponent labelComponent = pill.EnsureComponent <LabelComponent>(); labelComponent.OriginalName = _entities.GetComponent <MetaDataComponent>(pill).EntityName; string val = _entities.GetComponent <MetaDataComponent>(pill).EntityName + $" ({label})"; _entities.GetComponent <MetaDataComponent>(pill).EntityName = val; labelComponent.CurrentLabel = label; var bufferSolution = BufferSolution.SplitSolution(actualVolume); var pillSolution = EntitySystem.Get <SolutionContainerSystem>().EnsureSolution(pill, "food"); EntitySystem.Get <SolutionContainerSystem>().TryAddSolution(pill, pillSolution, bufferSolution); //Change pill Sprite component state if (!_entities.TryGetComponent(pill, out SpriteComponent? sprite)) { return; } sprite?.LayerSetState(0, "pill" + _pillType); //Try to give them the bottle if (_entities.TryGetComponent <HandsComponent?>(user, out var hands) && _entities.TryGetComponent <SharedItemComponent?>(pill, out var item)) { if (hands.CanPutInHand(item)) { hands.PutInHand(item); continue; } } //Put it on the floor _entities.GetComponent <TransformComponent>(pill).Coordinates = _entities.GetComponent <TransformComponent>(user).Coordinates; //Give it an offset pill.RandomOffset(0.2f); } } if (_bufferSolution?.Contents.Count == 0) { _label = ""; } UpdateUserInterface(); }
//public static void WriteFormData(LogicBase.Core.IOrchestrationComponent component) //{ // FormBuilderComponent fbc = ((FormBuilderComponent)component); // IOrchestrationComponent[] ioc = fbc.FormModel.Components; // FormSurface surface = FormSurfaceHelpers.Create(); // SilverGrid grid = new SilverGrid(); // surface.RootContainer = grid; // List<DataDescription> formData = new List<DataDescription>(); // grid.Columns = new[] // { // new SilverGridColumn() { Id = Guid.NewGuid(), LayoutType = LayoutElementType.Fixed, RequestedSize = 20 }, // new SilverGridColumn() { Id = Guid.NewGuid(), LayoutType = LayoutElementType.Resize, RequestedSize = 10 }, // new SilverGridColumn() { Id = Guid.NewGuid(), LayoutType = LayoutElementType.Fixed, RequestedSize = 5 }, // new SilverGridColumn() { Id = Guid.NewGuid(), LayoutType = LayoutElementType.Resize, RequestedSize = 15 }, // new SilverGridColumn() { Id = Guid.NewGuid(), LayoutType = LayoutElementType.Fixed, RequestedSize = 20 } // }; // List<SilverGridRow> rows = new List<SilverGridRow>(); // foreach (IOrchestrationComponent eachLBSFormControl in ioc) // { // rows.Add(new SilverGridRow() { Id = Guid.NewGuid(), LayoutType = LayoutElementType.Fixed, RequestedSize = 20 }); // SilverGridRow separatorRow = null; // if (eachLBSFormControl is ILabelComponent) // { // ILabelComponent lbLabel = (ILabelComponent)eachLBSFormControl; // formData.Add(new DataDescription((DecisionsNativeType)typeof(String), lbLabel.Name, false, true, false)); // SilverLabel label = new SilverLabel(); // label.Text = lbLabel.Name; // label.RequestedWidth = 100; // label.RequestedHeight = 25; // grid.Children.Add(new SilverGridChildInfo(label, 1, 1, rows.Count, 1)); // //SilverTextBox textBox = new SilverTextBox(); // //textBox.DataName = dataName; // //textBox.RequiredOnOutputs = new[] { outcomeName }; // //textBox.RequestedWidth = 100; // //textBox.RequestedHeight = 25; // //grid.Children.Add(new SilverGridChildInfo(textBox, 3, 1, rows.Count, 1)); // rows.Add(new SilverGridRow() { Id = Guid.NewGuid(), LayoutType = LayoutElementType.Fixed, RequestedSize = 25 }); // rows.Add(separatorRow = new SilverGridRow() { Id = Guid.NewGuid(), LayoutType = LayoutElementType.Fixed, RequestedSize = 5 }); // } // else if (eachLBSFormControl is ButtonComponent) // { // ButtonComponent button = (ButtonComponent)eachLBSFormControl; // SilverButton submit = new SilverButton(); // submit.OutcomePathName = button.PathName; // submit.Text = button.Text; // submit.RequestedWidth = 100; // submit.RequestedHeight = 25; // if (separatorRow == null) // rows.Add(separatorRow = new SilverGridRow() { Id = Guid.NewGuid(), LayoutType = LayoutElementType.Fixed, RequestedSize = 75 }); // grid.Children.Add(new SilverGridChildInfo(submit, 3, 1, rows.Count, 1)); // rows.Add(new SilverGridRow() { Id = Guid.NewGuid(), LayoutType = LayoutElementType.Fixed, RequestedSize = 25 }); // rows.Add(new SilverGridRow() { Id = Guid.NewGuid(), LayoutType = LayoutElementType.Fixed, RequestedSize = 20 }); // grid.Rows = rows.ToArray(); // surface.DesignerWidth = grid.RequestedWidth = 375; // surface.DesignerHeight = grid.RequestedHeight = rows.Sum(r => r.RequestedSize) + 70; // separatorRow.LayoutType = LayoutElementType.Resize; // separatorRow.RequestedSize = 1; // } // } // newForm.FormData = surface.WriteSurface(); // return newForm; //} public static ConvertedForm GetForm(LogicBase.Core.IOrchestrationComponent component) { FormBuilderComponent fbc = ((FormBuilderComponent)component); IOrchestrationComponent[] ioc = fbc.FormModel.Components; if (ioc == null || ioc.Length == 0) { throw new Exception("Oh snap!"); } IntermediateFormDefinition newForm = new IntermediateFormDefinition(); newForm.Id = fbc.Name; newForm.Name = fbc.Name; List <FormControl> allControls = new List <FormControl>(); foreach (IOrchestrationComponent eachLBSFormControl in ioc) { FormControl newControl = new FormControl(); newControl.Name = eachLBSFormControl.Name; newControl.X = (int)eachLBSFormControl.Location.X; newControl.Y = (int)eachLBSFormControl.Location.Y; newControl.TypeName = eachLBSFormControl.GetType().Name; newControl.Id = eachLBSFormControl.Id; if (eachLBSFormControl is LabelComponent) { LabelComponent label = ((LabelComponent)eachLBSFormControl); newControl.Text = label.Text; } else if (eachLBSFormControl is TextBoxComponent) { TextBoxComponent button = (TextBoxComponent)eachLBSFormControl; newControl.Text = button.Name; string value = button.OutputData; newControl.Value = value.Substring(value.LastIndexOf("]") + 1); } else if (eachLBSFormControl is ButtonComponent) { ButtonComponent button = (ButtonComponent)eachLBSFormControl; newControl.Path = button.PathName; newControl.Text = button.Text; } allControls.Add(newControl); } newForm.Controls = allControls.ToArray(); string tempFileName = Path.GetTempFileName(); string newFileName = Path.GetTempFileName(); // Call the other Thing. FileStream stream = new FileStream(tempFileName, FileMode.Create); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, newForm); stream.Close(); string pathToConverter = @"..\..\..\GetFormBytesFromDefinition\bin\Debug\GetFormBytesFromDefinition.exe"; // Run the other exe Process p = System.Diagnostics.Process.Start(pathToConverter, string.Format("\"{0}\" \"{1}\"", tempFileName, newFileName)); p.WaitForExit(); ConvertedForm form = new ConvertedForm(); form.FormId = component.Id; form.FormName = component.Name; try { // Now read in new file name. byte[] allData = File.ReadAllBytes(newFileName); if (allData != null) { form.FormData = allData; } } catch { MessageBox.Show("Error prevented form from being converted."); } return(form); }