Esempio n. 1
0
    /// <summary>
    /// 杠牌区,根据杠牌的方位和类型,调用不同杠牌方法
    /// </summary>
    /// <param name="gangMsg"></param>
    /// <param name="isNotConn"></param>
    public void GangPai(GangMSG gangMsg, bool isNotConn = true)
    {
        FW fw = GameInfo.GetFW(gangMsg.fw);

        GameInfo.HYFw = GameInfo.FW;

        paipaipai.ResetDiamondPosition(paipaipai.emptyGO.transform.position);
        switch (fw)
        {
        case FW.East:
            GangEast(gangMsg.mj.PaiHS);
            break;

        case FW.West:
            GangWest(gangMsg.mj.PaiHS);
            break;

        case FW.North:
            GangNorth(gangMsg.mj.PaiHS);
            break;

        case FW.South:

            switch (gangMsg.Type)
            {
            case 1:
                print("明杠,应该不存在");
                break;

            case 2:
                print("转弯杠");
                ZhuanWanGang(gangMsg.mj.PaiHS);
                break;

            case 3:
                print("暗杠");
                AnGang(gangMsg.mj.PaiHS);
                break;

            case 4:
                print("憨包杠");
                HanBaoGang(gangMsg.mj.PaiHS);
                break;
            }
            break;
        }

        //firstShouPaiTrans.position = newFirstShouPaiTrans + pengPaiGOList.Count * shouPaiOffsetX;
        firstShouPaiTrans.position = newFirstShouPaiTrans + (13 - shouPaiGOList.Count) * shouPaiOffsetX;
    }
Esempio n. 2
0
        public void Ref(Reference value)
        {
            ForwardReference FW;

            if (null == (object)value)
            {
                Null();
            }
            else if (null == (object)(FW = value.API().FR))
            {
                throw new System.InvalidOperationException("reference value did not return a type reference from a static register");
            }
            else
            {
                FW.Ref(this, value);
            }
        }
Esempio n. 3
0
    /// <summary>
    /// 重连杠牌
    /// </summary>
    /// <param name="hs"></param>
    /// <param name="type"></param>
    /// <param name="fw"></param>
    public void GangREConnect(int hs, string type, FW fw)
    {
        switch (fw)
        {
        case FW.East:
            GangEast(hs);
            break;

        case FW.West:
            GangWest(hs);
            break;

        case FW.North:
            GangNorth(hs);
            break;

        case FW.South:

            switch (type)
            {
            case "M":
                print("明杠,应该不存在");
                break;

            case "Z":
                print("转弯杠");
                ReconZhuanWanGang(hs);
                break;

            case "A":
                print("暗杠");
                AnGang(hs);
                break;

            case "H":
                print("憨包杠");
                HanBaoGang(hs);
                break;
            }
            break;
        }
        //firstShouPaiTrans.position = newFirstShouPaiTrans + (13 - shouPaiGOList.Count) * shouPaiOffsetX;
        Debug.Log(shouPaiOffsetX);
    }
Esempio n. 4
0
    public void ReconTingPaiInfo(FW fw, string tingName, int tingState)
    {
        GameObject tempGo = new GameObject();
        Transform  tempTf = transform;

        switch (fw)
        {
        case FW.South:
            tempTf = ficSGame.AniJi_S.transform;
            break;

        case FW.East:
            tempTf = ficSGame.AniJi_E.transform;
            break;

        case FW.North:
            tempTf = ficSGame.AniJi_N.transform;
            break;

        case FW.West:
            tempTf = ficSGame.AniJi_W.transform;
            break;
        }

        if (tingName == "tianting")
        {
            tempGo = ficSGame.deskSkillGOArray[9];
        }
        else
        {
            tempGo = ficSGame.deskSkillGOArray[2];
        }
        switch (tingState)
        {
        case -1:
            break;

        case 1:
            GameObject go = GameObject.Instantiate(tempGo, tempTf.position, Quaternion.identity, ficSGame.deskSkillTran) as GameObject;
            go.transform.Find("Big1boom").gameObject.SetActive(false);
            break;
        }
    }
