Inheritance: MonoBehaviour
Esempio n. 1
0
        /// <summary>
        /// Approves a job currently in the 'Reviewable' state
        /// </summary>
        /// <param name="jobId">The job ID</param>
        /// <param name="stars">Quality rating of translation work</param>
        /// <param name="commentForTranslator">
        /// Comments for translator (optional)
        /// </param>
        /// <param name="commentForGengo">
        /// Comments for Gengo (optional)
        /// </param>
        /// <param name="gengoCommentIsPublic">
        /// Wether Gengo may publish the comment on their public website
        /// </param>
        /// <returns>Task yielding no value</returns>
        public async Task Approve(int jobId, Stars stars,
                                  string commentForTranslator,
                                  string commentForGengo,
                                  bool gengoCommentIsPublic)
        {
            var uri = UriPartJob + jobId;

            var data = new JObject();

            data["action"] = "approve";
            data["rating"] = ((int)stars).ToString();

            if (!String.IsNullOrWhiteSpace(commentForTranslator))
            {
                data["for_translator"] = commentForTranslator;
            }

            if (!String.IsNullOrWhiteSpace(commentForGengo))
            {
                data["for_mygengo"] = commentForGengo;
                data["public"]      = Convert.ToInt32(gengoCommentIsPublic).ToString();
            }

            await _client.PutJsonAsync <JObject>(uri, data);
        }
    /// <summary>
    /// Initialisiert alles und startet das Spiel
    /// </summary>
    /// <param name="spielmodus">Beschreibt welcher Spielmodus gespielt werden soll</param>
    public void Start(Spielmodus spielmodus)
    {
        this.spielmodus = spielmodus;
        timer.Start();
        superman   = new Superman(gr, new Size(GAME_WIDTH, GAME_HEIGHT));
        stars      = new Stars(gr, new Size(GAME_WIDTH, GAME_HEIGHT));
        kryptonite = new Kryptonite(gr, new Size(GAME_WIDTH, GAME_HEIGHT));
        powerups   = new Powerups(gr, new Size(GAME_WIDTH, GAME_HEIGHT));

        if (this.spielmodus == Spielmodus.Normal)
        {
            // Normalmodus etwas schneller machen damit es nicht zu langweilig wird
            this.speed = 3;
        }
        else if (this.spielmodus == Spielmodus.Endlos)
        {
            this.speed = 3;
        }
        else if (this.spielmodus == Spielmodus.Hardcore)
        {
            this.speed = 6;
        }

        stars.SpawnStars(this.speed, spielmodus);
        kryptonite.SpawnKryptonite(this.speed, this.level, this.spielmodus);
        powerups.SpawnPowerup();

        Draw();
    }
Esempio n. 3
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Sky/Upper", true, out subEle);
            SkyUpper.WriteXML(subEle, master);

            ele.TryPathTo("Fog", true, out subEle);
            Fog.WriteXML(subEle, master);

            ele.TryPathTo("Unused1", true, out subEle);
            Unused1.WriteXML(subEle, master);

            ele.TryPathTo("Ambient", true, out subEle);
            Ambient.WriteXML(subEle, master);

            ele.TryPathTo("Sunlight", true, out subEle);
            Sunlight.WriteXML(subEle, master);

            ele.TryPathTo("Sun", true, out subEle);
            Sun.WriteXML(subEle, master);

            ele.TryPathTo("Stars", true, out subEle);
            Stars.WriteXML(subEle, master);

            ele.TryPathTo("Sky/Lower", true, out subEle);
            SkyLower.WriteXML(subEle, master);

            ele.TryPathTo("Horizon", true, out subEle);
            Horizon.WriteXML(subEle, master);

            ele.TryPathTo("Unused2", true, out subEle);
            Unused2.WriteXML(subEle, master);
        }
Esempio n. 4
0
 public void AddComment(string comment)
 {
     BtnLetsCook.Click();
     Stars.Submit();
     TxtComment.SendKeys(comment);
     BtnAddComment.Click();
 }
Esempio n. 5
0
 void StarsDetection()
 {     //Determines how many stars the players have
     if (resourceDecrease <= 9)
     {
         Stars          = 0;
         StarsText.text = "STARS: " + Stars.ToString();
     }
     else if (resourceDecrease >= 10 && resourceDecrease <= 50)
     {
         Stars          = 1;
         StarsText.text = "STARS: " + Stars.ToString();
     }
     else if (resourceDecrease >= 51 && resourceDecrease <= 100)
     {
         Stars          = 2;
         StarsText.text = "STARS: " + Stars.ToString();
     }
     else if (resourceDecrease >= 101 && resourceDecrease <= 150)
     {
         Stars          = 3;
         StarsText.text = "STARS: " + Stars.ToString();
     }
     else if (resourceDecrease >= 151 && resourceDecrease <= 200)
     {
         Stars          = 4;
         StarsText.text = "STARS: " + Stars.ToString();
     }
     else if (resourceDecrease >= 201 && resourceDecrease <= 300)
     {
         Stars          = 5;
         StarsText.text = "STARS: " + Stars.ToString();
     }
 }
