public CardReplacer(Th095Converter parent, bool hideUntriedCards)
            {
                this.evaluator = new MatchEvaluator(match =>
                {
                    var level = LevelParser.Parse(match.Groups[1].Value);
                    var scene = int.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture);
                    var type  = int.Parse(match.Groups[3].Value, CultureInfo.InvariantCulture);

                    var key = new LevelScenePair(level, scene);
                    if (!SpellCards.ContainsKey(key))
                    {
                        return(match.ToString());
                    }

                    if (hideUntriedCards)
                    {
                        var score = parent.allScoreData.Scores.Find(
                            elem => (elem != null) && elem.LevelScene.Equals(key));
                        if (score == null)
                        {
                            return("??????????");
                        }
                    }

                    return((type == 1) ? SpellCards[key].Enemy.ToLongName() : SpellCards[key].Card);
                });
            }
예제 #2
0
    IEnumerator start()
    {
        if (spriteRenderer == null)
        {
            spriteRenderer = gameObject.AddComponent <SpriteRenderer>();
        }

        百鬼夜行 sc;

        sc            = gameObject.AddComponent <百鬼夜行>();
        sc.enabled    = false;
        sc.Difficulty = Difficulty;
        sc.player     = player;
        SpellCards.Add(sc);

        foreach (SpellCard spellCard in SpellCards)
        {
            spellCard.enabled = true;
            HealPoint         = spellCard.HealPoint;
            do
            {
                yield return(new WaitForSeconds(0.5f));
            } while (!(HealPoint <= 0 || spellCard.time <= 0f));
            Destroy(spellCard);
        }
    }
예제 #3
0
 private void Start()
 {
     client          = FindObjectOfType <Client>();
     com             = FindObjectOfType <Command>();
     spells          = FindObjectOfType <SpellCards>();
     cooldownManager = FindObjectOfType <SpellManager>();
     soundManager    = FindObjectOfType <SoundManager>();
     turnText        = GameObject.Find("TurnText").GetComponent <TextMeshPro>();
     playerIsWhite   = client.isHost;
     Instance        = this;
     spawnAllChessmen();
     cooldownManager.spellButtonsEnable(isWhiteTurn == playerIsWhite);
 }
