Пример #1
0
        private static int YieldFactor(Card[] cards)
        {
            ScoreRank rank = GetRank(cards);

            switch (rank)
            {
            case ScoreRank.Pok:
                return((cards[0].Number == cards[1].Number || cards[0].CardType == cards[1].CardType)
                        ? 2 : 1);

            case ScoreRank.Three:
                return(5);

            case ScoreRank.Ghost:
            case ScoreRank.Sequence:
            case ScoreRank.Tripple:
                return(3);

            case ScoreRank.Double:
                return(2);

            default:
                return(1);
            }
        }
Пример #2
0
        /// <summary>
        /// Retrieves the colour for a <see cref="ScoreRank"/>.
        /// </summary>
        public static Color4 ForRank(ScoreRank rank)
        {
            switch (rank)
            {
            case ScoreRank.XH:
            case ScoreRank.X:
                return(Color4Extensions.FromHex(@"de31ae"));

            case ScoreRank.SH:
            case ScoreRank.S:
                return(Color4Extensions.FromHex(@"02b5c3"));

            case ScoreRank.A:
                return(Color4Extensions.FromHex(@"88da20"));

            case ScoreRank.B:
                return(Color4Extensions.FromHex(@"e3b130"));

            case ScoreRank.C:
                return(Color4Extensions.FromHex(@"ff8e5d"));

            default:
                return(Color4Extensions.FromHex(@"ff5a5a"));
            }
        }
    public void Set(ScoreRank rank)
    {
        gameObject.SetActive(true);

        nameUI.text = rank.Name;
        scoreUI.text = rank.Score.ToString();
    }
Пример #4
0
    public void FinishLevel()
    {
        var data = new ScoreRank();

        data.score = score;
        if (ifSend)
        {
        }
        else
        {
            bmobUnity.Create("scoreRank", data, (resp, exception) =>
            {
                if (exception != null)
                {
                    print("保存失败,失败原因为 " + exception.Message);
                    return;
                }
                ifSend = true;
                print("保存成功,@" + resp.createdAt);
            });
        }
        showMenu = !showMenu;
        deadMenu.SetActive(showMenu);
        titleText.text = "MISSION Finish";
    }
Пример #5
0
    public bool ScoreRank_Bind()///分数排行绑定数据
    {
        DB            db           = new DB();
        string        scoreRankstr = "SELECT GAME_RECORD.jobskyerID,gamScore,jobName FROM GAME_RECORD,JOBSKYER WHERE GAME_RECORD.jobskyerID=JOBSKYER.jobskyerID ORDER BY gamScore desc";
        SqlConnection con          = new SqlConnection();

        con = db.GetCon();
        con.Open();
        SqlCommand    com = new SqlCommand(scoreRankstr, con);
        SqlDataReader dr  = com.ExecuteReader();

        try
        {
            ScoreRank.DataSource = dr;
            ScoreRank.DataBind();
        }
        catch (Exception ex)
        {
            return(false);
        }
        finally
        {
            com.Dispose();
            con.Close();
        }
        return(true);
    }
Пример #6
0
            public ScoreRankInfo(ScoreRank rank)
            {
                this.rank = rank;

                AutoSizeAxes  = Axes.Both;
                InternalChild = new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Y,
                    Width        = 56,
                    Direction    = FillDirection.Vertical,
                    Children     = new Drawable[]
                    {
                        rankSprite = new Sprite
                        {
                            RelativeSizeAxes = Axes.Both,
                            FillMode         = FillMode.Fit
                        },
                        rankCount = new OsuSpriteText
                        {
                            Font   = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre
                        }
                    }
                };
            }
Пример #7
0
    private void EndGame()
    {
        GameRunning = false;

        ScoreRank scoreRank = GetScoreRank(true);

        CharacterCreation.Instance.NumberOfSuspects = scoreRank.NumberOfSuspects;

        string scoreColorAsString = '#' + ColorUtility.ToHtmlStringRGBA(scoreRank.Color);

        FindObjectOfType <DialogueRunner>().variableStorage.SetValueNoLeading(ScoreColorName, scoreColorAsString);

        FindObjectOfType <DialogueUI>().onDialogueEnd.AddListener(() =>
        {
            AsyncOperation loadSceneOperation = SceneManager.LoadSceneAsync(1); // Load Main Menu
            loadSceneOperation.completed     += op =>
            {
                CharacterCreation.Instance.CreateSuspects();

                DialogueRunner dialogueRunner     = FindObjectOfType <DialogueRunner>();
                dialogueRunner.startNode          = "MainMenu-Return";
                dialogueRunner.startAutomatically = true;
            };
        });

        FindObjectOfType <DialogueController>().StartPostGameDialogue();
    }
