public async Task <ExecutionStatus> Run(Judge entity, ByWhatId byWhatId)
        {
            using var connection = new SqliteConnection(_geekLemonContext.ConnectionString);

            //Nie ma SQL INjection
            var q2 = @"UPDATE Judges 
                SET Login = @Login, Password = @Password, BirthDate=@BirthDate  
                ,Name_First = @Name_First, Name_Last = @Name_Last
                WHERE Id = @Id; ";
            var q  = @"UPDATE Judges 
                SET Login = @Login, Password = @Password, BirthDate=@BirthDate  
                ,Name_First = @Name_First, Name_Last = @Name_Last
                WHERE UniqueId = @UniqueId; ";

            var temp = _mapper.Map <JudgeTemp>(entity);

            try
            {
                if (byWhatId == ByWhatId.CreatedId)
                {
                    q = q2;
                }

                var result = await connection.ExecuteAsync(q, temp);

                return(ExecutionStatus.DbOk());
            }
            catch (Exception ex)
            {
                return(ExecutionStatus.DbError(ex.Message));
            }
        }
Beispiel #2
0
        public IHttpActionResult PutJudge(int id, Judge judge)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != judge.ID)
            {
                return(BadRequest());
            }

            db.Entry(judge).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!JudgeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #3
0
        protected Winner_Loser Judgement_Base(Judge Enemy)
        {
            /*
             * じゃんけんの結果を判定。
             * 結果は自身の状態によって決まる。あいこは存在しない。
             */
            Winner_Loser win_lose;

            if (Enemy.pass_ID == Win)
            {
                win_lose = new Win();
            }
            else if (Enemy.pass_ID == Lose)
            {
                win_lose = new Lose();
            }
            else
            {
                win_lose = draw(this.My_Judge.total_force, Enemy.total_force);
            }
            if (Enemy.state_id == Define.Injury_ID)
            {
                win_lose = new Win();
            }
            My_Judge.Last_Result = win_lose.Result;
            return(win_lose);
        }
Beispiel #4
0
        public void next_game()                 //次ターンの更新。効果中の強化や必殺技等もこの関数で処理。
        {
            scheme_use  = scheme_use.Where(x => x.Finish == false).ToList();
            enhance_use = enhance_use.Where(x => x.Finish == false).ToList();
            wait_sel    = Sel_Next;
            sel_refresh();
            int i = 0;

            for (i = 0; i < 5; i++)
            {
                hand[i] = hand[i].recreate();
                if (hand[i].injury == Define.Injury_Param && hand[i].state_id != Define.Injury_ID)
                {
                    hand[i].Stack(new Hand_Injury(hand[i]));
                }
            }

            for (i = 0; i < scheme_use.Count; i++)
            {
                scheme_use[i].update_scheme();
            }
            for (i = 0; i < enhance_use.Count; i++)
            {
                enhance_use[i].update_scheme();
            }
            Play_Handler.select().next_game();
            determ = null;
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //clear session variables and set state to WI
            if (!Page.IsPostBack)
            {
                checkPermissions();
                loadDistrictDropdown();
                loadYearDropdown();

                Session[contactSearch] = null;
                Session[contactVar]    = null;
                Session[judgeVar]      = null;
            }

            //if a contact object has been instantiated, reload
            if (Page.IsPostBack && Session[contactVar] != null)
            {
                contact = (Contact)Session[contactVar];
            }
            //if a judge object has been instantiated, reload
            if (Page.IsPostBack && Session[judgeVar] != null)
            {
                judge = (Judge)Session[judgeVar];
            }
        }
Beispiel #6
0
        public void Exec(TalkGeneratorArgs args)
        {
            isSuccess = false;
            talkList  = new Dictionary <string, double>();

            // 騙り判定を取得できなければ実行失敗にする
            if (!args.Items.ContainsKey("FakeSeerJudge"))
            {
                return;
            }

            // 騙り判定の取得
            List <Judge> judgeList = (List <Judge>)args.Items["FakeSeerJudge"];

            // 全て報告済みなら実行失敗にする
            if (judgeList.Count <= reportCount)
            {
                return;
            }

            Judge reportJudge = judgeList[reportCount];

            DivinedResultContentBuilder builder = new DivinedResultContentBuilder(reportJudge.Target, reportJudge.Result);

            talkList.Add(new Content(builder).Text, 999.0);

            // 報告件数のカウント(必ずこの発話を返す前提)
            reportCount++;

            isSuccess = true;
        }
Beispiel #7
0
 public Score(int ID, Dive d, Judge j, double points)
 {
     this.Id = ID;
     this.dive = d;
     this.judge = j;
     this.Points = points;
 }
Beispiel #8
0
        /// <summary>
        /// キャラクターを更新する
        /// </summary>
        /// <param name="difference"> タイミングとの誤差 </param>
        public override void Update(int difference)
        {
            Judge judge =
                Abs(difference) <= 42 ? Judge.JustShoot :
                Abs(difference) <= 92 ? Judge.Shoot :
                Abs(difference) <= 142 ? Judge.Hit : Judge.Miss;

            Skills[1].Update(judge);
            Skills[2].Update(judge);

            switch (judge)
            {
            case Judge.JustShoot: Player.Update(judge, IncreseRate * 4 * ClearPointAmplitude); break;

            case Judge.Shoot: Player.Update(judge, IncreseRate * 3 * ClearPointAmplitude); break;

            case Judge.Hit: Player.Update(judge, IncreseRate * 2 * ClearPointAmplitude); break;

            case Judge.Miss: Player.Update(judge, -10_0000); break;
            }

            AddEffet(judge);

            SetGaugeValue(Player.ClearPoint / 1_0000);
        }
Beispiel #9
0
 public JudgeRoomAssignment(Judge judge, string room, List <Tuple <int, string> > times, int scheduleOrder)
 {
     this.judge         = judge;
     this.room          = room;
     this.times         = times;
     this.scheduleOrder = scheduleOrder;
 }
        public ExecutionStatus TryPreliminaryAccept(Judge decisionBy)
        {
            if (Status == CallForSpeechStatus.PreliminaryAcceptedByJudge)
            {
                return(ExecutionStatus.
                       LogicError("You already PreliminaryAcceptedByJudge this CallForSpeech"));
            }

            if (Status != CallForSpeechStatus.EvaluatedByMachine)
            {
                return(ExecutionStatus.LogicError("Cannot accept application that WASNT'T in EvaluatedByMachine"));
            }

            if (ScoreResult == null)
            {
                return(ExecutionStatus.LogicError("Cannot accept application before scoring"));
            }

            if (!decisionBy.CanAccept(this.Category.Id))
            {
                return(ExecutionStatus.
                       LogicError("Judge is from diffrent category. Can't Accept"));
            }

            Status = CallForSpeechStatus.PreliminaryAcceptedByJudge;
            PreliminaryDecision = new Decision(AppTime.Now(), decisionBy);
            return(ExecutionStatus.LogicOk());
        }
