static Block getBlock(blocks b, Point p) { MyAttribute local = getAtribute(b); Block r = new Block(p, local.tag); return(r); }
public bool EditBlock(int id, string newName) { using (Model1 _db = new Model1()) { blocks b = (from blocks in _db.blocks where blocks.BlockID == id select blocks).FirstOrDefault(); b.BlockName = newName; _db.SaveChanges(); } return(true); }
// Private methods private void Init() { blocks = GameObject.FindGameObjectWithTag("Blocks").GetComponent <blocks>(); target = GameObject.FindGameObjectWithTag("Target").GetComponent <target>(); sum = GameObject.FindGameObjectWithTag("Sum").GetComponent <sum>(); combo = GameObject.FindGameObjectWithTag("Combo").GetComponent <combo>(); timer = GameObject.FindGameObjectWithTag("Timer").GetComponent <timer>(); lifes_score = GameObject.FindGameObjectWithTag("LifesScore").GetComponent <lifes_score>(); game_over = GameObject.FindGameObjectWithTag("GameOver").GetComponent <game_over>(); stage = GameObject.FindGameObjectWithTag("Stage").GetComponent <stage>(); refresh = GameObject.FindGameObjectWithTag("Refresh").GetComponent <refresh>(); }
public void clicked() { if (clickable) { blocks = GameObject.FindGameObjectWithTag("Blocks").GetComponent <blocks>(); blocks.generate_random_numbers(); blocks.play_particle(); blocks.audio.clip = blocks.for_refresh; blocks.audio.Play(); set_activation(false); } }
public bool RemoveBlock(int id) { using (Model1 _db = new Model1()) { blocks res = (from blocks in _db.blocks where blocks.BlockID == id select blocks).FirstOrDefault(); if (res != null) { _db.blocks.Remove(res); _db.SaveChanges(); } } return(true); }
static void Main(string[] args) { blocks1 = new List <blocks>(); for (int y = 1; y < 5; y++) { for (int x = 1; x < 5; x++) { blocks newBlock = new blocks(); newBlock.xb = x * 2; newBlock.yb = y * 2; newBlock.size = 2; blocks1.Add(newBlock); } } }
public void ShowEditBlock(object sender, CommandEventArgs e) { ModalPopupExtender popup = (ModalPopupExtender)Page.FindControlRecursive("EditBlockPopup"); popup.Show(); TextBox blockName = (TextBox)Page.FindControlRecursive("EditBlockName"); Model1 _db = new Model1(); ViewState["BlockID"] = e.CommandArgument.ToString(); int id = int.Parse(ViewState["BlockID"].ToString()); blocks b = (from blocks in _db.blocks where blocks.BlockID == id select blocks).FirstOrDefault(); blockName.Text = b.BlockName; }
public bool AddBlocks(int SubjectID, string name) { var MyBlock = new blocks { BlockName = name, SubjectID = SubjectID }; using (Model1 _db = new Model1()) { _db.blocks.Add(MyBlock); _db.SaveChanges(); } return(true); }
void Explode() { int layerMask = LayerMask.GetMask("block"); Collider2D[] colliders = Physics2D.OverlapCircleAll(transform.position, explodeRadius, layerMask); foreach (Collider2D col in colliders) { blocks block = col.GetComponent <blocks>(); if (block == null) { Destroy(gameObject); } else { block.DestroyBlock(); } } }
// Update is called once per frame void Update () { indice.x = Mathf.Floor(transform.position.x + 16.5f); indice.y = Mathf.Floor(transform.position.y + 16.5f); last = GameObject.Find("Grid").GetComponent<GridBehaviour>().getGridItem((int)indice.x, (int)indice.y); if (Input.GetKeyDown("space")) { if (item != null && item.GetComponent<Item>().canMove && this.GetComponentsInChildren<Transform>().Length == 4) { item.transform.parent = this.transform; itemSegurado = item; itemSegurado.transform.position = posicao.position; itemSegurado.transform.GetChild(0).GetComponent<SpriteRenderer>().sortingOrder = 2; print("ASD"); //item.GetComponent<SpriteRenderer>().enabled = false; GameObject.Find("Socket").SendMessage("SendObject", item); } else if (this.GetComponentsInChildren<Transform>().Length > 4) { itemSegurado.transform.parent = GameObject.Find("GameManager").transform; Vector3 temp = itemSegurado.transform.position; temp.x = Mathf.Floor(transform.position.x + .5f) - .5f; temp.y = Mathf.Floor(transform.position.y + .5f) + .5f; temp.z = 0; itemSegurado.transform.position = temp; itemSegurado.transform.GetChild(0).GetComponent<SpriteRenderer>().sortingOrder = 1; itemSegurado = null; // last = GameObject.Find("Grid").GetComponent<GridBehaviour>().getGridItem((int)indice.x, (int)indice.y); bool b = last.CompareTo(blocks.ALTAR) == 0; if (b) { item.SendMessage("cant"); Invoke("liberar", 30); } GameObject.Find("Socket").SendMessage("SendObject", item); } } }
private void OnEnable() { blk = (blocks)target; }
static MyAttribute getAtribute(blocks b) { return((MyAttribute)Attribute.GetCustomAttribute( typeof(blocks).GetField(Enum.GetName(typeof(blocks), b)), typeof(MyAttribute))); }
// Start is called before the first frame update void Start() { blocks = GameObject.FindGameObjectWithTag("Blocks").GetComponent <blocks>(); refresh = GameObject.FindGameObjectWithTag("Refresh").GetComponent <refresh>(); the_timer = count_down_timer; }
public void loadblocks() { try { //added by naveeen string token = System.Web.HttpContext.Current.Request.Headers["token"]; string employecode = System.Web.HttpContext.Current.Request.Headers["empcode"]; string huuid = System.Web.HttpContext.Current.Request.Headers["uuid"]; //end cmd = new SqlCommand("SELECT RowCode, UserID, EmployeeCode, Domain, SessionToken, SessionExpiryTime, LoginTime, LogoutTime, DeviceID, IsActive FROM tbl_TRN_LogInDetail WHERE (EmployeeCode = @empcode) AND (SessionToken = @token) AND (DeviceID=@uuid) AND (IsActive=@IsActive)"); cmd.Parameters.Add("@empcode", employecode); cmd.Parameters.Add("@token", token); cmd.Parameters.Add("@uuid", huuid); cmd.Parameters.Add("@IsActive", true); DataTable dttoken = vdm.SelectQuery(cmd).Tables[0]; if (dttoken.Rows.Count > 0) { foreach (DataRow drt in dttoken.Rows) { string sessionexpdate = drt["SessionExpiryTime"].ToString(); DateTime dtsessionexpdate = Convert.ToDateTime(sessionexpdate); DateTime nowdatetime = DateTime.Now; if (nowdatetime > dtsessionexpdate) { Context.Response.Clear(); Context.Response.StatusCode = 401; HttpContext.Current.ApplicationInstance.CompleteRequest(); } else { DateTime extendsessionexpdate = nowdatetime.AddHours(1); cmd = new SqlCommand("UPDATE tbl_TRN_LogInDetail SET SessionExpiryTime=@extenddate WHERE (EmployeeCode = @emplcode) AND (SessionToken = @stoken) AND (DeviceID=@duuid) AND (IsActive=@active)"); cmd.Parameters.Add("@emplcode", employecode); cmd.Parameters.Add("@stoken", token); cmd.Parameters.Add("@duuid", huuid); cmd.Parameters.Add("@active", true); cmd.Parameters.Add("@extenddate", extendsessionexpdate); vdm.Update(cmd); postcmd = new NpgsqlCommand("SELECT block_code,block_name FROM block_master"); DataTable dtblocks = postvdm.SelectQuery(postcmd).Tables[0]; List <blocks> blockslist = new List <blocks>(); foreach (DataRow dr in dtblocks.Rows) { blocks block = new blocks(); block.blockcode = dr["block_code"].ToString(); block.blockname = dr["block_name"].ToString(); blockslist.Add(block); } JavaScriptSerializer jsonSerializer = new JavaScriptSerializer(); jsonSerializer.MaxJsonLength = Int32.MaxValue; string response = jsonSerializer.Serialize(blockslist); Context.Response.Clear(); Context.Response.ContentType = "application/json"; Context.Response.AddHeader("content-length", response.Length.ToString()); Context.Response.Flush(); Context.Response.Write(response); HttpContext.Current.ApplicationInstance.CompleteRequest(); } } } else { Context.Response.Clear(); Context.Response.StatusCode = 401; HttpContext.Current.ApplicationInstance.CompleteRequest(); } } catch (Exception ex) { Context.Response.Clear(); Context.Response.StatusCode = 401; HttpContext.Current.ApplicationInstance.CompleteRequest(); } }
// Start is called before the first frame update void Start() { blocks = GameObject.FindGameObjectWithTag("Blocks").GetComponent <blocks>(); reset_stage(); }
ref readonly var code = ref skip(blocks, i);