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; } }
public void RefreshStateCell(State state) { StateCell stateCell = stateCellsMap[state]; stateCell.SetIcon(state.tool.Icon); stateCell.SetForm(state.Title()); }
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; } } }
public void RemoveStateCell(State state) { StateCell stateCell = stateCellsMap[state]; stateCellsMap.Remove(state); Destroy(stateCell.gameObject); }
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(); } }
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); }
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); }; }
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); }; }
private void SetCellTintColor(StateCell stateCell, int color) { stateCell.SetTintColor(StyleManager.Themes[color]); }
public BoardCell(int x, int y) { this.x = x; this.y = y; stateCell = StateCell.Empty; }