コード例 #1
0
        public virtual void OnCacheConversations()
        {
            //HELPER VARABLES
            string file = Server.SecurePath("~/dialogtemplates/{0}.xml", this.ModelId);

            if (File.Exists(file))
            {
                using (DialogReader reader = DialogReader.Open(file))
                {
                    while (reader.Read())
                    {
                        if (reader.HasInformation)
                        {
                            //Always uppercase (invariant for globalisation issues)
                            string name = reader.Name.ToUpperInvariant();
                            if (name == "GOSSIP")
                            {
                                //Gossip is a base function of ours
                                _Gossip = reader.Value;
                            }
                            else
                            {
                                //Parse to all child registered functions
                                for (int i = 0; i < state.RegisteredNpcFunctions.Count; i++)
                                {
                                    state.RegisteredNpcFunctions[i].OnCacheDialogInfo(this, reader.Name, reader.Value);
                                }
                            }
                        }
                    }
                }
            }
        }