Esempio n. 6
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
Esempio n. 7
0
        /// <summary>
        /// Updates the specified question.
        /// </summary>
        /// <param name="question">question.</param>
        public void Update(Question question)
        {
            Open_connection();
            command.CommandText = string.Format("update questions set question_text ='{0}' ,question_order ={1} where id={2}", question.Question_text, question.Question_order, question.ID);
            command.ExecuteNonQuery();//execute command
            switch (question.Question_type)
            {
            case "Slider":
                Slider slider = (Slider)question;
                command.CommandText = string.Format("update Slider set Start_Value ={0},End_Value ={1},Start_Value_Caption ='{2}',End_Value_Caption ='{3}',question_order ={4} where Question_Id={5}", slider.Start, slider.End, slider.Start_Caption, slider.End_Caption, question.Question_order, question.ID);
                command.ExecuteNonQuery();
                break;

            case "Smiley":
                Smiley smiley = (Smiley)question;
                command.CommandText = string.Format("update Smiley set Num_Faces ={0},question_order={1} where Question_Id={2}", smiley.Smiles, question.Question_order, question.ID);
                command.ExecuteNonQuery();
                break;

            case "Stars":
                Stars stars = (Stars)question;
                command.CommandText = string.Format("update Stars set Num_Stars ={0},question_order={1} where Question_Id={2}", stars.Star, question.Question_order, question.ID);
                command.ExecuteNonQuery();
                break;
            }
        }
Esempio n. 8
0
        private static void ImportStars()
        {
            var context = new MassDefectContext();
            var json    = File.ReadAllText(StarsPath);
            var stars   = JsonConvert.DeserializeObject <IEnumerable <StarDTO> >(json);

            foreach (var star in stars)
            {
                if (star.Name == null || star.SolarSystem == null)
                {
                    RaiseError();
                    continue;
                }

                var starEntity = new Stars
                {
                    Name        = star.Name,
                    SolarSystem = GetSolarSystemByName(star.SolarSystem, context)
                };

                if (starEntity.SolarSystem == null)
                {
                    RaiseError();
                    continue;
                }

                context.Stars.Add(starEntity);
                Console.WriteLine($"Successfully imported Star {starEntity.Name}.");
            }
            context.SaveChanges();
        }
 public ActionResult Edit(Star Update, int id)
 {
     if (Session["Username"] == null && Session["Password"] == null)
     {
         return(RedirectToAction("Index", "Admin", new { area = "" }));
     }
     else
     {
         if (ModelState.IsValid)
         {
             Stars UpdateStar = new Stars();
             UpdateStar.Name        = Update.Name;
             UpdateStar.Star_type   = Update.Star_type;
             UpdateStar.Achievement = Update.Achievement;
             HttpPostedFileBase imgFile = Request.Files["Picture"];
             if (imgFile.ContentLength > 0)
             {
                 string ext     = imgFile.FileName.Substring(imgFile.FileName.LastIndexOf("."));
                 string imgName = DateTime.Now.Ticks + ext;
                 string webpath = "~/Stars/" + imgName;
                 imgFile.SaveAs(Request.MapPath(webpath));
                 UpdateStar.Picture = imgName;
                 new Cateloge().UpdateStar_img(UpdateStar, id);
             }
             else
             {
                 new Cateloge().UpdateStar(UpdateStar, id);
             }
             TempData["Msg"] = "Shining Star Have Updated Successfully";
             return(RedirectToAction("Index"));
         }
         return(View(Update));
     }
 }
Esempio n. 10
0
        private void makeStar(object sender, System.Timers.ElapsedEventArgs args)
        {
            Stars newStar = new Stars(new Point(rng.Next(playingField.Width - SIDE_BUFFER) + SIDE_BUFFER, 0),
                                      (byte)(rng.Next(55) + 151), (byte)(rng.Next(3) + 1));

            stars.Add(newStar);
        }
