Пример #1
0
    [MenuItem("GameObject/Set Pivot")] //Place the Set Pivot menu item in the GameObject menu
    static void Init()
    {
        SetPivot window = (SetPivot)EditorWindow.GetWindow(typeof(SetPivot));

        window.RecognizeSelectedObject();         //Initialize the variables by calling RecognizeSelectedObject on the class instance
        window.Show();
    }
Пример #2
0
        public void Test_DoubleYakuPai()
        {
            SetPivot openedSets = new SetPivot(new TilePivot(WindPivot.East),
                                               new TilePivot(WindPivot.East),
                                               new TilePivot(WindPivot.East));

            List <TilePivot> tiles = new List <TilePivot>
            {
                new TilePivot(FamilyPivot.Bamboo, 4),
                new TilePivot(FamilyPivot.Bamboo, 5),
                new TilePivot(FamilyPivot.Bamboo, 6),
                new TilePivot(FamilyPivot.Bamboo, 5),
                new TilePivot(FamilyPivot.Bamboo, 6),
                new TilePivot(FamilyPivot.Bamboo, 7),
                new TilePivot(FamilyPivot.Circle, 3),
                new TilePivot(FamilyPivot.Circle, 3),
                new TilePivot(FamilyPivot.Circle, 1),
                new TilePivot(FamilyPivot.Circle, 2)
            };

            tiles = tiles.OrderBy(x => _randomizer.Next()).ToList();

            FullHandPivot handPivot = new FullHandPivot(tiles, WindPivot.East, WindPivot.East,
                                                        new TilePivot(FamilyPivot.Circle, 3),
                                                        openedSets: new List <SetPivot> {
                openedSets
            });

            List <HandYakuListPivot> groupsOfYakus = handPivot.ComputeHandYakus();

            Assert.IsNotNull(groupsOfYakus);
            Assert.AreEqual(1, groupsOfYakus.Count);
            Assert.IsNotNull(groupsOfYakus[0]);
            Assert.AreEqual(2, groupsOfYakus[0].Yakus.Count);
            Assert.IsTrue(groupsOfYakus[0].Yakus.All(y => y.Name == YakuPivot.Yakuhai));
        }