Beispiel #11
0
        private void LockUpdate(bool inLoop = false)
        {
            if (this.online && this.frame + 1 == WAITTING_INTERVAL && this.playDataList.Count == 0)
            {
                return;
            }

            if (this.online)
            {
                this.frame++;

                if (this.frame == WAITTING_INTERVAL)
                {
                    var data = this.playDataList[0];
                    this.playDataList.RemoveAt(0);

                    if (Judge.IsRunning && data.addrs != null)
                    {
                        for (int i = 0; i < data.addrs.Length; i++)
                        {
                            Judge.Input(data.addrs[i], data.inputs[i]);
                        }
                    }

                    this.playFrame++;
                    this.frame = 0;

                    if (!inLoop || (inLoop && this.sendInLoop))
                    {
                        var input = new Datas.Input()
                        {
                            data = new InputData()
                            {
                                movingValue = Networkmgr.MovingValue,
                                willElaste  = Networkmgr.WillElaste
                            },
                            frame = this.playFrame
                        };

                        this.sendInLoop       = false;
                        Networkmgr.WillElaste = false;
                        this.client.Send(EventCode.Input, input);
                    }

                    if (this.playFrame > LEAST_COMPARE_FRAME)
                    {
                        var comparison = new Datas.Comparison()
                        {
                            playFrame = this.playFrame,
                            content   = Judge.Comparison
                        };

                        this.client.Send(EventCode.Comparison, comparison);
                    }
                }
            }

            Networkmgr.UpdateEvent();
            Networkmgr.LateUpdateEvent();
        }
        public void Accept(Judge decisionBy)
        {
            if (Status == CallForSpeechStatus.AcceptedByJudge)
            {
                throw new ApplicationException("You already Accepted this CallForSpeech");
            }

            if (Status == CallForSpeechStatus.Rejected)
            {
                throw new ApplicationException("Cannot accept application that is already rejected");
            }

            if (Status != CallForSpeechStatus.PreliminaryAcceptedByJudge)
            {
                throw new ApplicationException("Cannot accept application that wasn't PreliminaryAccepted FIRST");
            }

            if (ScoreResult == null)
            {
                throw new ApplicationException("Cannot accept application before scoring");
            }

            if (!decisionBy.CanAccept(this.Category.Id))
            {
                throw new ApplicationException("Judge is from diffrent category. Can't Accept");
            }

            Status        = CallForSpeechStatus.AcceptedByJudge;
            FinalDecision = new Decision(AppTime.Now(), decisionBy);
        }
        public ActionResult Edit(CourtHearing courthearing, string JudgeName)
        {
            if (string.IsNullOrWhiteSpace(JudgeName) == true)
            {
                ModelState.Clear();
                ModelState.AddModelError("JudgeId", "Judge Name is Required");
            }

            if (courthearing.JudgeTypeId == null)
            {
                ModelState.AddModelError("JudgeTypeId", "Judge Type is Required");
            }
            else if (courthearing.CourtId > 0 && string.IsNullOrWhiteSpace(JudgeName) == false && courthearing.JudgeId == 0)
            {
                Judge judge = new Judge();
                judge.CourtId = courthearing.CourtId;
                judge.Name    = JudgeName;
                db.Judges.Add(judge);
                db.SaveChanges();

                courthearing.JudgeId = judge.JudgeId;
            }

            if (ModelState.IsValid)
            {
                db.Entry(courthearing).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            PopulateDropDowns(courthearing);
            return(View(courthearing));
        }
Beispiel #14
0
        public BaseResponse AddJudge(AddJudgeRequest request)
        {
            return(ServiceProcessor.ProcessRequest(request,
                                                   //inbound.do validate or do something here
                                                   () =>
            {
            },

                                                   req =>
            {
                var response = new BaseResponse();
                using (var repo = new NhGlobalRepository())
                {
                    var entity = repo.Query <Judge>(x => x.Name == req.Name && x.PhoneNo == req.PhoneNo).FirstOrDefault();
                    if (entity != null)
                    {
                        throw new EeException(ErrorCodes.Existed, "Object is existed.");
                    }
                    var court = repo.GetById <Court>(req.InCourtId);
                    entity = new Judge()
                    {
                        Name = req.Name,
                        PhoneNo = req.PhoneNo,
                        Gender = req.Gender,
                        InCourt = court,
                    };
                    repo.Create(entity);
                }
                return response;
            }
                                                   ));
        }
        public void SetStartTimes_ThreeJudgesTenCompetitorsInSameGrade_ReturnsSameStartTime()
        {
            // Test: 3 judges for 3 different idioms, and 10 competitors registered for those 3 idioms.
            // Expected result: all 3 events should be scheduled to start at the same time.
            Contest contest = this.Contest;

            contest.ContestJudges = this.GetContestJudges(contest, Instrument.Bagpipe, Idiom.Piobaireachd, Idiom.March24, Idiom.March68);
            var competitors = new List <Competitor>();

            Enumerable.Range(1, 10).ToList().ForEach(x =>
            {
                competitors.Add(GetFakeCompetitor(x, contest, Grade.FourJunior, Instrument.Bagpipe, Idiom.Piobaireachd, Idiom.March24, Idiom.March68));
            });
            contest.Competitors = competitors;

            Judge piobaireachdJudge = contest.ContestJudges.Single(x => x.Judge.Idioms.Contains(Idiom.Piobaireachd)).Judge;

            this.judgeService.GetMatchingJudge(Arg.Any <Contest>(), Arg.Is <SoloEvent>(x => x.Idiom == Idiom.Piobaireachd)).Returns(piobaireachdJudge);
            Judge march24Judge = contest.ContestJudges.Single(x => x.Judge.Idioms.Contains(Idiom.March24)).Judge;

            this.judgeService.GetMatchingJudge(Arg.Any <Contest>(), Arg.Is <SoloEvent>(x => x.Idiom == Idiom.March24)).Returns(march24Judge);
            Judge march68Judge = contest.ContestJudges.Single(x => x.Judge.Idioms.Contains(Idiom.March68)).Judge;

            this.judgeService.GetMatchingJudge(Arg.Any <Contest>(), Arg.Is <SoloEvent>(x => x.Idiom == Idiom.March68)).Returns(march68Judge);

            List <SoloEvent> soloEvents = contest.SoloEvents.Where(x => x.SoloEventCompetitors.Any()).ToList();

            // call method being tested
            this.service.GetSoloEventSchedule(contest);

            DateTime oneEventStart = soloEvents.First().Start.Value;

            Assert.That(soloEvents.All(x => x.Start.Value == oneEventStart), Is.True);
        }
Beispiel #16
0
    public void Show(Judge _judge)
    {
        show  = true;
        timer = 0f;

        int judgeNum = 0;

        switch (_judge)
        {
        case Judge.Perfect:
            judgeNum = 1;
            break;

        case Judge.Nice:
            judgeNum = 2;
            break;

        case Judge.Good:
            judgeNum = 3;
            break;

        case Judge.PreMiss:
        case Judge.Miss:
            judgeNum = 0;
            break;
        }
        spriteRenderer.sprite  = judgeSprite[judgeNum];
        spriteRenderer.enabled = true;
        animator.Play("Show", -1, 0);
    }
Beispiel #17
0
 public void getFirstControllerRessoruce(CoastModel start, CoastModel end, BoatModel b)
 {
     startCoast = start;
     endCoast   = end;
     boat       = b;
     judge      = new Judge(startCoast, endCoast, boat);
 }
Beispiel #18
0
 private void AplyDtoToEntity(Judge judge, JudgeDto judgeDto)
 {
     judge.Name    = judgeDto.Name;
     judge.Age     = judgeDto.Age;
     judge.Raiting = judgeDto.Raiting;
     judge.SportId = judgeDto.SportId;
 }
Beispiel #19
0
        public void InsertJudge()
        {
            Judge     j      = CreateJudge();
            SqlHelper helper = new SqlHelper(TournamentLocation);

            helper.InsertJudge(j);
        }
Beispiel #20
0
        public async Task Delete(int id)
        {
            Judge judge = _judgesDbContext.Judges.Find(id);

            _judgesDbContext.Judges.Remove(judge);
            await _judgesDbContext.SaveChangesAsync();
        }
Beispiel #21
0
        public void GetMatchingJudge_MultiplePiobJudges_ReturnsLeastBusyJudge()
        {
            // Test: Four piob judges - piob event should be assigned to the piob judge with the least amount of events in terms of time required

            // Setup here is 2 piob judges and 2 competitors registered for 2 different piob events.
            // Judge 1 (busyJudge) will be set up to already be judging the one event, so Judge 2 (availableJudge)
            // should be selected to judge the other event.
            Contest contest = this.Contest;

            contest.ContestJudges = this.GetContestJudges(contest, Instrument.Bagpipe, Idiom.Piobaireachd, Idiom.Piobaireachd);
            Judge busyJudge      = contest.ContestJudges.First().Judge;
            Judge availableJudge = contest.ContestJudges.Last().Judge;

            contest.Competitors.Add(TestBase.GetFakeCompetitor(1, contest, Grade.FourJunior, Instrument.Bagpipe, Idiom.Piobaireachd));
            contest.Competitors.Add(TestBase.GetFakeCompetitor(2, contest, Grade.FourSenior, Instrument.Bagpipe, Idiom.Piobaireachd));

            // Add the first Piob event to this judge in order to make him busy
            ContestJudge contestJudge   = contest.ContestJudges.Single(x => x.JudgeId == busyJudge.JudgeId);
            SoloEvent    busyJudgeEvent = contest.SoloEvents.Single(x => x.Idiom == Idiom.Piobaireachd && x.Grade == Grade.FourJunior);

            busyJudgeEvent.Judge = busyJudge;

            // This is the event that should get assigned to availableJudge
            SoloEvent availableJudgeEvent = contest.SoloEvents.Single(x => x.Idiom == Idiom.Piobaireachd && x.Grade == Grade.FourSenior);

            // Call the method being tested
            Judge result = this.service.GetMatchingJudge(contest, availableJudgeEvent);

            // Ensure that the judge picked for the event is the available one
            Assert.That(result.JudgeId, Is.EqualTo(availableJudge.JudgeId));
        }
Beispiel #22
0
    private void OnTriggerStay(Collider other)
    {
        Debug.LogError("akfhalh");
        if (other.tag != "HandSphere")
        {
            return;
        }

        var notes = NotesController.Instance.Notes;

        if (notes.Where(it => it.LaneNumber == 1).Count() == 0)
        {
            return;
        }
        var note = notes.
                   Where(it => it.LaneNumber == 1).
                   OrderBy(it => it.DownTime).First();
        //ノーツが"n"秒経過していたら処理しない
        //TODO:処理用確認
        var tapTime = note.DownTime - NotesController.Instance.elapsedTime;

        if (Mathf.Abs(tapTime) > NotesController.Instance.WaitTime)
        {
            return;
        }
        //判定処理
        Judge.Execute(tapTime);
        note.Unregister();
    }
Beispiel #23
0
        public void addJudges()
        {
            Judge judge1 = new Judge(10, 1, "Anton", "SWE");
            Judge judge2 = new Judge(20, 2, "Olle", "SWE");
            Judge judge3 = new Judge(30, 3, "Kalle", "SWE");
            Judge judge4 = new Judge(40, 4, "Nils", "SWE");
            Judge judge5 = new Judge(50, 5, "Sven", "SWE");
            Judge judge6 = new Judge(60, 6, "Maj-Britt", "SWE");
            Judge judge7 = new Judge(70, 7, "Inga-lill", "SWE");
            Judge judge8 = new Judge(80, 8, "Klas-Göran", "SWE");
            Judge judge9 = new Judge(90, 9, "Klas-Bertil", "SWE");

            c.judges.Add(judge1);
            c.judges.Add(judge2);
            c.judges.Add(judge3);
            c.judges.Add(judge4);
            c.judges.Add(judge5);
            c.judges.Add(judge6);
            c.judges.Add(judge7);
            c.judges.Add(judge8);
            c.judges.Add(judge9);

            Assert.AreEqual(4, judge4.judgeSeat);
            Assert.AreEqual("Klas-Göran", judge8.name);
            Assert.AreEqual(9, c.judges.Count);
            Assert.AreEqual("SWE", judge7.nationality);
            Assert.AreNotEqual("wut", judge7.name);
        }
Beispiel #24
0
 private void evalAction(Judge judge, GameObject targetNote)
 {
     switch (judge) {
     case Judge.PERFECT:
         this.player.addScore(500);
         this.player.addCombo();
         Destroy(targetNote);
         break;
     case Judge.GREAT:
         this.player.addScore(300);
         this.player.addCombo();
         Destroy(targetNote);
         break;
     case Judge.GOOD:
         this.player.addScore(100);
         this.player.addCombo();
         Destroy(targetNote);
         break;
     case Judge.BAD:
         this.player.missCombo();
         Destroy(targetNote);
         break;
     case Judge.MISS:
         this.player.missCombo();
         Destroy(targetNote);
         break;
     case Judge.NONE:
         break;
     }
     this.screen.screenJudgeAndCombo(judge);
     //Debug.Log (judge);
 }
Beispiel #25
0
        void Divine()
        {
            foreach (var agent in AliveAgentList.Where(a => RoleOf(a) == Role.SEER))
            {
                var target     = gameServer.RequestDivineTarget(agent);
                var targetRole = RoleOf(target);
                if (target == null || StatusOf(target) == Status.DEAD || targetRole == Role.UNC)
                {
                    // Do nothing.
                }
                else
                {
                    var divine = new Judge(Day, agent, target, targetRole.GetSpecies());
                    gameData.Divine = divine;

                    if (targetRole == Role.FOX)
                    {
                        gameData.AddLastDeadAgent(target);
                        gameData.CursedFox = target;
                    }

                    if (GameLogger != null)
                    {
                        GameLogger.Log($"{Day},divine,{agent.AgentIdx},{target.AgentIdx},{divine.Result}");
                    }
                }
            }
        }
Beispiel #26
0
    public void LoadResources()
    {
        GameObject water = Instantiate(Resources.Load("Prefabs/Water", typeof(GameObject)), new Vector3(0, -1, 30), Quaternion.identity) as GameObject;

        water.name = "water";
        start_land = new LandModel("start");
        end_land   = new LandModel("end");
        boat       = new BoatModel();
        roles      = new RoleModel[6];
        judge      = new Judge(start_land, end_land, boat);

        for (int i = 0; i < 3; i++)
        {
            RoleModel role = new RoleModel("priest");
            role.SetName("priest" + i);
            role.SetPosition(start_land.GetEmptyPosition());
            role.GoLand(start_land);
            start_land.AddRole(role);
            roles[i] = role;
        }

        for (int i = 0; i < 3; i++)
        {
            RoleModel role = new RoleModel("devil");
            role.SetName("devil" + i);
            role.SetPosition(start_land.GetEmptyPosition());
            role.GoLand(start_land);
            start_land.AddRole(role);
            roles[i + 3] = role;
        }
    }
Beispiel #27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (null == CurrentUser || (CurrentUser.Role != RoleType.AreaJudge && CurrentUser.Role != RoleType.RegionJudge))
         {
             MasterPage.ShowErrorMessage("You are not Authorized to view this page");
             Response.Redirect("~/Default.aspx");
         }
         else
         {
             Judge = UserService.GetJudge(CurrentUser);
             if (CurrentUser.Role == RoleType.AreaJudge)
             {
                 lblInfo.Text = Judge.Area.Name + " Area";
             }
             else
             {
                 lblInfo.Text = " Region";
             }
             lblCategory.Text = Judge.Category.Name;
             SortDirection    = SortDirection.Ascending;
             SortColumn       = "j.Application.Ranking";
             LoadNominees();
         }
     }
 }
