Ejemplo n.º 1
0
 public void DropPiecePicture(IEnumerable <Uri> uris, PiecePictureType ppt)
 {
     foreach (var uri in uris)
     {
         Console.WriteLine(uri.LocalPath);
         AddPiecePicture(uri.LocalPath, ppt, false);
     }
     RedrawViewImage();
 }
Ejemplo n.º 2
0
        // リストを全消去する
        // リストの選択項目を削除する
        private void DeletePiecePictureAll(PiecePictureType ppt)
        {
            switch (ppt)
            {
            case PiecePictureType.Main:
                if (PiecePictureList1.Count == 0)
                {
                    return;
                }
                {
                    foreach (string name in PiecePictureList1)
                    {
                        piecePictureData.Remove(name);
                    }
                    PiecePictureList1.Clear();
                    PiecePictureIndex1.Value = -1;
                    RedrawViewImage();
                }
                break;

            case PiecePictureType.Support:
                if (PiecePictureList2.Count == 0)
                {
                    return;
                }
                {
                    foreach (string name in PiecePictureList2)
                    {
                        piecePictureData.Remove(name);
                    }
                    PiecePictureList2.Clear();
                    PiecePictureIndex2.Value = -1;
                    RedrawViewImage();
                }
                break;

            case PiecePictureType.Base:
                if (PiecePictureList3.Count == 0)
                {
                    return;
                }
                {
                    foreach (string name in PiecePictureList3)
                    {
                        piecePictureData.Remove(name);
                    }
                    PiecePictureList3.Clear();
                    PiecePictureIndex3.Value = -1;
                    RedrawViewImage();
                }
                break;
            }
        }
Ejemplo n.º 3
0
        // リストの選択項目を削除する
        private void DeletePiecePicture(PiecePictureType ppt)
        {
            switch (ppt)
            {
            case PiecePictureType.Main:
                if (PiecePictureIndex1.Value < 0)
                {
                    return;
                }
                {
                    int    selectedIndex = PiecePictureIndex1.Value;
                    string temp          = PiecePictureList1[selectedIndex];
                    PiecePictureList1.RemoveAt(selectedIndex);
                    piecePictureData.Remove(temp);
                    PiecePictureIndex1.Value = Math.Min(selectedIndex, PiecePictureList1.Count - 1);
                    RedrawViewImage();
                }
                break;

            case PiecePictureType.Support:
                if (PiecePictureIndex2.Value < 0)
                {
                    return;
                }
                {
                    int    selectedIndex = PiecePictureIndex2.Value;
                    string temp          = PiecePictureList2[selectedIndex];
                    PiecePictureList2.RemoveAt(selectedIndex);
                    piecePictureData.Remove(temp);
                    PiecePictureIndex2.Value = Math.Min(selectedIndex, PiecePictureList2.Count - 1);
                    RedrawViewImage();
                }
                break;

            case PiecePictureType.Base:
                if (PiecePictureIndex3.Value < 0)
                {
                    return;
                }
                {
                    int    selectedIndex = PiecePictureIndex3.Value;
                    string temp          = PiecePictureList3[selectedIndex];
                    PiecePictureList3.RemoveAt(selectedIndex);
                    piecePictureData.Remove(temp);
                    PiecePictureIndex3.Value = Math.Min(selectedIndex, PiecePictureList3.Count - 1);
                    RedrawViewImage();
                }
                break;
            }
        }
Ejemplo n.º 4
0
        // リストの選択項目を下に移動させる
        private void MoveDownPiecePicture(PiecePictureType ppt)
        {
            switch (ppt)
            {
            case PiecePictureType.Main:
                if (PiecePictureIndex1.Value >= PiecePictureList1.Count - 1 || PiecePictureIndex1.Value < 0)
                {
                    return;
                }
                {
                    int    selectedIndex = PiecePictureIndex1.Value;
                    string temp          = PiecePictureList1[selectedIndex];
                    PiecePictureList1[selectedIndex]     = PiecePictureList1[selectedIndex + 1];
                    PiecePictureList1[selectedIndex + 1] = temp;
                    PiecePictureIndex1.Value             = selectedIndex + 1;
                    RedrawViewImage();
                }
                break;

            case PiecePictureType.Support:
                if (PiecePictureIndex2.Value >= PiecePictureList2.Count - 1 || PiecePictureIndex2.Value < 0)
                {
                    return;
                }
                {
                    int    selectedIndex = PiecePictureIndex2.Value;
                    string temp          = PiecePictureList2[selectedIndex];
                    PiecePictureList2[selectedIndex]     = PiecePictureList2[selectedIndex + 1];
                    PiecePictureList2[selectedIndex + 1] = temp;
                    PiecePictureIndex2.Value             = selectedIndex + 1;
                    RedrawViewImage();
                }
                break;

            case PiecePictureType.Base:
                if (PiecePictureIndex3.Value >= PiecePictureList3.Count - 1 || PiecePictureIndex3.Value < 0)
                {
                    return;
                }
                {
                    int    selectedIndex = PiecePictureIndex3.Value;
                    string temp          = PiecePictureList3[selectedIndex];
                    PiecePictureList3[selectedIndex]     = PiecePictureList3[selectedIndex + 1];
                    PiecePictureList3[selectedIndex + 1] = temp;
                    PiecePictureIndex3.Value             = selectedIndex + 1;
                    RedrawViewImage();
                }
                break;
            }
        }
Ejemplo n.º 5
0
        // 画像ファイルを追加する
        // ただし種別による選別は施す(当てはまらない画像データはインポートしないように設定)
        private void AddPiecePicture(string fileName, PiecePictureType ppt, bool redrawFlg = true)
        {
            if (fileName == "")
            {
                return;
            }
            switch (ppt)
            {
            case PiecePictureType.Main:
                if (PiecePictureList1.Count >= 12)
                {
                    return;
                }
                break;

            case PiecePictureType.Support:
                if (PiecePictureList2.Count >= 12)
                {
                    return;
                }
                break;

            case PiecePictureType.Base:
                if (PiecePictureList3.Count >= 3)
                {
                    return;
                }
                break;
            }
            try {
                var image = new Bitmap(fileName);
                //
                if (image.Width != 800 || image.Height != 480)
                {
                    return;
                }
                if (ppt != PiecePictureType.Base && !IsRefitScene(image))
                {
                    return;
                }
                if (ppt == PiecePictureType.Base && !IsBaseScene(image))
                {
                    return;
                }
                //
                string key = System.IO.Path.GetFileNameWithoutExtension(fileName);
                if (piecePictureData.ContainsKey(key))
                {
                    for (int i = 1; ; ++i)
                    {
                        string key2 = $"{key}_{i}";
                        if (!piecePictureData.ContainsKey(key2))
                        {
                            key = key2;
                            break;
                        }
                    }
                }
                piecePictureData[key] = image;
                switch (ppt)
                {
                case PiecePictureType.Main:
                    PiecePictureList1.Add(key);
                    break;

                case PiecePictureType.Support:
                    PiecePictureList2.Add(key);
                    break;

                case PiecePictureType.Base:
                    PiecePictureList3.Add(key);
                    break;
                }
                if (redrawFlg)
                {
                    RedrawViewImage();
                }
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }
        }