コード例 #1
0
 public void UpdateRing()
 {
     if (!double.IsNaN(Radius) && Radius > 0 && Center != null && PointCount > 2)
     {
         PointCollection pnts = new PointCollection();
         for (int i = PointCount; i >= 0; i--)
         {
             double rad = 2 * Math.PI / PointCount * i;
             double x   = Math.Cos(rad) * Radius + Center.X;
             double y   = Math.Sin(rad) * Radius + Center.Y;
             pnts.Add(new MapPoint(x, y));
         }
         if (Rings.Count == 0)
         {
             Rings.Add(pnts);
         }
         else
         {
             Rings[0] = pnts;
         }
     }
     else
     {
         Rings.Clear();
     }
 }
コード例 #2
0
        private static bool RingsHaveDifferentIds(
            [NotNull] Dictionary <int, List <int> > pointIndexesById,
            [NotNull] Rings rings,
            out int firstPointId)
        {
            var errorRingsById = new Dictionary <int, List <IRing> >();

            firstPointId = 0;
            bool first = true;

            foreach (KeyValuePair <int, List <int> > pair in pointIndexesById)
            {
                int        pointId      = pair.Key;
                List <int> pointIndexes = pair.Value;

                if (first)
                {
                    firstPointId = pointId;
                }

                first = false;

                List <IRing> errorRings = rings.GetRingsIfComplete(pointIndexes);

                if (errorRings == null)
                {
                    errorRingsById = null;
                    break;
                }

                errorRingsById.Add(pointId, errorRings);
            }

            return(errorRingsById != null);
        }
コード例 #3
0
ファイル: DialogManager.cs プロジェクト: Blacksyde/Cubenaut
 // Use this for initialization
 void Start()
 {
     scanButton.onClick.AddListener(OnScanClick);
     travelButton.onClick.AddListener(OnTravelClick);
     sat          = UnityEngine.Object.FindObjectOfType <Satellite> ();
     audioManager = UnityEngine.Object.FindObjectOfType <AudioManager>();
     rings        = UnityEngine.Object.FindObjectOfType <Rings> ();
 }
コード例 #4
0
        internal Polygon(JObject obj)
        {
            var coordinates = obj.GetValue("coordinates").ToObject <double[][][]>();

            Rings = AsReadOnlyCollection(coordinates
                                         .Select(r => (IList <Point>)r.Select(p => new Point(p[0], p[1])).ToList())
                                         .ToList());
            _ringsWithOrderedPoints = Rings.Select(r => (IList <Point>)r.OrderBy(p => p).ToList()).ToList();
        }
コード例 #5
0
        /// <summary>
        /// Creates a new instance of <see cref="Polygon"/> using serialization information.
        /// </summary>
        protected Polygon(SerializationInfo info, StreamingContext context)
        {
            var coordinates = (double[][][])info.GetValue("coordinates", typeof(double[][][]));

            Rings = AsReadOnlyCollection(coordinates
                                         .Select(r => (IList <Point>)r.Select(p => new Point(p[0], p[1])).ToList())
                                         .ToList());
            _ringsWithOrderedPoints = Rings.Select(r => (IList <Point>)r.OrderBy(p => p).ToList()).ToList();
        }
コード例 #6
0
 /// <summary>
 /// Creates a new instance of <see cref="Polygon"/> using multiple rings.
 /// </summary>
 /// <param name="rings">The polygon rings</param>
 public Polygon(IList <IList <Point> > rings)
 {
     if (rings == null)
     {
         throw new ArgumentNullException("rings");
     }
     Rings = AsReadOnlyCollection(rings, r => AsReadOnlyCollection(r));
     _ringsWithOrderedPoints = Rings.Select(r => (IList <Point>)r.OrderBy(p => p).ToList()).ToList();
 }
コード例 #7
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is Rings)
     {
         Rings mask = (Rings)parameter;
         this.target = (Rings)value;
         return((mask & this.target) != 0);
     }
     return(false);
 }
コード例 #8
0
ファイル: Molecule.cs プロジェクト: lolly4/Version3
        private void WipeMoleculeRings()
        {
            Rings.RemoveAll();

            //first set all atoms to side chains
            foreach (var a in Atoms)
            {
                a.Rings.RemoveAll();
                _sortedRings = null;
            }
        }