Esempio n. 5
0
    /// <summary>
    /// 返回退出玩家
    /// 现判断返回的状态,如果0,已经开始游戏,需要提醒?
    /// 如果1:退出成功,则需判断openid是自己还是别人
    ///                     如果是自己,则直接跳转,清空玩家信息
    ///                     如果是别人,直接清空玩家信息,将显示信息清除
    /// </summary>
    private void ReturnRemoveUser()
    {
        if (GameInfo.returnRemoveUser != null)
        {
            if (GameInfo.returnRemoveUser.status == 0)
            {//返回已经开始游戏了,需要提醒?
            }
            else
            {
                //退出成功,需判断是不是自己
                if (GameInfo.returnRemoveUser.openid == GameInfo.OpenID)
                {
                    GameInfo.MJplayers.Clear();
                    GameInfo.ClearAllListsAndChanges();
                    SceneManager.LoadScene("Scene_Hall");
                }
                else
                {
                    GameInfo.MJplayers.Remove(GameInfo.MJplayersWhoQuit[GameInfo.returnRemoveUser.openid]);
                    FW fw = GameInfo.GetFW(GameInfo.MJplayersWhoQuit[GameInfo.returnRemoveUser.openid]);

                    switch (fw)
                    {
                    case FW.East:
                        mjPlaying.rightHeadFGO.SetActive(false);
                        break;

                    case FW.West:

                        mjPlaying.leftHeadFGO.SetActive(false);
                        break;

                    case FW.North:

                        mjPlaying.frontHeadFGO.SetActive(false);
                        break;
                    }
                }
            }

            GameInfo.returnRemoveUser = null;
        }
    }
Esempio n. 6
0
        /// <summary>
        /// Removes an item from inventory, subtracts cost from user balance, and logs the transaction.
        /// </summary>
        /// <param name="userSelection">Slot number</param>
        public bool BuyItem(string userSelection)
        {
            if (Inventory[userSelection].Count == 0)       //  PREVENT THE USER FROM GETTING AN ERROR
            {
                return(false);
            }

            //IDENTIFY ITEM TO BUY
            var itemToBuy = Inventory[userSelection][0];

            if (itemToBuy.Price > Balance)                        //  "                                       "
            {
                return(false);
            }

            else if (!Inventory.ContainsKey(userSelection))      //  "                                       "
            {
                return(false);
            }

            //ADD TO LIST OF ITEMS BOUGHT
            this.ItemsBought.Add(itemToBuy);
            //REMOVE FROM INVENTORY
            this.Inventory[userSelection].Remove(itemToBuy);
            //REMOVE COST OF ITEM FROM MONEY USER INSERTED
            Balance -= itemToBuy.Price;
            //IF USER HAS BOUGHT THE LAST ITEM, REMOVE FROM INVENTORY DICTIONARY
            if (Inventory[userSelection].Count == 0)
            {
                Inventory.Remove(userSelection);
            }
            //CREATE A TRANSACTION OBJECT
            Transaction itemSold = new Transaction(itemToBuy);

            //ADD TRANSACTION TO LOG
            FW.AddLog(itemSold);
            this.TransactionLog.Add(itemSold);
            //return true;
            return(true);
        }
Esempio n. 7
0
        public void TestMethod3()
        {
            Double[,] Inarray = new Double[, ]
            {
                { 1, 1.2, 0.89 },
                { 0.88, 1, 5.1 },
                { 1.1, 0.15, 1 }
            };

            int d = 3;


            FW TestFW = new FW(Inarray, d);

            String[] codes = { "AUS", "USD", "JPY" };



            String Expected = "no arbitrage found";
            String Actual   = TestFW.ReturnProft(0.99, 2, codes);

            Assert.AreEqual(Expected, Actual);
        }