Пример #8
0
            public int this[ScoreRank rank]
            {
                get
                {
                    switch (rank)
                    {
                    case ScoreRank.XH:
                        return(SSPlus);

                    case ScoreRank.X:
                        return(SS);

                    case ScoreRank.SH:
                        return(SPlus);

                    case ScoreRank.S:
                        return(S);

                    case ScoreRank.A:
                        return(A);

                    default:
                        throw new ArgumentException($"API does not return {rank.ToString()}");
                    }
                }
            }
Пример #9
0
            protected override LocalisableString LabelFor(ScoreRank value)
            {
                switch (value)
                {
                case ScoreRank.XH:
                    return(BeatmapsStrings.RankXH);

                case ScoreRank.X:
                    return(BeatmapsStrings.RankX);

                case ScoreRank.SH:
                    return(BeatmapsStrings.RankSH);

                case ScoreRank.S:
                    return(BeatmapsStrings.RankS);

                case ScoreRank.A:
                    return(BeatmapsStrings.RankA);

                case ScoreRank.B:
                    return(BeatmapsStrings.RankB);

                case ScoreRank.C:
                    return(BeatmapsStrings.RankC);

                case ScoreRank.D:
                    return(BeatmapsStrings.RankD);

                default:
                    throw new ArgumentException("Unsupported value.", nameof(value));
                }
            }
Пример #10
0
        /// <summary>
        /// Retrieves the colour for a <see cref="ScoreRank"/>.
        /// </summary>
        public static Color4 ForRank(ScoreRank rank)
        {
            switch (rank)
            {
            case ScoreRank.XH:
            case ScoreRank.X:
                return(Color4Extensions.FromHex(@"ce1c9d"));

            case ScoreRank.SH:
            case ScoreRank.S:
                return(Color4Extensions.FromHex(@"00a8b5"));

            case ScoreRank.A:
                return(Color4Extensions.FromHex(@"7cce14"));

            case ScoreRank.B:
                return(Color4Extensions.FromHex(@"e3b130"));

            case ScoreRank.C:
                return(Color4Extensions.FromHex(@"f18252"));

            default:
                return(Color4Extensions.FromHex(@"e95353"));
            }
        }
Пример #11
0
        public void GetRankWorksCorrectly(Card[] cards, ScoreRank expected)
        {
            var sut    = new Pokdeng();
            var result = sut.GetRank(cards);

            result.Should().Be(expected);
        }
Пример #12
0
        public RankBadge(double accuracy, ScoreRank rank)
        {
            Accuracy  = accuracy;
            this.rank = rank;

            RelativeSizeAxes = Axes.Both;
            Alpha            = 0;
        }
Пример #13
0
        public void UpdateRank(ScoreRank newRank)
        {
            Rank = newRank;

            if (IsLoaded)
            {
                updateTexture();
            }
        }
Пример #14
0
        private ScoreRank getRank(ScoreRank rank)
        {
            foreach (var mod in score.Mods.OfType <IApplicableToScoreProcessor>())
            {
                rank = mod.AdjustRank(rank, score.Accuracy);
            }

            return(rank);
        }
Пример #15
0
        public void UpdateRank(ScoreRank newRank)
        {
            Rank = newRank;

            if (LoadState >= LoadState.Ready)
            {
                updateTexture();
            }
        }
Пример #16
0
        public RankText(ScoreRank rank)
        {
            this.rank = rank;

            Anchor = Anchor.Centre;
            Origin = Anchor.Centre;

            Alpha        = 0;
            AutoSizeAxes = Axes.Both;
        }
Пример #17
0
        public DrawableRank(ScoreRank rank)
        {
            Rank = rank;

            Children = new Drawable[]
            {
                sprite = new Sprite
                {
                    RelativeSizeAxes = Axes.Both,
                },
            };
        }
Пример #18
0
        public void TestResultsWithPlayer(double accuracy, ScoreRank rank)
        {
            TestResultsScreen screen = null;

            var score = TestResources.CreateTestScoreInfo();

            score.Accuracy = accuracy;
            score.Rank     = rank;

            AddStep("load results", () => Child = new TestResultsContainer(screen = createResultsScreen(score)));
            AddUntilStep("wait for loaded", () => screen.IsLoaded);
            AddAssert("retry overlay present", () => screen.RetryOverlay != null);
        }