コード例 #9
0
 /// <summary>
 /// Returns Well-known text (WKT) representation of the geometry object.
 /// </summary>
 public override string ToString()
 {
     if (Rings.Count == 0)
     {
         return("POLYGON EMPTY");
     }
     return(string.Format("POLYGON ({0})", string.Join(", ",
                                                       Rings.Select(r =>
                                                                    "(" +
                                                                    string.Join(", ", r.Select(p => p.X.ToString(CultureInfo.InvariantCulture) + " " + p.Y.ToString(CultureInfo.InvariantCulture))) +
                                                                    ")"))));
 }
コード例 #10
0
        public RingTreeNode(Rings ringValue)
        {
            _ringValue = ringValue;
            Type ringType = typeof(Rings);
            Type infoType = typeof(RingInfoAttribute);

            RingInfoAttribute attr = ringType.GetMember(ringValue.ToString())[0].GetCustomAttributes(infoType, false)
                                     .Cast <RingInfoAttribute>().SingleOrDefault();

            _name        = attr.Name;
            _description = attr.Description;
        }
コード例 #11
0
        private int ReportPointErrors(
            [NotNull] IDictionary <int, List <int> > pointIndexesById,
            int maxPointsId,
            [NotNull] Rings rings,
            [NotNull] IRow row)
        {
            object missing = Type.Missing;

            IPointCollection points = new MultipointClass();

            GeometryUtils.EnsureSpatialReference((IGeometry)points,
                                                 rings.SpatialReference);

            foreach (KeyValuePair <int, List <int> > pair in pointIndexesById)
            {
                int id = pair.Key;
                if (id == maxPointsId)
                {
                    continue;
                }

                List <int> pointIndexes = pair.Value;

                foreach (int pointIndex in pointIndexes)
                {
                    IPoint point = rings.get_Point(pointIndex);
                    points.AddPoint(point, ref missing, ref missing);
                }
            }

            string description;

            if (rings.RingsCount > 1)
            {
                description = string.Format(
                    "The point ids of these points differ from the most frequent point id {0} " +
                    "({1} occurrences) in the rings (outer ring = {2}. patch in multipatch)",
                    maxPointsId, pointIndexesById[maxPointsId].Count,
                    rings.FirstPatchIndex + 1);
            }
            else
            {
                description = string.Format(
                    "The point ids of these points differ from the most frequent point id {0} " +
                    "({1} occurrences) in the ring ({2}. patch in Multipatch)",
                    maxPointsId, pointIndexesById[maxPointsId].Count,
                    rings.FirstPatchIndex + 1);
            }

            return(ReportError(description, (IGeometry)points, Codes[Code.DifferentIdInRing],
                               TestUtils.GetShapeFieldName(row), row));
        }
コード例 #12
0
        private int ReportError(
            [NotNull] Rings rings,
            [NotNull] IDictionary <int, List <int> > pointIndexesById,
            int maxPointsId,
            [NotNull] IRow row)
        {
            int totalPointCount = 0;
            int errorPointCount = 0;

            foreach (KeyValuePair <int, List <int> > pair in pointIndexesById)
            {
                int        id           = pair.Key;
                List <int> pointIndexes = pair.Value;

                totalPointCount += pointIndexes.Count;

                if (id == maxPointsId)
                {
                    continue;
                }

                errorPointCount += pointIndexes.Count;
            }

            if (errorPointCount < 5 && errorPointCount * 2 < totalPointCount)
            {
                return(ReportPointErrors(pointIndexesById, maxPointsId, rings, row));
            }

            string description;

            if (rings.RingsCount > 1)
            {
                description = string.Format(
                    "{0} point ids differ from the most frequent point id {1} " +
                    "({2} occurrences) in the rings (outer ring = {3}. patch in multipatch)",
                    errorPointCount, maxPointsId, pointIndexesById[maxPointsId].Count,
                    rings.FirstPatchIndex);
            }
            else
            {
                description = string.Format(
                    "{0} point ids differ from the most frequent point id {1} " +
                    "({2} occurrences) in the ring ({3}. patch in multipatch)",
                    errorPointCount, maxPointsId, pointIndexesById[maxPointsId].Count,
                    rings.FirstPatchIndex);
            }

            return(ReportError(description, rings.CreateMultiPatch(),
                               Codes[Code.DifferentIdInRing], TestUtils.GetShapeFieldName(row),
                               row));
        }
