Ejemplo n.º 1
0
        private static bool CheckColor(GameHexagon hex, OpType op)
        {
            if (op == OpType.Pass)
            {
                Globals.Instance.UIManager.SendMessage(MsgType.OnShowTips, "此次跳过");
                return(false);
            }
            else if (op == OpType.Both)
            {
                return(true);
            }
            else
            {
                if (hex.OpType != op)
                {
                    Globals.Instance.UIManager.SendMessage(MsgType.OnShowTips,
                                                           string.Format("<color=yellow>必须砸{0}颜色块!</color>", UIConstants.s_ops[op]));
                }

                return(hex.OpType == op);
            }
        }
Ejemplo n.º 2
0
        IEnumerator UpdateAllHexesLater(float lastStrength)
        {
            yield return(new WaitForSeconds(0.1f));

            m_curTargetHex.OnHit(lastStrength);
            HexManager.UpdateAllBalance();

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

                    NextPlayer(lastStrength > 0.95f);
                }
                m_singleTargetHex = null;
            }

            m_curTargetHex = null;
        }
Ejemplo n.º 3
0
        private void HandleTarget()
        {
            // 按下时选择一一个格子,并开始模拟力度
            if (Input.GetMouseButtonDown(0))
            {
                if (m_curTargetHex != null)
                {
                    return;
                }

                GameHexagon theHex = GetHittingHex();

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

                if (theHex != null && theHex != m_mainHex && CheckColor(theHex, OpType))
                {
                    m_curTargetHex    = theHex;
                    m_singleTargetHex = theHex;
                    UIManager.GetUIByType <UIGame>().StartSliderMoving();

                    Hammer.transform.position = m_curTargetHex.Obj.transform.position + Vector3.up;
                }
            }

            // 抬起时加判断,如果是按在同一个格子上,则为砸下,否则为取消
            if (Input.GetMouseButtonUp(0))
            {
                if (m_curTargetHex == null)
                {
                    return;
                }

                float strength = UIManager.GetUIByType <UIGame>().StopSliderMoving() * c_strenghtSensitivity;
                if (m_curTargetHex == GetHittingHex())
                {
                    //if(strength > 0.95f)
                    //{
                    //    GameView.ShowTips("GOOD !!!");
                    //}

                    // 锤子
                    Hammer.Knock();

                    CoroutineManager.StopAllCoroutines();
                    CoroutineManager.StartCoroutine(UpdateAllHexesLater(strength));
                }
                else
                {
                    m_curTargetHex    = null;
                    m_singleTargetHex = null;
                }

                UIManager.GetUIByType <UIGame>().ResetSlider();
                //HexManager.OnSelectTarget(null);
            }
        }