Ejemplo n.º 1
0
        private void DeleteLabel(TextAppearance appearance)
        {
            TextAppearancesCollection.Remove(TextAppearancesCollection.Single(t => t.Tag == appearance.Tag));
            Appearance.TextAppearances.Remove(Appearance.TextAppearances.Single(t => t.Tag == appearance.Tag));

            LabelDeleted?.Invoke(this, new TextLabelChangedEventArgs(appearance));
        }
Ejemplo n.º 2
0
        private void CreateTextLabel(TextAppearance appearance)
        {
            var label = new FormattedTextLabel(appearance.FormatString, appearance.Color, appearance.FontSize, appearance.FontFamily, appearance.TextAlignment);

            label.DataBindings.Add(nameof(label.Format), appearance, nameof(appearance.FormatString));
            label.DataBindings.Add(nameof(label.DefaultColor), appearance, nameof(appearance.Color));
            label.DataBindings.Add(nameof(label.FontSize), appearance, nameof(appearance.FontSize));
            label.DataBindings.Add(nameof(label.FontFamily), appearance, nameof(appearance.FontFamily));
            label.DataBindings.Add(nameof(label.Alignment), appearance, nameof(appearance.TextAlignment));

            label.DataBindings.Add(nameof(label.Visible), appearance, nameof(appearance.IsVisible));
            label.DataBindings.Add(nameof(label.Width), appearance, nameof(appearance.Width));
            label.DataBindings.Add(nameof(label.Height), appearance, nameof(appearance.Height));
            label.DataBindings.Add(nameof(label.Location), appearance, nameof(appearance.Location));
            label.DataBindings.Add(nameof(label.ScrollSpeed), appearance, nameof(appearance.ScrollSpeed));

            label.AlbumName    = _audioSourceStatus.AlbumName;
            label.Artist       = _audioSourceStatus.Artist;
            label.SongName     = _audioSourceStatus.SongName;
            label.SongLength   = _audioSourceStatus.SongLength;
            label.SongProgress = _audioSourceStatus.SongProgress;

            label.DataBindings.Add(nameof(label.AlbumName), _audioSourceStatus, nameof(_audioSourceStatus.AlbumName));
            label.DataBindings.Add(nameof(label.Artist), _audioSourceStatus, nameof(_audioSourceStatus.Artist));
            label.DataBindings.Add(nameof(label.SongName), _audioSourceStatus, nameof(_audioSourceStatus.SongName));
            label.DataBindings.Add(nameof(label.SongLength), _audioSourceStatus, nameof(_audioSourceStatus.SongLength));
            label.DataBindings.Add(nameof(label.SongProgress), _audioSourceStatus, nameof(_audioSourceStatus.SongProgress));

            appearance.Tag = _nextTag++;
            label.TagId    = appearance.Tag;
            label.Name     = "formatted label";
            Controls.Add(label);
        }
Ejemplo n.º 3
0
        private void CreateLabel(TextAppearance appearance)
        {
            Appearance.TextAppearances.Add(appearance);
            TextAppearancesCollection.Add(appearance);

            NewLabelCreated?.Invoke(this, new TextLabelChangedEventArgs(appearance));
        }
Ejemplo n.º 4
0
        private void NewLabelOnExecute(object sender, ExecutedRoutedEventArgs e)
        {
            var appearance = new TextAppearance {
                Name = "New label"
            };

            CreateLabel(appearance);

            _addedTextAppearances.Add(appearance);
            appearance.BeginEdit();
        }
