本文整理汇总了C#中GameObjects.Troop.SetStatus方法的典型用法代码示例。如果您正苦于以下问题:C# Troop.SetStatus方法的具体用法?C# Troop.SetStatus怎么用?C# Troop.SetStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObjects.Troop
的用法示例。
在下文中一共展示了Troop.SetStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadGameDataFromDataBase
//.........这里部分代码省略.........
}
DbConnection.Close();
DbConnection.Open();
reader = new OleDbCommand("Select * From Routeway", DbConnection).ExecuteReader();
while (reader.Read())
{
Routeway routeway = new Routeway();
routeway.Scenario = this;
routeway.ID = (short)reader["ID"];
routeway.Building = (bool)reader["Building"];
routeway.ShowArea = (bool)reader["ShowArea"];
routeway.RemoveAfterClose = (bool)reader["RemoveAfterClose"];
routeway.LastActivePointIndex = (int)reader["LastActivePointIndex"];
routeway.InefficiencyDays = (int)reader["InefficiencyDays"];
routeway.StartArchitecture = this.Architectures.GetGameObject((int)reader["StartArchitecture"]) as Architecture;
if (routeway.StartArchitecture != null)
{
routeway.StartArchitecture.Routeways.Add(routeway);
}
routeway.EndArchitecture = this.Architectures.GetGameObject((int)reader["EndArchitecture"]) as Architecture;
routeway.DestinationArchitecture = this.Architectures.GetGameObject((int)reader["DestinationArchitecture"]) as Architecture;
routeway.LoadRoutePointsFromString(reader["Points"].ToString());
this.Routeways.AddRoutewayWithEvent(routeway);
}
DbConnection.Close();
DbConnection.Open();
reader = new OleDbCommand("Select * From Troop", DbConnection).ExecuteReader();
while (reader.Read())
{
Troop troop = new Troop();
troop.Scenario = this;
troop.ID = (short)reader["ID"];
troop.Controllable = (bool)reader["Controllable"];
troop.SetStatus((TroopStatus)((short)reader["Status"]));
troop.Direction = (TroopDirection)((short)reader["Direction"]);
troop.Auto = (bool)reader["Auto"];
troop.Operated = (bool)reader["Operated"];
troop.Food = (int)reader["Food"];
troop.zijin = (int)reader["zijin"];
troop.StartingArchitecture = this.Architectures.GetGameObject((short)reader["StartingArchitecture"]) as Architecture;
troop.LoadPersonsFromString(this.AllPersons, reader["Persons"].ToString(), (short)reader["LeaderID"]);
troop.LoadPathInformation((short)reader["PositionX"], (short)reader["PositionY"], (short)reader["DestinationX"], (short)reader["DestinationY"], (short)reader["RealDestinationX"], (short)reader["RealDestinationY"], reader["FirstTierPath"].ToString(), reader["SecondTierPath"].ToString(), reader["ThirdTierPath"].ToString(), (short)reader["FirstIndex"], (short)reader["SecondIndex"], (short)reader["ThirdIndex"]);
troop.MilitaryID = (short)reader["MilitaryID"];
troop.AttackDefaultKind = (TroopAttackDefaultKind)((short)reader["AttackDefaultKind"]);
troop.AttackTargetKind = (TroopAttackTargetKind)((short)reader["AttackTargetKind"]);
troop.TargetTroopID = (short)reader["TargetTroopID"];
troop.TargetArchitectureID = (short)reader["TargetArchitectureID"];
troop.WillTroopID = (short)reader["WillTroopID"];
troop.WillArchitectureID = (short)reader["WillArchitectureID"];
troop.CurrentCombatMethodID = (short)reader["CurrentCombatMethodID"];
troop.CurrentStratagemID = (short)reader["CurrentStratagemID"];
troop.SelfCastPosition = new Point((short)reader["SelfCastPositionX"], (short)reader["SelfCastPositionY"]);
troop.ChaosDayLeft = (short)reader["ChaosDayLeft"];
troop.CutRoutewayDays = (short)reader["CutRoutewayDays"];
troop.LoadCaptivesFromString(this.Captives, reader["Captives"].ToString());
troop.RecentlyFighting = (short)reader["RecentlyFighting"];
troop.TechnologyIncrement = (short)reader["TechnologyIncrement"];
troop.EventInfluences.LoadFromString(this.GameCommonData.AllInfluences, reader["EventInfluences"].ToString());
try
{
troop.CurrentStunt = this.GameCommonData.AllStunts.GetStunt((short)reader["CurrentStunt"]);
troop.StuntDayLeft = (short)reader["StuntDayLeft"];
}
catch
{
}
示例2: LoadGameDataFromDataBase
//.........这里部分代码省略.........
else
{
e.Add("建筑ID" + (int)reader["StartArchitecture"] + "不存在");
}
routeway.EndArchitecture = this.Architectures.GetGameObject((int)reader["EndArchitecture"]) as Architecture;
routeway.DestinationArchitecture = this.Architectures.GetGameObject((int)reader["DestinationArchitecture"]) as Architecture;
routeway.LoadRoutePointsFromString(reader["Points"].ToString());
if (e.Count > 0)
{
errorMsg.Add("粮道ID" + routeway.ID + ":");
errorMsg.AddRange(e);
}
else
{
this.Routeways.AddRoutewayWithEvent(routeway);
}
}
DbConnection.Close();
DbConnection.Open();
reader = new OleDbCommand("Select * From Troop", DbConnection).ExecuteReader();
while (reader.Read())
{
List<string> errors = new List<string>();
Troop troop = new Troop();
troop.Scenario = this;
troop.ID = (short)reader["ID"];
troop.Controllable = (bool)reader["Controllable"];
if ((short)reader["Status"] >= Enum.GetNames(typeof(TroopStatus)).Length || (short)reader["Status"] < 0)
{
errors.Add("部队状态在0至" + Enum.GetNames(typeof(TroopStatus)).Length + "之间");
}
else
{
troop.SetStatus((TroopStatus)((short)reader["Status"]));
}
if ((short)reader["Direction"] >= Enum.GetNames(typeof(TroopDirection)).Length || (short)reader["Direction"] < 0)
{
errors.Add("部队方向在0至" + Enum.GetNames(typeof(TroopDirection)).Length + "之间");
}
else
{
troop.Direction = (TroopDirection)((short)reader["Direction"]);
}
troop.Auto = (bool)reader["Auto"];
troop.Operated = (bool)reader["Operated"];
troop.Food = (int)reader["Food"];
troop.zijin = (int)reader["zijin"];
troop.StartingArchitecture = this.Architectures.GetGameObject((short)reader["StartingArchitecture"]) as Architecture;
if (troop.StartingArchitecture == null)
{
errors.Add("起始建筑ID" + (short)reader["StartingArchitecture"] + "不存在");
}
errors.AddRange(troop.LoadPersonsFromString(this.AllPersons, reader["Persons"].ToString(), (short)reader["LeaderID"]));
troop.LoadPathInformation((short)reader["PositionX"], (short)reader["PositionY"], (short)reader["DestinationX"], (short)reader["DestinationY"], (short)reader["RealDestinationX"], (short)reader["RealDestinationY"], reader["FirstTierPath"].ToString(), reader["SecondTierPath"].ToString(), reader["ThirdTierPath"].ToString(), (short)reader["FirstIndex"], (short)reader["SecondIndex"], (short)reader["ThirdIndex"]);
troop.MilitaryID = (short)reader["MilitaryID"];
if (this.Militaries.GetGameObject(troop.MilitaryID) == null)
{
errors.Add("编队ID" + troop.MilitaryID + "不存在");
}
if ((short)reader["AttackDefaultKind"] >= Enum.GetNames(typeof(TroopAttackTargetKind)).Length || (short)reader["AttackDefaultKind"] < 0)
{
errors.Add("攻击预设模式在0至" + Enum.GetNames(typeof(TroopAttackTargetKind)).Length + "之间");
}
else
{
troop.AttackDefaultKind = (TroopAttackDefaultKind)((short)reader["AttackDefaultKind"]);