コード例 #13
0
ファイル: Molecule.cs プロジェクト: lolly4/Version3
        }//have we calculated the rings yet?

        public void RebuildRings()
        {
#if DEBUG
            Stopwatch sw = new Stopwatch();
            sw.Start();
#endif
            if (HasRings)
            {
                WipeMoleculeRings();

                //working set of atoms
                //it's a dictionary, because we initially store the degree of each atom against it
                //this will change as the pruning operation kicks in
                Dictionary <Atom, int> workingSet = Projection(a => a.Degree);
                //lop off any terminal branches
                PruneSideChains(workingSet);

                while (workingSet.Any())                                                       //do we have any atoms left in the set
                {
                    var  startAtom = workingSet.Keys.OrderByDescending(a => a.Degree).First(); // go for the highest degree atom
                    Ring nextRing  = GetRing(startAtom);                                       //identify a ring
                    if (nextRing != null)                                                      //bingo
                    {
                        //and add the ring to the atoms
                        Rings.Add(nextRing); //add the ring to the set
                        foreach (Atom a in nextRing.Atoms.ToList())
                        {
                            if (!a.Rings.Contains(nextRing))
                            {
                                a.Rings.Add(nextRing);
                            }

                            if (workingSet.ContainsKey(a))
                            {
                                workingSet.Remove(a);
                            }
                            //remove the atoms in the ring from the working set BUT NOT the graph!
                        }
                    }
                    else
                    {
                        workingSet.Remove(startAtom);
                    } //the atom doesn't belong in a ring, remove it from the set.
                }
            }
#if DEBUG
            //Debug.WriteLine($"Molecule = {(ChemicalNames.Count > 0 ? this.ChemicalNames?[0].Name : this.ConciseFormula)},  Number of rings = {Rings.Count}");
            sw.Stop();
            Debug.WriteLine($"Elapsed {sw.ElapsedMilliseconds}");
#endif
        }
コード例 #14
0
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool?b = value as bool?;

            if (b == true)
            {
                this.target |= (Rings)parameter;
            }
            else
            {
                this.target ^= (Rings)parameter;
            }
            return(this.target);
        }
コード例 #15
0
 private string PolygonToWkt()
 {
     if (!(Rings?.Length > 0))
     {
         return("POLYGON EMPTY");
     }
     else if (Rings.Length == 1)
     {
         return(FormattableString.Invariant($"POLYGON({EsriJsonHelper.PointArrayToString(Rings[0])})"));
     }
     else
     {
         return(FormattableString.Invariant($"MULTIPOLYGON({string.Join(", ", Rings.Select(i => $"({EsriJsonHelper.PointArrayToString(i)})"))})"));
     }
 }
コード例 #16
0
 public void SetCurrentStance(string ring)
 {
     if (string.IsNullOrEmpty(ring))
     {
         CurrentStance = ring;
     }
     else if (Rings.ContainsKey(ring))
     {
         CurrentStance = ring;
     }
     else
     {
         throw new ArgumentException($"Changement de posture: Anneau en paramètre incorrect : {ring}");
     }
 }
コード例 #17
0
 public static bool IsJewelery(string itemBase)
 {
     if (Belts.Contains(itemBase))
     {
         return(true);
     }
     if (Amulets.Contains(itemBase))
     {
         return(true);
     }
     if (Rings.Contains(itemBase))
     {
         return(true);
     }
     return(false);
 }
コード例 #18
0
ファイル: Molecule.cs プロジェクト: lolly4/Version3
        /// <summary>
        /// Sorts a series of small rings ready for determining double bond placement
        /// see DOI: 10.1002/minf.201200171
        /// Rendering molecular sketches for publication quality output
        /// Alex M Clark
        /// </summary>
        /// <returns>List of rings</returns>
        // ReSharper disable once InconsistentNaming
        public List <Ring> SortRingsForDBPlacement()
        {
            //
            Debug.Assert(HasRings);        //no bloody point in running this unless it has rings
            Debug.Assert(RingsCalculated); //make sure that if the molecule contains rings that we have calculated them
            //1) All rings of sizes 6, 5, 7, 4 and 3 are discovered, in that order, and added to a list R.
            var R = Rings.Where(x => x.Priority > 0).OrderBy(x => x.Priority).ToList();

            //Define B as an array of size equal to the number of atoms, where each value is equal to the number of times the atom occurs in any of the rings R
            Dictionary <Atom, int> B = new Dictionary <Atom, int>();

            foreach (Atom atom in Atoms)
            {
                B[atom] = atom.Rings.Count;
            }

            //Define Q as an array of size equal to length of R, where each value is equal to sum of B[r], where r iterates over each of the atoms within the ring.
            Dictionary <Ring, int> Q = new Dictionary <Ring, int>();

            foreach (Ring ring in R)
            {
                int sumBr = 0;
                foreach (Atom atom in ring.Atoms)
                {
                    sumBr += B[atom];
                }

                Q[ring] = sumBr;
            }

            //Perform a stable sort of the list of rings, R, so that those with the lowest values of Q are listed first.
            var R2 = R.OrderBy(r => Q[r]);

            //Define D as an array of size equal to length of R, where each value is equal to the number of double bonds within the corresponding ring
            Dictionary <Ring, int> D = new Dictionary <Ring, int>();

            foreach (Ring ring in R2)
            {
                D[ring] = ring.Bonds.Count(b => b.OrderValue == 2);
            }

            //Perform a stable sort of the list of rings, R, so that those with highest values of D are listed first

            var R3 = R2.OrderByDescending(r => D[r]);

            return(R3.ToList());
        }