Ejemplo n.º 5
0
    private void Init()
    {
        GameObject pools = GameObject.Find("pools");

        movement          = pools.GetComponent <PoolMaskMovement>();
        manager           = pools.GetComponent <LevelManager>();
        textAppearance    = GameObject.Find("Dialogue").GetComponent <TextAppearance>();
        sceneEventManager = GameObject.Find("GameManager").GetComponent <SceneEventManager>();

        //get default values to allow for live restoration
        baseMovementSpeed       = movement.transitionSpeed;
        baseTimeWaitClientEnter = sceneEventManager.timeWaitClientEnter;
    }
        public void MigrateV1ToV2_CustomText()
        {
            var text1 = new TextAppearance
            {
                Color        = Color.Red,
                Width        = 1,
                Height       = 2,
                Name         = "test",
                XPosition    = 4,
                IsVisible    = true,
                YPosition    = 10,
                ScrollSpeed  = 20,
                FontSize     = 1f,
                FontFamily   = "family",
                Alignment    = CustomLabel.TextAlignment.Center,
                FormatString = "123",
            };

            var texts = new List <TextAppearance>()
            {
                text1
            };
            var v1 = new V1Settings {
                TextAppearances = texts
            };
            var v2 = Migration.MigrateSettings <V2Settings>(v1, "0.1", "2");

            Assert.AreEqual(v2.CustomLabelSettings.Count, texts.Count);
            Assert.AreEqual(v2.CustomLabelSettings[0].Color, text1.Color);
            Assert.AreEqual(v2.CustomLabelSettings[0].Width, text1.Width);
            Assert.AreEqual(v2.CustomLabelSettings[0].Height, text1.Height);
            Assert.AreEqual(v2.CustomLabelSettings[0].Name, text1.Name);
            Assert.AreEqual(v2.CustomLabelSettings[0].XPosition, text1.XPosition);
            Assert.AreEqual(v2.CustomLabelSettings[0].IsVisible, text1.IsVisible);
            Assert.AreEqual(v2.CustomLabelSettings[0].YPosition, text1.YPosition);
            Assert.AreEqual(v2.CustomLabelSettings[0].ScrollSpeed, text1.ScrollSpeed);
            Assert.AreEqual(v2.CustomLabelSettings[0].FontSize, text1.FontSize);
            Assert.AreEqual(v2.CustomLabelSettings[0].FontFamily, text1.FontFamily);
            Assert.AreEqual(v2.CustomLabelSettings[0].Alignment, text1.Alignment);
            Assert.AreEqual(v2.CustomLabelSettings[0].FormatString, text1.FormatString);
        }
Ejemplo n.º 7
0
 public TextLabelChangedEventArgs(TextAppearance appearance)
 {
     Appearance = appearance;
 }
Ejemplo n.º 8
0
 public static IEnumerable <MetadataProperty> FindTextPropertiesOnTree(object node, string languageCode = null, TextAppearance textAppearance = TextAppearance.None) =>
 FindTextPropertiesOnTree <TextAttribute>(node, languageCode, textAppearance);
Ejemplo n.º 9
0
 public static IEnumerable <MetadataProperty> FindTextPropertiesOnTree <T>(object node, string languageCode = null, TextAppearance textAppearance = TextAppearance.None) where T : Attribute =>
 GetAllParentNodes(node).Concat(GetAllDefaultChildrenNodes(node)).Distinct()
 .SelectMany(n => FindTextPropertiesOnNode <T>(n, languageCode, textAppearance));
Ejemplo n.º 10
0
 /// <summary>Get all key-value pairings of designated by TextAttribute of a node</summary>
 public static IEnumerable <MetadataProperty> FindTextPropertiesOnNode <T>(object node, string languageCode = null, TextAppearance textAppearance = TextAppearance.None) where T : Attribute =>
 FindPropertiesOnType <T>(node.GetType())
 .Where(p => languageCode == null || p.GetCustomAttribute <TextAttribute>()?.Culture == languageCode)
 .Where(p => textAppearance == TextAppearance.None ^ p.GetCustomAttribute <ShowOnAttribute>()?.TextAppearance.HasFlag(textAppearance) == true)
 .Select(p => new MetadataProperty
 {
     Name  = p.GetCustomAttribute <TextAttribute>()?.Name,
     Value = p.GetValue(node)
 });
Ejemplo n.º 11
0
 public ShowOnAttribute(TextAppearance ta)
 {
     this.TextAppearance = ta;
 }