Пример #19
0
        public DrawableRank(ScoreRank rank)
        {
            this.rank = rank;

            RelativeSizeAxes = Axes.Both;
            FillMode         = FillMode.Fit;
            FillAspectRatio  = 2;

            var rankColour = OsuColour.ForRank(rank);

            InternalChild = new DrawSizePreservingFillContainer
            {
                TargetDrawSize = new Vector2(64, 32),
                Strategy       = DrawSizePreservationStrategy.Minimum,
                Child          = new CircularContainer
                {
                    Masking          = true,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = rankColour,
                        },
                        new Triangles
                        {
                            RelativeSizeAxes = Axes.Both,
                            ColourDark       = rankColour.Darken(0.1f),
                            ColourLight      = rankColour.Lighten(0.1f),
                            Velocity         = 0.25f,
                        },
                        new OsuSpriteText
                        {
                            Anchor  = Anchor.Centre,
                            Origin  = Anchor.Centre,
                            Spacing = new Vector2(-3, 0),
                            Padding = new MarginPadding {
                                Top = 5
                            },
                            Colour       = getRankNameColour(),
                            Font         = OsuFont.Numeric.With(size: 25),
                            Text         = GetRankName(rank),
                            ShadowColour = Color4.Black.Opacity(0.3f),
                            ShadowOffset = new Vector2(0, 0.08f),
                            Shadow       = true,
                        },
                    }
                }
            };
        }
Пример #20
0
        public DrawableRank(ScoreRank rank)
        {
            Rank = rank;

            Children = new Drawable[]
            {
                rankSprite = new Sprite
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    FillMode = FillMode.Fit
                },
            };
        }
            protected override string LabelFor(ScoreRank value)
            {
                switch (value)
                {
                case ScoreRank.XH:
                    return(@"Silver SS");

                case ScoreRank.SH:
                    return(@"Silver S");

                default:
                    return(value.GetDescription());
                }
            }
Пример #22
0
        public ScoreRank AdjustRank(ScoreRank rank, double accuracy)
        {
            switch (rank)
            {
            case ScoreRank.X:
                return(ScoreRank.XH);

            case ScoreRank.S:
                return(ScoreRank.SH);

            default:
                return(rank);
            }
        }
Пример #23
0
        public DrawableRank(ScoreRank rank)
        {
            Rank = rank;

            Children = new Drawable[]
            {
                rankSprite = new Sprite
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    FillMode         = FillMode.Fit
                },
            };
        }
Пример #24
0
    private IEnumerator CheckMatch()
    {
        string sp1, sp2;

        sp1 = _firstRevealed.GetComponent <SpriteRenderer>().sprite.name;
        sp2 = _secondRevealed.GetComponent <SpriteRenderer>().sprite.name;
        if (sp1.Equals(sp2))
        {
            _score++;
            ScoreRank scoreRank = GetScoreRank(true);
            scoreLabel.color = scoreRank.Color;
            scoreLabel.text  = _score.ToString();
        }
        else
        {
            yield return(new WaitForSeconds(0.75f));

            _firstRevealed.Unreveal();
            _secondRevealed.Unreveal();
        }
        _firstRevealed = _secondRevealed = null;
    }
Пример #25
0
 private ScoreInfo createScore(double accuracy, ScoreRank rank) => new ScoreInfo
 {
     User = new User
     {
         Id       = 2,
         Username = "******",
     },
     BeatmapInfo = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo,
     Mods        = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() },
     TotalScore  = 2845370,
     Accuracy    = accuracy,
     MaxCombo    = 999,
     Rank        = rank,
     Date        = DateTimeOffset.Now,
     Statistics  =
     {
         { HitResult.Miss,    1 },
         { HitResult.Meh,    50 },
         { HitResult.Good,  100 },
         { HitResult.Great, 300 },
     }
 };
Пример #26
0
 public ScoreRankInfo(ScoreRank rank)
 {
     AutoSizeAxes  = Axes.Both;
     InternalChild = new FillFlowContainer
     {
         AutoSizeAxes = Axes.Y,
         Width        = 56,
         Direction    = FillDirection.Vertical,
         Children     = new Drawable[]
         {
             new DrawableRank(rank)
             {
                 RelativeSizeAxes = Axes.X,
                 Height           = 30,
             },
             rankCount = new OsuSpriteText
             {
                 Font   = OsuFont.GetFont(size: 20, weight: FontWeight.Bold),
                 Anchor = Anchor.TopCentre,
                 Origin = Anchor.TopCentre
             }
         }
     };
 }
Пример #27
0
 protected override MultipleSelectionFilterTabItem CreateTabItem(ScoreRank value) => new RankItem(value);
Пример #28
0
 public static string GetRankName(ScoreRank rank) => rank.GetDescription().TrimEnd('+');
Пример #29
0
 public void UpdateRank(ScoreRank newRank)
 {
     Rank = newRank;
     updateTexture();
 }
Пример #30
0
 public RankItem(ScoreRank value)
     : base(value)
 {
 }
Пример #31
0
 public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;