本文整理汇总了C#中CellState类的典型用法代码示例。如果您正苦于以下问题:C# CellState类的具体用法?C# CellState怎么用?C# CellState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CellState类属于命名空间,在下文中一共展示了CellState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public static void Render(object item, int count, bool isExpanded, IDrawingToolkit tk,
IContext context, Area backgroundArea, Area cellArea, CellState state)
{
if (item is EventType) {
RenderAnalysisCategory (item as EventType, count, isExpanded, tk,
context, backgroundArea, cellArea);
} else if (item is SubstitutionEvent) {
SubstitutionEvent s = item as SubstitutionEvent;
RenderSubstitution (s.Color, s.EventTime, s.In, s.Out, s.Selected, isExpanded, tk, context,
backgroundArea, cellArea, state);
} else if (item is TimelineEvent) {
TimelineEvent p = item as TimelineEvent;
RenderPlay (p.Color, p.Miniature, p.Players, p.Selected, p.Description, count, isExpanded, tk,
context, backgroundArea, cellArea, state);
} else if (item is Player) {
RenderPlayer (item as Player, count, isExpanded, tk, context, backgroundArea, cellArea);
} else if (item is Playlist) {
RenderPlaylist (item as Playlist, count, isExpanded, tk, context, backgroundArea, cellArea);
} else if (item is PlaylistPlayElement) {
PlaylistPlayElement p = item as PlaylistPlayElement;
RenderPlay (p.Play.EventType.Color, p.Miniature, null, p.Selected, p.Description, count, isExpanded, tk,
context, backgroundArea, cellArea, state);
} else if (item is IPlaylistElement) {
IPlaylistElement p = item as IPlaylistElement;
RenderPlay (Config.Style.PaletteActive, p.Miniature, null, p.Selected, p.Description,
count, isExpanded, tk, context, backgroundArea, cellArea, state);
} else {
Log.Error ("No renderer for type " + item.GetType ());
}
}
示例2: GetCellBrush
private Brush GetCellBrush(CellState state)
{
if (state == CellState.Live)
return this.liveCellStyle ?? (this.liveCellStyle = Application.Current.FindResource("LiveCellBrush") as Brush);
return this.deadCellStyle ?? (this.deadCellStyle = Application.Current.FindResource("DeadCellBrush") as Brush);
}
示例3: GameTile
public GameTile (GameObject tile, int x, int y)
{
Go = tile;
cellState = CellState.WhiteHidden;
locX = x;
locY = y;
}
示例4: Program
/// <summary>
/// In this constructor main cycle is performed
/// </summary>
/// <param name="fold">path to game folder</param>
/// <param name="player">player symbol</param>
/// <param name="time">permited time</param>
public Program(string fold, CellState player, int time)
{
start = DateTime.Now;
Field field = new Field(fold);
int delta = 0;
# if DEBUG
delta = (new Random()).Next(Field.SIZE);//col shift, makes game more different
#endif
Solution root = new Solution(field, Solution.invertCell(player));
for (int i = 0; i < Field.SIZE; i++) {
Solution buf = new Solution(root, (i + delta) % Field.SIZE);
branch[i] = buf;
if (!buf.isFinalized)
que.Enqueue(buf);
}
while ((DateTime.Now - start).TotalMilliseconds + 300 < time && que.Count != 0)//main cycle
Solve(que.Dequeue());
Solution max = branch[0];
for (int i = 1; i < Field.SIZE; i++)
if (branch[i] != null)
max = branch[i].isGreater(max);
int turn = Directory.GetFiles(fold).Length / 2 + 1;
string path = fold + (player == CellState.Cross ? "X" : "O") + turn.ToString() + ".txt";
File.WriteAllLines(path, new String[] { max.getTurn() });
}
示例5: SetCell
public void SetCell( CellState cs, int row, int col )
{
Util.RangeCheck(row, 1, width);
Util.RangeCheck(col, 1, width);
d_board[ToIndex(row), ToIndex(col)] = cs;
}
示例6: PlaceRecordItem
public PlaceRecordItem(
OverturnableInfo placeAndTurnableInfo,
CellState stoneColor)
{
PlaceAndTurnableInfo = placeAndTurnableInfo;
StoneColor = stoneColor;
}
示例7: move_to_next
public void move_to_next()
{
hasChanges = state == next_state ? false : true;
last_state = state;
state = next_state;
next_state = CellState.Unknown;
}
示例8: DrainEnergy
public int DrainEnergy()
{
if (State != CellState.Dead)
{
Energy--;
if (Energy <= 4)
{
State = CellState.Sick;
}
if (Energy <= 0)
{
SoundManager.PlaySound(GameAssets.CellDeadSound, Position, 1F);
State = CellState.Dead;
this.Tint = new Color(50, 50, 50, 128);
GameStats.IncrementDeadCellCount();
}
return 1;
}
else
{
return 0;
}
}
示例9: GenerateSong
public static CellState[,] GenerateSong(Automatone automatone, Random random, MusicTheory theory)
{
InputParameters.Instance.Tempo = (ushort)(theory.MIN_TEMPO + InputParameters.Instance.SongSpeed * (theory.MAX_TEMPO - theory.MIN_TEMPO));
InputParameters.Instance.TimeSignatureN = (int)(2 + random.NextDouble() / 4 * (13 - 2));
InputParameters.Instance.TimeSignatureD = (int)Math.Pow(2, (int)(1 + random.NextDouble() * 2));
Song s = new Song(theory, random);
NoteThread thread = new NoteThread(s.Notes, InputParameters.Instance.TimeSignature);
int gridWidth = s.MeasureCount * s.MeasureLength;
CellState[,] grid = new CellState[Automatone.PIANO_SIZE,gridWidth];
foreach (List<Note> nts in s.Notes)
{
foreach (Note n in nts)
{
grid[n.GetOctave() * MusicTheory.OCTAVE_SIZE + n.GetNoteName().ChromaticIndex - Automatone.LOWEST_NOTE_CHROMATIC_NUMBER, (int)Math.Min(n.GetStartMeasure() * s.MeasureLength + n.GetStartBeat() * Automatone.SUBBEATS_PER_WHOLE_NOTE, gridWidth - 1)] = CellState.START;
for (int i = 1; i < n.GetRemainingDuration() * Automatone.SUBBEATS_PER_WHOLE_NOTE; i++)
{
if (grid[n.GetOctave() * MusicTheory.OCTAVE_SIZE + n.GetNoteName().ChromaticIndex - Automatone.LOWEST_NOTE_CHROMATIC_NUMBER, (int)Math.Min(n.GetStartMeasure() * s.MeasureLength + n.GetStartBeat() * Automatone.SUBBEATS_PER_WHOLE_NOTE + i, gridWidth - 1)] == CellState.SILENT)
{
grid[n.GetOctave() * MusicTheory.OCTAVE_SIZE + n.GetNoteName().ChromaticIndex - Automatone.LOWEST_NOTE_CHROMATIC_NUMBER, (int)Math.Min(n.GetStartMeasure() * s.MeasureLength + n.GetStartBeat() * Automatone.SUBBEATS_PER_WHOLE_NOTE + i, gridWidth - 1)] = CellState.HOLD;
}
}
}
}
automatone.MeasureLength = s.MeasureLength;
return grid;
}
示例10: Formula
private Value v; // Up to date if state==Uptodate
public Formula(Workbook workbook, Expr e) {
Debug.Assert(workbook != null);
Debug.Assert(e != null);
this.workbook = workbook;
this.e = e;
this.state = CellState.Uptodate;
}
示例11: Cell
public Cell(Texture2D texture, Rectangle drawBounds)
: base(texture, drawBounds)
{
this.Type = SpriteType.Cell;
this.Energy = 7;
this.State = CellState.Living;
}
示例12: Clicked
public void Clicked(CellController cell)
{
if (!Attack)
{
switch (this.state)
{
case CellState.None:
if (SelectedCells.Count < ShipAmount.TotalCellAmount)
{
this.state = CellState.Selected;
SelectedCells.Add(this);
}
break;
case CellState.Selected:
this.state = CellState.None;
SelectedCells.Remove(this);
break;
}
this.Invalidate();
}
else
{
if (!Locked)
{
if (EnemyCell)
{
state = CellState.Selected;
Invalidate();
ShipAmount.TotalCellAmount--;
}
MainController.DoAttack();
}
}
}
示例13: InitializeForestFire
private static CellState[,] InitializeForestFire(int height, int width)
{
// Create our state array, initialize all indices as Empty, and return it.
var state = new CellState[height, width];
state.Initialize();
return state;
}
示例14: SelectBestCell
public override Point SelectBestCell(CellState color) {
foreach(Point attempt in Board.EnumerateCells()) {
if(Board.GetStone(attempt) == CellState.None)
return attempt;
}
return Draw;
}
示例15: OverTurnStonesPhase
public OverTurnStonesPhase(CellState colorToTurn)
{
_placePos = new System.Drawing.Point(-1, -1);
_turnPosList = new List<System.Drawing.Point>();
_colorToTurn = colorToTurn;
Init();
}