コード例 #19
0
ファイル: Bond.cs プロジェクト: alan008/Version3
        /// <summary>
        /// indicates which side of bond to draw subsidiary double bond
        /// </summary>
        /// if bond order is not 2, returns null
        /// if bond is in single ring, vector points to centre of ring
        /// if bond is in cisoid bond (excluding hydrogens) points to area
        /// including both bonds
        /// if bond is in 3 rings vector is null
        ///
        /// this is not foolproof as we may need to make a benzene ring consistent
        /// <returns></returns>
        public Vector?GetPrettyCyclicDoubleBondVector()
        {
            Debug.Assert(Parent.RingsCalculated);

            Vector?vector = null;

            Ring theRing = PrimaryRing;

            List <Ring> ringList = Rings.Where(x => x.Priority > 0).OrderBy(x => x.Priority).ToList();

            if (ringList.Any()) //no rings
            {
                Point?ringCentroid = theRing.Centroid;
                vector = ringCentroid - MidPoint;
            }

            return(vector);
        }
コード例 #20
0
        protected (int, int) CostOfFighting(string[] input)
        {
            var boss = ReadStats(input);

            var minCostForWinning = int.MaxValue;
            var maxCostForLosing  = 0;

            foreach (var weapon in Weapons)
            {
                foreach (var armor in Armors)
                {
                    foreach (var ring1 in Rings)
                    {
                        foreach (var ring2 in Rings.Where(r => r != ring1))
                        {
                            var cost = weapon.Cost + armor.Cost + ring1.Cost + ring2.Cost;
                            var you  = new Stats
                            {
                                Hitpoints = 100,
                                Damage    = weapon.Damage + armor.Damage + ring1.Damage + ring2.Damage,
                                Armor     = weapon.Armor + armor.Armor + ring1.Armor + ring2.Armor
                            };
                            if (YouWinFight(boss, you))
                            {
                                if (cost < minCostForWinning)
                                {
                                    minCostForWinning = cost;
                                }
                            }
                            else
                            {
                                if (cost > maxCostForLosing)
                                {
                                    maxCostForLosing = cost;
                                }
                            }
                        }
                    }
                }
            }
            return(minCostForWinning, maxCostForLosing);
        }
コード例 #21
0
        private void DrawRings()
        {
            int ringCounter = 0;

            foreach (List <Node> ring in Rings.Skip(1))
            {
                double radius = Radius * ((ringCounter + 1.0) / (Rings.Count - 1.0));
                RingCoordinates.Add(new List <Coordinate <Node> >());
                double angle       = 0;
                double incrementor = 2.0 * Math.PI / ring.Count;
                foreach (Node item in ring)
                {
                    RingCoordinates[ringCounter].Add(new Coordinate <Node> {
                        CoordinateX = CenterX + (radius * Math.Cos(angle)), CoordinateY = CenterY + (radius * Math.Sin(angle)), Item = item
                    });
                    angle += incrementor;
                }
                ringCounter++;
            }
        }
コード例 #22
0
        private int ReportError(
            [NotNull] Rings rings,
            [NotNull] Dictionary <int, List <int> > pointIndexesById,
            [NotNull] IRow row)
        {
            int firstId;

            if (RingsHaveDifferentIds(pointIndexesById, rings, out firstId))
            {
                int    outerRingIds = firstId;
                string description  = string.Format("Point ids within rings are constant, " +
                                                    "but inner ring point ids differ from outer ring point ids ({0})" +
                                                    "(outer ring = {1}. patch in multipatch)",
                                                    outerRingIds, rings.FirstPatchIndex + 1);

                IGeometry errorGeometry = rings.CreateMultiPatch();

                return(ReportError(description, errorGeometry,
                                   Codes[Code.InnerRingIdDifferentFromOuterRingId],
                                   TestUtils.GetShapeFieldName(row), row));
            }

            int?maxPointsId = GetMaxPointsId(pointIndexesById);

            if (maxPointsId == null)
            {
                IGeometry errorGeometry = rings.CreateMultiPatch();
                string    description   = string.Format(
                    rings.RingsCount <= 1
                                                ? "Different point ids exist in this ring ({0}. patch in multipatch)"
                                                : "Different point ids exist in these rings (out ring = {0}. patch in multipatch)",
                    rings.FirstPatchIndex + 1);

                return(ReportError(description, errorGeometry,
                                   Codes[Code.DifferentIdInRing],
                                   TestUtils.GetShapeFieldName(row),
                                   row));
            }

            return(ReportError(rings, pointIndexesById, maxPointsId.Value, row));
        }