Esempio n. 8
0
    private void InitPaiDui(FW fw)
    {
        GameObject go;

        for (int i = 0; i < 54; i++)
        {
            if (i < 14)
            {
                go = (GameObject)GameObject.Instantiate(_GOCube, _FirstPosition + ConfirmMessageMethod(fw, 1).offset *i, ConfirmMessageMethod(fw, 1).quater, ConfirmMessageMethod(fw, 1).trans);
                _ArrayUpPais[i] = go;
                go = (GameObject)GameObject.Instantiate(_GOCube, _ArrayUpPais[i].transform.position - _VeceUpOffset, ConfirmMessageMethod(fw, 1).quater, ConfirmMessageMethod(fw, 1).trans);
                _ArrayDownPais[i] = go;
            }
            if (i > 13 && i < 27)
            {
                go = (GameObject)GameObject.Instantiate(_GOCube, _SecondPosition + ConfirmMessageMethod(fw, 2).offset *(i - 14), ConfirmMessageMethod(fw, 2).quater, ConfirmMessageMethod(fw, 2).trans);
                _ArrayUpPais[i] = go;
                go = (GameObject)GameObject.Instantiate(_GOCube, _ArrayUpPais[i].transform.position - _VeceUpOffset, ConfirmMessageMethod(fw, 2).quater, ConfirmMessageMethod(fw, 2).trans);
                _ArrayDownPais[i] = go;
            }
            if (i > 26 && i < 41)
            {
                go = (GameObject)GameObject.Instantiate(_GOCube, _ThirdPosition + ConfirmMessageMethod(fw, 3).offset *(i - 27), ConfirmMessageMethod(fw, 3).quater, ConfirmMessageMethod(fw, 3).trans);
                _ArrayUpPais[i] = go;
                go = (GameObject)GameObject.Instantiate(_GOCube, _ArrayUpPais[i].transform.position - _VeceUpOffset, ConfirmMessageMethod(fw, 3).quater, ConfirmMessageMethod(fw, 3).trans);
                _ArrayDownPais[i] = go;
            }

            if (i > 40 && i < 54)
            {
                go = (GameObject)GameObject.Instantiate(_GOCube, _FourthPosition + ConfirmMessageMethod(fw, 4).offset *(i - 41), ConfirmMessageMethod(fw, 4).quater, ConfirmMessageMethod(fw, 4).trans);
                _ArrayUpPais[i] = go;
                go = (GameObject)GameObject.Instantiate(_GOCube, _ArrayUpPais[i].transform.position - _VeceUpOffset, ConfirmMessageMethod(fw, 4).quater, ConfirmMessageMethod(fw, 4).trans);
                _ArrayDownPais[i] = go;
            }
        }
    }
Esempio n. 9
0
 public void BeforeAll()
 {
     FW.CreateTestResultsDirectory();
 }
Esempio n. 10
0
 public Form1()
 {
     InitializeComponent();
     FW.InitializeContexts();
 }
Esempio n. 11
0
 public virtual void BeforeAll()
 {
     FW.SetConfig();
     FW.CreateTestResultsDirectory();
 }
Esempio n. 12
0
 public virtual void BeforeAll()
 {
     FW.SetConfig();
 }
Esempio n. 13
0
 public static extern IntPtr CreateFont(int nHeight, int nWidth, int nEscapement, int nOrientation, FW fnWeight,
                                        [MarshalAs(UnmanagedType.Bool)] bool fdwItalic, [MarshalAs(UnmanagedType.Bool)] bool fdwUnderline,
                                        [MarshalAs(UnmanagedType.Bool)] bool fdwStrikeOut, CHARSET fdwCharSet, OUTPRECIS fdwOutputPrecision,
                                        CLIP fdwClipPrecision, QUALITY fdwQuality, PITCH_FF fdwPitchAndFamily, string lpszFace);
Esempio n. 14
0
 public void SuiteSetup()
 {
     FW.Init();
 }
