コード例 #1
0
ファイル: Cell.cs プロジェクト: MainGitForCHAR/SeaBattle
        public void ChangeState(StateCell RightState)
        {
            switch ((int)RightState)
            {
            case 0:
                CurrentView = new BitmapImage(new Uri(@"immage\Clear.jpg"));
                State       = RightState;
                break;

            case 1:
                CurrentView = new BitmapImage(new Uri(@"immage\Filled.jpg"));
                State       = RightState;
                break;

            case 2:
                CurrentView = new BitmapImage(new Uri(@"immage\Dead.jpg"));
                State       = RightState;
                break;

            case 3:
                CurrentView = new BitmapImage(new Uri(@"immage\Miss.jpg"));
                State       = RightState;
                break;
            }
        }
コード例 #2
0
    public void RefreshStateCell(State state)
    {
        StateCell stateCell = stateCellsMap[state];

        stateCell.SetIcon(state.tool.Icon);
        stateCell.SetForm(state.Title());
    }
コード例 #3
0
ファイル: CellTorus.cs プロジェクト: kdbanman/conway_cann
    private void InitCells()
    {
        if (automata == null)
        {
            Debug.LogError("CellTorus automata is null.  Set it before InitCells is called.");
        }

        cells = new GameObject[planeWidth, planeHeight];

        for (int x = 0; x < planeWidth; x++)
        {
            for (int y = 0; y < planeHeight; y++)
            {
                GameObject cell = (GameObject)Instantiate(cellPrefab);
                cells[x, y]           = cell;
                cell.transform.parent = this.transform;

                PositionCell(cell, x, y, rotate: true);

                StateCell stateCell = cell.GetComponent <StateCell>();
                stateCell.x        = x;
                stateCell.y        = y;
                stateCell.onToggle = automata.onToggle;
            }
        }
    }
コード例 #4
0
    public void RemoveStateCell(State state)
    {
        StateCell stateCell = stateCellsMap[state];

        stateCellsMap.Remove(state);

        Destroy(stateCell.gameObject);
    }
コード例 #5
0
    public void RefreshLayout(List <State> states)
    {
        float posY = 0;

        for (int i = 0; i < states.Count; i++)
        {
            StateCell stateCell = stateCellsMap[states[i]];
            stateCell.SetPosY(posY);
            posY += stateCell.GetHeight();
        }
    }
コード例 #6
0
    private StateCell InitStateCell(State state)
    {
        GameObject cellObject = GameObject.Instantiate(StateCellPrefab.gameObject);

        cellObject.name = state.tool.Name;
        cellObject.transform.SetParent(transform, false);

        StateCell stateCell = cellObject.GetComponent <StateCell>();

        stateCell.Init();

        return(stateCell);
    }
コード例 #7
0
    public void AddStateCell(State state, int color)
    {
        StateCell stateCell = InitStateCell(state);

        stateCellsMap.Add(state, stateCell);

        stateCell.OnClickDelete = () =>
        {
            if (state.OnClickDelete != null)
            {
                state.OnClickDelete();
            }
        };

        stateCell.UndoFaceHighlight = () =>
        {
            if (state.UndoFaceHighlight != null)
            {
                state.UndoFaceHighlight();
            }
        };

        stateCell.OnElementHighlight = () =>
        {
            if (state.OnElementHighlight != null)
            {
                state.OnElementHighlight();
            }
        };



        stateCell.DoubleClick = () =>
        {
            //Debug.Log("statePanel点击图标");
            if (state.DoubleClick != null)
            {
                state.DoubleClick();
            }
        };


        RefreshStateCell(state);

        SetCellTintColor(stateCell, color);
        StyleManager.OnStyleChange += () =>
        {
            SetCellTintColor(stateCell, color);
        };
    }
コード例 #8
0
    public void AddStateCell(State state, int color)
    {
        StateCell stateCell = InitStateCell(state);

        stateCellsMap.Add(state, stateCell);

        stateCell.OnClickDelete = () =>
        {
            if (state.OnClickDelete != null)
            {
                state.OnClickDelete();
            }
        };

        RefreshStateCell(state);

        SetCellTintColor(stateCell, color);
        StyleManager.OnStyleChange += () =>
        {
            SetCellTintColor(stateCell, color);
        };
    }
コード例 #9
0
 private void SetCellTintColor(StateCell stateCell, int color)
 {
     stateCell.SetTintColor(StyleManager.Themes[color]);
 }
コード例 #10
0
 public BoardCell(int x, int y)
 {
     this.x    = x;
     this.y    = y;
     stateCell = StateCell.Empty;
 }