Esempio n. 11
0
        private static void ImportStars()
        {
            var context = new MassDefectContext();
            var json    = File.ReadAllText(StarsPath);
            var stars   = JsonConvert.DeserializeObject <IEnumerable <StarDTO> >(json);

            foreach (var star in stars)
            {
                if (star.Name == null)
                {
                    throw new ArgumentException("Error: Invalid data.");
                    continue;
                }

                var starEntity = new Stars()
                {
                    Name = star.Name,
                    //SolarSystem = context.Stars.Select(sls => sls.SolarSystem.Name)
                };

                //if (starEntity.SolarSystem == null)
                //{
                //    throw new ArgumentException("Error: Invalid data.");
                //    continue;
                //}

                context.Stars.Add(starEntity);
                System.Console.WriteLine($"Successfully imported {starEntity}.");
            }
        }
        public ActionResult Create(Star Add)
        {
            if (Session["Username"] == null && Session["Password"] == null)
            {
                return(RedirectToAction("Index", "Admin", new { area = "" }));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    Stars AddStar = new Stars();
                    AddStar.Name        = Add.Name;
                    AddStar.Star_type   = Add.Star_type;
                    AddStar.Achievement = Add.Achievement;
                    HttpPostedFileBase imgFile = Request.Files["Picture"];
                    if (imgFile.ContentLength > 0)
                    {
                        string ext     = imgFile.FileName.Substring(imgFile.FileName.LastIndexOf("."));
                        string imgName = DateTime.Now.Ticks + ext;
                        string webpath = "~/Stars/" + imgName;
                        imgFile.SaveAs(Request.MapPath(webpath));
                        AddStar.Picture = imgName;
                    }
                    AddStar.Date  = DateTime.Today.ToString("dd-MM-yyyy");
                    AddStar.Month = DateTime.Today.ToString("MMM");
                    AddStar.Year  = DateTime.Today.ToString("yyyy");
                    AddStar.Time  = DateTime.Now.ToString("HH:mm:ss");
                    new Cateloge().AddStar(AddStar);
                    TempData["Msg"] = "New Shining Star Have Added Successfully";
                    return(RedirectToAction("Index"));
                }

                return(RedirectToAction("Index"));
            }
        }
Esempio n. 13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ds"></param>
        /// <returns></returns>
        public ModelDashboard ToModel()
        {
            var md = new ModelDashboard()
            {
                OrgId    = OrgId,
                Id       = Id,
                Title    = Title,
                Uid      = Uid,
                HasAcl   = HasAcl,
                Data     = Data,
                FolderId = FolderId,
                Tags     = Tags
                           .Select(x => x.Term)
                           .ToList(),
                Stars = Stars
                        .Select(x => x.UserId)
                        .ToList()
            };

            md.Bag.FolderUid   = Folder?.Uid;
            md.Bag.FolderTitle = Folder?.Title;
            md.Bag.FolderUrl   = Folder?.ToModel().Url;

            return(md);
        }
Esempio n. 14
0
        private async void SaveButton_Clicked(object sender, EventArgs e)
        {
            if (TypeItem == CollectionPage.TypeItemsOfColl.Constellation)
            {
                Constellations.Add(newConstellation);
                newConstellation.Name = nameEntry.Text;
            }
            else if (TypeItem == CollectionPage.TypeItemsOfColl.Star)
            {
                Stars.Add(newStar);
                newStar.Name       = nameEntry.Text;
                newStar.Weight     = Convert.ToDouble(weightEntry.Text);
                newStar.Radius     = Convert.ToDouble(radiusEntry.Text);
                newStar.Luminosity = Convert.ToDouble(luminosityEntry.Text);
                newStar.type       = (Star.typeOfStar)typePicker.SelectedIndex;
                if (searchParentListView.SelectedItem != null)
                {
                    newStar.Constellation = (Constellation)searchParentListView.SelectedItem;
                }
            }
            else if (TypeItem == CollectionPage.TypeItemsOfColl.Planet)
            {
                Planets.Add(newPlanet);
                newPlanet.Name   = nameEntry.Text;
                newPlanet.Weight = Convert.ToDouble(weightEntry.Text);
                newPlanet.Radius = Convert.ToDouble(radiusEntry.Text);
                if (searchParentListView.SelectedItem != null)
                {
                    newPlanet.Star = (Star)searchParentListView.SelectedItem;
                }
            }

            await Navigation.PopAsync();
        }
Esempio n. 15
0
        /// <summary>
        /// Returns true if ClanWarAttack instances are equal
        /// </summary>
        /// <param name="input">Instance of ClanWarAttack to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ClanWarAttack?input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Order == input.Order ||
                     Order.Equals(input.Order)
                     ) &&
                 (
                     AttackerTag == input.AttackerTag ||
                     (AttackerTag != null &&
                      AttackerTag.Equals(input.AttackerTag))
                 ) &&
                 (
                     DefenderTag == input.DefenderTag ||
                     (DefenderTag != null &&
                      DefenderTag.Equals(input.DefenderTag))
                 ) &&
                 (
                     Stars == input.Stars ||
                     Stars.Equals(input.Stars)
                 ) &&
                 (
                     DestructionPercentage == input.DestructionPercentage ||
                     DestructionPercentage.Equals(input.DestructionPercentage)
                 ));
        }
