private List <PosMap> CheckCellDown_2(PosMap pos, ColorType eColorType)
    {
        int row         = pos.Row;
        int nConvertCol = pos.Col - 2;

        return(this.CheckCellGerenal(row, nConvertCol, eColorType));
    }
示例#2
0
    private void GetListHint(List <CellModel> listMapping)
    {
        this._listHint.Clear();
        int count = listMapping.Count;

        if (count == 0)
        {
            return;
        }
        for (int i = 0; i < count; i++)
        {
            PosMap   posInMap = listMapping[i].PosInMap;
            int      row      = posInMap.Row;
            int      col      = posInMap.Col;
            CellType type     = listMapping[i].Type;
            if (row >= 0 && col >= 0)
            {
                if (type != CellType.NONE)
                {
                    if (type == this._mapData[row, col].Type)
                    {
                        this._listHint.Add(listMapping[i]);
                    }
                }
            }
        }
    }
    private List <PosMap> CheckCellDown_3(PosMap pos, ColorType eColorType)
    {
        int row = pos.Row;
        int col = pos.Col;

        return(this.CheckCellGerenal(row, col, eColorType));
    }
示例#4
0
    private void RotateNormal()
    {
        this._listRotate.Clear();
        this.CreateListRotate();
        int count = this._listPosMap.Count;
        int num   = this._nNumberTriangle;
        int num2  = this._nFinalIndex;
        int num3  = num2 + 1 - this._nNumberTriangle;

        num3 = ((num3 >= 0) ? num3 : (count + num3));
        while (num != 0)
        {
            int num4 = num2 + 1;
            num4 = ((num4 < count) ? num4 : 0);
            this._listRotate[num4] = (CellType)((int)this._listRotate[num2] * (int)CellType.DOWN);
            num2--;
            num2 = ((num2 != -1) ? num2 : (count - 1));
            num--;
        }
        this._listRotate[num3] = CellType.NONE;
        this._nFinalIndex++;
        this._nFinalIndex = ((this._nFinalIndex < count) ? this._nFinalIndex : 0);
        this._nIndexPositionCenter++;
        this._nIndexPositionCenter = ((this._nIndexPositionCenter < count) ? this._nIndexPositionCenter : 0);
        for (int i = 0; i < count; i++)
        {
            PosMap posMap = this._listPosMap[i];
            this._map[posMap.Row, posMap.Col] = this._listRotate[i];
        }
    }
    private List <PosMap> CheckCellUp_3(PosMap pos, ColorType eColorType)
    {
        int nConvertRow = pos.Row - 1;
        int nConvertCol = pos.Col - 2;

        return(this.CheckCellGerenal(nConvertRow, nConvertCol, eColorType));
    }
示例#6
0
    private void DrawMap(Color colorUI)
    {
        int count = this._listPosMap.Count;

        for (int i = 0; i < count; i++)
        {
            PosMap   posMap   = this._listPosMap[i];
            CellType cellType = this._map[posMap.Row, posMap.Col];
            if (cellType != CellType.NONE)
            {
                GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/PatternTriangle"));
                gameObject.transform.SetParent(base.transform);
                gameObject.transform.localScale = Vector3.one;
                GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/PatternTriangle"));
                gameObject2.transform.SetParent(gameObject.transform);
                gameObject2.transform.localScale         = new Vector2(0.85f, 0.9f);
                gameObject2.transform.localPosition      = Vector2.zero;
                gameObject2.GetComponent <Image>().color = ((this._eTypePattern != PatternScript.Type.SPECIAL) ? colorUI : gameObject.GetComponent <Image>().color);
                int num = (cellType != CellType.UP) ? 180 : 0;
                gameObject.transform.localEulerAngles = new Vector3(0f, 0f, (float)num);
                float num2 = (float)((cellType != CellType.UP) ? 0 : (-(float)Constant.DELTA));
                float num3 = (float)((posMap.Col != 0) ? ((Constant.RANGE_X - 2) * posMap.Col) : 0);
                float num4 = (float)((posMap.Row != 0) ? Constant.RANGE_Y : 0);
                float y    = (!this._bOneLine) ? ((float)(-(float)this._nHeightPattern / 2 + Constant.CELL_SIZE_HEIGHT / 2 + Constant.CELL_SIZE_HEIGHT * posMap.Row) + num4 + num2) : ((float)(-(float)this._nHeightPattern / 2 + Constant.CELL_SIZE_HEIGHT / 2) + num2);
                gameObject.transform.localPosition = new Vector2((float)(-(float)this._nWidthPattern / 2 + Constant.CELL_SIZE_WIDTH / 2 + Constant.CELL_SIZE_WIDTH / 2 * posMap.Col) + num3, y);
                this._listPattern.Add(gameObject.transform);
            }
        }
    }