コード例 #23
0
            public Obstacle(Vector2 position, float radius)
            {
                // Get offset radius
                var radiusOffset = radius + 0.5f;
                // Get offset radius squared
                var radiusOffsetSquared = radiusOffset * radiusOffset;
                // Create ring radius
                var radiusRing = 0;
                // Get ring coordinate
                var coordinateRing = Converter.Coordinate(position);

                // Add coordinates
                while (true)
                {
                    // Create found
                    var found = false;
                    // Get ring
                    var ring = Rings.Get(radiusRing++);
                    // Run through ring
                    for (int i = 0; i < ring.Count; i++)
                    {
                        var coordinate = ring.GetCoordinate(coordinateRing, i);
                        // Get distance squared
                        var distanceSquared = (coordinate - position).sqrMagnitude;
                        // Check if distance is within offset radius
                        if (distanceSquared < radiusOffsetSquared)
                        {
                            // Add coordinate
                            _coordinates.Add(coordinate);
                            // Set found
                            found = true;
                        }
                    }
                    // Check if not found
                    if (!found)
                    {
                        // Stop loop
                        break;
                    }
                }
            }
コード例 #24
0
        private static List <(int cost, int armor, int damage)> GetCombinations()
        {
            var combinations = new List <(int, int, int)>();
            var count        = 0;

            for (int weaponIndex = 0; weaponIndex < Weapons.Count(); weaponIndex++)
            {
                for (int gearIndex = 0; gearIndex < Gear.Count(); gearIndex++)
                {
                    for (int firstRingIndex = 0; firstRingIndex < Rings.Count(); firstRingIndex++)
                    {
                        for (int secondRingIndex = firstRingIndex + 1; secondRingIndex < Rings.Count(); secondRingIndex++)
                        {
                            count++;
                            var combination = GetCombinationStats(weaponIndex, gearIndex, firstRingIndex, secondRingIndex);
                            combinations.Add(combination);
                        }
                    }
                }
            }

            return(combinations);
        }