Esempio n. 16
0
    // Use this for initialization
    void Start()
    {
        ship         = GetComponentInChildren <StarshipController>();
        gui          = GetComponent <GUIController>();
        frontMessage = GetComponentInChildren <FrontMessage>();
        mainTimer    = GetComponentInChildren <MainTimer>();
        bar          = GetComponentInChildren <Bar>();
        speedCounter = GetComponentInChildren <SpeedCounter>();
        oobAudio     = GetComponentInChildren <OutOfBoundsAudio>();
        fuelAlarm    = GetComponentInChildren <FuelAlarm>();
        lowFuelText  = GetComponentInChildren <LowFuelText>();

        timeLeft     = 10f;     //!!!!
        currentSpeed = minimumSpeed;
        fuel         = 100f;

        theLevel = GetComponent <TheLevel>();


        foreach (Transform child in transform)
        {
            if (child.name == "StarsNear")
            {
                starsNear = child.GetComponent <Stars>();
            }
            else if (child.name == "StarsMedium")
            {
                starsMedium = child.GetComponent <Stars>();
            }
            else if (child.name == "StarsFar")
            {
                starsFar = child.GetComponent <Stars>();
            }
        }
    }
Esempio n. 17
0
        public static Qustions AddNewStar(Qustions Qustion)
        {
            Stars StarQuestion = (Stars)Qustion;
            int   Id           = AddQustionInDataBase(Qustion);

            if (Id != -1)
            {
                try
                {
                    using (SqlConnection Connection = new SqlConnection(DataBaseConnections.connectionString))
                    {
                        SqlCommand CommandForInsertStar = new SqlCommand(InsertInStar, Connection);
                        CommandForInsertStar.Parameters.AddWithValue(NewNumberOfStars, StarQuestion.NumberOfStars);
                        CommandForInsertStar.Parameters.AddWithValue(QustionIdDataBase, Id);
                        CommandForInsertStar.Connection.Open();
                        CommandForInsertStar.ExecuteNonQuery();
                        CommandForInsertStar.Parameters.Clear();
                        StarQuestion.Id = Id;
                        //StaticObjects.ListOfAllQuestion.Add(StarQuestion);
                        StaticObjects.SuccOfFail = 1;
                        return(StarQuestion);
                    }
                }
                catch (Exception ex)
                {
                    StaticObjects.Erros.Log(ex);
                    StaticObjects.SuccOfFail = 0;
                    return(StarQuestion);
                }
            }
            return(StarQuestion);
        }
Esempio n. 18
0
        public List <string> GenerateView()
        {
            int MinX = Stars.Min(s => s.Position.x);
            int MaxX = Stars.Max(s => s.Position.x);
            int MinY = Stars.Min(s => s.Position.y);
            int MaxY = Stars.Max(s => s.Position.y);

            List <string> rows = new List <string>();

            // it is enough to draw only that part of the sky where there are currently stars
            for (int y = MinY; y < MaxY + 1; y++)
            {
                string row = "";
                for (int x = MinX; x < MaxX + 1; x++)
                {
                    // if any star has the current position, it's expressed by 'X'
                    if (Stars.Any(pos => pos.Position.x == x && pos.Position.y == y))
                    {
                        row += "X";
                    }
                    else
                    {
                        row += " ";
                    }
                }
                rows.Add(row);
            }

            return(rows);
        }