示例#7
0
    private bool CheckAllowAddPattern(List <CellModel> listMapping, ColorType eColorType)
    {
        int count = listMapping.Count;

        for (int i = 0; i < count; i++)
        {
            PosMap   posInMap = listMapping[i].PosInMap;
            CellType type     = listMapping[i].Type;
            int      row      = posInMap.Row;
            int      col      = posInMap.Col;
            if (type != CellType.NONE)
            {
                if (row < 0 || col < 0 || row >= this._Row || col >= this._Col)
                {
                    return(false);
                }
                if (eColorType != ColorType.SPECIAL_COLOR)
                {
                    if (this._mapData[row, col].Color != ColorType.NONE)
                    {
                        return(false);
                    }
                    if (type != this._mapData[row, col].Type)
                    {
                        return(false);
                    }
                }
            }
        }
        return(true);
    }
示例#8
0
    private void CreateListRotate()
    {
        int count = this._listPosMap.Count;

        for (int i = 0; i < count; i++)
        {
            PosMap posMap = this._listPosMap[i];
            this._listRotate.Add(this._map[posMap.Row, posMap.Col]);
        }
    }
示例#9
0
    private void ClearHint()
    {
        int count = this._listHint.Count;

        for (int i = 0; i < count; i++)
        {
            PosMap posInMap = this._listHint[i].PosInMap;
            int    row      = posInMap.Row;
            int    col      = posInMap.Col;
            this._mapUI[row, col].ClearHint();
        }
        this._listHint.Clear();
    }
    private bool IsPosMapExist(List <PosMap> listCheckHexa, PosMap checkPosMap)
    {
        int count = listCheckHexa.Count;

        for (int i = 0; i < count; i++)
        {
            PosMap posMap = listCheckHexa[i];
            if (posMap.Row == checkPosMap.Row && posMap.Col == checkPosMap.Col)
            {
                return(true);
            }
        }
        return(false);
    }
示例#11
0
    private void DebugLisMapping(List <CellModel> listMapping)
    {
        int    count = listMapping.Count;
        string text  = string.Empty;
        string text2 = string.Empty;

        for (int i = 0; i < count / 2; i++)
        {
            text = text + listMapping[i].Type + " - ";
        }
        text += "\n";
        for (int j = count - 1; j >= count / 2; j--)
        {
            text = text + listMapping[j].Type + " - ";
        }
        for (int k = 0; k < count / 2; k++)
        {
            PosMap posInMap = listMapping[k].PosInMap;
            string text3    = text2;
            text2 = string.Concat(new object[]
            {
                text3,
                "( ",
                posInMap.Row,
                " , ",
                posInMap.Col,
                " )  - "
            });
        }
        text2 += "\n";
        for (int l = count - 1; l >= count / 2; l--)
        {
            PosMap posInMap2 = listMapping[l].PosInMap;
            string text3     = text2;
            text2 = string.Concat(new object[]
            {
                text3,
                "( ",
                posInMap2.Row,
                " , ",
                posInMap2.Col,
                " )  - "
            });
        }
        Debug.Log(text);
        Debug.Log(text2);
    }
示例#12
0
    IEnumerator ClearPatternTriangle(List <PosMap> lists)
    {
        yield return(new WaitForEndOfFrame());

        SoundManager.Instance.PlaySfx(SFX.Clear);
        for (int i = 0; i < lists.Count; i++)
        {
            PosMap map = lists[i];
            this._mapData[map.Row, map.Col].Color = ColorType.NONE;
            if (this._mapData[map.Row, map.Col].Type != CellType.NONE)
            {
                this._mapUI[map.Row, map.Col].ClearPatternTriangle();
                yield return(new WaitForSeconds(0.1f));

                this.CreateExplosionEffect(this._mapUI[map.Row, map.Col].transform.position);
            }
        }
    }
示例#13
0
    private void ShowHint(ColorType eColorType)
    {
        int count = this._listHint.Count;

        if (count == 0)
        {
            return;
        }
        Color colorUI = (eColorType != ColorType.SPECIAL_COLOR) ? this._listColorUI[(int)eColorType] : Color.white;

        for (int i = 0; i < count; i++)
        {
            PosMap posInMap = this._listHint[i].PosInMap;
            int    row      = posInMap.Row;
            int    col      = posInMap.Col;
            this._mapUI[row, col].DisplayHint(colorUI);
        }
    }
    private List <PosMap> CheckCellGerenal(int nConvertRow, int nConvertCol, ColorType eColorType)
    {
        List <PosMap> list  = new List <PosMap>();
        int           count = this._listPosMap.Count;

        for (int i = 0; i < count; i++)
        {
            PosMap posMap = this._listPosMap[i];
            int    num    = nConvertRow + posMap.Row;
            int    num2   = nConvertCol + posMap.Col;
            if (!this.IsCellMatchColor(num, num2, eColorType))
            {
                list.Clear();
                break;
            }
            list.Add(new PosMap(num, num2));
        }
        return(list);
    }
