示例#1
0
 private Component <ReactorType> bestReactor() => ReactorType.MakeBest(
     playersTechLevels,
     this.selectedHull,
     this.selectedSpecialEquipment,
     this.selectedMissionEquipment,
     game.Statics
     );
示例#2
0
        private Design makeDesign(StaticsDB statics, StatesDB states, PredefinedDesign predefDesign, Dictionary <string, double> techLevels, bool isVirtual)
        {
            var hull     = statics.Hulls[predefDesign.HullCode].MakeHull(techLevels);
            var specials = predefDesign.SpecialEquipment.OrderBy(x => x.Key).Select(
                x => statics.SpecialEquipment[x.Key].MakeBest(techLevels, x.Value)
                ).ToList();

            var armor     = AComponentType.MakeBest(statics.Armors.Values, techLevels);
            var reactor   = ReactorType.MakeBest(techLevels, hull, specials, statics);
            var isDrive   = predefDesign.HasIsDrive ? IsDriveType.MakeBest(techLevels, hull, reactor, specials, statics) : null;
            var sensor    = AComponentType.MakeBest(statics.Sensors.Values, techLevels);
            var shield    = predefDesign.ShieldCode != null ? statics.Shields[predefDesign.ShieldCode].MakeBest(techLevels) : null;
            var equipment = predefDesign.MissionEquipment.Select(
                x => statics.MissionEquipment[x.Key].MakeBest(techLevels, x.Value)
                ).ToList();

            var thruster = AComponentType.MakeBest(statics.Thrusters.Values, techLevels);

            var design = new Design(
                states.MakeDesignId(), Player, false, isVirtual, predefDesign.Name, predefDesign.HullImageIndex,
                armor, hull, isDrive, reactor, sensor, shield, equipment, specials, thruster
                );

            design.CalcHash(statics);

            if (!states.Designs.Contains(design))
            {
                states.Designs.Add(design);
                this.Analyze(design, statics);
                return(design);
            }

            return(states.Designs.First(x => x == design));
        }
示例#3
0
        public Design DesignUpgrade(Design oldDesign, StaticsDB statics, StatesDB states)
        {
            var techLevels = states.DevelopmentAdvances.Of[Player].ToDictionary(x => x.Topic.IdCode, x => (double)x.Level);

            var hull     = statics.Hulls[oldDesign.Hull.TypeInfo.IdCode].MakeHull(techLevels);
            var specials = oldDesign.SpecialEquipment.Select(
                x => statics.SpecialEquipment[x.TypeInfo.IdCode].MakeBest(techLevels, x.Quantity)
                ).ToList();

            var armor   = AComponentType.MakeBest(statics.Armors.Values, techLevels);
            var reactor = ReactorType.MakeBest(techLevels, hull, specials, statics);
            var isDrive = oldDesign.IsDrive != null?IsDriveType.MakeBest(techLevels, hull, reactor, specials, statics) : null;

            var sensor    = AComponentType.MakeBest(statics.Sensors.Values, techLevels);
            var shield    = oldDesign.Shield != null ? statics.Shields[oldDesign.Shield.TypeInfo.IdCode].MakeBest(techLevels) : null;
            var equipment = oldDesign.MissionEquipment.Select(
                x => statics.MissionEquipment[x.TypeInfo.IdCode].MakeBest(techLevels, x.Quantity)
                ).ToList();

            var thruster = AComponentType.MakeBest(statics.Thrusters.Values, techLevels);

            var design = new Design(
                states.MakeDesignId(), Player, false, oldDesign.IsVirtual, oldDesign.Name, oldDesign.ImageIndex,
                armor, hull, isDrive, reactor, sensor, shield, equipment, specials, thruster
                );

            design.CalcHash(statics);

            return(design);
        }
示例#4
0
        private void makeDesign(StaticsDB statics, StatesDB states, DesignTemplate predefDesign, Dictionary <string, double> techLevels)
        {
            var hull     = statics.Hulls[predefDesign.HullCode].MakeHull(techLevels);
            var specials = predefDesign.SpecialEquipment.OrderBy(x => x.Key).Select(
                x => statics.SpecialEquipment[x.Key].MakeBest(techLevels, x.Value)
                ).ToList();
            var equipment = predefDesign.MissionEquipment.Select(
                x => statics.MissionEquipment[x.Key].MakeBest(techLevels, x.Value)
                ).ToList();

            var armor   = AComponentType.MakeBest(statics.Armors.Values, techLevels);
            var reactor = ReactorType.MakeBest(techLevels, hull, specials, equipment, statics);
            var isDrive = predefDesign.HasIsDrive ? IsDriveType.MakeBest(techLevels, hull, reactor, specials, equipment, statics) : null;
            var sensor  = AComponentType.MakeBest(statics.Sensors.Values, techLevels);
            var shield  = predefDesign.ShieldCode != null ? statics.Shields[predefDesign.ShieldCode].MakeBest(techLevels) : null;

            var thruster = AComponentType.MakeBest(statics.Thrusters.Values, techLevels);

            var design = new Design(
                this.Player, predefDesign.Name, predefDesign.HullImageIndex, true,
                armor, hull, isDrive, reactor, sensor, thruster, shield, equipment, specials
                );

            if (!states.Designs.Contains(design))
            {
                states.Designs.Add(design);
                this.Analyze(design, statics);
            }
        }