コード例 #25
0
        public string DisplayString(int indent = 0, bool includefront = true, MaterialCommoditiesList historicmatlist = null, MaterialCommoditiesList currentmatlist = null)
        {
            string inds = new string(' ', indent);

            StringBuilder scanText = new StringBuilder();

            scanText.Append(inds);

            if (includefront)
            {
                scanText.AppendFormat("{0} {1}\n\n", BodyName, IsEDSMBody ? " (EDSM)" : "");

                if (IsStar)
                {
                    scanText.AppendFormat(GetStarTypeName());
                }
                else if (PlanetClass != null)
                {
                    scanText.AppendFormat("{0}", PlanetClass);

                    if (!PlanetClass.ToLower().Contains("gas"))
                    {
                        scanText.AppendFormat((Atmosphere == null || Atmosphere == String.Empty) ? ", No Atmosphere" : (", " + Atmosphere));
                    }
                }

                if (IsLandable)
                {
                    scanText.AppendFormat(", Landable");
                }

                scanText.AppendFormat("\n");

                if (HasAtmosphericComposition)
                {
                    scanText.Append("\n" + DisplayAtmosphere(2));
                }

                if (HasPlanetaryComposition)
                {
                    scanText.Append("\n" + DisplayComposition(2));
                }

                if (HasPlanetaryComposition || HasAtmosphericComposition)
                {
                    scanText.Append("\n\n");
                }

                if (nAge.HasValue)
                {
                    scanText.AppendFormat("Age: {0} million years\n", nAge.Value.ToString("N0"));
                }

                if (nStellarMass.HasValue)
                {
                    scanText.AppendFormat("Solar Masses: {0:0.00}\n", nStellarMass.Value);
                }

                if (nMassEM.HasValue)
                {
                    scanText.AppendFormat("Earth Masses: {0:0.0000}\n", nMassEM.Value);
                }

                if (nRadius.HasValue)
                {
                    if (IsStar)
                    {
                        scanText.AppendFormat("Solar Radius: {0:0.00} Sols\n", (nRadius.Value / solarRadius_m));
                    }
                    else
                    {
                        scanText.AppendFormat("Body Radius: {0:0.00}km\n", (nRadius.Value / 1000));
                    }
                }
            }

            if (nSurfaceTemperature.HasValue)
            {
                scanText.AppendFormat("Surface Temp: {0}K\n", nSurfaceTemperature.Value.ToString("N0"));
            }

            if (Luminosity != null)
            {
                scanText.AppendFormat("Luminosity: {0}\n", Luminosity);
            }

            if (nSurfaceGravity.HasValue)
            {
                scanText.AppendFormat("Gravity: {0:0.0}g\n", nSurfaceGravity.Value / oneGee_m_s2);
            }

            if (nSurfacePressure.HasValue && nSurfacePressure.Value > 0.00 && !PlanetClass.ToLower().Contains("gas"))
            {
                if (nSurfacePressure.Value > 1000)
                {
                    scanText.AppendFormat("Surface Pressure: {0} Atmospheres\n", (nSurfacePressure.Value / oneAtmosphere_Pa).ToString("N2"));
                }
                else
                {
                    { scanText.AppendFormat("Surface Pressure: {0} Pa\n", (nSurfacePressure.Value).ToString("N2")); }
                }
            }

            if (Volcanism != null)
            {
                scanText.AppendFormat("Volcanism: {0}\n", Volcanism == String.Empty ? "No Volcanism" : System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.
                                      ToTitleCase(Volcanism.ToLower()));
            }

            if (DistanceFromArrivalLS > 0)
            {
                scanText.AppendFormat("Distance from Arrival Point {0:N1}ls\n", DistanceFromArrivalLS);
            }

            if (nOrbitalPeriod.HasValue && nOrbitalPeriod > 0)
            {
                scanText.AppendFormat("Orbital Period: {0} days\n", (nOrbitalPeriod.Value / oneDay_s).ToString("N1"));
            }

            if (nSemiMajorAxis.HasValue)
            {
                if (IsStar || nSemiMajorAxis.Value > oneAU_m / 10)
                {
                    scanText.AppendFormat("Semi Major Axis: {0:0.00}AU\n", (nSemiMajorAxis.Value / oneAU_m));
                }
                else
                {
                    scanText.AppendFormat("Semi Major Axis: {0}km\n", (nSemiMajorAxis.Value / 1000).ToString("N1"));
                }
            }

            if (nEccentricity.HasValue)
            {
                scanText.AppendFormat("Orbital Eccentricity: {0:0.000}\n", nEccentricity.Value);
            }

            if (nOrbitalInclination.HasValue)
            {
                scanText.AppendFormat("Orbital Inclination: {0:0.000}°\n", nOrbitalInclination.Value);
            }

            if (nPeriapsis.HasValue)
            {
                scanText.AppendFormat("Arg Of Periapsis: {0:0.000}°\n", nPeriapsis.Value);
            }

            if (nAbsoluteMagnitude.HasValue)
            {
                scanText.AppendFormat("Absolute Magnitude: {0:0.00}\n", nAbsoluteMagnitude.Value);
            }

            if (nAxialTilt.HasValue)
            {
                scanText.AppendFormat("Axial tilt: {0:0.00}°\n", nAxialTilt.Value * 180.0 / Math.PI);
            }

            if (nRotationPeriod.HasValue)
            {
                scanText.AppendFormat("Rotation Period: {0} days\n", (nRotationPeriod.Value / oneDay_s).ToString("N1"));
            }

            if (nTidalLock.HasValue && nTidalLock.Value)
            {
                scanText.Append("Tidally locked\n");
            }

            if (Terraformable)
            {
                scanText.Append("Candidate for terraforming\n");
            }

            if (HasRings)
            {
                scanText.Append("\n");
                if (IsStar)
                {
                    scanText.AppendFormat("Belt{0}", Rings.Count() == 1 ? ":" : "s:");
                    for (int i = 0; i < Rings.Length; i++)
                    {
                        if (Rings[i].MassMT > (oneMoon_MT / 10000))
                        {
                            scanText.Append("\n" + RingInformation(i, 1.0 / oneMoon_MT, " Moons"));
                        }
                        else
                        {
                            scanText.Append("\n" + RingInformation(i));
                        }
                    }
                }
                else
                {
                    scanText.AppendFormat("Ring{0}", Rings.Count() == 1 ? ":" : "s:");

                    for (int i = 0; i < Rings.Length; i++)
                    {
                        scanText.Append("\n" + RingInformation(i));
                    }
                }
            }

            if (HasMaterials)
            {
                scanText.Append("\n" + DisplayMaterials(2, historicmatlist, currentmatlist) + "\n");
            }

            string habzonestring = HabZoneString();

            if (habzonestring != null)
            {
                scanText.Append("\n" + habzonestring);
            }

            if (scanText.Length > 0 && scanText[scanText.Length - 1] == '\n')
            {
                scanText.Remove(scanText.Length - 1, 1);
            }

            if (EstimatedValue > 0)
            {
                scanText.AppendFormat("\nEstimated value: {0:N0}", EstimatedValue);
            }

            if (EDSMDiscoveryCommander != null)
            {
                scanText.AppendFormat("\n\nDiscovered by " + EDSMDiscoveryCommander + " on " + EDSMDiscoveryUTC.ToStringZulu());
            }

            return(scanText.ToNullSafeString().Replace("\n", "\n" + inds));
        }
