查看: 1494|回复: 1
打印 上一主题 下一主题

Saving and Loading XML example(保存和加载 XML)

[复制链接]

5552

主题

2

听众

8万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
11

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2012-5-4 15:26:39 |只看该作者 |倒序浏览


(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

分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

markq    

511

主题

1

听众

1万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
15839
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

沙发
发表于 2012-5-4 23:20:23 |只看该作者
  谢谢分享



爱生活 爱3D 爱纳金网



www.narkii.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2025-6-14 21:44 , Processed in 0.064297 second(s), 31 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部