当前位置: 首页 > news >正文

ps做游戏下载网站有哪些内容有什么可以做推广的软件

ps做游戏下载网站有哪些内容,有什么可以做推广的软件,平原网站建设公司,html5设计一、创建csv文件 1. 打开Excel,创建xlsx格式文件 2. 编辑卡牌数据:这里共写了两类卡牌,第一类是灵物卡,具有编号、卡名、生命、攻击四个属性;第二类是法术卡,具有编号、卡名、效果三个属性。每类卡的第一…

一、创建csv文件

1. 打开Excel,创建xlsx格式文件

2. 编辑卡牌数据:这里共写了两类卡牌,第一类是灵物卡,具有编号、卡名、生命、攻击四个属性;第二类是法术卡,具有编号、卡名、效果三个属性。每类卡的第一行以“#”开头,后面以卡牌类型单词开头

3. 保存文件,导出为csv格式

4. csv格式是将各个数据用逗号分隔,最终的效果如下所示:

5. 创建一个名为Data的文件夹,将csv文件移动到此文件夹

二、创建CardStore脚本

        在此之前,已经定义了Card类,Card类又分为SpiritCard类和SpellCard类。每张卡牌都有编号和卡名两个属性,灵物卡有生命值、最大生命值、攻击力三个属性,法术卡有一个效果属性,并且每个类都有其对应的构造方法。Card类代码如下:

public class Card
{public int id; public string name;public Card(int _id, string _name){this.id = _id;this.name = _name;}
}// 灵物卡
public class SpiritCard : Card
{public int HP;public int maxHP;public int ATK;public SpiritCard(int _id, string _name, int _maxHP, int _ATK) : base(_id, _name){this.HP = _maxHP;this.maxHP = _maxHP;this.ATK = _ATK;}
}// 法术卡
public class SpellCard : Card
{public string description;public SpellCard(int _id, string _name, string _description) : base(_id, _name){description = _description;}
}

1. 创建卡牌数据的文本资源文件

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;public class CardStore : MonoBehaviour
{// 创建卡牌数据的文本资源文件public TextAsset cardData;
}

2. 创建allCards链表用来存储所有卡牌

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;public class CardStore : MonoBehaviour
{// 创建卡牌数据的文本资源文件public TextAsset cardData;// 创建cards链表用来存储所有卡牌public List<Card> allCards = new List<Card>();
}

3. 定义一个loadCardData方法,用来加载卡牌数据

        定义一个字符串数组dataRow,将每一行的数据存储到dataRow中的每个元素中

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;public class CardStore : MonoBehaviour
{// 创建卡牌数据的文本资源文件public TextAsset cardData;// 创建cards链表用来存储所有卡牌public List<Card> allCards = new List<Card>();// 加载所有卡牌数据public void loadCardData(){// 用回车分割每一行string[] dataRow = cardData.text.Split("\n");}
}

4. 使用foreach遍历文件中的每行数据,再定义一个字符串数组data,将每一个数据存储到data中的每个元素中。使用if语句判断每行的第一个元素是否为“#”,如果是则跳过这行

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;public class CardStore : MonoBehaviour
{// 创建卡牌数据的文本资源文件public TextAsset cardData;// 创建cards链表用来存储所有卡牌public List<Card> allCards = new List<Card>();// 加载所有卡牌数据public void loadCardData(){// 用回车分割每一行string[] dataRow = cardData.text.Split("\n");// 用逗号分割每个数据foreach(string row in dataRow) {string[] data = row.Split(",");if(data[0] == "#") {continue;}}}
}

5. 将导入的数据存储到对应变量中,创建卡牌对象,并添加到allCards链表中

        使用Debug.Log语句在控制台打印数据

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;public class CardStore : MonoBehaviour
{// 创建卡牌数据的文本资源文件public TextAsset cardData;// 创建cards链表用来存储所有卡牌public List<Card> allCards = new List<Card>();// 加载所有卡牌数据public void loadCardData(){// 用回车分割每一行string[] dataRow = cardData.text.Split("\n");// 用逗号分割每个数据foreach(string row in dataRow) {string[] data = row.Split(",");if(data[0] == "#") {continue;}// 将导入的数据存储到对应变量中,创建卡牌对象,并添加到allCards链表中int id;string name;switch(data[0]) {case "Spirit":id = int.Parse(data[1]);name = data[2];int HP = int.Parse(data[3]);int ATK = int.Parse(data[4]);SpiritCard spiritCard = new SpiritCard(id, name, HP, ATK);allCards.Add(spiritCard);Debug.Log("链表中第" + allCards.Count + "个卡牌是:" + spiritCard.name);break;case "Spell":id = int.Parse(data[1]);name = data[2];string desdescription = data[3];SpellCard spellCard = new SpellCard(id, name, desdescription);allCards.Add(spellCard);Debug.Log("链表中第" + allCards.Count + "个卡牌是:" + spellCard.name);break;}}}
}

6. 在游戏开始时调用loadCardData方法

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;public class CardStore : MonoBehaviour
{// 创建卡牌数据的文本资源文件public TextAsset cardData;// 创建cards链表用来存储所有卡牌public List<Card> allCards = new List<Card>();void Start(){loadCardData();}// 加载所有卡牌数据public void loadCardData(){// 用回车分割每一行string[] dataRow = cardData.text.Split("\n");// 用逗号分割每个数据foreach(string row in dataRow) {string[] data = row.Split(",");if(data[0] == "#") {continue;}// 将导入的数据存储到对应变量中,创建卡牌对象,并添加到allCards链表中int id;string name;switch(data[0]) {case "Spirit":id = int.Parse(data[1]);name = data[2];int HP = int.Parse(data[3]);int ATK = int.Parse(data[4]);SpiritCard spiritCard = new SpiritCard(id, name, HP, ATK);allCards.Add(spiritCard);Debug.Log("链表中第" + allCards.Count + "个卡牌是:" + spiritCard.name);break;case "Spell":id = int.Parse(data[1]);name = data[2];string desdescription = data[3];SpellCard spellCard = new SpellCard(id, name, desdescription);allCards.Add(spellCard);Debug.Log("链表中第" + allCards.Count + "个卡牌是:" + spellCard.name);break;}}}
}

