// IDialogueEditing
        public void Initialize(TextEffectParams effectParams)
        {
            Assert.IsTrue(effectParams.EffectType == TextEffectType.Animation_SizeTransition);

            _range = effectParams.Range;
            Dictionary <string, string> attributes = effectParams.Attributes;

            if (attributes.ContainsKey(TextEffectsAttributes.SpeedAttribute))
            {
                _speed = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.SpeedAttribute]);
            }
            Assert.IsTrue(_speed >= 0);

            if (attributes.ContainsKey(TextEffectsAttributes.SizeFromAttribute))
            {
                _sizeFrom = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.SizeFromAttribute]);
            }
            Assert.IsTrue(_sizeFrom >= 0);

            if (attributes.ContainsKey(TextEffectsAttributes.SizeToAttribute))
            {
                _sizeTo = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.SizeToAttribute]);
            }
            Assert.IsTrue(_sizeTo >= 0);
        }
Ejemplo n.º 2
0
        // IDialogueEditing
        public void Initialize(TextEffectParams effectParams)
        {
            Assert.IsTrue(effectParams.EffectType == TextEffectType.Animation_Wobble);

            _range = effectParams.Range;
            Dictionary <string, string> attributes = effectParams.Attributes;

            if (attributes.ContainsKey(TextEffectsAttributes.Frequency1Attribute))
            {
                _frequency1 = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.Frequency1Attribute]);
            }
            Assert.IsTrue(_frequency1 >= 0);

            if (attributes.ContainsKey(TextEffectsAttributes.Frequency2Attribute))
            {
                _frequency2 = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.Frequency2Attribute]);
            }
            Assert.IsTrue(_frequency2 >= 0);

            if (attributes.ContainsKey(TextEffectsAttributes.AmplitudeAttribute))
            {
                _amplitude = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.AmplitudeAttribute]);
            }
            Assert.IsTrue(_amplitude >= 0);

            if (attributes.ContainsKey(TextEffectsAttributes.CoverageAttribute))
            {
                Assert.IsTrue(Tools.StringToEnum(attributes[TextEffectsAttributes.CoverageAttribute], ref _coverage));
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// If the dialogue entry has a canvasRect field, extract it and use it to set the canvas rect position.
 /// </summary>
 public void UseCanvasRectField()
 {
     var canvasRectField = Field.Lookup(fields, "canvasRect");
     if (canvasRectField != null && !string.IsNullOrEmpty(canvasRectField.value))
     {
         var values = canvasRectField.value.Split(';');
         var canvasX = (values.Length >= 1) ? Tools.StringToFloat(values[0]) : 0;
         var canvasY = (values.Length >= 2) ? Tools.StringToFloat(values[1]) : 0;
         if (canvasX > 0 && canvasY > 0) canvasRect = new Rect(canvasX, canvasY, canvasRect.width, canvasRect.height);
         fields.Remove(canvasRectField);
     }
 }
Ejemplo n.º 4
0
        // ITextEffect
        public void Initialize(TextEffectParams effectParams)
        {
            Assert.IsTrue(effectParams.EffectType == TextEffectType.Color_Rainbow);

            _range = effectParams.Range;

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.FrequencyAttribute))
            {
                _frequency = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.FrequencyAttribute]);
            }
            Assert.IsTrue(_frequency >= 0);

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.LengthAttribute))
            {
                _length = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.LengthAttribute]);
            }
            Assert.IsTrue(_length >= 0);
        }
Ejemplo n.º 5
0
        public static void RefreshRelationshipTableFromLua()
        {
            relationshipTable.Clear();
            string relationshipTableString = Lua.Run("return RelationshipTable").AsString;

            char[] semicolons = new char[] { ';' };
            char[] commas     = new char[] { ',' };
            foreach (var entry in relationshipTableString.Split(semicolons))
            {
                string[] fields = entry.Split(commas);
                if (fields.Length > 3)
                {
                    string key   = string.Format("{0},{1},{2}", new string[] { fields[0], fields[1], fields[2] });
                    float  value = Tools.StringToFloat(fields[3]);
                    relationshipTable[key] = value;
                }
            }
        }
        // ITextEffect
        public void Initialize(TextEffectParams effectParams)
        {
            Assert.IsTrue(effectParams.EffectType == TextEffectType.Color_Blink);

            _range = effectParams.Range;

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.FrequencyAttribute))
            {
                _frequency = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.FrequencyAttribute]);
            }
            Assert.IsTrue(_frequency >= 0);

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.ColorFromAttribute))
            {
                _colorFrom = Tools.WebColor(effectParams.Attributes[TextEffectsAttributes.ColorFromAttribute]);
            }

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.ColorToAttribute))
            {
                _colorTo = Tools.WebColor(effectParams.Attributes[TextEffectsAttributes.ColorToAttribute]);
            }
        }
        // ITextEffect
        public void Initialize(TextEffectParams effectParams)
        {
            Assert.IsTrue(effectParams.EffectType == TextEffectType.Color_Transition);

            _range = effectParams.Range;

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.SpeedAttribute))
            {
                _transitionSpeed = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.SpeedAttribute]);
            }
            Assert.IsTrue(_transitionSpeed >= 0);

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.ColorFromAttribute))
            {
                _colorFrom = Tools.WebColor(effectParams.Attributes[TextEffectsAttributes.ColorFromAttribute]);
            }

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.ColorToAttribute))
            {
                _colorTo = Tools.WebColor(effectParams.Attributes[TextEffectsAttributes.ColorToAttribute]);
            }
        }
Ejemplo n.º 8
0
        // IDialogueEditing
        public void Initialize(TextEffectParams effectParams)
        {
            Assert.IsTrue(effectParams.EffectType == TextEffectType.Animation_Wave);

            _range = effectParams.Range;

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.FrequencyAttribute))
            {
                _frequency = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.FrequencyAttribute]);
            }
            Assert.IsTrue(_frequency >= 0);

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.LengthAttribute))
            {
                _length = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.LengthAttribute]);
            }
            Assert.IsTrue(_length >= 0);

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.AmplitudeAttribute))
            {
                _amplitude = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.AmplitudeAttribute]);
            }
            Assert.IsTrue(_amplitude >= 0);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// A static utility method that looks up a field in a list and returns its float value.
 /// </summary>
 /// <param name='fields'>
 /// A list of fields.
 /// </param>
 /// <param name='title'>
 /// Title of the field.
 /// </param>
 /// <returns>
 /// The value of the field, or <c>0</c> if the field doesn't exist or isn't a float.
 /// </returns>
 public static float LookupFloat(List <Field> fields, string title)
 {
     return(Tools.StringToFloat(LookupValue(fields, title)));
 }