Beispiel #28
0
        public async Task <Problem> GetProblemAsync(Judge judge, int problemId)
        {
            var problem = new Problem(this);
            await problem.LoadAsync(judge, problemId);

            return(problem);
        }
Beispiel #29
0
        private void UpdateUI()
        {
            switch (examType)
            {
            case QuestionHistory.EXAM_TYPE_UNDO:
                this.Text = "判断题训练 - 训练模式(全部是没做过的题目及部分做错的题目)";
                break;

            case QuestionHistory.EXAM_TYPE_WRONG:
                this.Text = "判断题训练 - 错题模式(全部是做错的题目)";
                break;

            case QuestionHistory.EXAM_TYPE_REVIEW:
                this.Text = "判断题训练 - 复习模式(全部是做过的题)";
                break;
            }

            if (list.Count == 0)
            {
                return;
            }

            judge = list[index];

            content.Text = judge.content;

            right.Checked = false;
            wrong.Checked = false;
        }
Beispiel #30
0
        public Problem GetProblem(Judge judge, int problemId)
        {
            var problem = new Problem(this);

            problem.Load(judge, problemId);
            return(problem);
        }
Beispiel #31
0
        public async Task <string> GetOutputAsync(Judge judge, int problemId, string input)
        {
            var problem = new Problem(this);
            await problem.LoadAsync(judge, problemId);

            return(await problem.GetOutputAsync(input));
        }
Beispiel #32
0
        public string GetOutput(Judge judge, int problemId, string input)
        {
            var problem = new Problem(this);

            problem.Load(judge, problemId);
            return(problem.GetOutput(input));
        }
Beispiel #33
0
 //PCでのデバッグ用にクリックに反応するようにしているが、、実際にはタッチやフリックで反応するようにする。
 public void OnMouseDown()
 {
     judge = JudgeTiming();
     Debug.Log(judge);
     if (judge != Judge.Miss)
     {
      Destroy(gameObject);
     }
     MusicPlayController.comboAndScoreUpdate();
 }
