예제 #1
0
        public static Script FromXML(XElement xml, Script baseScript)
        {
            Script script = baseScript != null ? new Script(baseScript) : new Script();

            script.ScriptLines.Clear();
            foreach (var element in xml.Elements())
            {
                switch (element.Name.LocalName)
                {
                case "Comment":
                    script.ScriptLines.Add(Comment.FromXML(element));
                    break;

                case "If":
                    script.ScriptLines.Add(Conditions.Conditional.FromXML(element, script));
                    break;

                case "DisplayText":
                    script.ScriptLines.Add(TextFunctions.DisplayText.FromXML(element));
                    break;

                case "AddText":
                    script.ScriptLines.Add(TextFunctions.AddText.FromXML(element));
                    break;

                case "SetVariable":
                    script.ScriptLines.Add(Flow.SetVariable.FromXML(element));
                    break;

                case "ReturnTrue":
                    script.ScriptLines.Add(new Flow.ReturnTrue());
                    break;

                case "ReturnFalse":
                    script.ScriptLines.Add(new Flow.ReturnFalse());
                    break;

                case "StopGame":
                    script.ScriptLines.Add(new Flow.StopGame());
                    break;

                case "AddItem":
                    script.ScriptLines.Add(AddItemToInventory.FromXML(element));
                    break;

                case "GetItemProperty":
                    script.ScriptLines.Add(GetItemProperty.FromXML(element));
                    break;

                case "SetItemProperty":
                    script.ScriptLines.Add(SetItemProperty.FromXML(element));
                    break;

                case "GetCurrentItem":
                    script.ScriptLines.Add(GetCurrentItem.FromXML(element));
                    break;

                case "RemoveItem":
                    script.ScriptLines.Add(RemoveItem.FromXML(element));
                    break;

                case "RemoveThisItem":
                    script.ScriptLines.Add(new RemoveThisItem());
                    break;

                case "RunCommonEvent":
                    script.ScriptLines.Add(Editor.Scripter.Flow.RunCommonEvent.FromXml(element, script));
                    break;

                case "ReturnValue":
                    script.ScriptLines.Add(Editor.Scripter.Flow.ReturnValue.FromXML(element));
                    break;

                case "GetEquipmentSlot":
                    script.ScriptLines.Add(GetEquipmentSlot.FromXML(element));
                    break;

                case "ForceUnequip":
                    script.ScriptLines.Add(ForceUnequip.FromXML(element));
                    break;

                case "ForceEquip":
                    script.ScriptLines.Add(ForceEquip.FromXML(element));
                    break;

                case "StartConversation":
                    script.ScriptLines.Add(TextFunctions.StartConversation.FromXML(element));
                    break;

                case "GoToStage":
                    script.ScriptLines.Add(ConversationFlow.GoToStage.FromXML(element));
                    break;

                case "ChangeRoom":
                    script.ScriptLines.Add(Misc.ChangeRoom.FromXML(element));
                    break;

                case "CreateEvent":
                    script.ScriptLines.Add(Editor.Scripter.Flow.CreateEvent.FromXML(element));
                    break;

                case "AddToArray":
                    script.ScriptLines.Add(Arrays.AddToArray.FromXML(element));
                    break;

                case "ForEachInArray":
                    script.ScriptLines.Add(Arrays.ForEachInArray.FromXML(element, script));
                    break;

                case "ShowImage":
                    script.ScriptLines.Add(TextFunctions.ShowImage.FromXML(element));
                    break;

                case "AddImage":
                    script.ScriptLines.Add(TextFunctions.AddImage.FromXML(element));
                    break;

                case "GetItemName":
                    script.ScriptLines.Add(ItemManagement.GetItemName.FromXML(element));
                    break;

                case "SetItemName":
                    script.ScriptLines.Add(ItemManagement.SetItemName.FromXML(element));
                    break;

                case "GetAllItems":
                    script.ScriptLines.Add(Arrays.GetAllItems.FromXML(element));
                    break;

                case "GetAllItemsOfType":
                    script.ScriptLines.Add(Arrays.GetAllItemsOfType.FromXML(element));
                    break;

                case "ConcatenateArray":
                    script.ScriptLines.Add(Arrays.ConcatenateArray.FromXML(element));
                    break;

                case "StopProcessing":
                    script.ScriptLines.Add(new Editor.Scripter.Flow.StopProcessing());
                    break;

                case "AddStatusEffect":
                    script.ScriptLines.Add(StatusEffects.AddStatusEffect.FromXML(element));
                    break;

                case "RemoveStatusEffect":
                    script.ScriptLines.Add(StatusEffects.RemoveStatusEffect.FromXML(element));
                    break;

                case "GetArgument":
                    script.ScriptLines.Add(StatusEffects.GetArgument.FromXML(element, script.CurrentStatusEffect));
                    break;

                case "CheckIfEffectsResolved":
                    script.ScriptLines.Add(new StatusEffects.CheckIfEffectsResolved());
                    break;

                default:
                    break;
                }
            }
            script.ScriptLines.Add(new Blank());
            return(script);
        }
예제 #2
0
 public GetEquipmentSlotWrapper(GetEquipmentSlot ges)
 {
     line = ges;
 }