Inheritance: Microsoft.Xna.Framework.DrawableGameComponent
Esempio n. 1
0
        public Dialog(List<Conversation> conversations, Entity owner, int cooldown = 2000)
            : base()
        {
            _enter = new EventHandler(OnEnter);

            _conversations = new List<Conversation>();
            foreach(Conversation con in conversations)
            {
                _conversations.Add(con.Clone());
            }
            _dm = DialogManager.Instance;
            _cm = owner.CM;
            _cm.AddCounter(_cShutdown);
            _cm.Bang += new EventHandler<BangEventArgs>(OnBang);
            _currentCon = _conversations.First().GetIterator();
            this._owner = owner;
            Cooldown = cooldown;

            foreach (Conversation con in _conversations)
            {
                try
                {
                    con.Add(new ComboBreaker());
                }
                catch (ConversationAlreadyFinalisedException e)
                { }

                con.SetOwner(owner);
            }
        }
Esempio n. 2
0
        public Dialog(List<Conversation> conversations, int cooldown = 2000)
            : base()
        {
            _enter = new EventHandler(OnEnter);

            _conversations = new List<Conversation>();
            foreach(Conversation con in conversations)
            {
                _conversations.Add(con.Clone());
            }
            _dm = DialogManager.Instance;

            Cooldown = cooldown;
        }
Esempio n. 3
0
        public Dialog(DataRow data)
        {
            string dialogID = data["Dialog"].ToString() + "_Dialog.xml";
            string path = Game1.Instance.Content.RootDirectory + "/Data";

            IEnumerable<string> files = Directory.EnumerateFiles(path, dialogID, SearchOption.AllDirectories);

            DataSet dialogData = null;
            foreach (string file in files)
            {
                if (dialogData == null)
                {
                    dialogData = new DataSet();
                    dialogData.ReadXml(file);
                }
                else
                {
                    throw new Exception("More than one dialog file found for ID " + data["Dialog"].ToString());
                }
            }

            List<Conversation> conversations = ReadConversations(dialogData);

            _enter = new EventHandler(OnEnter);

            _conversations = new List<Conversation>();
            foreach (Conversation con in conversations)
            {
                _conversations.Add(con.Clone());
            }
            _dm = DialogManager.Instance;

            _currentCon = _conversations.First().GetIterator();

            Cooldown = 2000;
        }