Esempio n. 19
0
        /// <summary>
        ///     使用一定的格式构造一个字符串
        /// </summary>
        /// <param name="format"></param>
        /// <param name="formatProvider"></param>
        /// <returns></returns>
        public string ToString(string format, IFormatProvider formatProvider)
        {
            var b = new StringBuilder(format);

            b.Replace("Artist", Artist);
            b.Replace("artist", Artist);
            b.Replace("bpm", Bpm.ToString(CultureInfo.CurrentCulture));
            b.Replace("stars", Stars.ToString(CultureInfo.CurrentCulture));
            b.Replace("mode", Mode.ToString());
            b.Replace("cs", CircleSize.ToString(CultureInfo.CurrentCulture));
            b.Replace("ar", ApproachRate.ToString(CultureInfo.CurrentCulture));
            b.Replace("hp", HpDrain.ToString(CultureInfo.CurrentCulture));
            b.Replace("od", OverallDifficulty.ToString(CultureInfo.CurrentCulture));
            b.Replace("circles", HitCircle.ToString());
            b.Replace("sliders", Slider.ToString());
            b.Replace("spiners", Spinner.ToString());
            b.Replace("creator", Creator);
            b.Replace("Title", Title);
            b.Replace("title", Title);
            b.Replace("Tags", Tags);
            b.Replace("tags", Tags);
            b.Replace("setid", BeatmapSetId.ToString());
            b.Replace("maxcombo", MaxCombo.ToString());
            b.Replace("approved", Approved.ToString());
            var total = TimeSpan.FromSeconds(TotalTime);
            var hit   = TimeSpan.FromSeconds(DrainTime);

            b.Replace("length", $"{total.TotalMinutes}:{total.Seconds}");
            b.Replace("hitlength", $"{hit.TotalMinutes}:{hit.Seconds}");
            b.Replace("version", Version);
            b.Replace("md5", Md5);
            b.Replace("id", BeatmapId.ToString());
            return(b.ToString());
        }
        public LevelSelectData(int score, int lost, TimeSpan time, bool p_3, bool unlocked, LevelCompletionData data)
        {
            if(score >= data.ThreeStarScore)
                ScoreStarNumber = Stars.Three;
            //else if(score >= data.TwoStarScore)
            //    ScoreStarNumber = Stars.Two;
            //else if(score >= data.OneStarScore)
            //    ScoreStarNumber = Stars.One;
            else
                ScoreStarNumber = Stars.Zero;

            if(time <= data.ThreeStarTime)
                TimeStarNumber = Stars.Three;
            //else if(time <= data.TwoStarTime)
            //    TimeStarNumber = Stars.Two;
            //else if(time <= data.OneStarTime)
            //    TimeStarNumber = Stars.One;
            else
                TimeStarNumber = Stars.Zero;

            if(lost <= data.ThreeStarBoxes)
                BoxStarNumber = Stars.Three;
            //else if(lost <= data.TwoStarBoxes)
            //    BoxStarNumber = Stars.Two;
            //else if(lost <= data.OneStarBoxes)
            //    BoxStarNumber = Stars.One;
            else
                BoxStarNumber = Stars.Zero;

            Score = score;
            BoxesLost = lost;
            Time = time;
            Unlocked = unlocked;
            Completed = p_3;
        }
Esempio n. 21
0
 private void Start()
 {
     // carParts = GetComponentInChildren<CarParts>();
     stars = GetComponentInChildren <Stars>();
     stars.gameObject.SetActive(false);
     wheels = GetComponent <WheelRotate>();
 }
 private void SetStarsInternal(Stars stars)
 {
     SetAllStars(false);
     if (stars == Stars.Zero)
     {
         SetAllStars(false);
     }
     if (stars == Stars.One)
     {
         pictureBox1.Image = Resources.Stars_Yellow;
     }
     if (stars == Stars.Two)
     {
         pictureBox1.Image = Resources.Stars_Yellow;
         pictureBox2.Image = Resources.Stars_Yellow;
     }
     if (stars == Stars.Three)
     {
         pictureBox1.Image = Resources.Stars_Yellow;
         pictureBox2.Image = Resources.Stars_Yellow;
         pictureBox3.Image = Resources.Stars_Yellow;
     }
     if (stars == Stars.Four)
     {
         pictureBox1.Image = Resources.Stars_Yellow;
         pictureBox2.Image = Resources.Stars_Yellow;
         pictureBox3.Image = Resources.Stars_Yellow;
         pictureBox4.Image = Resources.Stars_Yellow;
     }
     if (stars == Stars.Five)
     {
         SetAllStars(true);
     }
 }
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "sessionid": // Int
                return(SessionId.ToString(strFormat, formatProvider));

            case "userid": // Int
                return(UserId.ToString(strFormat, formatProvider));

            case "stars": // Int
                return(Stars.ToString(strFormat, formatProvider));

            case "review": // NVarCharMax
                if (Review == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Review, strFormat));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
Esempio n. 24
0
        protected void Explode(Mobile m, Point3D p)
        {
            if (m == null || m.Deleted)
            {
                return;
            }

            if (ExplodeID > 0)
            {
                var fx = new EffectInfo(p, Map, ExplodeID, ExplodeHue, ExplodeSpeed, ExplodeDuration, ExplodeRender);

                fx.Send();
            }

            if (ExplodeSound >= 0)
            {
                Effects.PlaySound(p, Map, ExplodeSound);
            }

            ExplodeStars(
                m,
                StarsEffect,
                p,
                Utility.RandomMinMax(StarsRangeMin, StarsRangeMax),
                StarsSound,
                Stars.ToArray(),
                StarsHue > 0 ? new[] { StarsHue } : StarHues.ToArray());
        }
        private void DrawStars(Stars stars, KeyboardCustom keyboard)
        {
            var t = (DateTimeOffset.UtcNow - Game.FsdJumpChange).TotalSeconds;

            stars.Clean();

            foreach (var star in stars)
            {
                var r = Math.Pow((DateTimeOffset.UtcNow - star.Birth).TotalMilliseconds / star.Lifespan.TotalMilliseconds, 2);

                var x = (int)Math.Round(_x0 + (star.VX * r * _xScale));
                var y = (int)Math.Round(_y0 + (star.Y * _yScale));

                if (x < 0 || x >= KeyboardConstants.MaxColumns)
                {
                    continue;
                }

                if (y < 0 || y >= KeyboardConstants.MaxRows)
                {
                    continue;
                }

                var c = keyboard[y, x].Combine(star.Color.Transform(r * 1, 1.5));

                if (Game.FsdJumpType == FsdJumpType.Hyperspace && t >= 4 && t <= 5)
                {
                    c = c.Combine(Color.White, t - 4);
                }

                keyboard[y, x] = c;
            }
        }
