Beispiel #1
0
    private void OnPatternDrag(Vector2 position, PatternScript pattern)
    {
        if (this._bActiveHammer)
        {
            return;
        }

        Vector3 pos = Camera.main.ScreenToWorldPoint(new Vector3(position.x, position.y));

        Vector2 position2 = pattern.transform.parent.InverseTransformPoint(pos);

        pattern.UpdatePosDrag(position2);

        Vector2 p = pattern.GetPositionTriangleCenter();

        PointerEventData pointer = new PointerEventData(EventSystem.current);

        pointer.position = Input.mousePosition;
        List <RaycastResult> raycastResults = new List <RaycastResult>();

        EventSystem.current.RaycastAll(pointer, raycastResults);

        if (raycastResults.Count != 0)
        {
            Debug.LogError("Length = " + raycastResults.Count);
            TriangelScript component = getTriangel(raycastResults);// array[0].collider.GetComponent<TriangelScript>();
            if (component != null)
            {
                int row = component.Row;
                int col = component.Col;
                if (this._nChoseRow == row && this._nChoseCol == col)
                {
                    return;
                }
                this._bAllowAddPattern = false;
                this._nChoseRow        = row;
                this._nChoseCol        = col;
                this._listMapping      = pattern.GetListMapping(this._nChoseRow, this._nChoseCol);
                this.DebugLisMapping(this._listMapping);
                this._bAllowAddPattern = this.CheckAllowAddPattern(this._listMapping, pattern.Color);
                if (this._bAllowAddPattern)
                {
                    this.ClearHint();
                    this.GetListHint(this._listMapping);
                    this.ShowHint(pattern.Color);
                }
                else
                {
                    this.ClearHint();
                }
            }
        }
        else
        {
            this._nChoseRow = -1;
            this._nChoseCol = -1;
            this.ClearHint();
        }
    }
Beispiel #2
0
    private void OnPatternEndDrag(Vector2 position, PatternScript pattern)
    {
        if (this._bActiveHammer)
        {
            return;
        }
        position = pattern.GetPositionTriangleCenter();
        RaycastHit[] array = Physics.RaycastAll(new Vector3(position.x, position.y, -1f), Vector3.forward, 1000f, LayerMask.GetMask(new string[]
        {
            "Triangle"
        }));

        PointerEventData pointer = new PointerEventData(EventSystem.current);

        pointer.position = Input.mousePosition;
        List <RaycastResult> raycastResults = new List <RaycastResult>();

        EventSystem.current.RaycastAll(pointer, raycastResults);

        this.ClearHint();
        if (raycastResults.Count != 0)
        {
            TriangelScript component = getTriangel(raycastResults);// array[0].collider.GetComponent<TriangelScript>();
            if (component != null)
            {
                this._nChoseRow   = component.Row;
                this._nChoseCol   = component.Col;
                this._listMapping = pattern.GetListMapping(this._nChoseRow, this._nChoseCol);
                this.DebugLisMapping(this._listMapping);
                this._bAllowAddPattern = this.CheckAllowAddPattern(this._listMapping, pattern.Color);
                if (this._bAllowAddPattern)
                {
                    this.GetListHint(this._listMapping);
                    this.ShowPatternTriangle(pattern.Color, this._listHint);
                    List <PosMap> list = this._algorithmCheckHexa.CheckHexa(this._listHint, this._mapData, pattern.TypePattern);
                    int           num  = this.CaculateScore(pattern.NumberTriangle, list.Count, pattern.Color, ref this._bCanGetDouble);
                    if (this._bCanGetDouble)
                    {
                        //this._bCreateSpecialPattern = this._specialPatternManager.CanCreateSpecial();
                    }
                    //this.PlayEffectGetScore(num, pattern.transform.position, pattern.Color);
                    //base.StartCoroutine("ClearPatternTriangle", list);
                    // this.CheckTransferColor();
                    pattern.DestroyPattern();
                    //base.StartCoroutine("DelayCheckOutOfMove");
                    //Messenger.Broadcast<bool>(Constant.MsgCanUseHammer, this.CanUseHammer());
                    this.testCreate();
                    //this.AddNewPattern(pattern.IndexInPanel, this._bCreateSpecialPattern);
                    //if (num >= 60)
                    //{
                    //    SoundManager.GetInstance().PlayAfterScore();
                    //}
                }
                else
                {
                    //this.ResetPosPattern(pattern);
                }
            }
        }
        else
        {
            //this.ResetPosPattern(pattern);
        }
    }