示例#5
0
        internal ReactorInfo(ReactorType type, int level, IDictionary <string, double> shipVars)
        {
            this.Type  = type;
            this.Level = level;

            this.vars = new Dictionary <string, double>(shipVars);
            this.vars[AComponentType.LevelKey] = level;
        }
示例#6
0
        public static INode ToNode(this IPEndPoint endPoint, ReactorType transportType)
        {
            NodeConfig nodeConfig = new UdpNodeConfig()
            {
                LocalAddress = endPoint.Address.ToString(),
                LocalPort    = endPoint.Port
            };

            return(new Node {
                nodeConfig = nodeConfig, reactorType = transportType
            });
        }
示例#7
0
        private ReactorInfo bestReactor()
        {
            var hull    = new Component <HullType>(this.selectedHull.Type, this.selectedHull.Level);
            var reactor = ReactorType.MakeBest(
                playersTechLevels,
                hull,
                this.selectedSpecialEquipment,
                game.Statics
                );

            return(reactor != null ?
                   new ReactorInfo(reactor.TypeInfo, reactor.Level, PlayerProcessor.DesignBaseVars(hull, this.selectedSpecialEquipment, game.Statics).Get) :
                   null);
        }
示例#8
0
        /// <summary>
        /// 注入IP地址
        /// </summary>
        /// <param name="n">节点对象</param>
        /// <param name="host">IP地址</param>
        public static INode Host(this INode n, ReactorType hostType)
        {
            n.reactorType = hostType;
            switch (hostType)
            {
            case ReactorType.SerialPorts:
                n.nodeConfig = JsonConvert.DeserializeObject <SerialNodeConfig>(n.CustomData);
                break;

            case ReactorType.Udp:
                n.nodeConfig = JsonConvert.DeserializeObject <UdpNodeConfig>(n.CustomData);
                break;
            }
            return(n);
        }
示例#9
0
 public DeloreanModsCopy(DeloreanMods deloreanMods)
 {
     DeloreanType          = deloreanMods.DeloreanType;
     SuspensionsType       = deloreanMods.SuspensionsType;
     Wheel                 = deloreanMods.Wheel;
     Exterior              = deloreanMods.Exterior;
     Interior              = deloreanMods.Interior;
     OffCoils              = deloreanMods.OffCoils;
     GlowingEmitter        = deloreanMods.GlowingEmitter;
     GlowingReactor        = deloreanMods.GlowingReactor;
     DamagedBumper         = deloreanMods.DamagedBumper;
     SteeringWheelsButtons = deloreanMods.SteeringWheelsButtons;
     HoverUnderbody        = deloreanMods.HoverUnderbody;
     Vents                 = deloreanMods.Vents;
     Seats                 = deloreanMods.Seats;
     Reactor               = deloreanMods.Reactor;
     Exhaust               = deloreanMods.Exhaust;
     Hoodbox               = deloreanMods.Hoodbox;
     Hook  = deloreanMods.Hook;
     Plate = deloreanMods.Plate;
 }
示例#10
0
        private void makeDesign(StaticsDB statics, StatesDB states, string id, PredefinedDesign predefDesign, PlayerProcessor playerProc)
        {
            var design = states.Designs.FirstOrDefault(x => x.IdCode == id);

            if (design == null)
            {
                var techLevels = new Var().
                                 Init(statics.DevelopmentTopics.Select(x => x.IdCode), false).
                                 Init(statics.ResearchTopics.Select(x => x.IdCode), false).Get;

                var hull     = statics.Hulls[predefDesign.HullCode].MakeHull(techLevels);
                var specials = predefDesign.SpecialEquipment.OrderBy(x => x.Key).Select(
                    x => statics.SpecialEquipment[x.Key].MakeBest(techLevels, x.Value)
                    ).ToList();

                var armor     = AComponentType.MakeBest(statics.Armors.Values, techLevels);                                          //TODO(0.5) get id from template
                var reactor   = ReactorType.MakeBest(techLevels, hull, specials, statics);                                           //TODO(0.5) get id from template
                var isDrive   = predefDesign.HasIsDrive ? IsDriveType.MakeBest(techLevels, hull, reactor, specials, statics) : null; //TODO(0.5) get id from template
                var sensor    = AComponentType.MakeBest(statics.Sensors.Values, techLevels);                                         //TODO(0.5) get id from template
                var shield    = predefDesign.ShieldCode != null ? statics.Shields[predefDesign.ShieldCode].MakeBest(techLevels) : null;
                var equipment = predefDesign.MissionEquipment.Select(
                    x => statics.MissionEquipment[x.Key].MakeBest(techLevels, x.Value)
                    ).ToList();

                var thruster = AComponentType.MakeBest(statics.Thrusters.Values, techLevels);                 //TODO(0.5) get id from template

                design = new Design(
                    id, playerProc.Player, false, true, predefDesign.Name, predefDesign.HullImageIndex,
                    armor, hull, isDrive, reactor, sensor, shield, equipment, specials, thruster
                    );

                design.CalcHash(statics);
                states.Designs.Add(design);
            }

            playerProc.Analyze(design, statics);
        }