Esempio n. 26
0
 public Comment(int CustomerID, string CommentDescription, Stars Star)
 {
     this.CustomerID         = CustomerID;
     this.CommentDescription = CommentDescription;
     this.Star      = (int)Star;
     this.createdAt = DateTime.Now;
 }
Esempio n. 27
0
        private async void Initial()
        {
            string jsonStars = await netHelper.RequestStr(starsUrl, null);

            string jsonVideos = await netHelper.RequestStr(videoUrl, null);

            Stars     stars = netHelper.GetView <Stars>(jsonStars);
            HotVideos video = netHelper.GetView <HotVideos>(jsonVideos);

            if (stars.rescode != 0)
            {
                return;
            }
            if (video.rescode != 0)
            {
                return;
            }
            starsList = stars.hotStars;
            starsList.Add(new hotStars()
            {
                thumb = "/Assets/Icons/more.png",
                name  = "更多",
                sid   = 0
            });
            videoList           = video.videos;
            lvStars.ItemsSource = starsList;
            lvVideo.ItemsSource = videoList;
        }
Esempio n. 28
0
        private void LoadStars(LevelSelector screen, Stars stars)
        {
            switch (stars)
            {
            case Stars.NONE:
                this.starsTexture = screen.Content.Load <Texture2D>("LevelSelectionIcons_SD\\NoMedal_SD");
                break;

            case Stars.BRONZE:
                this.starsTexture = screen.Content.Load <Texture2D>("LevelSelectionIcons_SD\\Bronze_SD");
                break;

            case Stars.SILVER:
                this.starsTexture = screen.Content.Load <Texture2D>("LevelSelectionIcons_SD\\Silver_SD");
                break;

            case Stars.GOLD:
                this.starsTexture = screen.Content.Load <Texture2D>("LevelSelectionIcons_SD\\Gold_SD");
                break;

            case Stars.LOCKED:
                this.LockedTexture = screen.Content.Load <Texture2D>("LevelSelectionIcons_SD\\LockedLevel_SD");
                this.starsTexture  = screen.Content.Load <Texture2D>("LevelSelectionIcons_SD\\NoMedal_SD");
                break;
            }
        }
Esempio n. 29
0
        public Constellation WithLines(int Index, List <int> HRNums)
        {
            for (int i = 0; i < HRNums.Count - 1; i++)
            {
                Star s1 = physics.StarDictionary[HRNums[i]];
                Star s2 = physics.StarDictionary[HRNums[i + 1]];

                if (!Stars.Contains(s1))
                {
                    Stars.Add(s1);
                }
                if (!Stars.Contains(s2))
                {
                    Stars.Add(s2);
                }

                switch (Index)
                {
                case 0:
                    normalShape.AddLine(new Line(s1.Position, s2.Position));
                    break;

                case 1:
                    altShape.AddLine(new Line(s1.Position, s2.Position));
                    break;
                }
                StarPairs.Add(new Tuple <Star, Star>(s1, s2));
            }
            return(this);
        }
