public IGameState Move(Row row, Col col, Action<Move> invalidMoveCallback) { var move = new Move(row, col, Player.O); var newMoveSequence = MoveSequence.WithNewMove(move, invalidMoveCallback); return newMoveSequence.IsGameOver() ? new GameStateGameOver(newMoveSequence) : new GameStateXToMove(newMoveSequence) as IGameState; }
public void SpecT(bool v) { c = Col.Spec; img.color = cc.GetColorMain ( c ); RGBToHSV ( img.color, out H, out S, out V); Hue.value = H; Saturation.value = S; Value.value = V; }
private void button1_Click(object sender, System.EventArgs e) { Col c1=new Col(((Lugar)form.scene.element).bas.car.Colores); c1.ShowDialog(); int x=c1.selInd; c1.Close(); form.Focus(); ((Lugar)form.scene.element).bas.car.ChangeMaterialFrom3ds("body",new MiMetal(((Lugar)form.scene.element).bas.car.Colores[x].r,((Lugar)form.scene.element).bas.car.Colores[x].g,((Lugar)form.scene.element).bas.car.Colores[x].b)); ((Lugar)form.scene.element).bas.car.Recompile(); form.Focus(); form.Refresh(); }
public int Compare(Col a, Col b) { var orderA = a.cd.gameObject.GetComponent<INumberable>().number; var orderB = b.cd.gameObject.GetComponent<INumberable>().number; if (orderA != orderB) { return orderA - orderB; } else { return a.number - b.number; } }
public Color GetColorMain( Col c) { if (c == Col.Rim) { return r.material.GetColor ("_RimColor"); } else if (c == Col.Spec) { return r.material.GetColor ("_SpecColor"); } else return r.material.color; }
//Descarta el nº "n" de toda la Box menos las celdas del subgr void Descartar(int n, Cell[] subgr, string origen) { if (origen == "Row" || origen == "Col") { foreach (Cell cell in FindBox(subgr[0]).array) { if (!subgr.Contains(cell)) {//If that cell isn't in the subgr, discard "n" cell.Possible.Remove(n); } selectedCell = cell; Dispatcher.Invoke(ui); } } else if (origen == "Box") {//Comprueba si debe descartar en horizontal/vertical, y luego descarta "n" en todas las celdas de la Row/Col //que no estén en subgr //1º Compruebo si debo descartar en horizontal List <Cell> AuxGroup = new List <Cell>(); Row row = new Row(subgr[0]); if (row.Cells.Contains(subgr[1])) {//Debo descartar en horizontal foreach (Cell cell in row.Cells) { AuxGroup.Add(cell); } } else {//Debo descartar en vertical Col col = new Col(subgr[0]); foreach (Cell cell in col.Cells) { AuxGroup.Add(cell); } } //2º Descarto "n" en todas las celdas de Group excepto las que están en subgr foreach (Cell cell in AuxGroup) { if (!subgr.Contains(cell)) { cell.Possible.Remove(n); } selectedCell = cell; Dispatcher.Invoke(ui); } } }
/// <summary> /// /// </summary> /// <param name="dvo"></param> /// <returns></returns> public View getViewByName(string dvo) { var type = Assembly.GetEntryAssembly().GetType(dvo); if (type != null) { var viewAttr = (ViewAttribute)type.GetCustomAttribute(typeof(ViewAttribute)); var memberInfos = type.GetMembers(); var cols = new List <Col> (); var items = new List <Item> (); foreach (var m in memberInfos) { var colAttr = (ColAttribute)m.GetCustomAttribute(typeof(ColAttribute)); if (colAttr != null) { var col = new Col(); col.caption = colAttr.caption; cols.Add(col); } var itemAttr = (ItemAttribute)m.GetCustomAttribute(typeof(ItemAttribute)); if (itemAttr != null) { var item = new Item(); item.editorType = itemAttr.editorType.ToString(); item.label = new Label { text = itemAttr.label }; item.dataField = itemAttr.dataField == null? m.Name : itemAttr.dataField; items.Add(item); } } var view = new View(); view.viewType = viewAttr.viewType.ToString(); view.title = viewAttr.title; view.cols = cols; view.items = items; return(view); } else { return(null); } }
public override void DrawRect(Rectangle rectangle1, Col color) { var rectangle = Utils.ToRect(rectangle1); SetPass(0); // Draw lines GLBegin(GL.TRIANGLES); GLColor(color); Vertex3(rectangle.x, rectangle.y); Vertex3(rectangle.x + rectangle.width, rectangle.y); Vertex3(rectangle.x, rectangle.y + rectangle.height); Vertex3(rectangle.x + rectangle.width, rectangle.y); Vertex3(rectangle.x + rectangle.width, rectangle.y + rectangle.height); Vertex3(rectangle.x, rectangle.y + rectangle.height); GLEnd(); }
public void CopyNode() { if (_CurrentNode == Nodes.Table) { _ClipboardTable = _CurrentTreeViewItem.Tag as Table; //_ClipboardTable = table; System.Windows.DataObject dataobj = new System.Windows.DataObject(typeof(Table), _ClipboardTable); Clipboard.SetDataObject(dataobj); } else if (_CurrentNode == Nodes.Col) { _ClipboardCol = _CurrentTreeViewItem.Tag as Col; //_ClipboardCol = col; System.Windows.DataObject dataobj = new System.Windows.DataObject(typeof(Col), _ClipboardCol); Clipboard.SetDataObject(dataobj); } }
public void SetColorMain(Color col, Col c) { if (c == Col.Main) { r.material.color = col; } if (c == Col.Rim) { r.material.SetColor("_RimColor", col); } if (c == Col.Spec) { r.material.SetColor("_SpecColor", col); } }
//------------------------------------------------------------------------------------- // this message handler gets called when the user checks/unchecks an item the combo box //---------------------------------------------------------------------------------------- private void cmboStyles_CheckStateChanged(object sender, EventArgs e) { if (sender is CustomerServices.CheckComboBoxItem && formloaded) { CustomerServices.CheckComboBoxItem item = (CustomerServices.CheckComboBoxItem)sender; if (item.CheckState) { QueryParms.Styles.Add(repo.LoadStyle(item._Pk)); using (var context = new TTI2Entities()) { comboColours.Items.Clear(); var Colours = context.TLPPS_Replenishment.Where(x => x.TLREP_Style_FK == item._Pk && !x.TLREP_Discontinued).GroupBy(x => x.TLREP_Colour_FK).ToList(); foreach (var Col in Colours) { var Clr_Pk = Col.FirstOrDefault().TLREP_Colour_FK; var Clr = context.TLADM_Colours.Find(Clr_Pk); if (Clr != null) { comboColours.Items.Add(new CustomerServices.CheckComboBoxItem(Clr.Col_Id, Clr.Col_Display, false)); } } } } else { var value = QueryParms.Styles.Find(it => it.Sty_Id == item._Pk); if (value != null) { QueryParms.Styles.Remove(value); } if (QueryParms.Styles.Count == 0) { comboColours.Items.Clear(); using (var context = new TTI2Entities()) { var Colours = context.TLADM_Colours.Where(x => !(bool)x.Col_Discontinued).OrderBy(x => x.Col_Display).ToList(); foreach (var Colour in Colours) { comboColours.Items.Add(new CustomerServices.CheckComboBoxItem(Colour.Col_Id, Colour.Col_Display, false)); } } } } } }
public void Is_GivenTableColAndLang_ReturnsIdEqualLandIdSQLPartExpresssion() { //Arrange var col = new Col("ColName", "TableAlias"); var lang2Col = new Lang2Col("ColName", "TableAlias", new Dictionary <string, string> { { "no", "norsk" }, { "dk", "dansk" } }); var lang = "no"; //Act var result = col.Is(lang2Col, lang); //Assert var expectedResult = "TableAlias.ColName = TableAliasnorsk.ColName"; Assert.AreEqual(expectedResult, result); }
public override void DrawLine(Vec2 p0, Vec2 p1, float width, Col color, bool isRounded) { p0 = Aspect.Adjust(p0); p1 = Aspect.Adjust(p1); width = Aspect.Adjust(width); var dir = p1 - p0; dir.Normalize(); var perpendicular = Vec2.Perpendicular(dir); perpendicular.Normalize(); float halfWidth = width * 0.5f; var start0 = p0 + perpendicular * halfWidth; var start1 = p0 - perpendicular * halfWidth; var end0 = p1 + perpendicular * halfWidth; var end1 = p1 - perpendicular * halfWidth; // draw circles var res = CircleResolution; CircleResolution = 8; CircleResolution = res; SetPass(0); GLBegin(GL.TRIANGLES); GLColor(color); if (isRounded) { DrawCircleCommands(p0, halfWidth, color); DrawCircleCommands(p1, halfWidth, color); } Vertex3(start0.x, start0.y); Vertex3(end0.x, end0.y); Vertex3(end1.x, end1.y); Vertex3(start0.x, start0.y); Vertex3(end1.x, end1.y); Vertex3(start1.x, start1.y); GLEnd(); }
public override string ToString() { if (Kind == TokenKind.Letter) { return(Kind.ToString() + " : letter = " + Letter.ToString() + " : line = " + Line.ToString() + " : col = " + Col.ToString()); } else if (Kind == TokenKind.String) { return(Kind.ToString() + " : string = " + String.ToString() + " : line = " + Line.ToString() + " : col = " + Col.ToString()); } else if (Kind == TokenKind.Digit) { return(Kind.ToString() + " : digit = " + Digit.ToString() + " : line = " + Line.ToString() + " : col = " + Col.ToString()); } return(Kind.ToString() + " : line = " + Line.ToString() + " : col = " + Col.ToString()); }
public void SetColorMain( Color col, Col c ) { if (c == Col.Main) { r.material.color = col; } if (c == Col.Rim) { r.material.SetColor ("_RimColor", col); } if (c == Col.Spec) { r.material.SetColor ("_SpecColor", col); } }
public MessageTable(SourceTypeMessages ms) : base() { P = ms; ShouldHighlight = o => !((MessageRef)o).IsRead; IsSelected = o => ((MessageRef)o).Id == P._activeItemId; DisCol = new Col { Title = "DIS", Print = o => { var m = (MessageRef)o; var s = m.GetSource(P.QuerySources); if (s == null) { return(""); } else { return(s.GetShortDistinguisher()); } }, MaxWidth = 132, Hidden = true }; Cols.Add(DisCol); Cols.Add(FromCol); Cols.Add(new Col { Title = "SUBJECT", Stretches = true, Print = o => { var m = (MessageRef)o; return(m.GetTextSummary()); } }); Cols.Add(new Col { Title = "DATE", Stretches = false, Print = o => { var m = (MessageRef)o; return(Theme.FormatTime(m.PublishTime.ToLocalTime())); } }); ShouldHighlight = o => { var m = (MessageRef)o; return(!m.IsRead); }; }
void DrawCircleCommands(Vec2 center, float radius, Col color) { float angle = 0f; const float twopi = 2f * (float)System.Math.PI; float incr = twopi / (float)CircleResolution; while (angle < twopi) { Vertex3(center.x, center.y); Vertex3( center.x + (float)System.Math.Sin(angle) * radius, center.y + (float)System.Math.Cos(angle) * radius); Vertex3( center.x + (float)System.Math.Sin(angle + incr) * radius, center.y + (float)System.Math.Cos(angle + incr) * radius); angle += incr; } }
public int CompareTo(Node other) { int cmp = Time.CompareTo(other.Time); if (cmp == 0) { cmp = -Row.CompareTo(other.Row); } if (cmp == 0) { cmp = Col.CompareTo(other.Col); } if (cmp == 0) { cmp = Place.CompareTo(other.Place); } return(cmp); }
public CompanyExcel Init() { var col = new Col <Company>("电话", (e, v, b) => e.Tel = b ? v.ToString() : "120"); col.Verify += NotNull; foreach (var i in col.Verify.GetInvocationList()) { } var com = new Company(); Setter(ref com.Ndd); return(this); }
public Strelok() { InitializeComponent(); LoginForm lf = new LoginForm(); Col[] suck = new Col[6]; suck[0].r = 0; suck[0].g = 0; suck[0].b = 0; suck[1].r = 255; suck[1].g = 255; suck[1].b = 255; suck[2].r = 0; suck[2].g = 0; suck[2].b = 255; suck[3].r = 188; suck[3].g = 33; suck[3].b = 33; suck[4].r = 255; suck[4].g = 243; suck[4].b = 67; suck[5].r = 19; suck[5].g = 19; suck[5].b = 19; for (int i = 0; i < 6; i++) { array[i].ball = i + 1; array[i].c.r = suck[i].r; array[i].c.g = suck[i].g; array[i].c.b = suck[i].b; } lf.ShowDialog(); }
public override string ToString() { if (Columns == null || Columns.Count == 0) { return(""); } string FieldsSql = "", PrimaryKeys = ""; foreach (ColumnDefinition Col in Columns.Values) { if (FieldsSql.Length == 0) { FieldsSql = " " + Col.Name + " " + Col.SqlDefinition(false); } else { FieldsSql += "," + System.Environment.NewLine + " " + Col.Name + " " + Col.SqlDefinition(false); } if (Col.PrimaryKey) { if (PrimaryKeys.Length == 0) { PrimaryKeys = Col.Name; } else { PrimaryKeys += "," + Col.Name; } } } string TableSql = @"CREATE TABLE """ + this.Name + @""" (" + System.Environment.NewLine; TableSql += FieldsSql; if (PrimaryKeys.Length > 0) { TableSql += "," + System.Environment.NewLine + " PRIMARY KEY (" + PrimaryKeys + ")"; } TableSql += System.Environment.NewLine + ") $CREATETABLE_OPTIONS$;" + System.Environment.NewLine + System.Environment.NewLine; return(TableSql); }
public XlsBiffColInfo(byte[] bytes, uint offset) : base(bytes, offset) { var colFirst = ReadUInt16(0x0); var colLast = ReadUInt16(0x2); var colDx = ReadUInt16(0x4); var flags = (ColInfoSettings)ReadUInt16(0x8); var userSet = (flags & ColInfoSettings.UserSet) != 0; var hidden = (flags & ColInfoSettings.Hidden) != 0; Value = new Col { CustomWidth = userSet, Max = colLast, Min = colFirst, Width = (double)colDx / 256, Hidden = hidden }; }
public override void GenerateScript() { this.sScript = "SELECT "; foreach (csQueryColumn Col in this.Cols) { this.sScript += Col.GenerateColumn() + ", "; } this.sScript = this.sScript.Remove(this.sScript.Length - 2, 2) + " "; foreach (csQueryEntity Ent in this.Ents) { this.sScript += Ent.GenerateEntity(); } foreach (csQueryFilter Fil in this.Fill) { this.sScript += Fil.GenerateFilter(); } }
private void E_Movement() { if (FacingLeft) { if (transform.position.x > LWP) { if (transform.localScale.x != 1) { transform.localScale = new Vector3(1, 1, 1); } if (Col.IsTouchingLayers(Ground)) { Enemy.velocity = new Vector2(-JumpLength, JumpForce); state = State.jumping; } } else { FacingLeft = false; state = State.idle; } } else { if (transform.position.x < RWP) { if (transform.localScale.x == 1) { transform.localScale = new Vector3(-1, 1, 1); } if (Col.IsTouchingLayers(Ground)) { Enemy.velocity = new Vector2(+JumpLength, JumpForce); state = State.jumping; } } else { FacingLeft = true; state = State.idle; } } }
public string getCreateStatement() { List <Column> Columns = GetTableColumns(); StringBuilder Statement = new StringBuilder(); Statement.Append("CREATE TABLE [" + TableName + "]" + "(" + Environment.NewLine); foreach (Column Col in Columns) { Statement.Append(Col.GetDefintion()); if (Col.Ordinal < Columns.Count) { Statement.Append("," + Environment.NewLine); } } Statement.Append(");"); return(Statement.ToString()); }
/// <summary> /// 获取查询语主中 GroupBy 字符串有变量 /// </summary> /// <param name="ColList"></param> /// <returns></returns> protected ODAScript GetGroupByColumns(params IODAColumns[] ColList) { var sql = new ODAScript(); if (ColList == null || ColList.Length == 0) { return(sql); } foreach (IODAColumns Col in ColList) { string OSql = ""; var prms = Col.GetSelectColumn(out OSql); sql.ParamList.AddRange(prms); sql.SqlScript.Append(OSql + ","); } sql.SqlScript.Remove(sql.SqlScript.Length - 1, 1); return(sql); }
private void frmServer_FormClosing(object sender, FormClosingEventArgs e) { try { foreach (ServerJieShou Col in LianJIe) { Col.th.Abort(); Col.th.Join(); } foreach (TcpClient Col in arr) { Col.Close(); } } finally { Application.Exit(); } }
/// <summary> /// Load all DB table information in tableList /// </summary> /// <param name="tableList">Holds all Table information from DB with connection string ConnectionString</param> /// <param name="ConnectionString">Contains the connection string of the CSSPDB</param> /// <returns></returns> private bool LoadDBInfo(List <Table> tableList, string ConnectionString) { try { using (SqlConnection cnn = new SqlConnection(ConnectionString)) { cnn.Open(); DataTable tblList = cnn.GetSchema("Tables"); DataTable clmList = cnn.GetSchema("Columns"); foreach (DataRow tbl in tblList.Rows) { Table table = new Table(); table.TableName = tbl.ItemArray[2].ToString(); tableList.Add(table); foreach (DataRow dr in clmList.Rows) { if (dr[2].ToString() == table.TableName) { Col col = new Col(); col.FieldName = dr[3].ToString(); col.AllowNull = (dr[6].ToString() == "NO" ? false : true); col.DataType = dr[7].ToString(); col.StringLength = (string.IsNullOrWhiteSpace(dr[8].ToString()) ? 0 : int.Parse(dr[8].ToString())); table.colList.Add(col); } } } cnn.Close(); } } catch (Exception ex) { CSSPErrorEvent(new CSSPErrorEventArgs(ex.Message)); return(false); } return(true); }
public void StructuredDynamicYielder() { var result = new StructuredDynamicYielder(new[] { new { A = true, B = (bool?)false, C = Col.Bit(true), D = (bool?)null, E = Col.Bit(null) } }).First(); Assert.AreEqual(5, result.FieldCount); Assert.AreEqual(typeof(bool), result.GetValue(0).GetType()); Assert.AreEqual(true, result.GetValue(0)); Assert.AreEqual(typeof(bool), result.GetValue(1).GetType()); Assert.AreEqual(false, result.GetValue(1)); Assert.AreEqual(typeof(bool), result.GetValue(2).GetType()); Assert.AreEqual(true, result.GetValue(2)); Assert.AreEqual(DBNull.Value, result.GetValue(3)); Assert.AreEqual(DBNull.Value, result.GetValue(4)); }
public void MixedTypes() { var cmd = new SqlCommand(); db.AddParametersToCommand(cmd.Parameters, new { A = true, B = Col.Bit(false), C = new SqlSmallInt(null, ParameterDirection.Input), D = new SqlInt(5, ParameterDirection.Input), E = Col.VarChar("Test", 10), F = (bool?)null, G = 5L, H = (int?)null, I = (short)2, J = Col.Decimal(5.27m, 6, 2), K = (Guid?)null }); Assert.AreEqual(11, cmd.Parameters.Count); }
private void endPopingOrbs() { Debug.unityLogger.Log("End Orb Pop", "Starting"); foreach (LinkedList <GameObject> Col in Cols) { foreach (GameObject orb in Col.ToList()) { Orb temporb = orb.GetComponent <Orb>(); Debug.unityLogger.Log("End Orb Pop", "Orb " + temporb.name + " is being checked"); if (temporb.curState == Orb.OrbState.Poping) { Vector3 temp = temporb.GetComponent <Orb>().GetRelPos(); Cols[(int)temp.x].Remove(temporb.gameObject); Destroy(temporb.gameObject); Debug.unityLogger.Log("End Orb Pop", "Orb " + temporb.name + " has been Popped"); } } } Debug.unityLogger.Log("End Orb Pop", "Ending"); }
public void StructuredDynamicYielder() { var result = new StructuredDynamicYielder(new[] { new { A = 1, B = (int?)2, C = Col.Int(3), D = (int?)null, E = Col.Int(null) } }).First(); Assert.AreEqual(5, result.FieldCount); Assert.AreEqual(typeof(int), result.GetValue(0).GetType()); Assert.AreEqual(1, result.GetValue(0)); Assert.AreEqual(typeof(int), result.GetValue(1).GetType()); Assert.AreEqual(2, result.GetValue(1)); Assert.AreEqual(typeof(int), result.GetValue(2).GetType()); Assert.AreEqual(3, result.GetValue(2)); Assert.AreEqual(DBNull.Value, result.GetValue(3)); Assert.AreEqual(DBNull.Value, result.GetValue(4)); }
private void Update() { alpha = M.Clamp01(alpha); for (int i = 0; i < tmpLis.Count; i++) { tmpLis[i].color = Col.A(tmpLis[i].color, tmpALis[i] * alpha); } for (int i = 0; i < tmLis.Count; i++) { tmLis[i].color = Col.A(tmLis[i].color, tmALis[i] * alpha); } for (int i = 0; i < txtLis.Count; i++) { txtLis[i].color = Col.A(txtLis[i].color, txtALis[i] * alpha); } for (int i = 0; i < imgLis.Count; i++) { imgLis[i].color = Col.A(imgLis[i].color, imgALis[i] * alpha); } }
public void StructuredDynamicYielder() { var result = new StructuredDynamicYielder(new[] { new { A = guid, B = (Guid?)guid, C = Col.UniqueIdentifier(guid), D = (Guid?)null, E = Col.UniqueIdentifier(null) } }).First(); Assert.AreEqual(5, result.FieldCount); Assert.AreEqual(typeof(Guid), result.GetValue(0).GetType()); Assert.AreEqual(guid, result.GetValue(0)); Assert.AreEqual(typeof(Guid), result.GetValue(1).GetType()); Assert.AreEqual(guid, result.GetValue(1)); Assert.AreEqual(typeof(Guid), result.GetValue(2).GetType()); Assert.AreEqual(guid, result.GetValue(2)); Assert.AreEqual(DBNull.Value, result.GetValue(3)); Assert.AreEqual(DBNull.Value, result.GetValue(4)); }
public List <string> GetInsertStatements() { List <string> Inserts = new List <string>(); List <Column> Columns = GetTableColumns(); SqlCommand DataQuery = new SqlCommand("SELECT * FROM " + TableName, Connection); SqlDataReader DataReader = DataQuery.ExecuteReader(); while (DataReader.Read()) { List <string> DataFields = new List <string>(); StringBuilder Statement = new StringBuilder(); Statement.Append("INSERT INTO " + TableName + " ("); foreach (Column Col in Columns) { Statement.Append(Col.Name); if (Col.Ordinal < Columns.Count) { Statement.Append(", "); } } Statement.Append(") VALUES ("); foreach (Column Col in Columns) { Statement.Append(Col.FormatData(DataReader[Col.Name])); if (Col.Ordinal < Columns.Count) { Statement.Append(", "); } } Statement.Append(");"); Inserts.Add(Statement.ToString()); } DataReader.Close(); return(Inserts); }
public void ReturnAndResultSet() { DB.Execute(@" CREATE PROCEDURE uspReturnAndResultSet AS BEGIN SELECT 'Test' AS A RETURN 5 END" ); var parameters = new { ReturnValue = Col.Int(null, ParameterDirection.ReturnValue) }; var row = DB.GetRow("uspReturnAndResultSet", parameters, new QueryOptions { CommandType = CommandType.StoredProcedure }); Assert.AreEqual("Test", row.A); Assert.AreEqual(5, parameters.ReturnValue.Value); }
bool IGameState.IsValidMove(Row row, Col col) { return false; }
bool IGameState.IsValidMove(Row row, Col col) { return MoveSequence.IsValidMove(row, col); }
internal bool IsValidMove(Row row, Col col) { return !Moves.Any(m => m.IsSameSquare(row, col)); }
internal bool CanPlay(Row row, Col col) { return true; }
void Start() { c = Col.Main; img.color = cc.GetColorMain ( c ); col = img.color ; RGBToHSV ( img.color, out H, out S, out V); Hue.value = H; Saturation.value = S; Value.value = V; Alpha.value = img.color.a; spec.onValueChanged.AddListener (SpecT); main.onValueChanged.AddListener (MainT); rim.onValueChanged.AddListener (RimT); }