示例#1
0
        public void OnStartHitting()
        {
            if (OpType == OpType.Pass)
            {
                // 此轮跳过,延迟1秒到下一位

                CmdResponse.RandomOperation(null, OpType);

                // todo: 延迟
                NextPlayer();
                return;
            }

            // 检查是否有选定的颜色,如果已经没有相应的颜色,则再次随机
            if (OpType != OpType.Both && !HexManager.HasColor(OpType))
            {
                // 重新随机

                return;
            }

            GameStep = GameStep.Hitting;

            foreach (Player p in m_players.Values)
            {
                CmdResponse.StartHitting(p, OpType);
            }
        }
示例#2
0
        public void OnGameOver()
        {
            GameStep = GameStep.GameOver;

            foreach (Player p in m_players.Values)
            {
                CmdResponse.EndGame(p);
            }
        }
示例#3
0
        public void ToGame()
        {
            CurPlayer = 1;

            GameStep = GameStep.SelectingMain;
            foreach (Player p in m_players.Values)
            {
                CmdResponse.StartGame(p);
            }
        }
示例#4
0
        public void OnPlayerLogin(Player player)
        {
            foreach (Player p in m_players.Values)
            {
                if (p == player)
                {
                    continue;
                }

                CmdResponse.LoginResponse(player, Owner.GUID, new List <Player>(m_players.Values), GameConf);
            }
        }
示例#5
0
        public void SetMain(int x, int y)
        {
            m_mainHex        = HexManager.GetHexagon(x, y) as GameHexagon;
            m_mainHex.IsMain = true;
            GameStep         = GameStep.Start;

            // 开始随机
            // GameStep = GameStep.RandomOperation;
            foreach (Player p in m_players.Values)
            {
                CmdResponse.MainHex(p, x, y);
            }
        }
示例#6
0
        private void NextPlayer(bool isGood = false)
        {
            ++CurPlayer;
            if (CurPlayer > GameConf.MemCount)
            {
                CurPlayer = 1;
            }

            foreach (Player p in m_players.Values)
            {
                CmdResponse.CurrentPlayer(p, 0);
                CmdResponse.SetScore(p, 1, 0);
            }

            string goodOrNot = isGood ? "GOOD!!!\n" : "";
        }
示例#7
0
        public void EndHammer()
        {
            if (m_curTargetHex == null)
            {
                return;
            }

            float strength = 0;// UIManager.GetUIByType<UIGame>().StopSliderMoving() * c_strenghtSensitivity;

            //if (m_curTargetHex == GetHittingHex())
            {
                //if(strength > 0.95f)
                //{
                //    GameView.ShowTips("GOOD !!!");
                //}

                // 锤子
                CmdResponse.HammerKnock(null, strength);
            }
            //else
            //{
            //    m_curTargetHex = null;
            //    m_singleTargetHex = null;
            //}

            // 重置力度

            // 下一轮
            m_curTargetHex.OnHit(strength);
            HexManager.UpdateAllBalance();

            // 如果是强制砸落,则必须当前块掉落再进行下一轮
            if (!(m_curTargetHex.IsActive() && GameConf.ForceKill))
            {
                //
                if (GameStep != GameStep.GameOver)
                {
                    GameStep = GameStep.RandomOperation;

                    CmdResponse.CurrentPlayer(null, 0);
                }
                m_singleTargetHex = null;
            }

            m_curTargetHex = null;
        }
示例#8
0
        private static bool CheckColor(GameHexagon hex, OpType op)
        {
            if (op == OpType.Pass)
            {
                return(false);
            }
            else if (op == OpType.Both)
            {
                return(true);
            }
            else
            {
                if (hex.OpType != op)
                {
                    CmdResponse.Alert(null, string.Format("<color=yellow>必须砸{0}颜色块!</color>", UIConstants.s_ops[op]));
                }

                return(hex.OpType == op);
            }
        }
示例#9
0
        public void StartHammer(int x, int y)
        {
            if (m_curTargetHex != null)
            {
                return;
            }

            GameHexagon theHex = HexManager.GetHexagon(x, y) as GameHexagon;

            // 在强制模式下,必须砸同一个格子
            if (GameConf.ForceKill && m_singleTargetHex != null && m_singleTargetHex != theHex)
            {
                CmdResponse.Alert(CurrentPlayer, "必须砸同一个格子!");
                return;
            }

            if (theHex != null && theHex != m_mainHex && CheckColor(theHex, OpType))
            {
                m_curTargetHex    = theHex;
                m_singleTargetHex = theHex;

                // 重置力度
            }
        }