Esempio n. 30
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ItemId != 0L)
            {
                hash ^= ItemId.GetHashCode();
            }
            if (ImageId.Length != 0)
            {
                hash ^= ImageId.GetHashCode();
            }
            if (Stars != 0)
            {
                hash ^= Stars.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (Role != 0)
            {
                hash ^= Role.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        private List <Stars> fetchStars(SqlCommand cmd)
        {
            SqlConnection con   = cmd.Connection;
            List <Stars>  stars = null;

            con.Open();
            using (con)
            {
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    stars = new List <Stars>();
                    while (dr.Read())
                    {
                        Stars s = new Stars();
                        s.db_Id       = Convert.ToString(dr["id"]);
                        s.Name        = Convert.ToString(dr["name"]);
                        s.Star_type   = Convert.ToString(dr["star_type"]);
                        s.Achievement = Convert.ToString(dr["achvmnt"]);
                        s.Picture     = Convert.ToString(dr["picture"]);
                        s.Publish     = Convert.ToString(dr["publish"]);
                        stars.Add(s);
                    }
                    stars.TrimExcess();
                }
            }
            return(stars);
        }
Esempio n. 32
0
        internal Feedback(JObject obj)
        {
            if (obj == null)
                throw new ArgumentNullException("obj");

            CommentForTranslator = obj.Value<string>("for_translator");
            Rating = (Stars)(int)obj.DecValueStrict("rating");
        }
Esempio n. 33
0
        /// <summary>
        /// Constructs a new menu entry with the specified text.
        /// </summary>
        public LevelEntry(string levelName, string lvlIconToLoad, Stars stars, LevelSelector screen)
        {
            this.starsDisplayed = stars;
            this.levelName = levelName;
            this.levelIcon = screen.Content.Load<Texture2D>(lvlIconToLoad);
            LoadStars(screen, stars);

            screen.LevelEntries.Add(this);
        }
 public LevelSelectData(LevelSelectData copy)
 {
     Time = copy.Time;
     Score = copy.Score;
     BoxStarNumber = copy.BoxStarNumber;
     BoxesLost = copy.BoxesLost;
     ScoreStarNumber = copy.ScoreStarNumber;
     Completed = copy.Completed;
     Unlocked = copy.Unlocked;
     TimeStarNumber = copy.TimeStarNumber;
 }
 public LevelSelectData()
 {
     TimeStarNumber = Stars.Zero;
     ScoreStarNumber = Stars.Zero;
     BoxStarNumber = Stars.Zero;
     Score = 0;
     BoxesLost = 0;
     Time = TimeSpan.Zero;
     Completed = false;
     Unlocked = false;
 }
Esempio n. 36
0
        /// <summary>
        /// Approves a job currently in the 'Reviewable' state
        /// </summary>
        /// <param name="jobId">The job ID</param>
        /// <param name="stars">Quality rating of translation work</param>
        /// <param name="commentForTranslator">
        /// Comments for translator (optional)
        /// </param>
        /// <param name="commentForGengo">
        /// Comments for Gengo (optional)
        /// </param>
        /// <param name="gengoCommentIsPublic">
        /// Wether Gengo may publish the comment on their public website
        /// </param>
        /// <returns>Task yielding no value</returns>
        public async Task Approve(int jobId, Stars stars,
            string commentForTranslator,
            string commentForGengo,
            bool gengoCommentIsPublic)
        {
            var uri = UriPartJob + jobId;

            var data = new JObject();
            data["action"] = "approve";
            data["rating"] = ((int)stars).ToString();

            if (!String.IsNullOrWhiteSpace(commentForTranslator))
                data["for_translator"] = commentForTranslator;

            if (!String.IsNullOrWhiteSpace(commentForGengo))
            {
                data["for_mygengo"] = commentForGengo;
                data["public"] = Convert.ToInt32(gengoCommentIsPublic).ToString();
            }

            await _client.PutJsonAsync<JObject>(uri, data);
        }
    //Level Method (Did the user cleared the level?)
    void ShowScore()
    {
        if (waitSec < 3)
        {
            waitSec += Time.deltaTime;
        }
        else
        {
            if (!once)
            {
                disableHud = true;
                scoreScreen.SetActiveRecursively(true);
                scoreScreen.renderer.material.mainTexture = scoreLevels;
                if (plusMul >= menuScript.objectiveScore && plusMul < menuScript.objectiveScore + 75)
                {
                    if (!onceSound2)
                    {
                        soundScript.PlaySound(24, false, 1);
                        onceSound2 = true;
                    }
                }
                if (plusMul >= menuScript.objectiveScore + 75 && plusMul < menuScript.objectiveScore + 150)
                {
                    if (!onceSound2)
                    {
                        soundScript.PlaySound(25, false, 1);
                        onceSound2 = true;
                    }
                }
                if (plusMul >= menuScript.objectiveScore + 150)
                {
                    if (!onceSound2)
                    {
                        soundScript.PlaySound(26, false, 1);
                        onceSound2 = true;
                    }
                }
                if (plusMul >= menuScript.objectiveScore)
                {
                    destroyBlock++;
                    if (destroyBlock >= 5)
                    {
                        Destroy(block1.gameObject);
                    }

                    if (destroyBlock >= 10)
                    {
                        Destroy(block2.gameObject);
                    }

                    if (destroyBlock >= 15)
                    {
                        Destroy(block3.gameObject);
                        Destroy(survivorBlock.gameObject);
                    }

                    if (destroyBlock >= 20)
                    {
                        Destroy(block4.gameObject);
                    }

                    if (destroyBlock >= 25)
                    {
                        Destroy(block5.gameObject);
                    }

                    if (destroyBlock >= 30)
                    {
                        Destroy(block6.gameObject);
                    }

                    if (destroyBlock >= 35)
                    {
                        Destroy(block7.gameObject);
                    }

                    if (destroyBlock >= 40)
                    {
                        Destroy(block8.gameObject);
                    }

                    if (menuScript.level == 45)
                    {
                        NextLevel.renderer.enabled = false;
                        NextLevel.collider.enabled = false;
                    }
                    else
                    {
                        NextLevel.renderer.material.mainTexture = nextLevelNormal;
                        NextLevel.renderer.enabled = true;
                        NextLevel.collider.enabled = true;
                    }
                    if (menuScript.highScore < plusMul)
                    {
                        GameObject scoreHigh = (GameObject)GameObject.Instantiate(newHighScore);
                        scoreHigh.transform.position = highscorePos.transform.position;
                        listToDestroy.Add(scoreHigh);
                        highScoreList[menuScript.level] = plusMul;
                        SaveData();
                    }
                }
                else
                {
                    NextLevel.renderer.enabled = false;
                    NextLevel.collider.enabled = false;
                }
                if (plusMul >= menuScript.objectiveScore)
                {
                    GameObject star1 = (GameObject)GameObject.Instantiate(scoreObjects[0]);
                    star1.transform.position = positions[0].position;
                    listToDestroy.Add(star1);
                    starProv = stars[menuScript.level];
                    starScript = starProv.GetComponent<Stars>();
                    starScript.SetStar(1);
                }
                if (plusMul >= menuScript.objectiveScore + 75)
                {

                    GameObject star2 = (GameObject)GameObject.Instantiate(scoreObjects[1]);
                    star2.transform.position = positions[1].position;
                    listToDestroy.Add(star2);
                    starProv = stars[menuScript.level];
                    starScript = starProv.GetComponent<Stars>();
                    starScript.SetStar(2);
                }
                if (plusMul >= menuScript.objectiveScore + 150)
                {
                    GameObject star3 = (GameObject)GameObject.Instantiate(scoreObjects[2]);
                    star3.transform.position = positions[2].position;
                    listToDestroy.Add(star3);
                    starProv = stars[menuScript.level];
                    starScript = starProv.GetComponent<Stars>();
                    starScript.SetStar(3);
                }
                counting = 0;
                once = true;
            }
        }
    }
Esempio n. 38
0
 private void LoadStars(LevelSelector screen, Stars stars)
 {
     switch (stars)
     {
         case Stars.NONE:
             this.starsTexture = screen.Content.Load<Texture2D>("LevelSelectionIcons_SD\\NoMedal_SD");
             break;
         case Stars.BRONZE:
             this.starsTexture = screen.Content.Load<Texture2D>("LevelSelectionIcons_SD\\Bronze_SD");
             break;
         case Stars.SILVER:
             this.starsTexture = screen.Content.Load<Texture2D>("LevelSelectionIcons_SD\\Silver_SD");
             break;
         case Stars.GOLD:
             this.starsTexture = screen.Content.Load<Texture2D>("LevelSelectionIcons_SD\\Gold_SD");
             break;
         case Stars.LOCKED:
             this.LockedTexture = screen.Content.Load<Texture2D>("LevelSelectionIcons_SD\\LockedLevel_SD");
             this.starsTexture = screen.Content.Load<Texture2D>("LevelSelectionIcons_SD\\NoMedal_SD");
             break;
     }
 }
 private void SetStarsInternal(Stars stars)
 {
     SetAllStars(false);
     if (stars == Stars.Zero)
     {
         SetAllStars(false);
     }
     if (stars == Stars.One)
     {
         pictureBox1.Image = Resources.Stars_Yellow;
     }
     if (stars == Stars.Two)
     {
         pictureBox1.Image = Resources.Stars_Yellow;
         pictureBox2.Image = Resources.Stars_Yellow;
     }
     if (stars == Stars.Three)
     {
         pictureBox1.Image = Resources.Stars_Yellow;
         pictureBox2.Image = Resources.Stars_Yellow;
         pictureBox3.Image = Resources.Stars_Yellow;
     }
     if (stars == Stars.Four)
     {
         pictureBox1.Image = Resources.Stars_Yellow;
         pictureBox2.Image = Resources.Stars_Yellow;
         pictureBox3.Image = Resources.Stars_Yellow;
         pictureBox4.Image = Resources.Stars_Yellow;
     }
     if (stars == Stars.Five)
     {
         SetAllStars(true);
     }
 }
 private void pictureBox_Click(object sender, EventArgs e)
 {
     _stars = GetStarsInternal(sender);
 }
 public void SetStars(Stars? stars)
 {
     _stars = stars ?? Stars.Zero;
     SetStarsInternal(_stars);
 }