コード例 #26
0
ファイル: RingSecret.cs プロジェクト: Chibiyima/oracle-hack
 /// <summary>
 /// Initializes a new instance of the <see cref="RingSecret"/> class with the
 /// specified <paramref name="gameId"/> and <paramref name="rings"/>.
 /// </summary>
 /// <param name="gameId">The game identifier.</param>
 /// <param name="rings">The rings.</param>
 public RingSecret(short gameId, Rings rings)
 {
     GameID = gameId;
     Rings = rings;
 }
コード例 #27
0
        public override void LoadContent()
        {
            Content = new ContentManager(ScreenManager.Game.Services, "Content");

            SpriteBatch = ScreenManager.SpriteBatch;
            backgroundBatch = new SpriteBatch(ScreenManager.GraphicsDevice);

            bg = Content.Load<Texture2D>("Sprites/background");
            mg = new MovingBackground(Content.Load<Texture2D>("Sprites/middleground"), ScreenManager.GraphicsDevice.Viewport, speed/2);
            fg = new MovingBackground(Content.Load<Texture2D>("Sprites/foreground"), ScreenManager.GraphicsDevice.Viewport, speed);

            plane = new Plane(Content.Load<Texture2D>("Sprites/plane"), Content.Load<SoundEffect>("Sound/plane"));

            ringFront = Content.Load<Texture2D>("Sprites/ringFront");
            ringBack = Content.Load<Texture2D>("Sprites/ringBack");
            ringFrontCleared = Content.Load<Texture2D>("Sprites/ringFrontCleared");
            ringBackCleared = Content.Load<Texture2D>("Sprites/ringBackCleared");

            ringSound = Content.Load<SoundEffect>("Sound/ringDoDoDo");

            rings = new Rings(ringFront, ringBack, ringFrontCleared, ringBackCleared, numRings, speed, ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height, ringSound);

            gameFont = Content.Load<SpriteFont>("Font");

            float scoreLength = (gameFont.MeasureString("999/999")).X;
            scorePosition = new Vector2(this.ScreenManager.ScaleXPosition((this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2.0f) - (scoreLength / 2.0f)), this.ScreenManager.ScaleYPosition(20.0f));

            plane.playSound();
        }
コード例 #28
0
ファイル: Bond.cs プロジェクト: alan008/Version3
 /// <summary>
 /// is the bond cyclic
 /// </summary>
 /// <returns>bool indicating cyclicity</returns>
 public bool IsCyclic()
 {
     return(Rings.Any());
 }
コード例 #29
0
        public void LoadFromRow(DataRow row)
        {
            try
            {
                ID = Convert.ToInt32(row["JudgeID"]);
                UserID = Convert.ToInt32(row["UserID"]);

                _Notes = row["Notes"].ToString();
                if (row.Table.Columns.Contains("Status")) _Status = (JudgeStatus)Convert.ToInt32(row["Status"]);
                if (row.Table.Columns.Contains("JudgeName")) JudgeName = Convert.ToString(row["JudgeName"]);
                if (row.Table.Columns.Contains("Allocated")) _Allocated = Convert.ToInt32(row["Allocated"]);
                if (row.Table.Columns.Contains("RingID")) _ringID = Convert.ToInt32(row["RingID"]);
                if (row.Table.Columns.Contains("ShowDetailsID") && row["ShowDetailsID"] != DBNull.Value)
                {
                    ShowDetailsID = Convert.ToInt32(row["ShowDetailsID"]);
                }
                if (row.Table.Columns.Contains("ShowDate") && row["ShowDate"] != DBNull.Value)
                {
                    ShowDate = Convert.ToDateTime(row["ShowDate"]);
                }
                if (row.Table.Columns.Contains("RingOrder"))
                {
                    RingOrder = Convert.ToInt32(row["RingOrder"]);
                }

                _user = new User(UserID);
                _ring = new Rings(_ringID);
            }
            catch (Exception e )
            {
                AppException.LogEvent("Judge.LoadFromRow:" + e.Message);
            }
        }
