Exemplo n.º 1
0
        public void NagareMethod()
        {
            PlayerCondition.AgareJudge();
            int           count       = 0;
            bool          isOyaTenpai = false;
            List <Player> upPlayers   = new List <Player>();

            //统计有几家听牌
            foreach (var player in Element.Players)
            {
                if (player.IsReach)
                {
                    count++;
                    upPlayers.Add(player);
                    if (player.Name == Element.Session.OyaName)
                    {
                        isOyaTenpai = true;
                    }
                }
            }
            //移交点数
            if (!(count == 0 || count == 4))
            {
                foreach (var player in Element.Players)
                {
                    if (upPlayers.Contains(player))
                    {
                        player.Point += 3000 / count;
                    }
                    else
                    {
                        player.Point -= 3000 / (4 - count);
                    }
                }
            }
            //流局完后处理
            foreach (var player in Element.Players)
            {
                player.IsReachLockOn = false;
                player.IsReach       = false;
            }
            if (!isOyaTenpai)
            {
                Element.Session.NowSession++;
                foreach (var player in Element.Players)
                {
                    if (player.Wind == 0)
                    {
                        player.Wind = WindEnum.北;
                    }
                    else
                    {
                        player.Wind--;
                    }
                }
            }
            Element.Session.BenChang++;
            MainActivity.NowSessionNum++;
            MainActivity.IsOyaAgare = isOyaTenpai;
        }
Exemplo n.º 2
0
        public static void Save(string situation)
        {
            situation = PlayerCondition.GetCondition() + "|" + situation;
            System.Collections.ArrayList gameArrayList = new System.Collections.ArrayList
            {
                Element.LeftPlayer.ShallowClone(),
                                         Element.OppositePlayer.ShallowClone(),
                                         Element.RightPlayer.ShallowClone(),
                                         Element.MePlayer.ShallowClone(),
                                         Element.Session.ShallowClone(),
                                         situation
            };
            int i = MainActivity.NowSessionNum;

            while (true)//清除掉已有的记录
            {
                if (Element.GameLogDictionary.ContainsKey(i))
                {
                    Element.GameLogDictionary.Remove(i);
                    i++;
                }
                else
                {
                    break;
                }
            }
            Element.GameLogDictionary.Add(MainActivity.NowSessionNum, gameArrayList);
            ShowGameLog();
        }
Exemplo n.º 3
0
 private void SuddenlyNagare_Click()
 {
     Element.Session.BenChang++;
     NowSessionNum++;
     Element.Session.IsNagareMode = true;
     foreach (var player in Element.Players)
     {
         if (player.IsReach == true)
         {
             player.IsReachLockOn = true;
         }
     }
     PlayerCondition.NagareJudge();
     foreach (var player in Element.Players)
     {
         player.IsReachLockOn = false;
         player.IsReach       = false;
     }
     Element.Session.IsNagareMode = false;
     Game.Save(Element.Session.ToString() + Element.Session.BenChang + "本 " + "中途流局");
 }
Exemplo n.º 4
0
 private void AgareBtn_Click()
 {
     if (AgareBtn.Text == "和牌")
     {
         if (RunningOtherProgram)
         {
             return;
         }
         Element.Session.IsAgareMode = true;
         foreach (var player in Element.Players)
         {
             if (player.IsReach == true)
             {
                 player.IsReachLockOn = true;
             }
         }
         PlayerCondition.AgareJudge();
         foreach (var player in Element.Players)
         {
             player.IsReachLockOn = false;
         }
         Element.Session.IsNewAgare = true;
         Element.Session.Save       = 0;
         UpdateText.Set(ControlTextView, "谁出铳?");
         RunningOtherProgram = true;
         UpdateText.Set(AgareBtn, "取消和牌");
     }
     else
     {
         Element.Session.IsAgareMode = false;
         UpdateText.Set(ControlTextView, "(OvO)");
         UpdateText.Set(InpuTextView, "");
         UpdateText.Set(AgareBtn, "和牌");
         RunningOtherProgram = false;
     }
 }