コード例 #1
0
        /// <summary>
        /// Loads a party
        /// </summary>
        /// <param name="filename">Xml data</param>
        /// <returns>True if team successfuly loaded, otherwise false</returns>
        public virtual bool Load(XmlNode xml)
        {
            if (xml == null)
            {
                return(false);
            }


            Action = null;

            switch (xml.Name)
            {
            case SpawnMonster.Tag:
            {
                Action = new SpawnMonster();
            }
            break;

            case EnableTarget.Tag:
            {
                Action = new EnableTarget();
            }
            break;

            case DisableTarget.Tag:
            {
                Action = new DisableTarget();
            }
            break;

            case ActivateTarget.Tag:
            {
                Action = new ActivateTarget();
            }
            break;

            case DeactivateTarget.Tag:
            {
                Action = new DeactivateTarget();
            }
            break;

            case ChangePicture.Tag:
            {
                Action = new ChangePicture();
            }
            break;

            case ChangeText.Tag:
            {
                Action = new ChangeText();
            }
            break;

            case DisableChoice.Tag:
            {
                Action = new DisableChoice();
            }
            break;

            case EnableChoice.Tag:
            {
                Action = new EnableChoice();
            }
            break;

            case EndChoice.Tag:
            {
                Action = new EndChoice();
            }
            break;

            case EndDialog.Tag:
            {
                Action = new EndDialog();
            }
            break;

            case GiveExperience.Tag:
            {
                Action = new GiveExperience();
            }
            break;

            case GiveItem.Tag:
            {
                Action = new GiveItem();
            }
            break;

            case Healing.Tag:
            {
                Action = new Healing();
            }
            break;

            case JoinCharacter.Tag:
            {
                Action = new JoinCharacter();
            }
            break;

            case PlaySound.Tag:
            {
                Action = new PlaySound();
            }
            break;

            case SetTo.Tag:
            {
                Action = new SetTo();
            }
            break;

            case Teleport.Tag:
            {
                Action = new Teleport();
            }
            break;

            case ToggleTarget.Tag:
            {
                Action = new ToggleTarget();
            }
            break;

            case DisplayMessage.Tag:
            {
                Action = new DisplayMessage();
            }
            break;

            default:
            {
                Trace.WriteLine("[ScriptBase] Load() : Unknown node \"" + xml.Name + "\" found.");
                return(false);
            }
            }

            if (Action == null)
            {
                return(false);
            }


            Action.Load(xml);

            return(true);
        }