コード例 #30
0
        public void rings()
        {
            Rings rings1 = new Rings();

            rings1.rings();
        }
コード例 #31
0
ファイル: RingSecret.cs プロジェクト: Chibiyima/oracle-hack
 /// <summary>
 /// Loads in data from the specified game info
 /// </summary>
 /// <param name="info">The game info</param>
 /// <example>
 /// <code language="C#">
 /// GameInfo info = new GameInfo()
 /// {
 ///     GameID = 14129,
 ///     Rings = Rings.PowerRingL1 | Rings.DoubleEdgeRing | Rings.ProtectionRing
 /// };
 /// RingSecret secret = new RingSecret();
 /// secret.Load(info);
 /// </code>
 /// </example>
 public override void Load(GameInfo info)
 {
     GameID = info.GameID;
     Rings = info.Rings;
 }
コード例 #32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RingSecret"/> class with the
 /// specified <paramref name="gameId"/> and <paramref name="rings"/>.
 /// </summary>
 /// <param name="gameId">The game identifier.</param>
 /// <param name="rings">The rings.</param>
 public RingSecret(short gameId, Rings rings)
 {
     GameID = gameId;
     Rings  = rings;
 }
コード例 #33
0
 /// <summary>
 /// Loads in data from the specified game info
 /// </summary>
 /// <param name="info">The game info</param>
 /// <example>
 /// <code language="C#">
 /// GameInfo info = new GameInfo()
 /// {
 ///     GameID = 14129,
 ///     Rings = Rings.PowerRingL1 | Rings.DoubleEdgeRing | Rings.ProtectionRing
 /// };
 /// RingSecret secret = new RingSecret();
 /// secret.Load(info);
 /// </code>
 /// </example>
 public override void Load(GameInfo info)
 {
     GameID = info.GameID;
     Rings  = info.Rings;
 }
コード例 #34
0
        public static string GetItemType(string itemBase)
        {
            if (Bows.Contains(itemBase))
            {
                return("Bow");
            }
            if (Claws.Contains(itemBase))
            {
                return("Claw");
            }
            if (OneHandedAxes.Contains(itemBase))
            {
                return("One Hand Axe");
            }
            if (OneHandedMaces.Contains(itemBase))
            {
                return("One Hand Mace");
            }
            if (OneHandedSwords.Contains(itemBase))
            {
                return("One Hand Sword");
            }
            if (TwoHandedAxes.Contains(itemBase))
            {
                return("Two Hand Axe");
            }
            if (TwoHandedMaces.Contains(itemBase))
            {
                return("Two Hand Mace");
            }
            if (Sceptres.Contains(itemBase))
            {
                return("Sceptre");
            }
            if (Daggers.Contains(itemBase))
            {
                return("Dagger");
            }
            if (Staves.Contains(itemBase))
            {
                return("Staff");
            }
            if (Belts.Contains(itemBase))
            {
                return("Belt");
            }
            if (Amulets.Contains(itemBase))
            {
                return("Amulet");
            }
            if (Rings.Contains(itemBase))
            {
                return("Ring");
            }
            if (Boots.Contains(itemBase))
            {
                return("Boots");
            }
            if (Gloves.Contains(itemBase))
            {
                return("Gloves");
            }
            if (BodyArmors.Contains(itemBase))
            {
                return("Body Armour");
            }
            if (Wands.Contains(itemBase))
            {
                return("Wand");
            }
            if (Helmets.Contains(itemBase))
            {
                return("Helmet");
            }
            if (Shields.Contains(itemBase))
            {
                return("Shield");
            }
            if (Jewels.Contains(itemBase))
            {
                return("Jewel");
            }
            if (itemBase == "Gem")
            {
                return(itemBase);
            }
            if (Quivers.Contains(itemBase))
            {
                return("Quiver");
            }

            return("No type found");
        }