示例#1
0
        private void WinnerCheck()
        {
            int   win        = 0;
            int   winneruser = 0;
            lcrVM obllcr     = new lcrVM();

            for (int i = 1; i <= 4; i++)
            {
                var chip = "Chip" + i;
                var val  = Convert.ToInt16(GetType().GetProperty(chip).GetValue(this, null));
                if (val <= 0)
                {
                    win++;
                }
                else
                {
                    winneruser = i;
                }
            }

            if (win == 3)
            {
                var winuser = "******" + winneruser;
                var val     = GetType().GetProperty(winuser).GetValue(this, null);
                winner   = val + " is winner";
                isEnable = false;
            }
        }
示例#2
0
        private void diceCommand()
        {
            lcrVM obllcr = new lcrVM();

            Dice1 = string.Empty;
            Dice2 = string.Empty;
            Dice3 = string.Empty;

            // nextturn();

            WinnerCheck();


            if (trunCounter == 1)
            {
                if (Chip1 > 0)
                {
                    lcrRule(trunCounter);
                }
                background1 = "LightPink";
                background2 = "LightBlue";
                background3 = "LightPink";
                background4 = "LightPink";
                trunCounter++;
                return;
            }

            if (trunCounter == 2)
            {
                if (Chip2 > 0)
                {
                    lcrRule(trunCounter);
                }

                background1 = "LightPink";
                background2 = "LightPink";
                background3 = "LightBlue";
                background4 = "LightPink";
                trunCounter++;

                return;
            }


            if (trunCounter == 3)
            {
                if (Chip3 > 0)
                {
                    lcrRule(trunCounter);
                }

                background1 = "LightPink";
                background2 = "LightPink";
                background3 = "LightPink";
                background4 = "LightBlue";
                trunCounter++;
                return;
            }

            if (trunCounter == 4)
            {
                if (Chip4 > 0)
                {
                    lcrRule(trunCounter);
                }

                background1 = "LightBlue";
                background2 = "LightPink";
                background3 = "LightPink";
                background4 = "LightPink";
                trunCounter = 1;

                return;
            }
        }