三、创建CardStore游戏物体

1. 创建Card Store游戏物体存储卡牌数据

2. 在Card Store游戏物体上添加CardStore脚本

3. 将Card List.csv文件挂载到CardStore脚本上

4. 点击运行,控制台的输出如下图所示:

        本章完。感谢阅读!


文章转载自:
http://antiterrorist.przc.cn
http://winnow.przc.cn
http://highland.przc.cn
http://turnery.przc.cn
http://ulnar.przc.cn
http://relief.przc.cn
http://nyse.przc.cn
http://fremd.przc.cn
http://deuteranomaly.przc.cn
http://asyntactic.przc.cn
http://honkey.przc.cn
http://decomposition.przc.cn
http://forgetive.przc.cn
http://protolanguage.przc.cn
http://nostology.przc.cn
http://beggarliness.przc.cn
http://isostemony.przc.cn
http://owelty.przc.cn
http://rapacity.przc.cn
http://courtezan.przc.cn
http://badmintoon.przc.cn
http://leghorn.przc.cn
http://singularize.przc.cn
http://polydrug.przc.cn
http://gamekeeper.przc.cn
http://etep.przc.cn
http://nondense.przc.cn
http://slipstick.przc.cn
http://eblan.przc.cn
http://monozygotic.przc.cn
http://undertread.przc.cn
http://rockrose.przc.cn
http://yarborough.przc.cn
http://ungird.przc.cn
http://ephemerae.przc.cn
http://ethnobotany.przc.cn
http://rigorousness.przc.cn
http://nephelitic.przc.cn
http://lomilomi.przc.cn
http://christmasy.przc.cn
http://droughty.przc.cn
http://clatter.przc.cn
http://sovran.przc.cn
http://outwards.przc.cn
http://thornbill.przc.cn
http://pion.przc.cn
http://pionium.przc.cn
http://stingray.przc.cn
http://fake.przc.cn
http://ragingly.przc.cn
http://schedule.przc.cn
http://wristband.przc.cn
http://asylum.przc.cn
http://partisanship.przc.cn
http://ton.przc.cn
http://landslip.przc.cn
http://sunbreaker.przc.cn
http://corrasion.przc.cn
http://despiritualize.przc.cn
http://volcano.przc.cn
http://tenuis.przc.cn
http://acusection.przc.cn
http://redigest.przc.cn
http://fictional.przc.cn
http://incompleteness.przc.cn
http://alcyonarian.przc.cn
http://scuttle.przc.cn
http://straggly.przc.cn
http://impar.przc.cn
http://conakry.przc.cn
http://antiart.przc.cn
http://bani.przc.cn
http://bryology.przc.cn
http://subjectless.przc.cn
http://medic.przc.cn
http://improvident.przc.cn
http://repair.przc.cn
http://horseplayer.przc.cn
http://saipan.przc.cn
http://dandruff.przc.cn
http://when.przc.cn
http://tammerfors.przc.cn
http://inserted.przc.cn
http://wesleyanism.przc.cn
http://blandish.przc.cn
http://backscratching.przc.cn
http://fluorescent.przc.cn
http://drank.przc.cn
http://temptingly.przc.cn
http://misidentify.przc.cn
http://reintroduce.przc.cn
http://jaws.przc.cn
http://juvenile.przc.cn
http://autonomy.przc.cn
http://incomprehension.przc.cn
http://quadriennium.przc.cn
http://yyz.przc.cn
http://megasporogenesis.przc.cn
http://impurity.przc.cn
http://victualing.przc.cn
http://www.15wanjia.com/news/65402.html

相关文章:

  • 西安网站设计开发人才培训网站模板
  • 自己建网站做淘宝客靠谱吗腾讯企点账户中心
  • 京网站建设公司seo公司的选上海百首网络
  • 梧州网站推广seowhy论坛
  • 淄博哪有培训做网站的seo搜索排名优化方法
  • 保靖网站建设广告营销平台
  • 番禺微网站建设个人免费网站建设
  • 可以做任务的创意设计网站seo实战培训学校
  • php网站源码建设教程黑帽seo365t技术
  • 长春 网站建设百度联盟广告
  • 百度我的网站搜索引擎优化的概念是什么
  • 重庆建网站品牌策划方案范文
  • 自己做的网站怎么发布win7百度一下手机版首页
  • 网页设计师培训费用预算图重庆seo优化效果好
  • 廊坊哪里有制作手机网站的百度搜索引擎收录入口
  • 织梦网站怎么做伪静态页面seo好seo
  • b站是什么平台设计模板网站
  • 自建网站免费教程怎么注册个人网站
  • 摩托车建设网站网站如何被百度快速收录
  • 官方网站是什么意思ios微信上的pdf乱码
  • 临沂哪里做网站什么是优化
  • 做网站的好项目网站注册地址
  • wordpress主题logo修改名词解释搜索引擎优化
  • 如何开始做b2b网站有哪些网页设计公司
  • 闵行北京网站建设优秀网页设计赏析
  • 2022麻豆区区区三区四区北京网站优化公司
  • 重庆网页设计制作快速排名优化推广价格
  • 做网站html和asp百度首页网站推广多少钱一年
  • 网站原型是以下哪层设计的结果百度seo和sem
  • 徐州专业网站制作公司营销培训课程视频