Beispiel #34
0
        /// <summary>
        /// lägger till domare i databasen
        /// </summary>
        /// <returns>returnerar TRUE om det lyckas annars FALSE</returns>
        public static int AddJudgeToDatabase(Judge j1)
        {
            //ansluter till databasen
            MySqlConnection conn = Database.ConnectToDatabase();
            if (conn != null)
            {
                string id = "";
                //lägger till domaren i databasen
                MySqlCommand comm = conn.CreateCommand();
                comm.CommandText = "INSERT INTO judge(name) VALUES(@name)";
                comm.Parameters.AddWithValue("@name", j1.GetJudgeName());
                comm.ExecuteNonQuery();
                comm.CommandText = "SELECT LAST_INSERT_ID() AS id";
                var dr = comm.ExecuteReader();
                var dt = new DataTable();
                dt.Load(dr);
                DataRow row = dt.Rows[0];
                id = row["id"].ToString();

                conn.Close();
                return Int32.Parse(id);
            }
            else
            {
                MessageBox.Show("Anslutningen till databasen misslyckades", "Fel", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return -1;
            }
        }
Beispiel #35
0
	public void DisplayJudge(string judge,float TimeDistance){
		JudgeLable = GameObject.Find ("Judge");
		Judge = JudgeLable.GetComponent<Judge>();
		Judge.judge (judge,TimeDistance);
	}
Beispiel #36
0
 public Score(Dive d, Judge j, double points)
 {
     this.dive = d;
     this.judge = j;
     this.Points = points;
 }
Beispiel #37
0
 /// <summary>
 /// Lägg till en domare på eventet
 /// </summary>
 /// <param name="judge"></param>
 public void AddJudge(Judge judge)
 {
     Judges.Add(judge);
 }
Beispiel #38
0
        public static List<Judge> GetJudgesInEvent(int eventID)
        {
            List<Judge> judges = new List<Judge>();

            MySqlConnection conn = ConnectToDatabase();
            if (conn != null)
            {
                Judge j;
                string sql = "SELECT * FROM judge WHERE id IN (SELECT judgeId FROM event_judge WHERE eventId=" + eventID + ")"; //RADERA: ORDER BY id DESC, endast för "resultat"
                var cmd = new MySqlCommand(sql, conn);
                var dr = cmd.ExecuteReader();
                var dt = new DataTable();
                dt.Load(dr);

                foreach (DataRow row in dt.Rows)
                {
                    j = new Judge(Int32.Parse(row["id"].ToString()), row["name"].ToString());
                    judges.Add(j);
                }
                conn.Close();
            }
            return judges;
        }
        public void SendEntryEmail(int ShowId, int UserId, String userRefNo)
        {
            Shows show = new Shows(ShowId);
            User currentUser = new User(UserId);

            //
            // if entered show, send email saying entered show
            String htmlContents = readTemplate("EnteredShow", "html", show, userRefNo);
            String plainContents = readTemplate("EnteredShow", "txt", show, userRefNo);

            MailMessage mm = new MailMessage();

            String Classes_entered_html = "<table>";
            String Classes_entered_plain = "";
            List<ShowClasses> classList = ShowClasses.GetAllClassesForShow(ShowId);
            List<Dogs> dogList = Dogs.GetAllDogsForHandler(UserId, show.ShowDate);

            var multiClasses = TeamPairsManager.GetTeamPairClasses(ShowId);
            var multiTeams = TeamPairsManager.GetTeamPairsForShow(ShowId, multiClasses);

            foreach (Dogs d in dogList)
            {
                DogClasses dogClasses = new DogClasses(d.ID, ShowId);
                dogClasses.getDogsClasses(ShowId);
                if (d.Grade != 0)
                {
                    bool dogEntered = false;
                    foreach (ShowClasses cls in classList)
                    {
                        int clsIndex = dogClasses.Classlist.IndexOf(cls.ID);
                        if (clsIndex > -1)
                        {
                            if (!dogEntered)
                            {
                                Classes_entered_html += String.Format("<tr style='font-weight:bold;'><td colspan='3'><b>{0} ({1}) {2}  </b></td></tr>", d.PetName, d.Grade,(dogClasses.Lho == 0 ? "": "Entered lower height option"));
                                Classes_entered_plain += String.Format("{1}{0}{1}--------------------------------{1} ({2}) {3}", d.PetName, Environment.NewLine, d.Grade, (dogClasses.Lho == 0 ? "" : "Entered lower height option"));
                            }
                            Classes_entered_html += "<tr>";

                            Classes_entered_html += String.Format("<td style='width:25px'></td><td>{0}</td><td>{1} {2} {3} {4} {5}</td>", cls.ClassNo, cls.NormalName(withClassNo:false));
                            Classes_entered_plain += String.Format("{0} - {1} {2} {3} {4} {5} {6}", cls.ClassNo, cls.NormalName(withClassNo:false), Environment.NewLine);
                            Classes_entered_html += "</tr>";
                            dogEntered = true;
                        }
                    }

                }
            }

            foreach (var team in multiTeams.Where( t => t.UserId == UserId ))
            {
                if (team.Team)
                {
                    Classes_entered_html += string.Format(@"
            <tr style='height:25px' ><td colspan='3'></td><tr>
            <td>Team Name<br>{0}</td>
            <td colspan='2'>Captain<br/>{1}</td>
            </tr>", team.TeamDetails.TeamName.Replace("&#39;", "'"), team.TeamDetails.Captain.Replace("&#39;", "'"));
                    Classes_entered_plain += string.Format(@"Team Name:{0}  Team Captain:{1}{2}", team.TeamDetails.TeamName.Replace("&#39;", "'"), team.TeamDetails.Captain.Replace("&#39;", "'"), Environment.NewLine);

                    foreach (var member in team.Members)
                    {

                        Classes_entered_html += string.Format(
            @"
            <tr>
            <td>&nbsp;&nbsp;&nbsp;{0}</td>
            <td colspan='2'>{1}</td>
            </tr><tr>
            ", member.HandlerName.Replace("&#39;", "'"), member.DogName.Replace("&#39;", "'"));
                        Classes_entered_plain += string.Format(
            @"
            {0}, {1}{2}", member.HandlerName.Replace("&#39;", "'"), member.DogName.Replace("&#39;", "'"), Environment.NewLine);

                    }
                }
            }

            Classes_entered_html += " </table>";
            Classes_entered_plain += Environment.NewLine;

            htmlContents = htmlContents.Replace("[CLOSING_DATE]", show.ClosingDate.ToString("ddd, dd MMM yyyy"));
            plainContents = plainContents.Replace("[CLOSING_DATE]", show.ClosingDate.ToString("ddd, dd MMM yyyy"));

            htmlContents = htmlContents.Replace("[CLASSES_ENTERED]", Classes_entered_html);
            plainContents = plainContents.Replace("[CLASSES_ENTERED]", Classes_entered_plain);

            string campingdetails_html = "";
            string campingdetails_plain = "";
            var usershowid = Convert.ToInt32(userRefNo);
            var uc = new UserCamping(usershowid);
            if (uc.ID > -1)
            {
                campingdetails_html = string.Format("<h3>Camping Details</h3><div>Party Name: <b>{0}</b><br>{1}</div>", uc.PitchDetails[0].PartyName, uc.PitchDetails[0].CampingDays);
                campingdetails_plain = string.Format("Party Name: {0}\n\r{1}", uc.PitchDetails[0].PartyName, uc.PitchDetails[0].CampingDays);
            }
            htmlContents = htmlContents.Replace("[CAMPING_DETAILS]", campingdetails_html);
            plainContents = plainContents.Replace("[CAMPING_DETAILS]", campingdetails_plain);

            string helpingdetails_html = "";
            string helpingdetails_plain = "";
            var helpersList = Helpers.HelperForShow(ShowId, UserId);
            if (helpersList.Count > 0)
            {
                helpingdetails_html += "<div id='helperdetails' class='infoText'><h3>Helping Details</h3>";
                helpingdetails_plain = "Helper Details";
                foreach (Helpers helper in helpersList)
                {
                    String judge = "";
                    if (helper.JudgeID > -1)
                    {
                        Judge j = new Judge(helper.JudgeID);
                        judge = "Judge: " + j.Name;
                    }
                    String ring = "";
                    if (helper.RingNo > 0)
                    {
                        ring = "Ring No:" + helper.RingNo.ToString();
                    }
                    helpingdetails_html += String.Format("<div >{0:ddd dd MMM} - {1} {2} {3}</div>", helper.HelpDate, helper.expandJob(), judge, ring);
                    helpingdetails_plain += String.Format("{0:ddd dd MMM} - {1} {2} {3}", helper.HelpDate, helper.expandJob(), judge, ring);
                }
                helpingdetails_html += "</div>";
                helpingdetails_html += "\n";
            }

            htmlContents = htmlContents.Replace("[HELPING_DETAILS]", helpingdetails_html);
            plainContents = plainContents.Replace("[HELPING_DETAILS]", helpingdetails_html);

            Decimal totals = 0;
            String table = CreateTotalsSummaryEmail(ShowId, UserId, ref totals);
            //htmlContents = htmlContents.Replace("[PAYMENT_NOTE]", table);

            AlternateView htmlView = AlternateView.CreateAlternateViewFromString(htmlContents, null, MediaTypeNames.Text.Html);
            LinkedResource logoImage = new LinkedResource(HttpContext.Current.Server.MapPath("~/Assets/logo.gif"), MediaTypeNames.Image.Gif);
            logoImage.ContentId = "LogoImage";
            //htmlView.LinkedResources.Add(logoImage);
            AlternateView plainView = AlternateView.CreateAlternateViewFromString(plainContents, null, MediaTypeNames.Text.Plain);

            mm.AlternateViews.Add(plainView);
            mm.AlternateViews.Add(htmlView);

            SmtpClient client = new SmtpClient();
            mm.From = new MailAddress("*****@*****.**", "First Place Processing");
            mm.To.Add(new MailAddress(currentUser.EmailAddress, currentUser.Name));
            mm.Subject = String.Format("Entry Confirmation {0} ({1:dd MMM yyyy})", show.ShowName, show.ShowDate);
            try
            {
                client.Send(mm);
            }
            catch (Exception e)
            {
                AppException.LogError("Error SendEntry:" + e.Message + "-" + e.StackTrace);
            }
        }
Beispiel #40
0
        public static void GetScoresToDives(Contest contest)
        {
            MySqlConnection conn = Database.ConnectToDatabase();
            MySqlCommand comm = new MySqlCommand();
            string sql = "";
            comm = conn.CreateCommand();

            if(conn != null)
            {
                foreach (Diver diver in contest.Divers)
                {
                    //hämtar alla Scores som finns på hopparen
                    sql = "SELECT * FROM score WHERE diveId IN (SELECT id FROM dive WHERE diverId=" + diver.Id + " AND eventId=" + contest.Id + ") ORDER BY id";
                    comm.CommandText = sql;
                    MySqlDataReader dr = comm.ExecuteReader();
                    DataTable dt = new DataTable();

                    dt.Load(dr);
                    int count = 0;
                    int diveCount = 1;

                    Score currentScore = new Score();
                    Dive currentDive = new Dive();
                    Judge currentJudge = new Judge();

                    //Alla scores som finns på alla hoppen
                    foreach(DataRow row in dt.Rows)
                    {
                        if (count < diver.Dives.Count)
                        {
                            foreach (Judge judge in contest.Judges)
                            {
                                if (judge.Id.ToString().CompareTo(row["judgeId"].ToString()) == 0)
                                    currentJudge = judge;
                            }
                            try
                            {
                                currentDive = diver.Dives[count];
                            }
                            catch (IndexOutOfRangeException) { }

                            currentScore = new Score(Int32.Parse(row["id"].ToString()), currentDive, currentJudge, Double.Parse(row["point"].ToString()));
                            diver.Dives[count].AddScore(currentScore);

                            if(diveCount == contest.Judges.Count)
                            {
                                count++;
                                diveCount = 1;
                            }
                            else
                            {
                                diveCount++;
                            }

                        }
                    }
                }
            }
        }
 private void LoadFromRow(DataRow row)
 {
     try
     {
         ID = Convert.ToInt32(row["int"]);
         HelperName = Convert.ToString(row["HelperName"]);
         HelperTimeAllocation = new HelperTimeAllocation(row);
         HelperJob = new HelperJobs(row);
         ShowDetails = new ShowDetails(row);
         Judge = new Judge(row);
         RingPartyName = row["RingPartyName"].ToString();
         Comments = row["Comments"].ToString();
     }
     catch (Exception e)
     {
         AppException.LogEvent("HelperForShow.LoadFromRow:" + e.Message);
     }
 }
Beispiel #42
0
 public void LoadHitJudge(Judge j)
 {
     switch(j){
         case Judge.BEGINNER:
             PrecisionValues[Precision.FANTASTIC] = 0.135;
             PrecisionValues[Precision.EXCELLENT] = 0.180;
             PrecisionValues[Precision.GREAT] = 0.280;
             PrecisionValues[Precision.DECENT] = 0.350;
             PrecisionValues[Precision.WAYOFF] = 0.5;
         break;
         case Judge.EASY:
             PrecisionValues[Precision.FANTASTIC] = 0.043;
             PrecisionValues[Precision.EXCELLENT] = 0.102;
             PrecisionValues[Precision.GREAT] = 0.180;
             PrecisionValues[Precision.DECENT] = 0.240;
             PrecisionValues[Precision.WAYOFF] = 0.3;
         break;
         case Judge.NORMAL:
             PrecisionValues[Precision.FANTASTIC] = 0.0215;
             PrecisionValues[Precision.EXCELLENT] = 0.043;
             PrecisionValues[Precision.GREAT] = 0.102;
             PrecisionValues[Precision.DECENT] = 0.135;
             PrecisionValues[Precision.WAYOFF] = 0.180;
         break;
         case Judge.HARD:
             PrecisionValues[Precision.FANTASTIC] = 0.015;
             PrecisionValues[Precision.EXCELLENT] = 0.035;
             PrecisionValues[Precision.GREAT] = 0.070;
             PrecisionValues[Precision.DECENT] = 0.1;
             PrecisionValues[Precision.WAYOFF] = 0.135;
         break;
         case Judge.EXPERT:
             PrecisionValues[Precision.FANTASTIC] = 0.0075;
             PrecisionValues[Precision.EXCELLENT] = 0.015;
             PrecisionValues[Precision.GREAT] = 0.0215;
             PrecisionValues[Precision.DECENT] = 0.043;
             PrecisionValues[Precision.WAYOFF] = 0.102;
         break;
     }
 }
Beispiel #43
0
 public void LoadScoreJudge(Judge j)
 {
     switch(j){
         case Judge.BEGINNER:
             ScoreWeightValues["EXCELLENT"] = 1f;
             ScoreWeightValues["GREAT"] = 0.9f;
             ScoreWeightValues["DECENT"] = 0.5f;
             ScoreWeightValues["WAYOFF"] = 0f;
             ScoreWeightValues["MISS"] = 0f;
             ScoreWeightValues["MINE"] = -0.01f;
         break;
         case Judge.EASY:
             ScoreWeightValues["EXCELLENT"] = 0.9f;
             ScoreWeightValues["GREAT"] = 0.6f;
             ScoreWeightValues["DECENT"] = 0f;
             ScoreWeightValues["WAYOFF"] = 0f;
             ScoreWeightValues["MISS"] = -1f;
             ScoreWeightValues["MINE"] = -0.5f;
         break;
         case Judge.NORMAL:
             ScoreWeightValues["EXCELLENT"] = 0.8f;
             ScoreWeightValues["GREAT"] = 0.4f;
             ScoreWeightValues["DECENT"] = 0f;
             ScoreWeightValues["WAYOFF"] = -1.2f;
             ScoreWeightValues["MISS"] = -2.4f;
             ScoreWeightValues["MINE"] = -1.2f;
         break;
         case Judge.HARD:
             ScoreWeightValues["EXCELLENT"] = 0.5f;
             ScoreWeightValues["GREAT"] = 0.2f;
             ScoreWeightValues["DECENT"] = -0.5f;
             ScoreWeightValues["WAYOFF"] = -2f;
             ScoreWeightValues["MISS"] = -4f;
             ScoreWeightValues["MINE"] = -2f;
         break;
         case Judge.EXPERT:
             ScoreWeightValues["EXCELLENT"] = 0.3f;
             ScoreWeightValues["GREAT"] = 0f;
             ScoreWeightValues["DECENT"] = -2f;
             ScoreWeightValues["WAYOFF"] = -5f;
             ScoreWeightValues["MISS"] = -10f;
             ScoreWeightValues["MINE"] = -10f;
         break;
     }
 }
        /// <summary>
        /// Thread safe. Returns a dispatched judge to the pool. This method 
        /// do not accept a judge that have not been dispatched by the 
        /// current instance of the dispatcher.
        /// </summary>
        /// <param name="judge">The judge that answered a previous call to 
        /// Dispatch.</param>
        public void Returns(Judge judge)
        {
            lock (this.judgePool)
            {
                if (judge == null)
                {
                    throw new ArgumentNullException("judge");
                }

                if (!this.dispatchedJudges.Contains(judge.GetHashCode()))
                {
                    throw new ArgumentException(
                        "The judge received have not been dispatched by an " +
                        "earlier call to Dispatch()");
                }

                this.dispatchedJudges.Remove(judge.GetHashCode());
                this.judgePool.Push(judge);
            }
        }
Beispiel #45
0
        public static List<Judge> GetJudges()
        {
            var judgeList = new List<Judge>();

            var conn = ConnectToDatabase();
            if (conn != null)
            {
                var cmd = new MySqlCommand("SELECT * FROM judge ORDER BY id", conn);
                var dr = cmd.ExecuteReader();
                var dt = new DataTable();
                dt.Load(dr);

                foreach (DataRow row in dt.Rows)
                {
                    var tmp = new Judge(Int32.Parse(row["id"].ToString()), row["name"].ToString());
                    judgeList.Add(tmp);
                }
                return judgeList;
            }

            else
            {
                MessageBox.Show("Anslutningen till databasen misslyckades", "Fel", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return judgeList;
        }
Beispiel #46
0
 public void LoadLifeJudge(Judge j)
 {
     switch(j){
         case Judge.BEGINNER:
             LifeWeightValues["FANTASTIC"] = 5f;
             LifeWeightValues["EXCELLENT"] = 2f;
             LifeWeightValues["GREAT"] = 1f;
             LifeWeightValues["DECENT"] = 0.2f;
             LifeWeightValues["WAYOFF"] = -0.2f;
             LifeWeightValues["MISS"] = -1f;
             LifeWeightValues["MINE"] = -0.1f;
             LifeWeightValues["FREEZE"] = 5f;
             LifeWeightValues["UNFREEZE"] = -0.2f;
             regenComboAfterMiss = 0;
         break;
         case Judge.EASY:
             LifeWeightValues["FANTASTIC"] = 1.5f;
             LifeWeightValues["EXCELLENT"] = 1f;
             LifeWeightValues["GREAT"] = 0.5f;
             LifeWeightValues["DECENT"] = 0f;
             LifeWeightValues["WAYOFF"] = -2.5f;
             LifeWeightValues["MISS"] = -5f;
             LifeWeightValues["MINE"] = -2.5f;
             LifeWeightValues["FREEZE"] = 1.5f;
             LifeWeightValues["UNFREEZE"] = -3.5f;
             regenComboAfterMiss = 2;
         break;
         case Judge.NORMAL:
             LifeWeightValues["FANTASTIC"] = 0.8f;
             LifeWeightValues["EXCELLENT"] = 0.7f;
             LifeWeightValues["GREAT"] = 0.4f;
             LifeWeightValues["DECENT"] = 0f;
             LifeWeightValues["WAYOFF"] = -5f;
             LifeWeightValues["MISS"] = -10f;
             LifeWeightValues["MINE"] = -5f;
             LifeWeightValues["FREEZE"] = 0.8f;
             LifeWeightValues["UNFREEZE"] = -8f;
             regenComboAfterMiss = 5;
         break;
         case Judge.HARD:
             LifeWeightValues["FANTASTIC"] = 0.5f;
             LifeWeightValues["EXCELLENT"] = 0.4f;
             LifeWeightValues["GREAT"] = 0.05f;
             LifeWeightValues["DECENT"] = -5f;
             LifeWeightValues["WAYOFF"] = -20f;
             LifeWeightValues["MISS"] = -25f;
             LifeWeightValues["MINE"] = -10f;
             LifeWeightValues["FREEZE"] = 0.5f;
             LifeWeightValues["UNFREEZE"] = -20f;
             regenComboAfterMiss = 10;
         break;
         case Judge.EXPERT:
             LifeWeightValues["FANTASTIC"] = 0.2f;
             LifeWeightValues["EXCELLENT"] = 0.1f;
             LifeWeightValues["GREAT"] = 0f;
             LifeWeightValues["DECENT"] = -20f;
             LifeWeightValues["WAYOFF"] = -50f;
             LifeWeightValues["MISS"] = -100f;
             LifeWeightValues["MINE"] = -25f;
             LifeWeightValues["FREEZE"] = 0f;
             LifeWeightValues["UNFREEZE"] = -25f;
             regenComboAfterMiss = 20;
         break;
     }
 }
    // Use this for initialization
    //test
    void Start()
    {
        numberPack = 0;
        nextnumberPack = 0;
        startnumber = 0;
        timeFade = 0f;
        packs = new Dictionary<string, GameObject>();
        cubesPos = new Dictionary<GameObject, float>();
        songCubePack = new Dictionary<GameObject, string>();
        LinkCubeSong = new Dictionary<GameObject, string>();
        customSongCubePack = new Dictionary<GameObject, string>();
        customLinkCubeSong = new Dictionary<GameObject, string>();
        diffSelected = new Dictionary<Difficulty, GameObject>();
        diffActiveColor = new Dictionary<Difficulty, Color>();
        PSDiff = new Dictionary<int, ParticleSystem>();
        RayDiff = new Dictionary<int, GameObject>();
        if(!LoadManager.Instance.alreadyLoaded) ProfileManager.Instance.CreateTestProfile();
        if(!LoadManager.Instance.alreadyLoaded) TextManager.Instance.LoadTextFile();
        if(!LoadManager.Instance.alreadyLoaded) LoadManager.Instance.Loading();

        actualBanner = new Texture2D(256,512);

        tex = new Dictionary<string, Texture2D>();
        tex.Add("BEGINNER", (Texture2D) Resources.Load("beginner"));
        tex.Add("EASY", (Texture2D) Resources.Load("easy"));
        tex.Add("MEDIUM", (Texture2D) Resources.Load("medium"));
        tex.Add("HARD", (Texture2D) Resources.Load("hard"));
        tex.Add("EXPERT", (Texture2D) Resources.Load("expert"));
        tex.Add("EDIT", (Texture2D) Resources.Load("edit"));
        tex.Add("graph", (Texture2D) Resources.Load("graph"));
        tex.Add("bouton", (Texture2D) Resources.Load("Button"));
        tex.Add("Option1", (Texture2D) Resources.Load("Speedmod"));
        tex.Add("Option2", (Texture2D) Resources.Load("Rate"));
        tex.Add("Option3", (Texture2D) Resources.Load("Skin"));
        tex.Add("Option4", (Texture2D) Resources.Load("HitJudge"));
        tex.Add("Option5", (Texture2D) Resources.Load("ScoreJudge"));
        tex.Add("Option6", (Texture2D) Resources.Load("LifeJudge"));
        tex.Add("Option7", (Texture2D) Resources.Load("Display"));
        tex.Add("Option8", (Texture2D) Resources.Load("Race"));
        tex.Add("Option9", (Texture2D) Resources.Load("Death"));
        tex.Add("Black", (Texture2D) Resources.Load("black"));

        tex.Add("Failed", (Texture2D) Resources.Load("Fail"));
        tex.Add("BAD", (Texture2D) Resources.Load("NoteBAD"));
        tex.Add("C", (Texture2D) Resources.Load("NoteC"));
        tex.Add("B", (Texture2D) Resources.Load("NoteB"));
        tex.Add("A", (Texture2D) Resources.Load("NoteA"));
        tex.Add("S", (Texture2D) Resources.Load("NoteS"));

        diffSelected.Add(Difficulty.BEGINNER, GameObject.Find("DifficultyB"));
        diffSelected.Add(Difficulty.EASY, GameObject.Find("DifficultyEs"));
        diffSelected.Add(Difficulty.MEDIUM, GameObject.Find("DifficultyM"));
        diffSelected.Add(Difficulty.HARD, GameObject.Find("DifficultyH"));
        diffSelected.Add(Difficulty.EXPERT, GameObject.Find("DifficultyEx"));
        diffSelected.Add(Difficulty.EDIT, GameObject.Find("DifficultyEd"));

        diffActiveColor.Add(Difficulty.BEGINNER, diffSelected[Difficulty.BEGINNER].transform.GetChild(0).renderer.material.GetColor("_TintColor"));
        diffActiveColor.Add(Difficulty.EASY, diffSelected[Difficulty.EASY].transform.GetChild(0).renderer.material.GetColor("_TintColor"));
        diffActiveColor.Add(Difficulty.MEDIUM, diffSelected[Difficulty.MEDIUM].transform.GetChild(0).renderer.material.GetColor("_TintColor"));
        diffActiveColor.Add(Difficulty.HARD, diffSelected[Difficulty.HARD].transform.GetChild(0).renderer.material.GetColor("_TintColor"));
        diffActiveColor.Add(Difficulty.EXPERT, diffSelected[Difficulty.EXPERT].transform.GetChild(0).renderer.material.GetColor("_TintColor"));
        diffActiveColor.Add(Difficulty.EDIT, diffSelected[Difficulty.EDIT].transform.GetChild(0).renderer.material.GetColor("_TintColor"));

        for(int i=0; i<6;i++){
            PSDiff.Add(i, (ParticleSystem) PSCore.transform.FindChild(""+i).particleSystem);
        }

        for(int i=0; i<6;i++){
            RayDiff.Add(i, (GameObject) RayCore.transform.FindChild(""+i).gameObject);
        }

        //To do : correct "KeyAlreadyAssign"
        var tempPos = new Dictionary<GameObject, float>();
        var tempPack = new Dictionary<string, GameObject>();
        var position = 0;
        var thePackPosition = -1;
        foreach(var el in LoadManager.Instance.ListSong().Keys){
            var thego = (GameObject) Instantiate(miniCubePack, new Vector3(0f, 13f, 20f), miniCubePack.transform.rotation);
            if(LoadManager.Instance.ListTexture().ContainsKey(el)) thego.renderer.material.mainTexture = LoadManager.Instance.ListTexture()[el];
            if(tempPack.ContainsKey(el)){
                tempPack.Add(el + "(" + tempPack.Count + ")", thego);
                if(el + "(" + tempPack.Count + ")" == DataManager.Instance.packSelected) thePackPosition = position;
            }
            else
            {
                tempPack.Add(el, thego);
                if(el == DataManager.Instance.packSelected) thePackPosition = position;
            }
            tempPos.Add(thego, 0f);
            position++;
        }

        if(DataManager.Instance.packSelected != "" && thePackPosition != -1){
            for(int i=thePackPosition;i<tempPos.Count;i++){
                cubesPos.Add(tempPos.ElementAt(i).Key, tempPos.ElementAt(i).Value);
                packs.Add(tempPack.ElementAt(i).Key, tempPack.ElementAt(i).Value);
            }
            for(int i=0;i<thePackPosition;i++){
                cubesPos.Add(tempPos.ElementAt(i).Key, tempPos.ElementAt(i).Value);
                packs.Add(tempPack.ElementAt(i).Key, tempPack.ElementAt(i).Value);
            }
        }else{
            for(int i=0;i<tempPos.Count;i++){
                cubesPos.Add(tempPos.ElementAt(i).Key, tempPos.ElementAt(i).Value);
                packs.Add(tempPack.ElementAt(i).Key, tempPack.ElementAt(i).Value);
            }
        }

        organiseCube();
        createCubeSong();
        desactiveDiff();
        activePack(packs.ElementAt(0).Key);
        plane.renderer.material.mainTexture = LoadManager.Instance.ListTexture()[packs.ElementAt(0).Key];
        diffNumber = new int[6];
        actualClip = new AudioClip();
        for(int i=0;i<6; i++){ diffNumber[i] = 0; }
        decalFade = 0f;
        decalFadeM = 0f;
        fadeAlpha = 0f;
        posLabel = 0f;
        time = 0f;
        alphaBanner = 1f;
        totalAlpha = 0f;
        alphaBlack = 0f;

        alphaSongLaunch = new float[6];
        for(int i=0;i<6; i++){ alphaSongLaunch[i] = 0f; }
        alreadyRefresh = true;
        FadeOutBanner = false;
        FadeInBanner = false;
        graph.enabled = false;
        movinOption = false;
        OptionMode = false;
        SongMode = false;
        movinSong = false;
        locked = false;
        fadedOut = false;
        animok = true;
        speedmodok = true;
        rateok = true;
        textButton = "Option";
        matCache = cacheOption.renderer.material;
        fadeAlphaOptionTitle = 1f;
        stateLoading = new bool[9];
        displaySelected = new bool[DataManager.Instance.aDisplay.Length];
        for(int i=0;i<stateLoading.Length-1;i++) stateLoading[i] = false;
        for(int j=0;j<DataManager.Instance.aDisplay.Length;j++) displaySelected[j] = DataManager.Instance.songSelected != null ? DataManager.Instance.displaySelected[j] : false;

        if(!String.IsNullOrEmpty(ProfileManager.Instance.currentProfile.lastSpeedmodUsed)){
            speedmodstring = ProfileManager.Instance.currentProfile.lastSpeedmodUsed;
            speedmodSelected = (float)System.Convert.ToDouble(ProfileManager.Instance.currentProfile.lastSpeedmodUsed);
        }else{
            speedmodSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.speedmodSelected : 2f;
            speedmodstring = speedmodSelected.ToString("0.00");
        }

        if(DataManager.Instance.songSelected != null){
            var bpmtotest = DataManager.Instance.songSelected.bpmToDisplay;
            if(bpmtotest.Contains("->")){
                bpmstring = (System.Convert.ToDouble(System.Convert.ToDouble(bpmtotest.Replace(">", "").Split('-')[DataManager.Instance.BPMChoiceMode])*speedmodSelected)).ToString("0");
            }else{
                bpmstring = (System.Convert.ToDouble(bpmtotest)*speedmodSelected).ToString("0");
            }
        }else{
            bpmstring = String.IsNullOrEmpty(ProfileManager.Instance.currentProfile.lastBPM) ? "300" : ProfileManager.Instance.currentProfile.lastBPM;
        }
        DataManager.Instance.BPMEntryMode = ProfileManager.Instance.currentProfile.inBPMMode;

        rateSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.rateSelected : 0f;
        scoreJudgeSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.scoreJudgeSelected : Judge.NORMAL;
        hitJudgeSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.hitJudgeSelected : Judge.NORMAL;
        lifeJudgeSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.lifeJudgeSelected : Judge.NORMAL;
        skinSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.skinSelected : 0;
        raceSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.raceSelected : 0;
        deathSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.deathSelected :0;

        ratestring = rateSelected.ToString("00");

        alphaText = new float[stateLoading.Length];
        isFading = new bool[stateLoading.Length];
        alphaDisplay = new float[stateLoading.Length];
        isFadingDisplay = new bool[stateLoading.Length];
        offsetFading = new float[stateLoading.Length];
        offsetPreviousFading = new float[stateLoading.Length];
        for(int i=0;i<stateLoading.Length;i++) offsetFading[i] = 0f;
        for(int i=0;i<stateLoading.Length;i++) offsetPreviousFading[i] = 0f;
        for(int i=0;i<stateLoading.Length;i++) isFading[i] = false;
        for(int i=0;i<stateLoading.Length;i++) alphaText[i] = 1f;
        for(int i=0;i<stateLoading.Length;i++) isFadingDisplay[i] = false;
        for(int i=0;i<stateLoading.Length;i++) alphaDisplay[i] = 0f;

        search = "";
        searchOldValue = "";
        songList = new Dictionary<string, Dictionary<Difficulty, Song>>();

        alreadyFade = false;

        actualySelected =  DataManager.Instance.difficultySelected;
        trulySelected = DataManager.Instance.difficultySelected;
        onHoverDifficulty = Difficulty.NONE;

        /*TO DO !!!
        if(DataManager.Instance.mousePosition != -1){
            startnumber = DataManager.Instance.mousePosition;
        }*/
    }
        public static Judge getJudgeForClass(int ClassID)
        {
            Judge judge = new Judge() ;

            String moduleSettings = ModuleConfig.GetSettings();
            Data.Judge j = new Data.Judge(moduleSettings);
            DataSet ds = j.getJudgeForClass(ClassID);
            if (ds.Tables[0].Rows.Count > 0)
            {
                int JudgeID = Convert.ToInt32(ds.Tables[0].Rows[0]["JudgeID"]);
                judge = new Judge(JudgeID);
            }

            return judge;
        }
        /// <summary>
        /// Skapar en Contest med hoppare, hopp och domare
        /// </summary>
        /// <param name="textBox1"></param>
        /// <param name="textBox2"></param>
        /// <param name="dateTimePicker1"></param>
        /// <param name="numericUpDown1"></param>
        /// <param name="radioButton1meter"></param>
        /// <param name="radioButton3meter"></param>
        /// <param name="radioButton5meter"></param>
        /// <param name="radioButton7meter"></param>
        /// <param name="radioButton10meter"></param>
        /// <param name="radioButtonSingle"></param>
        /// <param name="radioButtonSync"></param>
        /// <param name="radioButtonMale"></param>
        /// <param name="radioButtonFemale"></param>
        /// <param name="listViewDivers"></param>
        /// <param name="listViewJudge"></param>
        /// <param name="successfully"></param>
        /// <param name="errorlabel"></param>
        /// <param name="dataGridViewList"></param>
        public static void AddNewEventToDatabase(TextBox textBox1, TextBox textBox2, DateTimePicker dateTimePicker1, NumericUpDown numericUpDown1, RadioButton radioButton1meter, RadioButton radioButton3meter, RadioButton radioButton5meter, RadioButton radioButton7meter, RadioButton radioButton10meter, RadioButton radioButtonSingle, RadioButton radioButtonSync, RadioButton radioButtonMale, RadioButton radioButtonFemale, ListView listViewDivers, ListView listViewJudge, Label successfully, Label errorlabel, List<DataGridView> dataGridViewList)
        {
            string eventName;
            string location;
            string date;
            int diveCount;
            int discipline = -1;
            int sync = -1;
            int sex = -1;

            eventName = textBox1.Text;
            location = textBox2.Text;
            date = dateTimePicker1.Value.ToString("yyyy-MM-dd");
            diveCount = (int)numericUpDown1.Value;

            //discipline
            if (radioButton1meter.Checked)
                discipline = 0;
            else if (radioButton3meter.Checked)
                discipline = 1;
            else if (radioButton5meter.Checked)
                discipline = 2;
            else if (radioButton7meter.Checked)
                discipline = 3;
            else if (radioButton10meter.Checked)
                discipline = 4;

            //sync: single = 0, sync = 1
            if (radioButtonSingle.Checked)
                sync = 0;
            else if (radioButtonSync.Checked)
                sync = 1;

            //sex: male = 0, female = 1
            if (radioButtonMale.Checked)
                sex = 0;
            else if (radioButtonFemale.Checked)
                sex = 1;

            //lägger till eventet i databasen
            Contest ev = new Contest(eventName, date, location, discipline, sync, diveCount, sex);

            //hämtar dommare och hoppare från tabellerna
            List<Judge> addJudgesToEvent = new List<Judge>();
            List<Diver> addDiversToEvent = new List<Diver>();
            Diver d;
            Judge j;
            string gender;
            int g;

            foreach (ListViewItem item in listViewDivers.CheckedItems)
            {
                gender = item.SubItems[3].Text;
                if (gender.CompareTo("M") == 0)
                    g = 0;
                else
                    g = 1;
                d = new Diver(Int32.Parse(item.SubItems[4].Text), item.SubItems[0].Text, Int32.Parse(item.SubItems[2].Text), g, item.SubItems[1].Text);
                addDiversToEvent.Add(d);
            }
            ev.AddDivers(addDiversToEvent);

            foreach (ListViewItem item in listViewJudge.CheckedItems)
            {
                j = new Judge(Int32.Parse(item.SubItems[0].Text), item.SubItems[1].Text);
                addJudgesToEvent.Add(j);
            }
            ev.AddJudges(addJudgesToEvent);

            int code = Database.AddEventToDatabase(ev);
            //om inmatningen lyckades
            if (code == 1)
            {
                int eventID = Database.GetLatestAddedEventID();

                DiveType dType = new DiveType();
                int diverID = -1, dNumber, diveTypeID;
                string dPosition;

                MySqlConnection conn;
                using (conn = Database.ConnectToDatabase())
                {
                    for (int i = 0; i < dataGridViewList.Count; i++)
                    {
                        //antal rader i en DataGridView
                        for (int rad = 0; rad < dataGridViewList[i].RowCount; rad++)
                        {
                            //diver ID
                            diverID = Int32.Parse(dataGridViewList[i].Tag.ToString());
                            //DiveNo
                            dNumber = Int32.Parse(dataGridViewList[i].Rows[rad].Cells[1].Value.ToString());
                            dPosition = dataGridViewList[i].Rows[rad].Cells[0].Value.ToString();

                            dType.No = dNumber;

                            SetDiveTypeHeight(dType, radioButton1meter, radioButton3meter, radioButton5meter, radioButton7meter, radioButton10meter);
                            SetDiveTypePosition(dType, dPosition);

                            diveTypeID = Database.AddDiveTypeToDatabase(dType, conn);
                            Database.AddDiveToDiver(dType, eventID, rad + 1, diveTypeID, diverID, conn);
                        }
                    }
                }

                successfully.Visible = true;
            }
            else if (code == -1)
            {
                successfully.Visible = false;
                errorlabel.Text = "Identical event already exist";
                errorlabel.Visible = true; ;
            }
            else
            {
                successfully.Visible = false;
                errorlabel.Text = "An error occoured, try again";
                errorlabel.Visible = true;
            }
        }
Beispiel #50
0
    // Use this for initialization
    void Start()
    {
        gs = GetComponent<GeneralScript>();
        activeModule = false;
        speedmodok = true;
        rateok = true;
        animok = true;

        matCache = cacheOption.renderer.material;

        fadeAlphaOptionTitle = 1f;
        stateLoading = new bool[9];
        displaySelected = new bool[DataManager.Instance.aDisplay.Length];
        for(int i=0;i<stateLoading.Length-1;i++) stateLoading[i] = false;
        for(int j=0;j<DataManager.Instance.aDisplay.Length;j++) displaySelected[j] = DataManager.Instance.songSelected != null ? DataManager.Instance.displaySelected[j] : false;

        DataManager.Instance.BPMEntryMode = ProfileManager.Instance.currentProfile.inBPMMode;

        rateSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.rateSelected : 0f;
        scoreJudgeSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.scoreJudgeSelected : Judge.NORMAL;
        hitJudgeSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.hitJudgeSelected : Judge.NORMAL;
        lifeJudgeSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.lifeJudgeSelected : Judge.NORMAL;
        skinSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.skinSelected : 0;
        raceSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.raceSelected : 0;
        deathSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.deathSelected :0;

        ratestring = rateSelected.ToString("00");

        alphaText = new float[stateLoading.Length];
        isFading = new bool[stateLoading.Length];
        alphaDisplay = new float[stateLoading.Length];
        isFadingDisplay = new bool[stateLoading.Length];
        offsetFading = new float[stateLoading.Length];
        offsetPreviousFading = new float[stateLoading.Length];
        for(int i=0;i<stateLoading.Length;i++) offsetFading[i] = 0f;
        for(int i=0;i<stateLoading.Length;i++) offsetPreviousFading[i] = 0f;
        for(int i=0;i<stateLoading.Length;i++) isFading[i] = false;
        for(int i=0;i<stateLoading.Length;i++) alphaText[i] = 1f;
        for(int i=0;i<stateLoading.Length;i++) isFadingDisplay[i] = false;
        for(int i=0;i<stateLoading.Length;i++) alphaDisplay[i] = displaySelected[i] ? 1f : 0f;

        if(DataManager.Instance.quickMode){
            timeOption = 0.02f;
        }
    }
        /// <summary>
        /// Lägger till en domare i databasen och i listViewJudge
        /// </summary>
        /// <param name="newJudgeName"></param>
        /// <param name="listViewJudge"></param>
        public static void AddNewJudge(TextBox newJudgeName, ListView listViewJudge)
        {
            //lägger till den nya domaren i databasen
            Judge judge = new Judge(newJudgeName.Text);
            int ID = Database.AddJudgeToDatabase(judge);

            ListViewItem item1 = new ListViewItem();
            item1.Text = ID.ToString();
            listViewJudge.Items.Add(item1);

            item1.SubItems.Add(judge.Name);

            //restore textbox
            newJudgeName.Text = "Namn";
        }
Beispiel #52
0
    void Start()
    {
        //Listを全てコピー
        fieldCardObj_Buck = new List<GameObject> (fieldCardObj);
        fieldCardNum_Buck = new List<int> (fieldCardNum);
        fieldCardMark_Buck = new List<int> (fieldCardMark);

        //ゲットコンポーネントする
        judge = GetComponent<Judge>();
        audioSource = GetComponent<AudioSource> ();
        turn = GetComponent<TouchMan>();
    }
Beispiel #53
0
    // Use this for initialization
    void Start()
    {
        MainSpriteRenderer = gameObject.GetComponent<SpriteRenderer>();
        MainSpriteRenderer.sprite = Faces[9];
                //coment.text = "よろしくね!";

        judge = GetComponent<Judge> ();
        carde = FindObjectOfType<Card>();
    }