Пример #1
0
    public void OnModelClick(Vector3 clickPoint)
    {
        if (m_selectType > -1)
        {
            var pointX  = clickPoint.x;
            var pointZ  = clickPoint.z;
            var offsetX = pointX % 2;
            var offsetZ = pointZ % 2;
            var x       = (pointX - offsetX) / 2;
            var z       = (pointZ - offsetZ) / 2;
            var point   = new Vector2(x, z);

            if (canNext == true && App.ChessLogic02.DoSummon(point, m_selectType))
            {
                Debug.Log("召唤成功");
                var type = m_selectType % 10;
                m_mediator.Energy -= Config.PieceCost[type];
                if (m_isTest == false)
                {
                    ActiveInfo.Builder activeInfo = ActiveInfo.CreateBuilder();
                    activeInfo.SetIsCall(true);
                    CallInfo.Builder callInfo = CallInfo.CreateBuilder();
                    callInfo.SetIndex(CoorToIndex((int)(x + 1), (int)(z + 1)));
                    callInfo.SetType(type);
                    callInfo.SetUserId(m_proxy.GetPlayerId());
                    activeInfo.SetCallInfo(callInfo);
                    m_mediator.NotifyPlayerActive(activeInfo);
                }
                OnSummon(m_selectType, new Vector2(point.x + 1, point.y + 1));
            }
            else
            {
                Debug.Log("召唤失败");
            }
            m_selectType = -1;
            OnSummonTipsHide();
            OnEnergyEffectHide();
        }
        else
        {
            var pointX  = clickPoint.x;
            var pointZ  = clickPoint.z;
            var offsetX = pointX % 2;
            var offsetZ = pointZ % 2;
            var x       = (pointX - offsetX) / 2;
            var z       = (pointZ - offsetZ) / 2;
            var point   = new Vector2(x + 1, z + 1);

            m_mediator.NotifyPieceClick(point);
        }
    }