예제 #1
0
        static void CreatePaifuList(string Argument, List<Argument> ArgList, List<Search.Result> Results)
        {
            string Dir = "paifu";
            int ShowShanten = 0;
            int ShowYaku = 1;
            int ShowNames = 1;
            int ShowDanger = 1;
            int ShowColor = 1;
            int ShowSex = 0;

            // Parse options
            foreach (Argument A in ArgList)
            {
                switch (A.Name)
                {
                    case "tileset":
                        Paifu.PaifuTileImage.TilesDirectory = A.Value;
                        break;
                    case "dir":
                        Dir = A.Value;
                        if (!Directory.Exists(Dir))
                            Directory.CreateDirectory(Dir);
                        break;
                    case "shanten":
                        ShowShanten = ParseBoolArg(A.Value, "shanten");
                        break;
                    case "yaku":
                        ShowYaku = ParseBoolArg(A.Value, "yaku");
                        break;
                    case "nickname":
                        ShowNames = ParseBoolArg(A.Value, "nickname");
                        break;
                    case "danger":
                        ShowDanger = ParseBoolArg(A.Value, "danger");
                        break;
                    case "color":
                        ShowColor = ParseBoolArg(A.Value, "color");
                        break;
                    case "sex":
                        ShowSex = ParseBoolArg(A.Value, "sex");
                        break;
                }
            }

            for (int i = 0; i < Results.Count; i++)
            {
                Search.Result R = Results[i];

                Console.Title = String.Format("Paifu creating {0:d}/{1:d}", i + 1, Results.Count);

                for (int r = 0; r < R.Replay.Rounds.Count; r++)
                {
                    Mahjong.Round Rnd = R.Replay.Rounds[r];

                    if (!R.RoundMark[r]) continue;

                    Paifu.PaifuGenerator P = new Paifu.PaifuGenerator(R.Replay, r);

                    string FileName = String.Format("./{0:s}/{1:s}_{2:d}.png", Dir, R.Replay.Hash, r);

                    P.ShowShanten = ShowShanten;
                    P.ShowDanger = ShowDanger;
                    P.ShowYakuInfo = ShowYaku;
                    P.ShowNames = ShowNames;
                    P.ShowColor = ShowColor;
                    P.ShowSex = ShowSex;

                    P.Generate();
                    P.Save(FileName);
                }
            }
        }
예제 #2
0
        static void CreatePaifu(string Hash, List<Argument> ArgList, List<Search.Result> Results)
        {
            string Dir = "paifu";
            string FN = null;
            int Round = -1;
            int ShowShanten = 0;
            int ShowYaku = 1;
            int ShowNames = 1;
            int ShowDanger = 1;
            int ShowColor = 1;
            int ShowSex = 0;

            if (Hash.CompareTo("") == 0)
            {
                Console.WriteLine("Error: Hash not defined.");
                return;
            }

            Hash = new Tenhou.TenhouHash(Hash).DecodedHash;

            // Parse options
            foreach (Argument A in ArgList)
            {
                switch (A.Name)
                {
                    case "tileset":
                        Paifu.PaifuTileImage.TilesDirectory = A.Value;
                        break;
                    case "dir":
                        Dir = A.Value;
                        break;
                    case "round":
                        Round = Convert.ToInt32(A.Value);
                        break;
                    case "filename":
                        FN = A.Value;
                        break;
                    case "shanten":
                        ShowShanten = ParseBoolArg(A.Value, "shanten");
                        break;
                    case "yaku":
                        ShowYaku = ParseBoolArg(A.Value, "yaku");
                        break;
                    case "nickname":
                        ShowNames = ParseBoolArg(A.Value, "nickname");
                        break;
                    case "danger":
                        ShowDanger = ParseBoolArg(A.Value, "danger");
                        break;
                    case "color":
                        ShowColor = ParseBoolArg(A.Value, "color");
                        break;
                    case "sex":
                        ShowSex = ParseBoolArg(A.Value, "sex");
                        break;
                }
            }

            Mahjong.Replay R = new Mahjong.Replay();
            R.LoadXml(Hash);

            for (int i = 0; i < R.Rounds.Count; i++)
            {
                if ((Round != -1) && (Round != i)) continue;

                Paifu.PaifuGenerator P = new Paifu.PaifuGenerator(R, i);

                string FileName;

                if (FN == null)
                {
                    if (!Directory.Exists(Dir)) Directory.CreateDirectory(Dir);
                    FileName = String.Format("./{0:s}/{1:s}_{2:d}.png", Dir, Hash, i);
                }
                else
                {
                    FileName = (Round == -1) ? String.Format("{0:s}_{1:d}.png", FN, i) : String.Format("{0:s}.png", FN);
                }

                P.ShowShanten = ShowShanten;
                P.ShowDanger = ShowDanger;
                P.ShowYakuInfo = ShowYaku;
                P.ShowNames = ShowNames;
                P.ShowColor = ShowColor;
                P.ShowSex = ShowSex;

                P.Generate();
                P.Save(FileName);
            }
        }