示例#15
0
    public List <CellModel> GetListMapping(int nRow, int nCol)
    {
        List <CellModel> list   = new List <CellModel>(6);
        PosMap           posMap = this._listPosMap[this._nIndexPositionCenter];
        int num   = nRow - posMap.Row;
        int num2  = nCol - posMap.Col;
        int count = this._listPosMap.Count;

        for (int i = 0; i < count; i++)
        {
            PosMap    posMap2 = this._listPosMap[i];
            int       nRow2   = num + posMap2.Row;
            int       nCol2   = num2 + posMap2.Col;
            CellType  eType   = this._map[posMap2.Row, posMap2.Col];
            CellModel item    = new CellModel(eType, this._eColor, new PosMap(nRow2, nCol2));
            list.Add(item);
        }
        return(list);
    }
    private void SumaryListCheckHexa(List <PosMap> listCheckHexa, List <PosMap> listTemp)
    {
        int count = listTemp.Count;

        if (count == 0)
        {
            return;
        }
        List <PosMap> list = new List <PosMap>();

        for (int i = 0; i < count; i++)
        {
            PosMap posMap = listTemp[i];
            if (!this.IsPosMapExist(listCheckHexa, posMap))
            {
                list.Add(posMap);
            }
        }
        listCheckHexa.AddRange(list);
        list.Clear();
    }
    public List <PosMap> CheckHexa(List <CellModel> listHint, CellModel[,] mapData, PatternScript.Type eType)
    {
        List <PosMap> list  = new List <PosMap>();
        int           count = listHint.Count;

        if (count == 0 || eType == PatternScript.Type.SPECIAL)
        {
            return(list);
        }
        this._mapData = mapData;
        for (int i = 0; i < count; i++)
        {
            PosMap   posInMap = listHint[i].PosInMap;
            CellType type     = listHint[i].Type;
            if (type != CellType.UP)
            {
                if (type == CellType.DOWN)
                {
                    List <PosMap> listTemp = this.CheckCellDown_1(posInMap, listHint[i].Color);
                    this.SumaryListCheckHexa(list, listTemp);
                    listTemp = this.CheckCellDown_2(posInMap, listHint[i].Color);
                    this.SumaryListCheckHexa(list, listTemp);
                    listTemp = this.CheckCellDown_3(posInMap, listHint[i].Color);
                    this.SumaryListCheckHexa(list, listTemp);
                }
            }
            else
            {
                List <PosMap> listTemp = this.CheckCellUp_1(posInMap, listHint[i].Color);
                this.SumaryListCheckHexa(list, listTemp);
                listTemp = this.CheckCellUp_2(posInMap, listHint[i].Color);
                this.SumaryListCheckHexa(list, listTemp);
                listTemp = this.CheckCellUp_3(posInMap, listHint[i].Color);
                this.SumaryListCheckHexa(list, listTemp);
            }
        }
        return(list);
    }
示例#18
0
    private void ShowPatternTriangle(ColorType eColorType, List <CellModel> listHint)
    {
        int count = listHint.Count;

        if (count == 0)
        {
            return;
        }
        for (int i = 0; i < count; i++)
        {
            PosMap posInMap = listHint[i].PosInMap;
            int    row      = posInMap.Row;
            int    col      = posInMap.Col;
            if (eColorType != ColorType.SPECIAL_COLOR)
            {
                this._mapUI[row, col].DisplayPatternTriangle(this._listColorUI[(int)eColorType]);
            }
            else
            {
                this._mapUI[row, col].ClearPatternTriangle();
            }
            this._mapData[row, col].Color = ((eColorType != ColorType.SPECIAL_COLOR) ? eColorType : ColorType.NONE);
        }
    }
示例#19
0
 public CellModel(CellType eType, ColorType eColor, PosMap posInMap)
 {
     this._eType    = eType;
     this._eColor   = eColor;
     this._position = posInMap;
 }
示例#20
0
 public void UpdateData(CellType eType, ColorType eColor, PosMap posInMap)
 {
     this._eType    = eType;
     this._eColor   = eColor;
     this._position = posInMap;
 }