当前位置: 首页>>代码示例>>C#>>正文


C# Troop.LoadPathInformation方法代码示例

本文整理汇总了C#中GameObjects.Troop.LoadPathInformation方法的典型用法代码示例。如果您正苦于以下问题:C# Troop.LoadPathInformation方法的具体用法?C# Troop.LoadPathInformation怎么用?C# Troop.LoadPathInformation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameObjects.Troop的用法示例。


在下文中一共展示了Troop.LoadPathInformation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadGameDataFromDataBase


//.........这里部分代码省略.........
                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
                {
                }
                try
                {
                    troop.mingling = reader["mingling"].ToString();
                }
                catch
                {
                }
                try
开发者ID:ptmaster,项目名称:ZhongHuaSanGuoZhi,代码行数:67,代码来源:GameScenario.cs

示例2: LoadGameDataFromDataBase


//.........这里部分代码省略.........
            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"]);
                }
                if ((short)reader["AttackTargetKind"] >= Enum.GetNames(typeof(TroopAttackTargetKind)).Length || (short)reader["AttackTargetKind"] < 0)
                {
                    errors.Add("攻击目标模式在0至" + Enum.GetNames(typeof(TroopAttackTargetKind)).Length + "之间");
                }
                else
                {
                    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"];
                try
                {
                    troop.ForceTroopTargetId = (short)reader["ForceTroopTarget"];
开发者ID:hero1991,项目名称:ZhongHuaSanGuoZhi,代码行数:67,代码来源:GameScenario.cs


注:本文中的GameObjects.Troop.LoadPathInformation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。