Exemplo n.º 1
0
        // パーティー分析
        private async Task PartyAnalysisAsync(
            CaptureImageManegementModel captureImageManegementModel,
            PartyManegementModel partyManegementModel,
            PartyWaitStateModel partyWaitStateModel)
        {
            // ポケモンIDコンバーター
            PokemonIdConverterModel pokemonIdConverterModel = new PokemonIdConverterModel();

            // パーティー初期化
            partyManegementModel.PartyReset();

            for (int i = PartyConst.FIRST; i <= PartyConst.SIXTH; i++)
            {
                // 待機演出開始
                partyWaitStateModel.Start(i);

                // 画像切り取り
                Bitmap myBitmap = await Task.Run(() => captureImageManegementModel.PartyPokemonImage(i));

                // 画像分析
                int pokemonId = Analysis(myBitmap);

                // ポケモンIDをオリジナルに変換
                int originalPokemonId = pokemonIdConverterModel.ToOriginalPokemonId(pokemonId);

                // 待機演出終了
                bool a = await partyWaitStateModel.End(i);

                Console.WriteLine("OriginalPokemonID = " + originalPokemonId.ToString());

                // 分析結果からポケモンイメージを表示
                partyManegementModel.ChangePokemonId(i, originalPokemonId);
            }
        }
Exemplo n.º 2
0
        private List <Rectangle> CreateIconSurroundRects(Rectangle rectangle, CaptureImageManegementModel captureImageManegementModel)
        {
            // アイコン部分を囲む矩形リストを作成
            List <Rectangle> iconSurroundRects = new List <Rectangle>();

            for (int i = PartyConst.FIRST; i <= PartyConst.SIXTH; i++)
            {
                // 矩形範囲
                var relativeRectangle = captureImageManegementModel.GetPartyRelativeRectangle(i);

                // パーティー
                iconSurroundRects.Add(new Rectangle(
                                          (int)(rectangle.Width * relativeRectangle.X),
                                          (int)(rectangle.Height * relativeRectangle.Y),
                                          (int)(rectangle.Width * relativeRectangle.Width),
                                          (int)(rectangle.Height * relativeRectangle.Height)
                                          ));
            }

            return(iconSurroundRects);
        }