本文整理汇总了C#中BaseCell类的典型用法代码示例。如果您正苦于以下问题:C# BaseCell类的具体用法?C# BaseCell怎么用?C# BaseCell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseCell类属于命名空间,在下文中一共展示了BaseCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ColumnIndex
public void ColumnIndex ()
{
DataGridViewCell c = new BaseCell ();
Assert.AreEqual (-1, c.ColumnIndex, "A1");
DataGridView dgv = new DataGridView ();
dgv.Columns.Add ("hi", "there");
DataGridViewRow row = new DataGridViewRow ();
row.Cells.Add (c);
dgv.Rows.Add (row);
Assert.AreEqual (0, dgv.Rows[0].Cells[0].ColumnIndex, "A2");
}
示例2: Awake
void Awake()
{
switch (GetComponent<BaseCell>().celltype) {
case CellType.STEM_CELL:
m_baseCell = GetComponent<StemCell>();
break;
case CellType.HEAT_CELL:
m_baseCell = GetComponent<HeatCell>();
break;
case CellType.COLD_CELL:
m_baseCell = GetComponent<ColdCell>();
break;
case CellType.HEAT_CELL_TIRE2:
m_baseCell = GetComponent<Tier2HeatCell>();
break;
case CellType.COLD_CELL_TIRE2:
m_baseCell = GetComponent<Tier2ColdCell>();
break;
case CellType.ACIDIC_CELL:
m_baseCell = GetComponent<AcidicCell>();
break;
case CellType.ALKALI_CELL:
m_baseCell = GetComponent<AlkaliCell>();
break;
case CellType.CANCER_CELL:
m_baseCell = GetComponent<CancerCell>();
break;
case CellType.NERVE_CELL:
m_baseCell = GetComponent<NerveCell>();
break;
default:
break;
}
m_visionRange = GetComponent<BaseCell>().fovRadius;
unitLayerMask = 1 << LayerMask.NameToLayer("Unit");
}
示例3: PreferredSize
public void PreferredSize ()
{
DataGridViewCell c = new BaseCell ();
Assert.AreEqual (new Size (-1, -1), c.PreferredSize, "A1");
DataGridView dgv = new DataGridView ();
dgv.Columns.Add ("hi", "there");
DataGridViewRow row = new DataGridViewRow ();
row.Cells.Add (c);
dgv.Rows.Add (row);
Assert.AreEqual (new Size (-1, -1), dgv.Rows[0].Cells[0].PreferredSize, "A2");
// Always returns (-1, -1)
dgv.Rows[0].Cells[0].Value = "bob";
Assert.AreEqual (new Size (-1, -1), dgv.Rows[0].Cells[0].PreferredSize, "A3");
}
示例4: MethodGetInheritedContextMenuStrip
public void MethodGetInheritedContextMenuStrip ()
{
DataGridViewCell c = new BaseCell ();
Assert.AreEqual (null, c.GetInheritedContextMenuStrip (c.RowIndex), "A1");
DataGridView dgv = new DataGridView ();
dgv.Columns.Add ("hi", "there");
DataGridViewRow row = new DataGridViewRow ();
row.Cells.Add (c);
dgv.Rows.Add (row);
Assert.AreEqual (null, dgv.Rows[0].Cells[0].GetInheritedContextMenuStrip (dgv.Rows[0].Cells[0].RowIndex), "A2");
ContextMenuStrip cms1 = new ContextMenuStrip ();
cms1.Items.Add ("Moose");
dgv.ContextMenuStrip = cms1;
Assert.AreSame (cms1, dgv.Rows[0].Cells[0].GetInheritedContextMenuStrip (dgv.Rows[0].Cells[0].RowIndex), "A3");
ContextMenuStrip cms2 = new ContextMenuStrip ();
cms2.Items.Add ("Moose");
dgv.Columns[0].ContextMenuStrip = cms2;
Assert.AreSame (cms2, dgv.Rows[0].Cells[0].GetInheritedContextMenuStrip (dgv.Rows[0].Cells[0].RowIndex), "A4");
dgv.Rows[0].ContextMenuStrip = cms1;
Assert.AreSame (cms1, dgv.Rows[0].Cells[0].GetInheritedContextMenuStrip (dgv.Rows[0].Cells[0].RowIndex), "A5");
dgv.Rows[0].Cells[0].ContextMenuStrip = cms2;
Assert.AreSame (cms2, dgv.Rows[0].Cells[0].GetInheritedContextMenuStrip (dgv.Rows[0].Cells[0].RowIndex), "A6");
}
示例5: MethodGetErrorText
public void MethodGetErrorText ()
{
Bitmap b = new Bitmap (1, 1);
Graphics g = Graphics.FromImage (b);
BaseCell c = new BaseCell ();
Assert.AreEqual (string.Empty, c.PublicGetErrorText (c.RowIndex), "A1");
DataGridView dgv = new DataGridView ();
dgv.Columns.Add ("hi", "there");
DataGridViewRow row = new DataGridViewRow ();
row.Cells.Add (c);
dgv.Rows.Add (row);
Assert.AreEqual (string.Empty, (dgv.Rows[0].Cells[0] as BaseCell).PublicGetErrorText (dgv.Rows[0].Cells[0].RowIndex), "A2");
g.Dispose ();
b.Dispose ();
}
示例6: MethodBorderWidths
public void MethodBorderWidths ()
{
BaseCell c = new BaseCell ();
DataGridViewAdvancedBorderStyle style = new DataGridViewAdvancedBorderStyle ();
style.Bottom = DataGridViewAdvancedCellBorderStyle.Inset;
style.Left = DataGridViewAdvancedCellBorderStyle.InsetDouble;
style.Top = DataGridViewAdvancedCellBorderStyle.None;
//style.Right = DataGridViewAdvancedCellBorderStyle.NotSet;
Assert.AreEqual (new Rectangle (2, 0, 0, 1), c.PublicBorderWidths (style), "A1");
style.Bottom = DataGridViewAdvancedCellBorderStyle.Outset;
style.Left = DataGridViewAdvancedCellBorderStyle.OutsetDouble;
style.Right = DataGridViewAdvancedCellBorderStyle.OutsetPartial;
style.Top = DataGridViewAdvancedCellBorderStyle.Single;
Assert.AreEqual (new Rectangle (2, 1, 1, 1), c.PublicBorderWidths (style), "A2");
DataGridView dgv = new DataGridView ();
dgv.Columns.Add ("hi", "there");
DataGridViewRow row = new DataGridViewRow ();
row.Cells.Add (c);
dgv.Rows.Add (row);
dgv.Rows[0].DividerHeight = 3;
dgv.Columns[0].DividerWidth = 5;
Assert.AreEqual (new Rectangle (2, 1, 6, 4), (dgv.Rows[0].Cells[0] as BaseCell).PublicBorderWidths (style), "A3");
}
示例7: Value2
public void Value2 ()
{
DataGridViewCell c = new BaseCell ();
Assert.AreEqual (null, c.Value, "A1");
DataGridView dgv = new DataGridView ();
dgv.Columns.Add ("hi", "there");
DataGridViewRow row = new DataGridViewRow ();
row.Cells.Add (c);
dgv.Rows.Add (row);
Assert.AreEqual (null, dgv.Rows[0].Cells[0].Value, "A2");
dgv.Rows[0].Cells[0].Value = "bob";
Assert.AreEqual ("bob", dgv.Rows[0].Cells[0].Value, "A3");
}
示例8: Style
public void Style ()
{
DataGridViewCell c = new BaseCell ();
Assert.AreEqual (DataGridViewContentAlignment.NotSet, c.Style.Alignment, "A1");
Assert.AreEqual (Color.Empty, c.Style.BackColor, "A2");
Assert.AreEqual (DBNull.Value, c.Style.DataSourceNullValue, "A3");
Assert.AreEqual (null, c.Style.Font, "A4");
Assert.AreEqual (Color.Empty, c.Style.ForeColor, "A5");
Assert.AreEqual (string.Empty, c.Style.Format, "A6");
Assert.AreEqual (Thread.CurrentThread.CurrentCulture, c.Style.FormatProvider, "A7");
Assert.AreEqual (true, c.Style.IsDataSourceNullValueDefault, "A8");
Assert.AreEqual (true, c.Style.IsFormatProviderDefault, "A9");
Assert.AreEqual (true, c.Style.IsNullValueDefault, "A10");
Assert.AreEqual (string.Empty, c.Style.NullValue, "A11");
Assert.AreEqual (Padding.Empty, c.Style.Padding, "A12");
Assert.AreEqual (Color.Empty, c.Style.SelectionBackColor, "A13");
Assert.AreEqual (Color.Empty, c.Style.SelectionForeColor, "A14");
Assert.AreEqual (null, c.Style.Tag, "A15");
Assert.AreEqual (DataGridViewTriState.NotSet, c.Style.WrapMode, "A16");
DataGridView dgv = new DataGridView ();
dgv.Columns.Add ("hi", "there");
DataGridViewRow row = new DataGridViewRow ();
row.Cells.Add (c);
dgv.Rows.Add (row);
// Style does not change based on parent
// (InheritedStyle does)
Assert.AreEqual (DataGridViewContentAlignment.NotSet, c.Style.Alignment, "A17");
Assert.AreEqual (Color.Empty, c.Style.BackColor, "A18");
Assert.AreEqual (DBNull.Value, c.Style.DataSourceNullValue, "A19");
Assert.AreEqual (null, c.Style.Font, "A20");
Assert.AreEqual (Color.Empty, c.Style.ForeColor, "A21");
Assert.AreEqual (string.Empty, c.Style.Format, "A22");
Assert.AreEqual (Thread.CurrentThread.CurrentCulture, c.Style.FormatProvider, "A23");
Assert.AreEqual (true, c.Style.IsDataSourceNullValueDefault, "A24");
Assert.AreEqual (true, c.Style.IsFormatProviderDefault, "A25");
Assert.AreEqual (true, c.Style.IsNullValueDefault, "A26");
Assert.AreEqual (string.Empty, c.Style.NullValue, "A27");
Assert.AreEqual (Padding.Empty, c.Style.Padding, "A28");
Assert.AreEqual (Color.Empty, c.Style.SelectionBackColor, "A29");
Assert.AreEqual (Color.Empty, c.Style.SelectionForeColor, "A30");
Assert.AreEqual (null, c.Style.Tag, "A31");
Assert.AreEqual (DataGridViewTriState.NotSet, c.Style.WrapMode, "A32");
}
示例9: DefaultNewRowValue
public void DefaultNewRowValue ()
{
DataGridViewCell c = new BaseCell ();
Assert.AreEqual (null, c.DefaultNewRowValue, "A1");
DataGridView dgv = new DataGridView ();
dgv.Columns.Add ("hi", "there");
DataGridViewRow row = new DataGridViewRow ();
row.Cells.Add (c);
dgv.Rows.Add (row);
Assert.AreEqual (null, dgv.Rows[0].Cells[0].DefaultNewRowValue, "A2");
}
示例10: Load
//public void Draw(Canvas canvas)
//{
// if (_mapCells == null) { throw new Exception("没有加载地图。"); }
//}
public bool Load(string filePathName)
{
releaseMapBitmap();
// 加载地图图片。
_mapBitmap = new Bitmap(filePathName);
if (_mapBitmap.Width < Cols || _mapBitmap.Height < Rows) { return false; }
for (int x = 0; x < Cols; x++)
{
for (int y = 0; y < Rows; y++)
{
System.Drawing.Color c = _mapBitmap.GetPixel(x, y);
if (c.R == 255 && c.G == 255 && c.B == 255) // 白色,地面
{
_mapCanvas.Children.Add(new LandCell(x,y));
}
else
{
if (c.R == 0 && c.G == 255 && c.B == 0) // 绿色,树
{
_mapCanvas.Children.Add(new TreeCell(x,y));
}
else
{
if (c.R == 0 && c.G == 0 && c.B == 255) // 蓝色,怪物进攻路线
{
_mapCanvas.Children.Add(new PathCell(x,y));
}
else
{
if (c.R == 0 && c.G == 0 && c.B == 0) // 黑色,基地
{
//if (_pathCells[x] != null) { throw new Exception("地图设计错误,基地只能有一个。"); }
_baseCell = new BaseCell(x,y);
_mapCanvas.Children.Add(_baseCell);
}
else
{
if (c.R == 255 && c.G == 0 && c.B == 0) // 红色,怪物入口
{
//if (x != 0||_pathCells[0]!=null) { throw new Exception("地图设计错误,怪物入口必须在最左侧且只能有一个入口。"); }
_entryCell = new PathCell(x, y);
_mapCanvas.Children.Add(_entryCell);
}
}
}
}
}
}
}
initPathCells();
initGunCells();
return true;
}
示例11: MethodGetErrorIconBounds
public void MethodGetErrorIconBounds ()
{
Bitmap b = new Bitmap (1, 1);
Graphics g = Graphics.FromImage (b);
BaseCell c = new BaseCell ();
c.ErrorText = "Yo!";
Assert.AreEqual (Rectangle.Empty, c.PublicGetErrorIconBounds (g, c.Style, c.RowIndex), "A1");
DataGridView dgv = new DataGridView ();
dgv.Columns.Add ("hi", "there");
DataGridViewRow row = new DataGridViewRow ();
row.HeaderCell = c;
dgv.Rows.Add (row);
Assert.AreEqual (Rectangle.Empty, (dgv.Rows[0].HeaderCell as BaseCell).PublicGetErrorIconBounds (g, dgv.Rows[0].HeaderCell.InheritedStyle, dgv.Rows[0].HeaderCell.RowIndex), "A2");
dgv.Rows[0].ErrorText = "Danger!";
Assert.AreEqual (new Rectangle (24, 5, 12, 11), (dgv.Rows[0].HeaderCell as BaseCell).PublicGetErrorIconBounds (g, dgv.Rows[0].HeaderCell.InheritedStyle, dgv.Rows[0].HeaderCell.RowIndex), "A3");
Assert.AreEqual ("Danger!", (dgv.Rows[0].HeaderCell as BaseCell).PublicGetErrorText (dgv.Rows[0].HeaderCell.RowIndex), "A4");
g.Dispose ();
b.Dispose ();
}
示例12: FormattedValueType
public void FormattedValueType ()
{
BaseCell c = new BaseCell ();
Assert.AreEqual (typeof (bool), c.FormattedValueType, "A1");
c.ThreeState = true;
Assert.AreEqual (typeof (CheckState), c.FormattedValueType, "A2");
}
示例13: RemoveDeadCell
public void RemoveDeadCell(BaseCell _in)
{
_in.isSelected = false;
allSelectableUnits.Remove(_in);
selectedUnits.Remove(_in);
CheckSelectedUnits();
}
示例14: DeselectCell
public void DeselectCell(BaseCell _in)
{
_in.isSelected = false;
selectedUnits.Remove(_in);
}
示例15: AddNewCell
public void AddNewCell(BaseCell _in)
{
if (PhotonNetwork.connected && !_in.gameObject.GetPhotonView().isMine)
{
allSelectableTargets.Add(_in.gameObject);
}
else if (_in.isSinglePlayer && !_in.isMine && !allSelectableTargets.Contains(_in.gameObject))
{
allSelectableTargets.Add(_in.gameObject);
}
else if (!allSelectableUnits.Contains(_in) && _in.isMine)
{
_in.isSelected = true;
if (!_in.transform.FindChild("FriendlySelector(Clone)"))
{
GameObject tFriendlySelector = GameObject.Instantiate(friendlySelector, _in.transform.position, Quaternion.Euler(90.0f, 0.0f, 0.0f)) as GameObject;
tFriendlySelector.transform.parent = _in.transform;
}
allSelectableUnits.Add(_in);
selectedUnits.Add(_in);
CheckSelectedUnits();
}
}