纳金网

标题: Saving and Loading XML example(保存和加载 XML) [打印本页]

作者: 会飞的鱼    时间: 2012-5-4 15:26
标题: Saving and Loading XML example(保存和加载 XML)


(1)

Also added to the wiki but not as a package, just the scripts to get this done, basically this simply walks all gameobjects in the scene and saves information about them to the XML file, you can expand what is saved through the SaveS***cture class file, then populate it via the _GameSaveLoad class


Output example in the XML

复制内容到剪贴板代码:

<?xml version="1.0" encoding="utf-8"?>

  <ArrayOfGameItems xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <GameItems>

      <ID>ScriptManager_-1370</ID>

      <Name>ScriptManager</Name>

      <posx>0</posx>

      <posy>1</posy>

      <posz>-10</posz>

    </GameItems>

    <GameItems>

      <ID>Main Camera_-474</ID>

      <Name>Main Camera</Name>

      <posx>0</posx>

      <posy>1</posy>

      <posz>-10</posz>

    </GameItems>

  </ArrayOfGameItems>(2)
Expanded example, this version not only saves / loads the object to XML, but also now allows you to apply the saved settings back into the scene. The code is really self explanatory.


http://screencast.com/t/ZGYwYzI0Y2M


(3)
FYI you can simply drag the SQLITECLASS to the scriptmanager object and then the sqlite code will have buttons to use for saving and loading to sqlite.
See video:
http://screencast.com/t/aFpF3j59

XMLDEMOProject1.zip

0 Bytes, 下载次数: 3


作者: markq    时间: 2012-5-4 23:20
  谢谢分享



爱生活 爱3D 爱纳金网



www.narkii.com




欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5