本文整理汇总了C#中Cell类的典型用法代码示例。如果您正苦于以下问题:C# Cell类的具体用法?C# Cell怎么用?C# Cell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Cell类属于命名空间,在下文中一共展示了Cell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Reify
public Output Reify(
Cell<IMaybe<Size>> size,
Stream<MouseEvent> sMouse, Stream<KeyEvent> sKey,
Cell<long> focus, Supply idSupply)
{
return this.reify(size, sMouse, sKey, focus, idSupply);
}
示例2: SetEndingCell
void SetEndingCell(GridDungeonModel model, Cell cell) {
var roomCenter = MathUtils.GridToWorld(model.Config.GridCellSize, cell.CenterF);
// Destroy all old level goal objects
var oldGoals = GameObject.FindObjectsOfType<DAShooter.LevelGoal>();
foreach (var oldGoal in oldGoals)
{
var oldGoalObj = oldGoal.gameObject;
if (oldGoalObj != null)
{
if (Application.isPlaying)
{
Destroy(oldGoalObj);
}
else
{
DestroyImmediate(oldGoalObj);
}
}
}
var goal = Instantiate(levelEndGoalTemplate) as GameObject;
goal.transform.position = roomCenter;
if (goal.GetComponent<DAShooter.LevelGoal>() == null)
{
Debug.LogWarning("No LevelGoal component attached to the Level goal prefab. cleanup will not be proper");
}
}
示例3: Clear
public override void Clear(Cell cell)
{
foreach (var item in _effects)
{
item.Clear(cell);
}
}
示例4: LoadLevel
public Cell[,] LoadLevel(int level_nr)
{
Cell[,] cell = null;
string[] lines;
try
{
lines = File.ReadAllLines(filename);
}
catch
{
return cell;
}
int curr = 0;
int curr_level_nr = 0;
int width;
int height;
while (curr < lines.Length)
{
ReadLevelHeader(lines[curr], out curr_level_nr, out width, out height);
if (level_nr == curr_level_nr)
{
cell = new Cell[width, height];
for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
cell[x, y] = CharToCell(lines[curr + 1 + y][x]);
break;
}
else
curr = curr + 1 + height;
}
return cell;
}
示例5: GetCellCore
protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context)
{
Performance.Start();
var cell = (ViewCell)item;
var container = convertView as ViewCellContainer;
if (container != null)
{
container.Update(cell);
Performance.Stop();
return container;
}
BindableProperty unevenRows = null, rowHeight = null;
if (ParentView is TableView)
{
unevenRows = TableView.HasUnevenRowsProperty;
rowHeight = TableView.RowHeightProperty;
}
else if (ParentView is ListView)
{
unevenRows = ListView.HasUnevenRowsProperty;
rowHeight = ListView.RowHeightProperty;
}
IVisualElementRenderer view = Platform.CreateRenderer(cell.View);
Platform.SetRenderer(cell.View, view);
cell.View.IsPlatformEnabled = true;
var c = new ViewCellContainer(context, view, cell, ParentView, unevenRows, rowHeight);
Performance.Stop();
return c;
}
示例6: GetPath
private static void GetPath(char[,] matrix, Cell start, Cell end, ref bool foundExit)
{
if (foundExit)
{
return; // already found the solution and other cases are not interesting
}
if (start.Row >= matrix.GetLength(0) || start.Row < 0 || start.Col >= matrix.GetLength(1) || start.Col < 0)
{
return; // the cell is outside the matrix
}
if (matrix[start.Row, start.Col] == '*')
{
return; // the cell is not passable
}
if (start.Equals(end))
{
foundExit = true; // found exit
return;
}
matrix[start.Row, start.Col] = '*';
GetPath(matrix, new Cell(start.Row + 1, start.Col), end, ref foundExit);
GetPath(matrix, new Cell(start.Row, start.Col + 1), end, ref foundExit);
GetPath(matrix, new Cell(start.Row - 1, start.Col), end, ref foundExit);
GetPath(matrix, new Cell(start.Row, start.Col - 1), end, ref foundExit);
matrix[start.Row, start.Col] = ' ';
}
示例7: GetCell
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
{
var entryCell = (EntryCell)item;
var tvc = reusableCell as EntryCellTableViewCell;
if (tvc == null)
tvc = new EntryCellTableViewCell(item.GetType().FullName);
else
{
tvc.Cell.PropertyChanged -= OnCellPropertyChanged;
tvc.TextFieldTextChanged -= OnTextFieldTextChanged;
tvc.KeyboardDoneButtonPressed -= OnKeyBoardDoneButtonPressed;
}
SetRealCell(item, tvc);
tvc.Cell = item;
tvc.Cell.PropertyChanged += OnCellPropertyChanged;
tvc.TextFieldTextChanged += OnTextFieldTextChanged;
tvc.KeyboardDoneButtonPressed += OnKeyBoardDoneButtonPressed;
WireUpForceUpdateSizeRequested(item, tvc, tv);
UpdateBackground(tvc, entryCell);
UpdateLabel(tvc, entryCell);
UpdateText(tvc, entryCell);
UpdateKeyboard(tvc, entryCell);
UpdatePlaceholder(tvc, entryCell);
UpdateLabelColor(tvc, entryCell);
UpdateHorizontalTextAlignment(tvc, entryCell);
UpdateIsEnabled(tvc, entryCell);
return tvc;
}
示例8: GetCellCore
protected override global::Android.Views.View GetCellCore(Cell item, global::Android.Views.View convertView, ViewGroup parent, Context context)
{
if ((_view = convertView as EntryCellView) == null)
_view = new EntryCellView(context, item);
else
{
_view.TextChanged = null;
_view.FocusChanged = null;
_view.EditingCompleted = null;
}
UpdateLabel();
UpdateLabelColor();
UpdatePlaceholder();
UpdateKeyboard();
UpdateHorizontalTextAlignment();
UpdateText();
UpdateIsEnabled();
UpdateHeight();
_view.TextChanged = OnTextChanged;
_view.EditingCompleted = OnEditingCompleted;
return _view;
}
示例9: AddCell
public CellTag AddCell(Cell cell, string tagName)
{
var child = new CellTag(cell, tagName);
Append(child);
return child;
}
示例10: MoveAction
byte WAIT_TICKS = 30; // How many ticks to wait for another unit to move.
#endregion Fields
#region Constructors
/// <summary>
/// This constructor will create a MoveAction to the given targetX, and targetY.
/// </summary>
/// <param name="targetX">X coordinate destination of the move action in game space.</param>
/// <param name="targetY">Y coordinate destination of the move action in game space.</param>
/// <param name="gw">The GameWorld that the move action is occurring in.</param>
/// <param name="entity">The Entity being given the MoveAction. (Should only be given to Units)</param>
public MoveAction(float targetX, float targetY, GameWorld gw, Entity entity)
{
this.actionType = ActionType.Move;
this.targetY = targetY;
this.targetX = targetX;
this.entity = entity;
this.gw = gw;
unit = (Unit)entity;
float startX = unit.x;
float startY = unit.y;
if ((int)targetX >= gw.map.width || (int)targetX < 0 || (int)targetY >= gw.map.height || (int)targetY < 0)
{
// Invalid target position.
path = new List<Cell>();
}
else
{
path = findPath.between(gw.map, gw.map.getCell((int)startX, (int)startY), gw.map.getCell((int)targetX, (int)targetY));
// Don't bother with path if it is just to same cell.
if (path.Count > 1)
{
targetCell = path[1];
cellIndex = 1;
}
else
{
path = new List<Cell>();
}
}
}
示例11: Load
public bool Load(Stream gnd)
{
BinaryReader br = new BinaryReader(gnd);
string header = ((char)br.ReadByte()).ToString() + ((char)br.ReadByte()) + ((char)br.ReadByte()) + ((char)br.ReadByte());
if (header != "GRAT")
return false;
majorVersion = br.ReadByte();
minorVersion = br.ReadByte();
if (majorVersion != 1 || minorVersion != 2)
return false;
_width = br.ReadInt32();
_height = br.ReadInt32();
_cells = new Cell[_width * _height];
for (int i = 0; i < _cells.Length; i++)
{
Cell c = new Cell();
c.Load(br);
_cells[i] = c;
}
Logger.WriteLine("Altitude v{0}.{1} status: {2}x{3} - {4} cells", majorVersion, minorVersion, _width, _height, _cells.Length);
return true;
}
示例12: GridCellInstantiationTest
public void GridCellInstantiationTest()
{
Grid grid;
// Assert each cell in grid is instantiated and initialized with expected default chemical concentrations
grid = new Grid(4);
for (int column = 0; column < grid.Size; column++)
{
for (int row = 0; row < grid.Size; row++)
{
Assert.AreEqual(grid[column, row]["A"], 0);
Assert.AreEqual(grid[column, row]["B"], 0);
}
}
// Assert each cell in grid is instantiated and initialized with given chemical concentrations
Cell cell = new Cell
{
{ "A", 0.25 },
{ "B", 0.75 }
};
grid = new Grid(4, cell);
for (int column = 0; column < grid.Size; column++)
{
for (int row = 0; row < grid.Size; row++)
{
Assert.AreEqual(grid[column, row]["A"], 0.25);
Assert.AreEqual(grid[column, row]["B"], 0.75);
}
}
}
示例13: CellTag
public CellTag(Cell cell, string tag)
: base(tag)
{
AddClass(GrammarConstants.CELL);
this.AddSafeClassName(cell.Key);
MetaData(GrammarConstants.KEY, cell.Key);
}
示例14: FindFirstExit
private static Cell FindFirstExit(Cell startingPoint)
{
var path = new Queue<Cell>();
if (startingPoint != null)
{
path.Enqueue(startingPoint);
}
while (path.Count > 0)
{
var curretnCell = path.Dequeue();
if (IsExit(curretnCell))
{
return curretnCell;
}
TryDirection(path, curretnCell, "U", 0, -1);
TryDirection(path, curretnCell, "R", 1, 0);
TryDirection(path, curretnCell, "D", 0, 1);
TryDirection(path, curretnCell, "L", -1, 0);
}
return null;
}
示例15: Edge
public Edge(int x, int y, Directions direction, int depth)
{
origin = new Cell {direction = direction, x = x, y = y, depth = depth};
exit = new Cell {x = x, y = y, depth = depth + 1};
switch (origin.direction)
{
case Directions.Left:
exit.direction = Directions.Right;
exit.x -= 1;
break;
case Directions.Right:
exit.direction = Directions.Left;
exit.x += 1;
break;
case Directions.Down:
exit.direction = Directions.Up;
exit.y -= 1;
break;
case Directions.Up:
exit.direction = Directions.Down;
exit.y += 1;
break;
}
}