Example #1
0
 public static void Copy(SerializedProperty dst, TalkParam src)
 {
     dst.FindPropertyRelative("name").stringValue    = src.name;
     dst.FindPropertyRelative("value").floatValue    = src.value;
     dst.FindPropertyRelative("rangeMin").floatValue = src.rangeMin;
     dst.FindPropertyRelative("rangeMax").floatValue = src.rangeMax;
 }
Example #2
0
 public Talk Clone()
 {
     return(new Talk {
         castName = (string)castName.Clone(),
         param = TalkParam.Clone(param),
         text = (string)text.Clone(),
     });
 }
Example #3
0
        public static List <Talk> TextFileToTalks(string path)
        {
            List <Talk> talks = null;

            using (var fin = new FileStream(path, FileMode.Open, FileAccess.Read))
            {
                talks = new List <Talk>();
                var rxName      = new Regex(@"^\[(.+?)\]");
                var rxEmptyLine = new Regex(@"^\s*$");

                var   castName  = "";
                var   baseParam = new List <TalkParam>();
                float baseWait  = 0.0f;

                var    sr = new StreamReader(fin);
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    var matcheName = rxName.Match(line);
                    if (matcheName.Success)
                    {
                        castName = matcheName.Groups[1].Value;

                        var cast = RemoteTalkProvider.FindCast(castName);
                        if (cast != null)
                        {
                            baseParam = TalkParam.Clone(cast.paramInfo).ToList();
                        }
                        else
                        {
                            baseParam.Clear();
                        }
                        TalkParam.Merge(baseParam, ExtractTalkParams(ref line, ref baseWait));
                    }
                    else if (!rxEmptyLine.IsMatch(line))
                    {
                        var   param = TalkParam.Clone(baseParam);
                        float wait  = -1.0f;
                        TalkParam.Merge(param, ExtractTalkParams(ref line, ref wait, true));
                        if (wait < 0.0f)
                        {
                            wait = baseWait;
                        }

                        var talk = new Talk();
                        talk.castName = castName;
                        talk.param    = param.ToArray();
                        talk.wait     = wait;
                        talk.text     = line;
                        talks.Add(talk);
                    }
                }
            }
            return(talks);
        }
Example #4
0
        public override bool Play(Talk talk)
        {
            if ((m_asyncTalk && !m_asyncTalk.isFinished) || m_asyncStop)
            {
                return(false);
            }

            castID = GetCastID(talk.castName);
            TalkParam.Merge(m_talkParams, talk.param);
            m_talkText = talk.text;
            return(Play());
        }
Example #5
0
        public bool ValidateParams()
        {
            var c = cast;

            if (c != null)
            {
                var prev = param;
                param = TalkParam.Clone(c.paramInfo);
                TalkParam.Merge(param, prev);
                return(true);
            }
            return(false);
        }