public static ConstellationType GetConstellationType(DateTime birthday)
        {
            float birthdayF = 0.00F;

            if (birthday.Month == 1 && birthday.Day < 20)
            {
                birthdayF = float.Parse(string.Format("13.{0}", birthday.Day));
            }
            else
            {
                birthdayF = float.Parse(string.Format("{0}.{1}", birthday.Month, birthday.Day));
            }
            float[] atomBound = { 1.20F, 2.20F, 3.21F, 4.21F, 5.21F, 6.22F, 7.23F, 8.23F, 9.23F, 10.23F, 11.21F, 12.22F, 13.20F };

            //string ret = "靠!外星人啊。";
            ConstellationType type = ConstellationType.Invalid;

            for (int i = 0; i < atomBound.Length - 1; i++)
            {
                if (atomBound[i] <= birthdayF && atomBound[i + 1] > birthdayF)
                {
                    type = (ConstellationType)i;
                    break;
                }
            }
            Debug.Assert(type != ConstellationType.Invalid);
            return(type);
        }
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override async void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            _baby = await BabyManager.Load();

            if (string.IsNullOrEmpty(_baby.Name))
            {
                this.pageTitle.Text = "请输入宝宝信息";
                return;
            }
            else
            {
                ConstellationType type          = GetConstellationType(_baby.Birthday);
                string            constellation = GetConstellationName(type);
                string            title         = string.Format("{0}的星座是{1}", _baby.NickName, constellation);
                this.pageTitle.Text = title;
                //BitmapImage image = new BitmapImage(new Uri(@"ms-appx:/Assets/Constellation/巨蟹座.jpg"));
                string      imagePath = string.Format(@"ms-appx:/Assets/Constellation/{0}.jpg", constellation);
                BitmapImage image     = new BitmapImage(new Uri(imagePath));
                this.image.Source = image;

                string            jsonPath = constellation + ".json";
                ConstellationInfo info     = await FileHelper.LoadData <ConstellationInfo>(jsonPath, "Assets\\Constellation", true);

                this.description.Text = info.Description;
            }
        }
Exemple #3
0
 // 星座の解放。
 public void Enable(ConstellationType targetConstelltionType)
 {
     // 星座を探し使用可能にする
     foreach (GameObject constellation in constellations)
     {
         ConstellationInfo info = constellation.GetComponent <ConstellationInfo>();
         if (info.Name == targetConstelltionType)
         {
             info.Enable();
         }
     }
 }
Exemple #4
0
 public void UpdateConstellationList(bool toggle, ConstellationType constellationName)
 {
     // toggle for a given constellation is off
     if (!toggle)
     {
         data.constellationNames.Remove(constellationName);
     }
     // toggle is on and the name is not present in the data list of constellation names
     else if (toggle & !data.constellationNames.Contains(constellationName))
     {
         data.constellationNames.Add(constellationName);
     }
 }
Exemple #5
0
        private static string GetAlmanacPath(ConstellationType constellationType, ConfigFile config)
        {
            switch (constellationType)
            {
            default:
                return(config.GpsAlmanacFile);

            case ConstellationType.Glonass:
                return(config.GlonassAlmanacFile);

            case ConstellationType.BeiDou:
                return(config.BeiDouAlmanacFile);

            case ConstellationType.Galileo:
                return(config.GalileoAlmanacFile);
            }
        }
Exemple #6
0
        public SatelliteDefinition(SatelliteBase satellite, SimulationParams simulationParameters, SatelliteGroup group)
        {
            id                        = satellite.Id;
            index                     = id - 1;
            constellationType         = satellite.ConstellationType;
            this.simulationParameters = simulationParameters;
            this.group                = group;
            IEnumerable <SignalType> source = from s in simulationParameters.Signals
                                              where s.ConstellationType == constellationType
                                              select s.SignalType;

            firstSignalType = source.FirstOrDefault((SignalType st) => simulationParameters.SignalLevels.ContainsKey(st));
            if (simulationParameters.SignalLevelMode == SignalLevelMode.Manual && firstSignalType != SignalType.None)
            {
                Level = simulationParameters.SignalLevels[firstSignalType][index];
            }
        }
        public string GetConstellationName(ConstellationType type)
	    {
            string[] atoms = { "水瓶座", "双鱼座", "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座", "魔羯座" };
            return atoms[(int)type];
	    } 
Exemple #8
0
 public void Enable(ConstellationType targetConstelltionType)
 {
     constellationManager.Enable(targetConstelltionType);
 }
 public string GetConstellationName(ConstellationType type)
 {
     string[] atoms = { "水瓶座", "双鱼座", "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座", "魔羯座" };
     return(atoms[(int)type]);
 }