Esempio n. 15
0
    private ConfirmMessages ConfirmMessageMethod(FW fw, int orderNum)
    {
        switch (fw)
        {
        case FW.North:
            switch (orderNum)
            {
            case 1:
                message.offset = _VecNorthOffset;
                message.trans  = _TransPaiDuiNorthParent;
                message.quater = _QuaNorth;
                break;

            case 2:
                message.offset = _VecEastOffset;
                message.trans  = _TransPaiDuiEastParent;
                message.quater = _QuaEast;
                break;

            case 3:
                message.offset = _VecSouthOffset;
                message.trans  = _TransPaiDuiSouthParent;
                message.quater = _QuaSouth;
                break;

            case 4:
                message.offset = _VecWestOffset;
                message.trans  = _TransPaiDuiWestParent;
                message.quater = _QuaWest;
                break;
            }
            break;

        case FW.East:
            switch (orderNum)
            {
            case 1:
                message.offset = _VecEastOffset;
                message.trans  = _TransPaiDuiEastParent;
                message.quater = _QuaEast;
                break;

            case 2:
                message.offset = _VecSouthOffset;
                message.trans  = _TransPaiDuiSouthParent;
                message.quater = _QuaSouth;
                break;

            case 3:
                message.offset = _VecWestOffset;
                message.trans  = _TransPaiDuiWestParent;
                message.quater = _QuaWest;
                break;

            case 4:
                message.offset = _VecNorthOffset;
                message.trans  = _TransPaiDuiNorthParent;
                message.quater = _QuaNorth;
                break;
            }
            break;

        case FW.South:
            switch (orderNum)
            {
            case 1:
                message.offset = _VecSouthOffset;
                message.trans  = _TransPaiDuiSouthParent;
                message.quater = _QuaSouth;
                break;

            case 2:
                message.offset = _VecWestOffset;
                message.trans  = _TransPaiDuiWestParent;
                message.quater = _QuaWest;
                break;

            case 3:
                message.offset = _VecNorthOffset;
                message.trans  = _TransPaiDuiNorthParent;
                message.quater = _QuaNorth;
                break;

            case 4:
                message.offset = _VecEastOffset;
                message.trans  = _TransPaiDuiEastParent;
                message.quater = _QuaEast;
                break;
            }
            break;

        case FW.West:
            switch (orderNum)
            {
            case 1:
                message.offset = _VecWestOffset;
                message.trans  = _TransPaiDuiWestParent;
                message.quater = _QuaWest;
                break;

            case 2:
                message.offset = _VecNorthOffset;
                message.trans  = _TransPaiDuiNorthParent;
                message.quater = _QuaNorth;
                break;

            case 3:
                message.offset = _VecEastOffset;
                message.trans  = _TransPaiDuiEastParent;
                message.quater = _QuaEast;
                break;

            case 4:
                message.offset = _VecSouthOffset;
                message.trans  = _TransPaiDuiSouthParent;
                message.quater = _QuaSouth;
                break;
            }
            break;
        }
        return(message);
    }
Esempio n. 16
0
 protected TestBase()
 {
     FW.Init();
     FW.CreateTestResultsDirectory();
 }
Esempio n. 17
0
    private int CalculateIndex(int zhuangNum, int diceNum1, int diceNum2)
    {
        FW  zhuangfw  = GameInfo.GetFW(zhuangNum);
        FW  fangzhufw = GameInfo.GetFW(1);
        int indexNum  = 0;
        int minNum    = diceNum1 > diceNum2 ? diceNum2 : diceNum1;
        int num       = diceNum1 + diceNum2;

        switch (fangzhufw)
        {
        case FW.East:
            switch (zhuangfw)
            {
            case FW.East:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum + 41;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum + 27;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum + 14;
                    break;
                }
                break;

            case FW.West:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum + 14;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum + 41;
                    break;
                }
                break;

            case FW.North:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum + 27;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum + 14;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum;
                    break;
                }
                break;

            case FW.South:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum + 41;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum + 27;
                    break;
                }
                break;

            default:
                break;
            }
            break;

        case FW.West:
            switch (zhuangfw)
            {
            case FW.East:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum + 14;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum + 27;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum + 41;
                    break;
                }
                break;

            case FW.West:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum + 41;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum + 27;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum + 14;
                    break;
                }
                break;

            case FW.North:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum + 41;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum + 27;
                    break;
                }
                break;

            case FW.South:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum + 27;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum + 14;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum;
                    break;
                }
                break;

            default:
                break;
            }
            break;

        case FW.North:
            switch (zhuangfw)
            {
            case FW.East:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum + 41;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum + 27;
                    break;
                }
                break;

            case FW.West:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum + 27;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum + 14;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum;
                    break;
                }
                break;

            case FW.North:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum + 41;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum + 27;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum + 14;
                    break;
                }
                break;

            case FW.South:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum + 14;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum + 41;
                    break;
                }
                break;

            default:
                break;
            }
            break;

        case FW.South:
            switch (zhuangfw)
            {
            case FW.East:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum + 27;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum + 14;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum;
                    break;
                }
                break;

            case FW.West:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum + 41;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum + 27;
                    break;
                }
                break;

            case FW.North:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum + 14;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum + 41;
                    break;
                }
                break;

            case FW.South:
                switch (num)
                {
                case 2:
                case 6:
                case 10:
                    indexNum = minNum + 41;
                    break;

                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                    indexNum = minNum + 27;
                    break;

                case 4:
                case 8:
                case 12:
                    indexNum = minNum + 14;
                    break;
                }
                break;

            default:
                break;
            }
            break;
        }
        return(indexNum);
    }
 protected TestBase()
 {
     FW.Init();
 }
