public Timer() { BigTextLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Far, VerticalAlignment = StringAlignment.Near, Width = 493, Text = "0", }; SmallTextLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Near, VerticalAlignment = StringAlignment.Near, Width = 257, Text = "0", }; BigMeasureLabel = new SimpleLabel() { Text = "88:88:88", IsMonospaced = true }; Formatter = new ShortTimeFormatter(); Settings = new TimerSettings(); UpdateTimeFormat(); Cache = new GraphicsCache(); }
public Title() { VerticalHeight = 10; Settings = new TitleSettings(); Cache = new GraphicsCache(); GameNameLabel = new SimpleLabel(); CategoryNameLabel = new SimpleLabel(); AttemptCountLabel = new SimpleLabel(); }
public GradedLabelsComponent(GradedSplitsSettings settings, IEnumerable <GradedColumnData> columns) { Settings = settings; MinimumHeight = 31; MeasureTimeLabel = new SimpleLabel(); MeasureDeltaLabel = new SimpleLabel(); TimeFormatter = new GradedRegularSplitTimeFormatter(Settings.SplitTimesAccuracy); DeltaTimeFormatter = new GradedDeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals); Cache = new GraphicsCache(); LabelsList = new List <SimpleLabel>(); ColumnsList = columns; }
public LabelsComponent(SplitsSettings settings, IEnumerable<ColumnData> columns) { Settings = settings; MinimumHeight = 31; MeasureTimeLabel = new SimpleLabel(); MeasureDeltaLabel = new SimpleLabel(); TimeFormatter = new RegularSplitTimeFormatter(Settings.SplitTimesAccuracy); DeltaTimeFormatter = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals); Cache = new GraphicsCache(); LabelsList = new List<SimpleLabel>(); ColumnsList = columns; }
public CounterComponent(LiveSplitState state) { VerticalHeight = 10; Settings = new CounterComponentSettings(); Cache = new GraphicsCache(); CounterNameLabel = new SimpleLabel(); Counter = new Counter(); this.state = state; Settings.CounterReinitialiseRequired += Settings_CounterReinitialiseRequired; Settings.IncrementUpdateRequired += Settings_IncrementUpdateRequired; // Subscribe to input hooks. Settings.Hook.KeyOrButtonPressed += hook_KeyOrButtonPressed; }
/// <summary> /// Initializes the input modes. /// </summary> /// <remarks> /// Calls <see cref="CreateEditorMode"/> and registers /// the result as the <see cref="CanvasControl.InputMode"/>. /// </remarks> protected virtual void InitializeInputModes() { graphControl.InputMode = CreateEditorMode(); // Custom label helpers RegisterCustomEditLabelHelper(); GraphControl.KeyDown += PrepareInstantTyping; // Register custom event handler for the instant typing feature GraphControl.KeyPress += HandleInstantTyping; // Create a dummy label for the page header pageHeader = PageHeaderSupport.CreatePageHeader(GraphControl); }
/// <summary> /// Load label and add all needed bindings /// </summary> /// <param name="labelData">All the data needed for the label to load</param> private void LoadLabel(Tuple <SimpleLabel, string> labelData) { SimpleLabel label = labelData.Item1; string uniqueName = labelData.Item2; SubscribedLabel subscribedLabel = subscribedLabels.Find(x => x.UniqueName == uniqueName); subscribedLabel.Label = label; Binding myBinding = new Binding("Labels[" + subscribedLabel.Id + "]"); subscribedLabel.Label.Label.SetBinding(ContentControl.ContentProperty, myBinding); Messenger.Default.Send(new UpdateLabelMessage { subscribedLabel = subscribedLabel, value = "null" }, "ChangeLabelValue"); }
public InfoTextComponent(String informationName, String informationValue) { NameLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Near, Text = informationName }; ValueLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Far, Text = informationValue }; NameMeasureLabel = new SimpleLabel(); VerticalHeight = 31; LongestString = ""; }
private void RepositionSegmentLabel(SimpleLabel label, float height) { if (!Settings.ShowTimer) { label.Height = height; if (!Settings.ShowSplitName && !HideComparison) { label.VerticalAlignment = StringAlignment.Near; } if (Settings.ShowSplitName && HideComparison) { label.VerticalAlignment = StringAlignment.Far; } } }
public Timer() { BigTextLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Far, VerticalAlignment = StringAlignment.Near, Width = 493, Text = "0", }; SmallTextLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Near, VerticalAlignment = StringAlignment.Near, Width = 257, Text = "0", }; DeathsLabel = new DeathCountLabel() { Text = "0", Width = 400, IsMonospaced = true, HorizontalAlignment = StringAlignment.Near, VerticalAlignment = StringAlignment.Near }; MeasureDeathsLabel = new DeathCountLabel() { Text = "9999", IsMonospaced = true }; BigMeasureLabel = new SimpleLabel() { Text = "88:88:88", IsMonospaced = true }; Formatter = new ShortTimeFormatter(); Settings = new TimerSettings(); UpdateTimeFormat(); Cache = new GraphicsCache(); TimerColor = Color.Transparent; DeathCountColor = Color.Transparent; DeathsLabelVisible = true; }
public DetailedTimer(LiveSplitState state) { InternalComponent = new LiveSplit.UI.Components.Timer(); SegmentTimer = new SegmentTimer(); Settings = new DetailedTimerSettings() { CurrentState = state }; IconWidth = 0; Cache = new GraphicsCache(); LabelSegment = new SimpleLabel(); LabelBest = new SimpleLabel(); SegmentTime = new SimpleLabel(); BestSegmentTime = new SimpleLabel(); SplitName = new SimpleLabel(); state.ComparisonRenamed += state_ComparisonRenamed; }
public InfoTextComponent(string informationName, string informationValue) { Cache = new GraphicsCache(); NameLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Near, Text = informationName }; ValueLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Far, Text = informationValue }; NameMeasureLabel = new SimpleLabel(); VerticalHeight = 31; LongestString = ""; }
public LabelsComponent(SplitsSettings settings, IEnumerable <ColumnData> columns) { Settings = settings; MinimumHeight = 31; MeasureTimeLabel = new SimpleLabel(); MeasureDeltaLabel = new SimpleLabel(); TimeFormatter = new RegularSplitTimeFormatter(Settings.SplitTimesAccuracy); DeltaTimeFormatter = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals); Cache = new GraphicsCache(); LabelsList = new List <SimpleLabel>(); IEnumerable <ColumnData> splitsLabel = new ColumnData[] { new ColumnData(Settings.SplitsLabel, ColumnType.SplitsLabel, null, null) }; ColumnsList = splitsLabel.Concat(columns); }
public InfoTextComponent(string informationName, string informationValue) { Cache = new GraphicsCache(); NameLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Near, Text = informationName }; ValueLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Far, Text = informationValue }; NameMeasureLabel = new SimpleLabel(); MinimumHeight = 25; VerticalHeight = 31; LongestString = ""; }
static ConnectedIconLabelStyle() { labelAsNode = new SimpleNode(); dummyTextLabel = new SimpleLabel(labelAsNode, "", FreeLabelModel.Instance.CreateDefaultParameter()) { Style = new DefaultLabelStyle() }; dummyForLabelOwner = new SimpleNode(); dummyEdge = new SimpleEdge(new SimplePort(labelAsNode, FreeNodePortLocationModel.NodeCenterAnchored), new SimplePort(dummyForLabelOwner, FreeNodePortLocationModel.NodeCenterAnchored)) { Style = new BpmnEdgeStyle { Type = EdgeType.Association } }; }
public NotesComponent(IComponentFactory factory, LiveSplitState state) { Factory = factory; Settings = new NotesSettings(); // Creates notes file if it doesn't exit Notes = GetNotes((Run)state.Run); CurrentNote = new Note("", ComponentName); Label = new SimpleLabel(); state.RunManuallyModified += DoStart; state.OnStart += DoStart; state.OnSplit += DoSplit; state.OnSkipSplit += DoSplit; state.OnUndoSplit += DoSplit; state.OnReset += DoReset; }
protected override VisualGroup CreateVisual(IRenderContext context, INode node) { var group = new VisualGroup(); group.Add(DecoratedStyle.Renderer.GetVisualCreator(node, DecoratedStyle).CreateVisual(context)); foreach (var button in Buttons) { var oldLabel = button.Visualization; var label = new SimpleLabel(node, oldLabel.Text, oldLabel.LayoutParameter) { Style = oldLabel.Style, PreferredSize = oldLabel.PreferredSize }; group.Add(label.Style.Renderer.GetVisualCreator(label, label.Style).CreateVisual(context)); } return(group); }
public static void AnnotationExample() { using (var vw = new VowpalWabbit <MyExample>(new VowpalWabbitSettings(enableStringExampleGeneration: true))) { var ex = new MyExample { Income = 40, Age = 25 }; var label = new SimpleLabel { Label = 1 }; var str = vw.Serializer.Create(vw.Native).SerializeToString(ex, label); // 1 |p Income:4 | Age25 vw.Learn(ex, label); var prediction = vw.Predict(ex, VowpalWabbitPredictionType.Scalar); } }
/// <summary> /// This function will take care of adding the new label element /// </summary> /// <param name="sender"></param> private void AddLabel(object sender) { SimpleLabel labelControl = new SimpleLabel(); Random RNG = new Random(); int length = 16; var rString = ""; for (var i = 0; i < length; i++) { rString += ((char)(RNG.Next(1, 26) + 64)).ToString().ToLower(); } SubscribedLabel _subscribedLabel = new SubscribedLabel { Id = Guid.NewGuid(), UniqueName = rString, Label = labelControl, Topic = "" }; Label label = labelControl.Label; label.Name = _subscribedLabel.UniqueName; Binding myBinding = new Binding("Labels[" + _subscribedLabel.Id + "]"); label.SetBinding(ContentProperty, myBinding); Messenger.Default.Send(new UpdateLabelMessage { subscribedLabel = _subscribedLabel, value = "Waiting for first Value..." }, "ChangeLabelValue"); labelControl.MouseDoubleClick += object_MouseDoubleClick; labelControl.VerticalAlignment = VerticalAlignment.Center; labelControl.HorizontalAlignment = HorizontalAlignment.Center; labelControl.Margin = new Thickness(0, 30, 0, 0); controlCanvas.Children.Add(labelControl); Messenger.Default.Send(_subscribedLabel, "labelAdd"); }
/// <summary> /// This function will load the whole grid from the file saved on disk /// </summary> /// <param name="gridName">Name of the grid that should be loaded</param> void reloadGrid(string gridName) { currentGrid = gridName; if (!File.Exists(@"layouts/" + gridName + ".xaml")) { controlCanvas.Children.Clear(); return; } StreamReader sR = new StreamReader(@"layouts/" + gridName + ".xaml"); string text = sR.ReadToEnd(); sR.Close(); StringReader stringReader = new StringReader(text); XmlReader xmlReader = XmlReader.Create(stringReader); Grid grid = (Grid)XamlReader.Load(xmlReader); controlCanvas.Children.Clear(); foreach (FrameworkElement child in grid.Children) { if (child.GetType().ToString() == "HomeControler.Controls.SimpleLabel") { SimpleLabel label = CloneFrameworkElement(child) as SimpleLabel; LoadLabel(label); } else if (child.GetType().ToString() == "HomeControler.Controls.SimpleSwitch") { SimpleSwitch simpleSwitch = CloneFrameworkElement(child) as SimpleSwitch; LoadSwitch(simpleSwitch); } else if (child.GetType().ToString() == "HomeControler.Controls.SimpleCamera") { SimpleCamera simpleCamera = CloneFrameworkElement(child) as SimpleCamera; LoadCamera(simpleCamera); } } Messenger.Default.Send("reload", "getSubscribedDevices"); Messenger.Default.Send("subscribe", "subscribeToTopics"); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SimpleLabelLayout); _simpleLabel = FindViewById <SimpleLabel>(Resource.Id.simpleLabel); _themeDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.themeDropDown); _textColorDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.textColorDropDown); _fontDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.fontDropDown); _letterSpacingDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.letterSpacingDropDown); _textSizeDropDown = FindViewById <EOSSandboxDropDown>(Resource.Id.textSizeDropDown); var resetButton = FindViewById <Button>(Resource.Id.buttonResetCustomization); _themeDropDown.Name = Fields.Theme; _themeDropDown.SetupAdapter(ThemeTypes.ThemeCollection.Select(item => item.Key).ToList()); _themeDropDown.ItemSelected += ThemeItemSelected; _textColorDropDown.Name = Fields.TextColor; _textColorDropDown.SetupAdapter(SimpleLabelConstants.FontColors.Select(item => item.Key).ToList()); _textColorDropDown.ItemSelected += TextColorItemSelected; _fontDropDown.Name = Fields.Font; _fontDropDown.SetupAdapter(SimpleLabelConstants.SimpleLabelFonts.Select(item => item.Key).ToList()); _fontDropDown.ItemSelected += FontItemSelected; _letterSpacingDropDown.Name = Fields.LetterSpacing; _letterSpacingDropDown.SetupAdapter(SimpleLabelConstants.LetterSpacings.Select(item => item.Key).ToList()); _letterSpacingDropDown.ItemSelected += LetterSpacingItemSelected; _textSizeDropDown.Name = Fields.TextSize; _textSizeDropDown.SetupAdapter(SimpleLabelConstants.TextSizes.Select(item => item.Key).ToList()); _textSizeDropDown.ItemSelected += TextSizeItemSelected; SetCurrenTheme(_simpleLabel.GetThemeProvider().GetCurrentTheme()); resetButton.Click += delegate { ResetCustomValues(); }; }
public SplitComponent(SplitsSettings settings, IEnumerable<ColumnData> columnsList) { NameLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Near, X = 8, }; MeasureTimeLabel = new SimpleLabel(); MeasureDeltaLabel = new SimpleLabel(); Settings = settings; ColumnsList = columnsList; TimeFormatter = new RegularSplitTimeFormatter(Settings.SplitTimesAccuracy); DeltaTimeFormatter = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals); MinimumHeight = 31; NeedUpdateAll = true; IsActive = false; Cache = new GraphicsCache(); LabelsList = new List<SimpleLabel>(); }
/// <summary> /// This function will load label object when the app is opened with already configured layout /// </summary> /// <param name="simpleLabel">Label control that should be loaded</param> private void LoadLabel(SimpleLabel simpleLabel) { SimpleLabel labelControl = new SimpleLabel(); labelControl.Margin = new Thickness(simpleLabel.Margin.Left, simpleLabel.Margin.Top, simpleLabel.Margin.Right, simpleLabel.Margin.Bottom); Label label = simpleLabel.Content as Label; labelControl.Label.Name = label.GetValue(NameProperty).ToString(); Tuple <SimpleLabel, string> labelData = new Tuple <SimpleLabel, string>(labelControl, label.GetValue(NameProperty).ToString()); Messenger.Default.Send(labelData, "loadLabel"); labelControl.MouseDoubleClick += object_MouseDoubleClick; labelControl.VerticalAlignment = VerticalAlignment.Center; labelControl.HorizontalAlignment = HorizontalAlignment.Center; controlCanvas.Children.Add(labelControl); }
public override void Load(IController hud) { base.Load(hud); equippedItemCount = new uint[Hud.Game.Me.ArmorySets.Length]; isMatchingSet = new bool[Hud.Game.Me.ArmorySets.Length]; isMatchingPowers = new bool[Hud.Game.Me.ArmorySets.Length]; float x = Hud.Window.Size.Width * ArmorySetLabelRatioX; float y = Hud.Window.Size.Height * ArmorySetLabelRatioY; labelArmorySetNamesLeft = new SimpleLabel(Hud, "tahoma", 7, SharpDX.Color.PaleTurquoise).WithPosition(x, y); ArmorySetLabelFont = Hud.Render.CreateFont("arial", 7, 255, 192, 192, 192, true, false, 220, 32, 32, 32, true); // light grey on drak grey ArmorySetNameFont = Hud.Render.CreateFont("tahoma", 7, 255, 0xff, 0xd7, 0x00, false, false, true); // gold EquippedBorderBrush = Hud.Render.CreateBrush(150, 238, 232, 170, -1.6f); // pale golden rod (quite light) StashBorderBrush = Hud.Render.CreateBrush(150, 0, 192, 128, -1.6f); // teal - but lighter InventoryBorderBrush = Hud.Render.CreateBrush(200, 255, 0, 0, -1.6f); // red NotArmorySetBorderBrush = Hud.Render.CreateBrush(100, 255, 51, 0, -1.6f); // orangish transparent }
public SplitComponent(SplitsSettings settings) { NoIconShadow = IconShadow.Generate(NoIconImage, Color.Black); NameLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Near, X = 8, }; MeasureTimeLabel = new SimpleLabel(); MeasureDeltaLabel = new SimpleLabel(); Settings = settings; TimeFormatter = new RegularSplitTimeFormatter(Settings.SplitTimesAccuracy); DeltaTimeFormatter = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals); MinimumHeight = 31; NeedUpdateAll = true; IsActive = false; Cache = new GraphicsCache(); LabelsList = new List <SimpleLabel>(); }
public SplitComponent(SplitsSettings settings, IEnumerable <ColumnData> columnsList) { NameLabel = new SimpleLabel() { HorizontalAlignment = StringAlignment.Near, X = 8, }; MeasureTimeLabel = new SimpleLabel(); MeasureDeltaLabel = new SimpleLabel(); Settings = settings; ColumnsList = columnsList; TimeFormatter = new RegularSplitTimeFormatter(Settings.SplitTimesAccuracy); DeltaTimeFormatter = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals); MinimumHeight = 31; NeedUpdateAll = true; IsActive = false; Cache = new GraphicsCache(); LabelsList = new List <SimpleLabel>(); }
public ManaTrackerComponent(LiveSplitState State) { Settings = new ManaTrackerSettings(State); this.State = State; State.OnStart += OnRunStart; State.OnSplit += OnRunSplit; State.OnSkipSplit += OnRunSplit; State.OnUndoSplit += OnUndoRunSplit; GameProcess = GetGameProcess(); CurrentSplitIndex = -1; ManaSnapshots = new List <ManaSnapshot>(); SpecialEvents = new List <SpecialEvent>(); IsInLoadingScreen = false; HeaderLabel = new SimpleLabel(); }
public override void ViewDidLoad() { base.ViewDidLoad(); _simpleLabel = new SimpleLabel { Text = "Label" }; _dropDowns = new List <EOSSandboxDropDown>() { themesDropDown, fontDropDown, textColorDropDown, textSizeDropDown, letterSpacingDropDown }; View.AddGestureRecognizer(new UITapGestureRecognizer(() => { _dropDowns.ForEach(field => field.CloseInputControl()); })); _simpleLabel.TextAlignment = UITextAlignment.Center; containerView.ConstrainLayout(() => _simpleLabel.Frame.GetCenterY() == containerView.Frame.GetCenterY() && _simpleLabel.Frame.Left == containerView.Frame.Left && _simpleLabel.Frame.Right == containerView.Frame.Right, _simpleLabel); var rect = new CGRect(0, 0, 100, 150); InitThemeDropDown(rect); InitSources(rect); resetButton.TouchUpInside += (sender, e) => { _simpleLabel.ResetCustomization(); _dropDowns.Except(new [] { themesDropDown }).ToList().ForEach(d => d.ResetValue()); }; }
protected override VisualGroup UpdateVisual(IRenderContext context, VisualGroup oldGroup, INode node) { if (oldGroup == null || oldGroup.Children.Count != Buttons.Count + 1) { return(CreateVisual(context, node)); } var decoratedVisual = oldGroup.Children[0]; var newDecoratedVisual = DecoratedStyle.Renderer.GetVisualCreator(node, DecoratedStyle).UpdateVisual(context, decoratedVisual); if (newDecoratedVisual != decoratedVisual) { oldGroup.Children[0] = newDecoratedVisual; } var i = 1; foreach (var button in Buttons) { var buttonVisual = oldGroup.Children[i]; var oldLabel = button.Visualization; var label = new SimpleLabel(node, oldLabel.Text, oldLabel.LayoutParameter) { Style = oldLabel.Style, PreferredSize = oldLabel.PreferredSize }; var newButtonVisual = label.Style.Renderer.GetVisualCreator(label, label.Style).UpdateVisual(context, buttonVisual); if (newButtonVisual != buttonVisual) { oldGroup.Children[i] = newButtonVisual; } i++; } return(oldGroup); }
public PageHeaderEditLabelHelper(SimpleLabel label, ICanvasObject labelCanvasObject) { this.label = label; this.labelCanvasObject = labelCanvasObject; }
public override void EnterExample(VowpalWabbitParser.ExampleContext context) { this.label = null; this.example.Features.Clear(); }
protected void UpdateColumn(LiveSplitState state, SimpleLabel label, ColumnData data) { var comparison = data.Comparison == "Current Comparison" ? state.CurrentComparison : data.Comparison; if (!state.Run.Comparisons.Contains(comparison)) comparison = state.CurrentComparison; var timingMethod = state.CurrentTimingMethod; if (data.TimingMethod == "Real Time") timingMethod = TimingMethod.RealTime; else if (data.TimingMethod == "Game Time") timingMethod = TimingMethod.GameTime; var type = data.Type; var splitIndex = state.Run.IndexOf(Split); if (splitIndex < state.CurrentSplitIndex) { if (type == ColumnType.SplitTime || type == ColumnType.SegmentTime) { label.ForeColor = Settings.OverrideTimesColor ? Settings.BeforeTimesColor : state.LayoutSettings.TextColor; if (type == ColumnType.SplitTime) label.Text = TimeFormatter.Format(Split.SplitTime[timingMethod]); else //SegmentTime { var segmentTime = LiveSplitStateHelper.GetPreviousSegmentTime(state, splitIndex, comparison, timingMethod); label.Text = TimeFormatter.Format(segmentTime); } } if (type == ColumnType.DeltaorSplitTime || type == ColumnType.Delta) { var deltaTime = Split.SplitTime[timingMethod] - Split.Comparisons[comparison][timingMethod]; var color = LiveSplitStateHelper.GetSplitColor(state, deltaTime, splitIndex, true, true, comparison, timingMethod); if (color == null) color = Settings.OverrideTimesColor ? Settings.BeforeTimesColor : state.LayoutSettings.TextColor; label.ForeColor = color.Value; if (type == ColumnType.DeltaorSplitTime) { if (deltaTime != null) label.Text = DeltaTimeFormatter.Format(deltaTime); else label.Text = TimeFormatter.Format(Split.SplitTime[timingMethod]); } else if (type == ColumnType.Delta) label.Text = DeltaTimeFormatter.Format(deltaTime); } else if (type == ColumnType.SegmentDeltaorSegmentTime || type == ColumnType.SegmentDelta) { var segmentDelta = LiveSplitStateHelper.GetPreviousSegmentDelta(state, splitIndex, comparison, timingMethod); var color = LiveSplitStateHelper.GetSplitColor(state, segmentDelta, splitIndex, false, true, comparison, timingMethod); if (color == null) color = Settings.OverrideTimesColor ? Settings.BeforeTimesColor : state.LayoutSettings.TextColor; label.ForeColor = color.Value; if (type == ColumnType.SegmentDeltaorSegmentTime) { if (segmentDelta != null) label.Text = DeltaTimeFormatter.Format(segmentDelta); else label.Text = TimeFormatter.Format(Split.SplitTime[timingMethod]); } else if (type == ColumnType.SegmentDelta) label.Text = DeltaTimeFormatter.Format(segmentDelta); } } else { if (type == ColumnType.SplitTime || type == ColumnType.SegmentTime || type == ColumnType.DeltaorSplitTime || type == ColumnType.SegmentDeltaorSegmentTime) { if (Split == state.CurrentSplit) label.ForeColor = Settings.OverrideTimesColor ? Settings.CurrentTimesColor : state.LayoutSettings.TextColor; else label.ForeColor = Settings.OverrideTimesColor ? Settings.AfterTimesColor : state.LayoutSettings.TextColor; if (type == ColumnType.SplitTime || type == ColumnType.DeltaorSplitTime) label.Text = TimeFormatter.Format(Split.Comparisons[comparison][timingMethod]); else //SegmentTime or SegmentTimeorSegmentDeltaTime { var previousTime = splitIndex > 0 ? state.Run[splitIndex - 1].Comparisons[comparison][timingMethod] : TimeSpan.Zero; label.Text = TimeFormatter.Format(Split.Comparisons[comparison][timingMethod] - previousTime); } } //Live Delta var bestDelta = LiveSplitStateHelper.CheckLiveDelta(state, true, comparison, timingMethod); if (bestDelta != null && Split == state.CurrentSplit && (type == ColumnType.DeltaorSplitTime || type == ColumnType.Delta || type == ColumnType.SegmentDeltaorSegmentTime || type == ColumnType.SegmentDelta)) { if (type == ColumnType.DeltaorSplitTime || type == ColumnType.Delta) label.Text = DeltaTimeFormatter.Format(bestDelta); else if (type == ColumnType.SegmentDeltaorSegmentTime || type == ColumnType.SegmentDelta) label.Text = DeltaTimeFormatter.Format(LiveSplitStateHelper.GetLiveSegmentDelta(state, splitIndex, comparison, timingMethod)); label.ForeColor = Settings.OverrideDeltasColor ? Settings.DeltasColor : state.LayoutSettings.TextColor; } else if (type == ColumnType.Delta || type == ColumnType.SegmentDelta) label.Text = ""; } }
void SetupLabels() { Debug.Log ("StartMenuScreen::SetupLabels"); SimpleLabel ctrl; Rect textArea; // // // textArea = new Rect(0, 40, Screen.width, Screen.height); ctrl = new SimpleLabel("Having a smoke...", textArea); ctrl.CustomSkin = this.skin; ctrl.StyleName = "StartMenuHeader"; labels.Add(ctrl); // // // textArea = new Rect(0, 80, Screen.width, Screen.height); ctrl = new SimpleLabel("(switched off robot power, too)", textArea); ctrl.CustomSkin = this.skin; ctrl.StyleName = "StartMenuSubHeader"; labels.Add(ctrl); }
protected override VisualGroup UpdateVisual(IRenderContext context, VisualGroup group, INode node1) { if (group == null || group.Children.Count != 6 + buttons.Count) { return(CreateVisual(context, node1)); } group.Transform = new Matrix(1, 0, 0, 1, (float)node1.Layout.X, (float)node1.Layout.Y); var data = (LayerConstraintsInfo)node1.Tag; node.Tag = data; var x = (float)insets.Left; var y = (float)insets.Top; var width = (float)(node.Layout.Width - insets.HorizontalInsets - ButtonSize); //var height = (float)(font.GetHeight(graphics) + insets.VerticalInsets); var height = ButtonSize * 2; // update background group.Children[0] = DecoratedStyle.Renderer.GetVisualCreator(node, DecoratedStyle).UpdateVisual(context, group.Children[0]); // update labels if (data.Constraints) { if (group.Children[1] == null) { var rectangle = new RectangleVisual(x, y, width, height) { Brush = GetBackgroundBrush(data) }; group.Children[1] = rectangle; string s = data.ToString(); Brush brush = GetForegroundBrush(data); IPoint location = new PointD(x + insets.Left, y + insets.Top); group.Children[2] = new TextVisual { Text = s, Font = font, Brush = brush, Location = location }; } else { ((ShapeVisual)group.Children[1]).Brush = GetBackgroundBrush(data); var textPaintable = (TextVisual)group.Children[2]; textPaintable.Brush = GetForegroundBrush(data); textPaintable.Text = data.ToString(); } } else { if (group.Children[1] != null) { group.Children[1] = VoidVisualCreator.Instance.CreateVisual(context); group.Children[2] = VoidVisualCreator.Instance.CreateVisual(context); } } // paint buttons toggleStateStyle.Icon = data.Constraints ? ButtonLabelStyle.ButtonIcon.Toggle : ButtonLabelStyle.ButtonIcon.None; toggleStateStyle.BackgroundColor = data.Constraints ? Color.Green : Color.Gray; int childIndex = 3; foreach (var button in buttons) { ILabel oldLabel = button.Visualization; var icon = ((ButtonLabelStyle)button.Visualization.Style).Icon; if (data.Constraints || icon == ButtonLabelStyle.ButtonIcon.Toggle || icon == ButtonLabelStyle.ButtonIcon.None) { SimpleLabel label = new SimpleLabel(node, oldLabel.Text, oldLabel.LayoutParameter) { Style = oldLabel.Style, PreferredSize = oldLabel.PreferredSize }; group.Children[childIndex] = label.Style.Renderer.GetVisualCreator(label, label.Style).UpdateVisual(context, group.Children[childIndex]); } else { group.Children[childIndex] = VoidVisualCreator.Instance.CreateVisual(context); } childIndex++; } if (data.Constraints) { if (group.Children[childIndex] == null) { double w = width + ButtonSize; var rectangle = new RectangleVisual(x, y, w, height) { Pen = Pens.Black }; group.Children[childIndex] = rectangle; var line = new LineVisual(x + width, y, x + width, y + height) { Pen = Pens.Black }; group.Children[childIndex + 1] = line; } } else { if (group.Children[childIndex] != null) { group.Children[childIndex] = VoidVisualCreator.Instance.CreateVisual(context); group.Children[childIndex + 1] = VoidVisualCreator.Instance.CreateVisual(context); } } childIndex += 2; ((TextVisual)group.Children[childIndex]).Text = data.Constraints ? "Enabled" : "Disabled"; return(group); }
protected override VisualGroup CreateVisual(IRenderContext context, INode node1) { var group = new VisualGroup(); group.Transform = new Matrix(1, 0, 0, 1, (float)node1.Layout.X, (float)node1.Layout.Y); var data = (LayerConstraintsInfo)node1.Tag; node.Layout = new RectD(PointD.Origin, node1.Layout.GetSize()); node.Tag = data; var x = (float)insets.Left; var y = (float)insets.Top; var width = (float)(node.Layout.Width - insets.HorizontalInsets - ButtonSize); //var height = (float)(font.GetHeight(graphics) + insets.VerticalInsets); var height = ButtonSize * 2; // add background group.Add(DecoratedStyle.Renderer.GetVisualCreator(node, DecoratedStyle).CreateVisual(context)); // paint label if (data.Constraints) { var rectangle = new RectangleVisual(x, y, width, height) { Brush = GetBackgroundBrush(data) }; group.Add(rectangle); group.Add(new TextVisual { Text = data.ToString(), Font = font, Brush = GetForegroundBrush(data), Location = new PointD(x + insets.Left, y + insets.Top) }); } else { group.Add(VoidVisualCreator.Instance.CreateVisual(context)); group.Add(VoidVisualCreator.Instance.CreateVisual(context)); } // paint buttons toggleStateStyle.Icon = data.Constraints ? ButtonLabelStyle.ButtonIcon.Toggle : ButtonLabelStyle.ButtonIcon.None; toggleStateStyle.BackgroundColor = data.Constraints ? Color.Green : Color.Gray; foreach (var button in buttons) { ILabel buttonLabel = button.Visualization; var icon = ((ButtonLabelStyle)buttonLabel.Style).Icon; if (data.Constraints || icon == ButtonLabelStyle.ButtonIcon.Toggle || icon == ButtonLabelStyle.ButtonIcon.None) { SimpleLabel label = new SimpleLabel(node, buttonLabel.Text, buttonLabel.LayoutParameter) { Style = buttonLabel.Style, PreferredSize = buttonLabel.PreferredSize }; group.Add(label.Style.Renderer.GetVisualCreator(label, label.Style).CreateVisual(context)); } else { group.Add(VoidVisualCreator.Instance.CreateVisual(context)); } } if (data.Constraints) { double w = width + ButtonSize; var rectangle = new RectangleVisual(x, y, w, height) { Pen = Pens.Black }; group.Add(rectangle); var line = new LineVisual(x + width, y, x + width, y + height) { Pen = Pens.Black }; group.Add(line); } else { group.Add(VoidVisualCreator.Instance.CreateVisual(context)); group.Add(VoidVisualCreator.Instance.CreateVisual(context)); } group.Add(new TextVisual { Text = data.Constraints ? "Enabled" : "Disabled", Font = labelFont, Brush = Brushes.Black, Location = new PointD(x + ButtonSize + 1, y + (float)node.Layout.Height + 1 - (float)insets.Bottom - font.Height - ButtonSize * 0.2f) }); return(group); }
void SetupLabels() { Debug.Log ("StartMenuScreen::SetupLabels"); SimpleLabel ctrl; Rect textArea; // // // textArea = new Rect(0, 40, Screen.width, Screen.height); ctrl = new SimpleLabel("HeartCore Rambot", textArea); ctrl.CustomSkin = this.skin; ctrl.StyleName = "StartMenuHeader"; labels.Add(ctrl); // // // textArea = new Rect(0, 80, Screen.width, Screen.height); ctrl = new SimpleLabel("(that's you!)", textArea); ctrl.CustomSkin = this.skin; ctrl.StyleName = "StartMenuSubHeader"; labels.Add(ctrl); }
protected void UpdateColumn(LiveSplitState state, SimpleLabel label, ColumnData data) { var comparison = data.Comparison == "Current Comparison" ? state.CurrentComparison : data.Comparison; if (!state.Run.Comparisons.Contains(comparison)) { comparison = state.CurrentComparison; } var timingMethod = state.CurrentTimingMethod; if (data.TimingMethod == "Real Time") { timingMethod = TimingMethod.RealTime; } else if (data.TimingMethod == "Game Time") { timingMethod = TimingMethod.GameTime; } var type = data.Type; var splitIndex = state.Run.IndexOf(Split); if (splitIndex < state.CurrentSplitIndex) { if (type == ColumnType.SplitTime || type == ColumnType.SegmentTime) { label.ForeColor = Settings.OverrideTimesColor ? Settings.BeforeTimesColor : state.LayoutSettings.TextColor; if (type == ColumnType.SplitTime) { label.Text = TimeFormatter.Format(Split.SplitTime[timingMethod]); } else //SegmentTime { var segmentTime = LiveSplitStateHelper.GetPreviousSegmentTime(state, splitIndex, timingMethod); label.Text = TimeFormatter.Format(segmentTime); } } if (type == ColumnType.DeltaorSplitTime || type == ColumnType.Delta) { var deltaTime = Split.SplitTime[timingMethod] - Split.Comparisons[comparison][timingMethod]; var color = LiveSplitStateHelper.GetSplitColor(state, deltaTime, splitIndex, true, true, comparison, timingMethod); if (color == null) { color = Settings.OverrideTimesColor ? Settings.BeforeTimesColor : state.LayoutSettings.TextColor; } label.ForeColor = color.Value; if (type == ColumnType.DeltaorSplitTime) { if (deltaTime != null) { label.Text = DeltaTimeFormatter.Format(deltaTime); } else { label.Text = TimeFormatter.Format(Split.SplitTime[timingMethod]); } } else if (type == ColumnType.Delta) { label.Text = DeltaTimeFormatter.Format(deltaTime); } } else if (type == ColumnType.SegmentDeltaorSegmentTime || type == ColumnType.SegmentDelta) { var segmentDelta = LiveSplitStateHelper.GetPreviousSegmentDelta(state, splitIndex, comparison, timingMethod); var color = LiveSplitStateHelper.GetSplitColor(state, segmentDelta, splitIndex, false, true, comparison, timingMethod); if (color == null) { color = Settings.OverrideTimesColor ? Settings.BeforeTimesColor : state.LayoutSettings.TextColor; } label.ForeColor = color.Value; if (type == ColumnType.SegmentDeltaorSegmentTime) { if (segmentDelta != null) { label.Text = DeltaTimeFormatter.Format(segmentDelta); } else { label.Text = TimeFormatter.Format(LiveSplitStateHelper.GetPreviousSegmentTime(state, splitIndex, timingMethod)); } } else if (type == ColumnType.SegmentDelta) { label.Text = DeltaTimeFormatter.Format(segmentDelta); } } } else { if (type == ColumnType.SplitTime || type == ColumnType.SegmentTime || type == ColumnType.DeltaorSplitTime || type == ColumnType.SegmentDeltaorSegmentTime) { if (Split == state.CurrentSplit) { label.ForeColor = Settings.OverrideTimesColor ? Settings.CurrentTimesColor : state.LayoutSettings.TextColor; } else { label.ForeColor = Settings.OverrideTimesColor ? Settings.AfterTimesColor : state.LayoutSettings.TextColor; } if (type == ColumnType.SplitTime || type == ColumnType.DeltaorSplitTime) { label.Text = TimeFormatter.Format(Split.Comparisons[comparison][timingMethod]); } else //SegmentTime or SegmentTimeorSegmentDeltaTime { var previousTime = TimeSpan.Zero; for (var index = splitIndex - 1; index >= 0; index--) { var comparisonTime = state.Run[index].Comparisons[comparison][timingMethod]; if (comparisonTime != null) { previousTime = comparisonTime.Value; break; } } label.Text = TimeFormatter.Format(Split.Comparisons[comparison][timingMethod] - previousTime); } } //Live Delta var splitDelta = type == ColumnType.DeltaorSplitTime || type == ColumnType.Delta; var bestDelta = LiveSplitStateHelper.CheckLiveDelta(state, splitDelta, comparison, timingMethod); if (bestDelta != null && Split == state.CurrentSplit && (type == ColumnType.DeltaorSplitTime || type == ColumnType.Delta || type == ColumnType.SegmentDeltaorSegmentTime || type == ColumnType.SegmentDelta)) { if (splitDelta) //DeltaorSplitTime or Delta { label.Text = DeltaTimeFormatter.Format(bestDelta); } else //SegmentDeltaorSegmentTime or SegmentDelta { label.Text = DeltaTimeFormatter.Format(LiveSplitStateHelper.GetLiveSegmentDelta(state, splitIndex, comparison, timingMethod)); } label.ForeColor = Settings.OverrideDeltasColor ? Settings.DeltasColor : state.LayoutSettings.TextColor; } else if (type == ColumnType.Delta || type == ColumnType.SegmentDelta) { label.Text = ""; } } }
/// <summary> /// Instantiates a new label style. /// </summary> public ZoomInvariantLabelStyle(ILabelStyle innerLabelStyle) { InnerLabelStyle = innerLabelStyle; rectangle = new OrientedRectangle(); dummyLabel = new SimpleLabel(null, string.Empty, new FreeLabelModel().CreateDynamic(rectangle)); }