コード例 #1
0
    public SavePatterModel Export()
    {
        SavePatterModel savePatterModel = new SavePatterModel();

        CellType[,] array = new CellType[2, 3];
        for (int i = 0; i < 2; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                array[i, j] = this._map[i, j];
            }
        }
        savePatterModel.TypePattern  = this._eTypePattern;
        savePatterModel.Color        = this._eColor;
        savePatterModel.IndexInPanel = this._nIndexInPanel;
        savePatterModel.CountClick   = this._nCountClick;
        return(savePatterModel);
    }
コード例 #2
0
    public void Import(SavePatterModel savePattern, List <Color> listColorUI)
    {
        this._eTypePattern  = savePattern.TypePattern;
        this._eColor        = savePattern.Color;
        this._nIndexInPanel = savePattern.IndexInPanel;
        this._nCountClick   = savePattern.CountClick;
        int num  = 0;
        int num2 = 0;

        this._nIndexPositionCenter = 0;
        switch (this._eTypePattern)
        {
        case PatternScript.Type.ONE_TRIANGLE:
            num  = 1;
            num2 = 1;
            this._nNumberTriangle = 1;
            this._map[1, 0]       = CellType.UP;
            this._bOneLine        = true;
            this._nFinalIndex     = 0;
            break;

        case PatternScript.Type.TWO_TRIANGLE:
            num  = 1;
            num2 = 2;
            this._nNumberTriangle = 2;
            this._map[1, 0]       = CellType.DOWN;
            this._map[1, 1]       = CellType.UP;
            this._bOneLine        = true;
            this._nFinalIndex     = 1;
            break;

        case PatternScript.Type.THREE_TRIANGLE:
            num  = 1;
            num2 = 3;
            this._nNumberTriangle = 3;
            this._map[1, 0]       = CellType.UP;
            this._map[1, 1]       = CellType.DOWN;
            this._map[1, 2]       = CellType.UP;
            this._bOneLine        = true;
            this._nFinalIndex     = 2;
            break;

        case PatternScript.Type.FOUR_TRIANGLE_1:
            num  = 2;
            num2 = 3;
            this._nNumberTriangle = 4;
            this._map[1, 0]       = CellType.UP;
            this._map[1, 1]       = CellType.DOWN;
            this._map[1, 2]       = CellType.UP;
            this._map[0, 2]       = CellType.DOWN;
            this._bOneLine        = false;
            this._nFinalIndex     = 3;
            break;

        case PatternScript.Type.FOUR_TRIANGLE_2:
            num  = 2;
            num2 = 3;
            this._nNumberTriangle      = 4;
            this._map[0, 0]            = CellType.UP;
            this._map[0, 1]            = CellType.DOWN;
            this._map[0, 2]            = CellType.UP;
            this._map[1, 1]            = CellType.UP;
            this._bOneLine             = false;
            this._nFinalIndex          = 3;
            this._nIndexPositionCenter = 1;
            break;

        case PatternScript.Type.FIVE_TRIANGLE:
            num  = 2;
            num2 = 3;
            this._nNumberTriangle = 5;
            this._map[1, 0]       = CellType.UP;
            this._map[1, 1]       = CellType.DOWN;
            this._map[1, 2]       = CellType.UP;
            this._map[0, 2]       = CellType.DOWN;
            this._map[0, 1]       = CellType.UP;
            this._bOneLine        = false;
            this._nFinalIndex     = 4;
            break;

        case PatternScript.Type.SPECIAL:
            num  = 2;
            num2 = 3;
            this._nNumberTriangle = 6;
            this._map[1, 0]       = CellType.UP;
            this._map[1, 1]       = CellType.DOWN;
            this._map[1, 2]       = CellType.UP;
            this._map[0, 2]       = CellType.DOWN;
            this._map[0, 1]       = CellType.UP;
            this._map[0, 0]       = CellType.DOWN;
            this._bOneLine        = false;
            this._nFinalIndex     = 5;
            break;
        }
        this._nWidthPattern  = Constant.CELL_SIZE_WIDTH + (Constant.RANGE_X + Constant.CELL_SIZE_WIDTH / 2) * (num2 - 1);
        this._nHeightPattern = Constant.CELL_SIZE_HEIGHT * num;
        this._nHeightPattern = ((num != 1) ? (this._nHeightPattern + Constant.RANGE_Y) : this._nHeightPattern);
        base.GetComponent <RectTransform>().sizeDelta = new Vector2((float)this._nWidthPattern, (float)this._nHeightPattern);
        Color colorUI = (this._eColor != ColorType.SPECIAL_COLOR) ? listColorUI[(int)this._eColor] : UnityEngine.Color.white;

        this.DrawMap(colorUI);
        base.GetComponent <RectTransform>().sizeDelta = new Vector2((float)(this._nWidthPattern + 50), (float)(this._nHeightPattern + 50));
        if (this._eColor == ColorType.SPECIAL_COLOR)
        {
            this.UpdateColorSpecial(listColorUI);
        }
        if (this._eTypePattern == PatternScript.Type.ONE_TRIANGLE || this._eTypePattern == PatternScript.Type.FOUR_TRIANGLE_2)
        {
            base.GetComponent <RectTransform>().pivot = new Vector2(0.5f, 0.3f);
        }
        base.transform.localScale = new Vector3(0.95f, 0.95f, 1f);
        this.RotateWithCountClick(this._nCountClick);
    }