Esempio n. 19
0
        public void AssemblySetup()
        {
            FW.SetConfig();

            ReportHelper.StartReporter();
        }
Esempio n. 20
0
 public void Test_results_directory_created()
 {
     FW.CreateTestResultsDirectory();
     Assert.That(Directory.Exists(FW.WORKSPACE_DIRECTORY + "/TestResults"));
 }
Esempio n. 21
0
 public static extern IntPtr CreateFont(int nHeight, int nWidth, int nEscapement, int nOrientation, FW fnWeight,
     [MarshalAs(UnmanagedType.Bool)] bool fdwItalic, [MarshalAs(UnmanagedType.Bool)] bool fdwUnderline,
     [MarshalAs(UnmanagedType.Bool)] bool fdwStrikeOut, CHARSET fdwCharSet, OUTPRECIS fdwOutputPrecision,
     CLIP fdwClipPrecision, QUALITY fdwQuality, PITCH_FF fdwPitchAndFamily, string lpszFace);
 public virtual void BeforeAll()
 {
     FW.Init();
 }
Esempio n. 23
0
 public virtual void Setup()
 {
     FW.SetLogger();
     Driver.Init();
     Driver.Goto(FW.Config.Test.Url);
 }
Esempio n. 24
0
        static int Main(string[] args)
        {
            long total = 0;

#if DEBUG
            args = new string[]
            {
                "COM3", "/S", "10", "/N", "0", "/M", "rnd_!.bin", "/D", @"C:\TEMP\RNG"
            };
#endif
            if (args.Length > 0)
            {
                Arguments A = parseArgs(args);
                if (A.ex == null)
                {
                    Stream     Output = null;
                    FileWriter FW     = null;
                    if (A.Mask == "-")
                    {
                        Output = Console.OpenStandardOutput();
                    }
                    else
                    {
                        FW = new FileWriter(A.Directory, A.Mask, A.FileSize * 1024 * 1024, A.NumFiles);
                    }
                    Console.Clear();
                    libOneRNG.RNG R = new libOneRNG.RNG(A.Port);
                    R.Start();
                    while (!HasKey(ConsoleKey.Escape))
                    {
                        byte[] b = R.Read(1024);
                        total += b.Length;
                        Console.SetCursorPosition(0, 0);
                        Console.Error.WriteLine("Processed: {0}", nice(total));
                        if (Output != null)
                        {
                            Output.Write(b, 0, b.Length);
                        }
                        else
                        {
                            Console.Error.WriteLine("File: {0}/{1} ({2,6:0.00}%)", FW.CurrentNumber, FW.Count, perc(FW.Count, FW.CurrentNumber));
                            Console.Error.WriteLine("Size: {0} ({1,6:0.00}%)", nice(FW.CurrentPosition), perc(FW.Size, FW.CurrentPosition));
                            if (!FW.Write(b))
                            {
                                FW.Dispose();
                                return(0);
                            }
                        }
                        Console.Error.WriteLine("Press [ESC] to abort");
                    }
                    R.Stop();
                    R.Dispose();
                    Console.Error.WriteLine("Operation aborted by user input");
                    return(2);
                }
                else
                {
                    Console.Error.WriteLine("Error parsing arguments: {0}", A.ex.Message);
                    return(3);
                }
            }
            else
            {
                Help();
                return(1);
            }
        }
Esempio n. 25
0
 public virtual void BeforeClass()
 {
     FW.CreateTestResultsDirectory();
 }
Esempio n. 26
0
 public void Setup()
 {
     FW.Init();
     Driver = DriverFactory.Build();
     Page.Init(Driver);
 }
Esempio n. 27
0
 public virtual void OneTimeSetup()
 {
     FW.SetConfig();
     FW.CreateTestResultsDirectory();
 }