Пример #1
0
 /// <summary>
 /// 创建说话
 /// </summary>
 /// <param name="talk"></param>
 /// <returns></returns>
 static int NewTalk(Variant talk)
 {
     int say = 0;
     if (talk != null)
     {
         double tp = talk.GetDoubleOrDefault("P");
         if (Sinan.Extensions.NumberRandom.RandomHit(tp))
         {
             object s;
             if (talk.TryGetValue("Say", out s))
             {
                 if (s is int)
                 {
                     say = (int)s;
                 }
                 else
                 {
                     say = Convert.ToInt32(s);
                 }
             }
         }
     }
     return say;
 }