本文整理汇总了C#中CellType类的典型用法代码示例。如果您正苦于以下问题:C# CellType类的具体用法?C# CellType怎么用?C# CellType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CellType类属于命名空间,在下文中一共展示了CellType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:jdohgamer,项目名称:SSC,代码行数:7,代码来源:Cell.cs
示例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];
}
开发者ID:petereichinger,项目名称:Unity-QuickSheet,代码行数:27,代码来源:ScriptPrescription.cs
示例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 + ")");
}
开发者ID:Johnnyfly,项目名称:source20131023,代码行数:35,代码来源:ForkedEvaluationCell.cs
示例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;
}
开发者ID:GJian,项目名称:UWP-master,代码行数:26,代码来源:CellFactory.cs
示例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;
}
}
开发者ID:jdcaruso,项目名称:Hero48Game,代码行数:27,代码来源:sCell.cs
示例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);
}
开发者ID:Sundem,项目名称:TD,代码行数:7,代码来源:BoardManager.cs
示例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;
}
开发者ID:kmichel,项目名称:passeur,代码行数:30,代码来源:Island.cs
示例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;
}
开发者ID:Evander83,项目名称:AICup-2013,代码行数:25,代码来源:World.cs
示例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();
}
开发者ID:sawat80,项目名称:Simulais,代码行数:28,代码来源:Cells.cs
示例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);
}
开发者ID:bReChThOu,项目名称:WarlightBlockBattle,代码行数:36,代码来源:FieldHelper.cs
示例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;
}
开发者ID:mdjabirov,项目名称:C1Decompiled,代码行数:34,代码来源:MyMergeManager.cs
示例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;
}
开发者ID:Download,项目名称:Irrlicht-Lime,代码行数:34,代码来源:Pathfinding.cs
示例13: Cell
public Cell(int y, int x, CellType cellType)
{
Gold = 0;
Y = y;
X = x;
CellType = cellType;
}
开发者ID:Sewil,项目名称:ATeam-DDO,代码行数:7,代码来源:Cell.cs
示例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;
}
开发者ID:jyzgo,项目名称:SodaLikeDemo,代码行数:7,代码来源:BombEff.cs
示例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;
}
开发者ID:KroneckerX,项目名称:WCell,代码行数:7,代码来源:DBCFileComparer.cs
示例16: PawnType
public PawnType(Tag tag)
{
if (tag.name == "_")
{
type_ = CellType.None;
tag_ = null;
}
else if (tag.name == "Float")
{
type_ = CellType.Float;
tag_ = null;
}
else if (tag.name == "bool")
{
type_ = CellType.Bool;
tag_ = null;
}
else if (SourcePawn.OpcodeHelpers.IsFunctionTag(tag))
{
type_ = CellType.Function;
tag_ = null;
}
else
{
type_ = CellType.Tag;
tag_ = tag;
}
}
开发者ID:not1ce111,项目名称:Spedit,代码行数:28,代码来源:TypeSet.cs
示例17: Map
public Map(string filename)
{
var lines = File.ReadAllLines(filename);
var heroPos = lines[0].Split().Select(int.Parse).ToArray();
Hero = new Location(heroPos[0], heroPos[1]);
cells = new CellType[lines.Length, lines[0].Length];
foreach (var y in lines.Indices())
foreach (var x in lines[0])
{
CellType cellType;
switch (lines[y][x])
{
case '.':
cellType = CellType.Empty;
break;
case '#':
cellType = CellType.Wall;
break;
case '@':
cellType = CellType.Swamp;
break;
default:
throw new NotSupportedException(lines[y][x].ToString());
}
cells[y, x] = cellType;
}
}
开发者ID:xoposhiy,项目名称:design-course,代码行数:27,代码来源:Map.cs
示例18: CMap
//internal CMap(MapRepresent_ProD representMap)
//{
// colCount = representMap.ColCount;
// rowCount = representMap.RowCount;
// mx = new CCell[colCount, rowCount];
// for (int i = 0; i < colCount; i++)
// for (int j = 0; j < rowCount; j++)
// {
// var cell = new CCell(i, j, representMap[i, j]);
// mx[i, j] = cell;
// if (cell.IsWall) wall.Add(cell);
// else
// switch (cell.Type)
// {
// case CellType.Entrance:
// entranceCell = cell;
// break;
// case CellType.Exit:
// exitCell = cell;
// break;
// case CellType.Door:
// doorCells.Add(cell);
// break;
// }
// }
//}
internal CMap(CellType[,] cellMatrix)
{
colCount = cellMatrix.GetLength(0);
rowCount = cellMatrix.GetLength(1);
mx = new CCell[colCount, rowCount];
for (int i = 0; i < colCount; i++)
for (int j = 0; j < rowCount; j++)
{
var cell = new CCell(i, j, cellMatrix[i, j]);
mx[i, j] = cell;
if (cell.IsWall) wall.Add(cell);
else
switch (cell.Type)
{
case CellType.Entrance:
entranceCell = cell;
break;
case CellType.Exit:
exitCell = cell;
break;
case CellType.Door:
doorCells.Add(cell);
break;
}
}
}
开发者ID:RrrEeGina,项目名称:PackMan,代码行数:54,代码来源:CMap.cs
示例19: Calculate
public IEnumerable<CellCost> Calculate(CellType[,] grid, int horizontalPosition, int verticalPosition)
{
var output = new List<CellCost>();
if (horizontalPosition > 0)
{
var left = horizontalPosition - 1;
var leftCell = grid[verticalPosition, left];
output.Add( new CellCost(verticalPosition, left, GetCost(leftCell)));
}
if (horizontalPosition < grid.GetLength(1) - 1)
{
var right = horizontalPosition + 1;
var leftCell = grid[verticalPosition, right];
output.Add( new CellCost(verticalPosition, right, GetCost(leftCell)));
}
if (verticalPosition > 0)
{
var down = verticalPosition - 1;
var leftCell = grid[down, horizontalPosition];
output.Add( new CellCost(down, horizontalPosition, GetCost(leftCell)));
}
if (verticalPosition < grid.GetLength(0) - 1)
{
var up = verticalPosition + 1;
var leftCell = grid[up, horizontalPosition];
output.Add( new CellCost(up, horizontalPosition, GetCost(leftCell)));
}
return output;
}
开发者ID:osw,项目名称:SC2012.Maze,代码行数:34,代码来源:CostCalculator.cs
示例20: CreateCell
/// <summary>
/// Cell factory implementation.
/// </summary>
/// <param name="cellType">Cell type.</param>
/// <returns>Required cell.</returns>
public static ICell CreateCell(CellType cellType)
{
//// Uses "lazy initialization".
ICell cell;
switch (cellType)
{
case CellType.EmptyCell:
cell = new EmptyCell();
cell.CellView = CellView.Empty;
break;
case CellType.Bomb:
int bombSize = RandomGenerator.GetRandomNumber(MIN_BOMB_SIZE, MAX_BOMB_SIZE);
cell = new BombCell(bombSize);
cell.CellView = (CellView)bombSize + ASCII_VIEW_OFFSET;
break;
case CellType.BlownCell:
cell = new BlownCell();
cell.CellView = CellView.Blown;
break;
default:
throw new ArgumentException("Invalid cell type give to the cell factory");
}
return cell;
}
开发者ID:huuuskyyy,项目名称:Teamworks,代码行数:34,代码来源:CellFactory.cs
注:本文中的CellType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论