本文整理汇总了C#中CellType类的典型用法代码示例。如果您正苦于以下问题:C# CellType类的具体用法?C# CellType怎么用?C# CellType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CellType类属于命名空间,在下文中一共展示了CellType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Cell
public Cell(int newID, int newType, Vector3 loc, Vector3 size)
{
id = newID;
type = (CellType)newType;
location = loc;
bounds = new Bounds(loc,size);
}
示例2: MemberFieldData
public MemberFieldData(string def)
{
string[] strSplit = def.Split(':');
if (strSplit.Length > 1) {
string typedef = strSplit[1];
if (string.Compare(typedef, "integer") == 0)
type = CellType.Int;
else if (string.Compare(typedef, "string") == 0)
type = CellType.String;
else if (string.Compare(typedef, "float") == 0)
type = CellType.Float;
else if (string.Compare(typedef, "double") == 0)
type = CellType.Double;
else if (string.Compare(typedef, "enum") == 0)
type = CellType.Enum;
else if (string.Compare(typedef, "bool") == 0)
type = CellType.Bool;
else {
type = CellType.Undefined;
Debug.LogError("Wrong cell type is defined: " + typedef);
}
} else
type = CellType.Undefined;
name = strSplit[0];
}
示例3: SetValue
public void SetValue(ValueEval value)
{
Type cls = value.GetType();
if (cls == typeof(NumberEval))
{
_cellType = CellType.NUMERIC;
_numberValue = ((NumberEval)value).NumberValue;
return;
}
if (cls == typeof(StringEval))
{
_cellType = CellType.STRING;
_stringValue = ((StringEval)value).StringValue;
return;
}
if (cls == typeof(BoolEval))
{
_cellType = CellType.BOOLEAN;
_boolValue = ((BoolEval)value).BooleanValue;
return;
}
if (cls == typeof(ErrorEval))
{
_cellType = CellType.ERROR;
_errorValue = ((ErrorEval)value).ErrorCode;
return;
}
if (cls == typeof(BlankEval))
{
_cellType = CellType.BLANK;
return;
}
throw new ArgumentException("Unexpected value class (" + cls.Name + ")");
}
示例4: CreateCell
public virtual FrameworkElement CreateCell(DataGrid grid, CellType cellType, CellRange rng)
{
// cell border
var bdr = CreateCellBorder(grid, cellType, rng);
// bottom right cells have no content
if (!rng.IsValid)
{
return bdr;
}
// bind/customize cell by type
switch (cellType)
{
case CellType.Cell:
CreateCellContent(grid, bdr, rng);
break;
case CellType.ColumnHeader:
CreateColumnHeaderContent(grid, bdr, rng);
break;
}
// done
return bdr;
}
示例5: sCell
public sCell(GameObject cell)
{
if (cell == null)
{
type = CellType.Null;
return;
}
pos = new sVector3(cell.transform.position);
value = cell.GetComponent<CellValue>().Value;
switch (cell.tag)
{
case "Dragon":
type = CellType.Dragon;
break;
case "Hero":
type = CellType.Hero;
break;
case "Monster":
type = CellType.Monster;
break;
case "Sword":
type = CellType.Sword;
break;
}
}
示例6: CreateCell
public void CreateCell(CellType type, Vector3 position)
{
var cellPrefab = cellPrefabs.Find(x => x.type == type);
if (cellPrefab == null) return;
Instantiate(cellPrefab.prefab, position, Quaternion.identity);
}
示例7: GenerateGround
public static CellType[] GenerateGround(string seed, int islandSize, int seedBase, float noiseSize, float falloffExponent, float threshold)
{
var cells = new CellType[islandSize * islandSize];
var seedHash = seedBase + seed.GetHashCode();
// These weird nubers are 'random' prime numbers
var seedX = seedHash % 65521;
var seedY = (seedHash * 45949) % 31147;
var spacing = noiseSize / islandSize;
var offset = (spacing - noiseSize) * 0.5f;
var center = islandSize * 0.5f;
var radius = islandSize * Mathf.Sqrt(0.5f);
for (var row = 0; row < islandSize; ++row) {
for (var column = 0; column < islandSize; ++column) {
if (row == 0 || column == 0 || row == islandSize - 1 || column == islandSize - 1) {
cells[row * islandSize + column] = CellType.Water;
} else {
var x = seedX + offset + row * spacing;
var y = seedY + offset + column * spacing;
var distanceToCenter =
Vector2.Distance(
new Vector2(row, column),
new Vector2(center, center))
/ radius;
var sample = Mathf.PerlinNoise(x, y) * (1.0f - Mathf.Pow(distanceToCenter, falloffExponent));
cells[row * islandSize + column] = sample > threshold ? CellType.Ground : CellType.Water;
}
}
}
return cells;
}
示例8: World
public World(int moveIndex, int width, int height, Player[] players, Trooper[] troopers, Bonus[] bonuses,
CellType[][] cells, bool[] cellVisibilities)
{
this.moveIndex = moveIndex;
this.width = width;
this.height = height;
this.players = new Player[players.Length];
Array.Copy(players, this.players, players.Length);
this.troopers = new Trooper[troopers.Length];
Array.Copy(troopers, this.troopers, troopers.Length);
this.bonuses = new Bonus[bonuses.Length];
Array.Copy(bonuses, this.bonuses, bonuses.Length);
this.cells = new CellType[width][];
for (int x = 0; x < width; ++x)
{
this.cells[x] = new CellType[cells[x].Length];
Array.Copy(cells[x], this.cells[x], cells[x].Length);
}
this.cellVisibilities = cellVisibilities;
}
示例9: Start
/*/// <summary>
/// Surface molecular pattern of the cell. An array of bits each of which represents a nucleotide.
/// </summary>
public MolecularPattern Pattern
{
get { return pattern; }
}*/
#endregion
#region Public Methods
/*public Cell(CellType type, ITissue parent, MolecularPattern initialPattern)
{
Type = type;
Parent = parent;
pattern = initialPattern;
maturationLevel = CellMaturationLevel.Immature;
Start();
}*/
public Cell(CellType type, ITissue parent)
{
Type = type;
Parent = parent;
maturationLevel = CellMaturationLevel.Immature;
Start();
}
示例10: FromString
/// <summary>
/// Creates a GameField object from the given string
/// </summary>
/// <param name="fieldData">The field data.</param>
/// <returns></returns>
public static GameField FromString(string fieldData)
{
var rows = fieldData.Split(new[] {";"}, StringSplitOptions.RemoveEmptyEntries);
var rowList = new List<CellType[]>();
foreach (var row in rows)
{
var rowData = row
.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries)
.Select(ToCellType)
.ToArray();
rowList.Add(rowData);
}
int width = rowList.First().Length;
int heigth = rows.Length;
// Construct and Initialize Grid
var gridData = new CellType[heigth][];
for (int y = 0; y < heigth; y++)
{
gridData[y] = new CellType[width];
for (int x = 0; x < width; x++)
{
gridData[y][x] = CellType.Empty;
}
}
return new GameField(new Size(width, heigth), gridData);
}
示例11: GetMergedRange
public CellRange GetMergedRange(C1FlexGrid grid, CellType cellType, CellRange rg)
{
// we are only interested in data cells
// (not merging row or column headers)
if (cellType == CellType.Cell)
{
// expand left/right
for (int i = rg.Column; i < grid.Columns.Count - 1; i++)
{
if (GetDataDisplay(grid, rg.Row, i) != GetDataDisplay(grid, rg.Row, i + 1)) break;
rg.Column2 = i + 1;
}
for (int i = rg.Column; i > 0; i--)
{
if (GetDataDisplay(grid, rg.Row, i) != GetDataDisplay(grid, rg.Row, i - 1)) break;
rg.Column = i - 1;
}
// expand up/down
for (int i = rg.Row; i < grid.Rows.Count - 1; i++)
{
if (GetDataDisplay(grid, i, rg.Column) != GetDataDisplay(grid, i + 1, rg.Column)) break;
rg.Row2 = i + 1;
}
for (int i = rg.Row; i > 0; i--)
{
if (GetDataDisplay(grid, i, rg.Column) != GetDataDisplay(grid, i - 1, rg.Column)) break;
rg.Row = i - 1;
}
}
// done
return rg;
}
示例12: SetCell
public void SetCell(int x, int y, CellType c)
{
if (x < 0 || x >= cells.GetLength(0) || y < 0 || y >= cells.GetLength(1))
return;
switch (c)
{
case CellType.Passable:
case CellType.Impassable:
if ((StartX == x && StartY == y) || (FinishX == x && FinishY == y))
return;
break;
case CellType.Start:
if (cells[x, y] == -2 || cells[x, y] == -4) // don't change if its impassable or "finish"
return;
cells[StartX, StartY] = -1;
StartX = x;
StartY = y;
break;
case CellType.Finish:
if (cells[x, y] == -2 || cells[x, y] == -3) // don't change if its impassable or "start"
return;
cells[FinishX, FinishY] = -1;
FinishX = x;
FinishY = y;
break;
}
cells[x, y] = -(int)c - 1;
}
示例13: Cell
public Cell(int y, int x, CellType cellType)
{
Gold = 0;
Y = y;
X = x;
CellType = cellType;
}
示例14: init
public void init(CellType _cellType,BombType _cellBombType,CellColor _cellColor)
{
string spritePath = _cellType.ToString() +_cellBombType.ToString()+ _cellColor.ToString();
Sprite newSprite = Resources.Load("Sprite/Cells/"+spritePath,typeof(Sprite)) as Sprite;
GetComponent<SpriteRenderer>().sprite = newSprite;
}
示例15: DBCFileComparer
public DBCFileComparer(string oldFile, string newFile, int testAmount, CellType[] knownColumnStructure)
{
oldReader = new DBCReader(oldFile);
newReader = new DBCReader(newFile);
this.knownColumnStructure = knownColumnStructure;
this.testAmount = testAmount;
}