예제 #1
0
        /// <summary>
        /// Loads actions
        /// </summary>
        /// <param name="filename">Xml node</param>
        public void LoadActions(XmlNode xml)
        {
            if (xml == null || xml.Name.ToLower() != "actions")
            {
                return;
            }

            foreach (XmlNode node in xml)
            {
                if (node.NodeType == XmlNodeType.Comment)
                {
                    continue;
                }


                switch (node.Name.ToLower())
                {
                case "teleport":
                {
                    Teleport teleport = new Teleport();
                    teleport.Load(node);
                    Actions.Add(teleport);
                }
                break;

                case "giveexperience":
                {
                    GiveExperience script = new GiveExperience();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                case "activate":
                {
                    ActivateTarget script = new ActivateTarget();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                case "changepicture":
                {
                    ChangePicture script = new ChangePicture();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                case "changetext":
                {
                    ChangeText script = new ChangeText();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                case "deactivate":
                {
                    DeactivateTarget script = new DeactivateTarget();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                case "disablechoice":
                {
                    DisableChoice script = new DisableChoice();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                case "disable":
                {
                    DisableTarget script = new DisableTarget();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                case "enablechoice":
                {
                    EnableChoice script = new EnableChoice();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                case "endchoice":
                {
                    EndChoice script = new EndChoice();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                case "enddialog":
                {
                    EndDialog script = new EndDialog();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                case "giveitem":
                {
                    GiveItem script = new GiveItem();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                case "healing":
                {
                    Healing script = new Healing();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                case "joincharacter":
                {
                    JoinCharacter script = new JoinCharacter();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                case "playsound":
                {
                    PlaySound script = new PlaySound();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                case "toggle":
                {
                    ToggleTarget script = new ToggleTarget();
                    script.Load(node);
                    Actions.Add(script);
                }
                break;

                default:
                {
                    Trace.WriteLine("[ScriptChoice] LoadActions() : Unknown node \"{0}\"", node.Name);
                }
                break;
                }
            }
        }