Ejemplo n.º 1
0
 /// <summary>
 /// 全てに線形比作成器をあてる
 /// </summary>
 public void SetDefaultMaker()
 {
     for (int i = 0; i < RatioMakers.Length; i++)
     {
         RatioMakers[i] = new LinearRatioMaker
         {
             Set = this
         };
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// ヌルの比作成器を持つものに線形比作成器をあてる
 /// </summary>
 public void SetDefaultToNullMaker()
 {
     for (int i = 0; i < RatioMakers.Length; i++)
     {
         if (RatioMakers[i] == null)
         {
             RatioMakers[i] = new LinearRatioMaker
             {
                 Set = this
             };
         }
     }
 }
Ejemplo n.º 3
0
        private static void ReadXMLRatioMakers(XmlReader reader, EffectStateRatioSet set)
        {
            while (reader.Read())
            {
                if (reader.Name == "RatioMaker")
                {
                    RatioType type = RatioType.X;
                    switch (reader.GetAttribute("Type"))
                    {
                    case "X":
                        type = RatioType.X;
                        break;

                    case "Y":
                        type = RatioType.Y;
                        break;

                    case "Alpha":
                        type = RatioType.Alpha;
                        break;

                    case "Rotation":
                        type = RatioType.Rotation;
                        break;

                    case "ScaleX":
                        type = RatioType.ScaleX;
                        break;

                    case "ScaleY":
                        type = RatioType.ScaleY;
                        break;

                    case "BezierPosition":
                        type = RatioType.BezierPosition;
                        break;
                    }
                    IRatioMaker maker = null;
                    switch (reader.GetAttribute("MakerType"))
                    {
                    case "LinearRatioMaker":
                        maker = new LinearRatioMaker();
                        break;

                    case "ConstantRatioMaker":
                        maker = new ConstantRatioMaker();
                        break;

                    case "BezierRatioMaker":
                        var p1 = BezierControlPoint.Deserialize(reader.GetAttribute("P1"));
                        var p2 = BezierControlPoint.Deserialize(reader.GetAttribute("P2"));
                        maker = new BezierRatioMaker(p1, p2);
                        break;
                    }
                    maker.Set = set;
                    set[type] = maker;
                }
            }
            reader.Close();
            set.SetDefaultToNullMaker();
        }