本文整理汇总了C#中Spell.CopyFrom方法的典型用法代码示例。如果您正苦于以下问题:C# Spell.CopyFrom方法的具体用法?C# Spell.CopyFrom怎么用?C# Spell.CopyFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spell
的用法示例。
在下文中一共展示了Spell.CopyFrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadPlayer
public bool ReadPlayer(string playerName, out Player player)
{
player = null;
string fileName = GetSaveFileName(playerName);
if (!System.IO.File.Exists(fileName)) return false;
using (StreamReader sr = new StreamReader(fileName))
{
string strLine = "";
while (!sr.EndOfStream)
{
strLine = sr.ReadLine();
// uid,name,level,exp,a,d,p,k
string[] datas = null;
Hero hero = null;
{
datas = strLine.Split(new char[] { ',' });
player = new Player();
player._id = System.Convert.ToInt32(datas[0]);
player._name = datas[1];
hero = new Hero();
hero._id = player._id;
hero._name = player._name;
hero._level = System.Convert.ToInt32(datas[2]);
hero._experience = System.Convert.ToInt32(datas[3]);
hero._attack = System.Convert.ToInt32(datas[4]);
hero._defense = System.Convert.ToInt32(datas[5]);
hero._power = System.Convert.ToInt32(datas[6]);
hero._knowledge = System.Convert.ToInt32(datas[7]);
}
// skillId,skillLevel,...
{
datas = strLine.Split(new char[] { ',' });
for (int i = 0; i < datas.Length; i += 2)
{
int skillId = System.Convert.ToInt32(datas[i]);
int skillLevel = System.Convert.ToInt32(datas[i + 1]);
Skill skill = new Skill();
skill.CopyFrom((Skill)Heroes.Core.Setting._skills[skillId]);
skill._level = skillLevel;
hero._skills.Add(skill._id, skill);
}
}
// spells
{
datas = strLine.Split(new char[] { ',' });
for (int i = 0; i < datas.Length; i++)
{
int spellId = System.Convert.ToInt32(datas[i]);
Spell spell = new Spell();
spell.CopyFrom((Spell)Heroes.Core.Setting._spells[spellId]);
hero._spells.Add(spell._id, spell);
}
}
// artifacts
}
}
return true;
}