Beispiel #1
0
    TreeNode IBattlePerception.GetAITree(string pathTree)
    {
        var xml  = ResourcesManager.Singleton.LoadText(pathTree);
        var root = XmlParser.DeSerialize <TreeNode> (xml);

        return(root);
    }
 private void Open(string path)
 {
     if (!string.IsNullOrEmpty(path))
     {
         line      = XmlParser.DeSerialize <TimeLine>(File.ReadAllText(path, XmlParser.UTF8));
         shortPath = path.Replace(Application.dataPath + "/Resources/", "");
     }
 }
    public static void OpenLayout(string layout)
    {
        Init();

        LayoutEditorWindow window = GetWindow <LayoutEditorWindow> ();

        window.path = Application.dataPath + "/Resources/" + layout;
        window.line = XmlParser.DeSerialize <TimeLine> (File.ReadAllText(window.path, XmlParser.UTF8));

        window.shortPath = layout;
    }
Beispiel #4
0
 private void OpenTree(string path)
 {
     if (!string.IsNullOrEmpty(path))
     {
         var xml = File.ReadAllText(path, XmlParser.UTF8);
         root            = XmlParser.DeSerialize <TreeNode>(xml);
         currenPath      = path;
         currentDrag     = null;
         currentShowDrag = null;
         _runRoot        = null;
         this._expand.Clear();
     }
 }
Beispiel #5
0
    private void PasteNode(object userState)
    {
        var m = userState as MenuState;

        if (CanAppend(m.node, pasteNode))
        {
            var tempNode = XmlParser.DeSerialize <TreeNode>(XmlParser.Serialize(pasteNode));
            tempNode.NewGuid();
            m.node.childs.Add(tempNode);
            pasteNode = null;
        }
        else
        {
            ShowNotification(new GUIContent(string.Format("Can't Paste:{0}", m.node.name)));
        }
    }
Beispiel #6
0
    private TimeLine TryToLoad(string path)
    {
        var lineAsset = ResourcesManager.Singleton.LoadText(path);

        if (string.IsNullOrEmpty(lineAsset))
        {
            return(null);
        }

        var line = XmlParser.DeSerialize <TimeLine> (lineAsset);

        if (UseCache)
        {
            _timeLines.Add(path, line);
        }
        return(line);
    }
Beispiel #7
0
    private void Open()
    {
        if (data != null)
        {
            if (!EditorUtility.DisplayDialog("Cancel", "Open file will lost current edit,Do you want to over it", "Yes", "Cancel"))
            {
                return;
            }
        }
        var path = EditorUtility.OpenFilePanel("Open", Application.dataPath + "/Resources", "xml");

        if (string.IsNullOrEmpty(path))
        {
            return;
        }
        var xml = File.ReadAllText(path, XmlParser.UTF8);

        data        = XmlParser.DeSerialize <MagicData> (xml);
        currentPath = path;
    }
Beispiel #8
0
    private void ExportNode(object userState)
    {
        var m    = userState as MenuState;
        var path = EditorUtility.SaveFilePanel("Export Ai Tree",
                                               Application.dataPath + AI_ROOT, "AITree", "xml");

        if (string.IsNullOrEmpty(path))
        {
            return;
        }

        var xml        = XmlParser.Serialize(m.node);
        var exportNode = XmlParser.DeSerialize <TreeNode>(xml);

        exportNode.NewGuid();
        xml = XmlParser.Serialize(exportNode);
        File.WriteAllText(path, xml);
        ShowNotification(new GUIContent("Export To:" + path));
        AssetDatabase.Refresh();
    }
Beispiel #9
0
    private void ImportNode(object userState)
    {
        var    m    = userState as MenuState;
        string path = EditorUtility.OpenFilePanel(
            "Import Ai Tree",
            Application.dataPath + AI_ROOT, "xml");

        if (!string.IsNullOrEmpty(path))
        {
            var node = XmlParser.DeSerialize <TreeNode>(File.ReadAllText(path));
            if (CanAppend(m.node, node))
            {
                node.NewGuid();
                m.node.childs.Add(node);
            }
            else
            {
                ShowNotification(new GUIContent(string.Format("Can't Import:{0}", m.node.name)));
            }
        }
    }
Beispiel #10
0
    void Awake()
    {
        UScene     = GameObject.FindObjectOfType <UGameScene>();
        _magicData = new Dictionary <string, Layout.MagicData> ();
        _timeLines = new Dictionary <string, TimeLine> ();
        var magics = ResourcesManager.Singleton.LoadAll <TextAsset> ("Magics");

        foreach (var i in magics)
        {
            var m = XmlParser.DeSerialize <Layout.MagicData> (i.text);
            _magicData.Add(m.key, m);
        }
        magicCount = _magicData.Count;
        var timeLines = ResourcesManager.Singleton.LoadAll <TextAsset> ("Layouts");

        foreach (var i in timeLines)
        {
            var line = XmlParser.DeSerialize <TimeLine> (i.text);
            _timeLines.Add("Layouts/" + i.name + ".xml", line);
        }
        timeLineCount = _timeLines.Count;
    }
Beispiel #11
0
 public void ReadXml()
 {
     model = parser.DeSerialize <NetworkModel>();
 }