cocos2d-实现读取.plist文件(使用数组CCArray)
学习札记之cocos2d-x2.1.1实现读取.plist文件(使用数组CCArray)
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
- <plist version="1.0">
- <dict>
- <key>picture</key>
- <array>
- <string>1.png</string>
- <string>2.png</string>
- <string>3.png</string>
- </array>
- <key>point</key>
- <array>
- <string>{200,300}</string>
- <string>{500,300}</string>
- <string>{800,300}</string>
- </array>
- </dict>
- </plist>
- //////////////////////////////////////////////////////////////////////////
- //SmallTools2
- CCDictionary* plistDic = CCDictionary::createWithContentsOfFile("SmallTools2.plist");
- CCArray* picture_array = (CCArray*)plistDic->objectForKey("picture");
- CCArray* point_array = (CCArray*)plistDic->objectForKey("point");
- for (int i=0;i<picture_array->count();i++)
- {
- CCString* pi_string = (CCString*)picture_array->objectAtIndex(i);
- CCSprite* sprite = CCSprite::create(pi_string->getCString());
- CCString* point_string = (CCString*)point_array->objectAtIndex(i);
- CCPoint point = CCPointFromString(point_string->getCString());
- sprite->setPosition(ccp(point.x,point.y));
- this->addChild(sprite,1,++TagCount);
- }
- //////////////////////////////////////////////////////////////////////////
cocos2d-实现读取.plist文件(使用数组CCArray)的更多相关文章
- cocos2d-x 读取.plist文件
转自:http://blog.csdn.net/hgplan/article/details/8629904 在cocos2d-x中可以用.plist格式的文件来保存数据,它是XML文件格式的一种,在 ...
- 黑马程序员——读取Plist文件
-iOS培训,iOS学习-------型技术博客.期待与您交流!------------ 读取Plist文件 一:新建一个plist文件,并将plist文件数据填入plist文件中,这里pli ...
- cocos2d-x 2.1 -- 读取.plist文件
在cocos2d-x中可以用.plist格式的文件来保存数据,它是XML文件格式的一种,在cocos2d-x解析.plist方面相关的资料比较少,但本身也很简单,要解析.plist文件可以参考coco ...
- PHP读取txt文件到数组
$file_path = "test.txt"; if(file_exists($file_path)){ $file_arr = file($file_path); for($i ...
- iOS开发读取plist文件、iphone中plist文件的
在Xcode中建立一个iOS项目后,会自己产生一个.plist文件,点击时会看见它显示的是类似于excel表格: 但是,如果打开方式选择Source Code,你会看见它其实是一个xml文件. 我们会 ...
- [How to]如何自定义plist文件和读取plist文件内容
1.简介 plist作为IOS的固化文件,就好比java中properties文件,但是在IOS中plist是可读写的. 本文将介绍自定义静态的plist文件. 2.自定义静态plist文件 右击你的 ...
- 解决pathForResource返回nil, 无法读取plist文件问题
有很多人在设置plist文件的时候, 会发现读取不了plist文件里面的内容, 返回值为nil, 下面我们来解决一下这个问题. 首先我们打开工程并且按照下面的步骤来设置: 设置好后, 我们来写一段代码 ...
- iOS-如何读取Plist文件
解决办法: // 1) 找到Plist文件的路径 "path" NSString *path = [[NSBundle mainBundle]pathForResource:@&q ...
- PHP excel读取excel文件转换为数组
/*备注:先去下载PHP EXCEL——http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=phpexcel&am ...
随机推荐
- Strata 2014 上的 AzureCAT 粉笔会谈
本周,AzureCAT 团队非常高兴在 Strata 会议上首次集体亮相.对于那些对 AzureCAT 团队不太熟悉的人来说,我们是 Microsoft 云与企业部门一个核心的国际性团队,由大约 ...
- 如何使用 Barracuda 防火墙设置/保护 Azure 应用程序
如果某企业在 Windows Azure 上托管某个应用程序,该应用程序会在某个特定时间暴露到 Internet,以用于商业用途.公共 Internet 带来 客户的同时也带来了攻击者. Tim ...
- HDU 1240 Asteroids!
三维广搜 #include <cstdio> #include <iostream> #include <cstring> #include <queue&g ...
- mysql下的SELECT INTO语句
在mysql下使用SELECT INTO语句会产生ERROR 1327 (42000): Undeclared variable:new_tablename 此时要使用: CREATE TABLE C ...
- hdoj 3062 Party(2-SAT)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3062 思路分析:将问题转换为2-SAT问题,需要注意的是将命题转换为有向图的方法:命题中A1, A2, ...
- MessageDigest简单介绍
本文博客原文 參考文章:http://blog.sina.com.cn/s/blog_4f36423201000c1e.html 一.概述 java.security.MessageDigest类用于 ...
- [LeetCode] Longest Substring Without Repeating Characters (LinkedHashSet的妙用)
Given a string, find the length of the longest substring without repeating characters. For example, ...
- Arcengine 开发,FeatureClass新增feature时“The Geometry has no z-value”或"The Geometry has null z-value"的解决方案
Arcengine 开发,当图层含有Z值时,新增的feature没有Z值就会 出现“The Geometry has no z-value”的错误.意思很明显,新增的geometry没有Z值. 此时按 ...
- document.domain与js跨域的问题
以前如果要使iframe里面的脚本能访问parent的内容,但iframe和parent的二级域名相同,那一般都会在两者都写上document.domain="xxx.com" 以 ...
- Eclipse 编码区-保护色-快捷大全
Eclipse快捷键大全 Eclipse编码区-保护色-快捷设置 1.设置路径: windows-preferences-general-editors-text Editors-ba ...