예제 #4
0
    void Start()
    {
        if (spriteRenderer == null)
        {
            spriteRenderer = gameObject.AddComponent <SpriteRenderer>();
        }

        lineBullet = gameObject.AddComponent <LineBullet>();
        lineBullet.SetFaceAngle(0);
        lineBullet.IsRotatToFace = false;

        for (int i = 1; i < 13; i++)
        {
            Texture2D texture = (Texture2D)Resources.Load($"贴图/敌机/博丽灵梦/博丽灵梦 ({i})");
            sprites.Add(Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)));
        }
        SpellCards.Add(gameObject.AddComponent <梦想封印>());
        ((梦想封印)SpellCards[0]).player        = player;
        ((梦想封印)SpellCards[0]).Difficulty    = Difficulty;
        ((梦想封印)SpellCards[0]).ObjLinebullet = lineBullet;
    }
            public ShotReplacer(Th095Converter parent, string outputFilePath)
            {
                this.evaluator = new MatchEvaluator(match =>
                {
                    var level = LevelParser.Parse(match.Groups[1].Value);
                    var scene = int.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture);

                    var key = new LevelScenePair(level, scene);
                    if (!SpellCards.ContainsKey(key))
                    {
                        return(match.ToString());
                    }

                    BestShotPair bestshot;
                    if (!string.IsNullOrEmpty(outputFilePath) &&
                        parent.bestshots.TryGetValue(key, out bestshot))
                    {
                        var relativePath = new Uri(outputFilePath)
                                           .MakeRelativeUri(new Uri(bestshot.Path)).OriginalString;
                        var alternativeString = Utils.Format(
                            "ClearData: {0}{3}Slow: {1:F6}%{3}SpellName: {2}",
                            Utils.ToNumberString(bestshot.Header.Score),
                            bestshot.Header.SlowRate,
                            Encoding.Default.GetString(bestshot.Header.CardName).TrimEnd('\0'),
                            Environment.NewLine);
                        return(Utils.Format(
                                   "<img src=\"{0}\" alt=\"{1}\" title=\"{1}\" border=0>",
                                   relativePath,
                                   alternativeString));
                    }
                    else
                    {
                        return(string.Empty);
                    }
                });
            }
            public ScoreReplacer(Th095Converter parent)
            {
                this.evaluator = new MatchEvaluator(match =>
                {
                    var level = LevelParser.Parse(match.Groups[1].Value);
                    var scene = int.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture);
                    var type  = int.Parse(match.Groups[3].Value, CultureInfo.InvariantCulture);

                    var key = new LevelScenePair(level, scene);
                    if (!SpellCards.ContainsKey(key))
                    {
                        return(match.ToString());
                    }

                    var score = parent.allScoreData.Scores.Find(
                        elem => (elem != null) && elem.LevelScene.Equals(key));

                    switch (type)
                    {
                    case 1:         // high score
                        return((score != null) ? Utils.ToNumberString(score.HighScore) : "0");

                    case 2:         // bestshot score
                        return((score != null) ? Utils.ToNumberString(score.BestshotScore) : "0");

                    case 3:         // num of shots
                        return((score != null) ? Utils.ToNumberString(score.TrialCount) : "0");

                    case 4:         // slow rate
                        return((score != null) ? Utils.Format("{0:F3}%", score.SlowRate2) : "-----%");

                    default:        // unreachable
                        return(match.ToString());
                    }
                });
            }
            public ShotExReplacer(Th095Converter parent, string outputFilePath)
            {
                this.evaluator = new MatchEvaluator(match =>
                {
                    var level = LevelParser.Parse(match.Groups[1].Value);
                    var scene = int.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture);
                    var type  = int.Parse(match.Groups[3].Value, CultureInfo.InvariantCulture);

                    var key = new LevelScenePair(level, scene);
                    if (!SpellCards.ContainsKey(key))
                    {
                        return(match.ToString());
                    }

                    BestShotPair bestshot;
                    if (!string.IsNullOrEmpty(outputFilePath) &&
                        parent.bestshots.TryGetValue(key, out bestshot))
                    {
                        switch (type)
                        {
                        case 1:         // relative path to the bestshot file
                            return(new Uri(outputFilePath)
                                   .MakeRelativeUri(new Uri(bestshot.Path)).OriginalString);

                        case 2:         // width
                            return(bestshot.Header.Width.ToString(CultureInfo.InvariantCulture));

                        case 3:         // height
                            return(bestshot.Header.Height.ToString(CultureInfo.InvariantCulture));

                        case 4:         // score
                            return(Utils.ToNumberString(bestshot.Header.Score));

                        case 5:         // slow rate
                            return(Utils.Format("{0:F6}%", bestshot.Header.SlowRate));

                        case 6:         // date & time
                            {
                                var score = parent.allScoreData.Scores.Find(
                                    elem => (elem != null) && elem.LevelScene.Equals(key));
                                if (score != null)
                                {
                                    return(new DateTime(1970, 1, 1)
                                           .AddSeconds(score.DateTime).ToLocalTime()
                                           .ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.CurrentCulture));
                                }
                                else
                                {
                                    return("----/--/-- --:--:--");
                                }
                            }

                        default:        // unreachable
                            return(match.ToString());
                        }
                    }
                    else
                    {
                        switch (type)
                        {
                        case 1: return(string.Empty);

                        case 2: return("0");

                        case 3: return("0");

                        case 4: return("--------");

                        case 5: return("-----%");

                        case 6: return("----/--/-- --:--:--");

                        default: return(match.ToString());
                        }
                    }
                });
            }