public XShape() { m_eRShape = SHAPE.RECTANGLE; p = new float[5] { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; }
public XShape(float x, float y, float w, float h, float t) { m_eRShape = SHAPE.RECTANGLE; p = new float[5] { x, y, w, h, t }; }
protected void lbtnAdd_Click(object sender, EventArgs e) { try { var item = _ShapeRepo.GetByCode(txtCode.Value.Trim()); if (item != null) { MessageBox1.ShowMessage("Mã này đã tồn tại!", "Thông báo"); return; } var shape = new SHAPE(); shape.CODE = txtCode.Value; shape.NAME = txtName.Value; _ShapeRepo.Create(shape); var shapePro = new SHAPE_PROPERTY(); shapePro.SHAPE_CODE = txtCode.Value; shapePro.D = 0; shapePro.H = 0; shapePro.L = 0; shapePro.W = 0; _ShapePropertyRepo.Create(shapePro); } catch { } finally { Response.Redirect("hinh-dang.aspx"); } }
public Block(short x, short y, short z, SHAPE shape, DIRECTION direction, STYLE style) : base(x, y, z) { Shape = shape; Direction = direction; Style = style; }
public XShape(SHAPE eRShape, float x, float y, float w, float h, float t) { m_eRShape = eRShape; p = new float[5] { x, y, w, h, t }; }
public static GameObject Create(SHAPE shape, Vector3 pos, Quaternion rot, float scale) { switch (shape) { case SHAPE.Cube: return(CreateCube(pos, rot, scale)); } return(null); }
public virtual int Delete(int id) { try { SHAPE cus = this.GetById(id); return(this.Delete(cus)); } catch (Exception e) { throw new Exception(e.Message); } }
public virtual void Remove(SHAPE cus) { try { db.SHAPEs.DeleteOnSubmit(cus); db.SubmitChanges(); } catch (Exception e) { throw new Exception(e.Message); } }
public virtual void Remove(int id) { try { SHAPE cus = this.GetById(id); this.Remove(cus); } catch //(Exception e) { //throw new Exception(e.Message); } }
public virtual void Create(SHAPE cus) { try { this.db.SHAPEs.InsertOnSubmit(cus); db.SubmitChanges(); } catch// (Exception e) { //throw new Exception(e.Message); } }
public virtual void Update(SHAPE cus) { try { SHAPE cusOld = this.GetById(cus.ID); cusOld = cus; db.SubmitChanges(); } catch //(Exception e) { //throw new Exception(e.Message); } }
public virtual int Delete(SHAPE cus) { try { //user.IsDelete = true; db.SubmitChanges(); return(0); } catch (Exception e) { throw new Exception(e.Message); } }
public Button() { m_TextAlign.Alignment = StringAlignment.Center; m_TextAlign.LineAlignment = StringAlignment.Center; m_eMouseUp = STATE.OFF; m_eShape = SHAPE.RECTANGLE; m_eStyle = STYLE.DRAW; m_eValue = STATE.OFF; m_nRound = 9; m_MouseUpColor = Color.OrangeRed; m_FillColor = Color.AliceBlue; m_BorderColor = Color.Blue; m_PushColor = Color.LightGray; InitializeComponent(); }
public static ModelInput RecreateRealModel(ModelInput origin) { if (origin.type == ModelData.DURATION.TYPE) { return(DURATION.CopyValues(origin)); } if (origin.type == ModelData.APPEAR.TYPE) { return(APPEAR.CopyValues(origin)); } if (origin.type == ModelData.SIZE.TYPE) { return(SIZE.CopyValues(origin)); } if (origin.type == ModelData.SPEED.TYPE) { return(SPEED.CopyValues(origin)); } if (origin.type == ModelData.POSITION.TYPE) { return(POSITION.CopyValues(origin)); } if (origin.type == ModelData.ROTATION.TYPE) { return(ROTATION.CopyValues(origin)); } if (origin.type == ModelData.EVENT.TYPE) { return(EVENT.CopyValues(origin)); } if (origin.type == ModelData.COUNT.TYPE) { return(COUNT.CopyValues(origin)); } if (origin.type == ModelData.SHAPE.TYPE) { return(SHAPE.CopyValues(origin)); } if (origin.type == ModelData.PROJECTILE.TYPE) { return(PROJECTILE.CopyValues(origin)); } return(null); }
/* randomly initialises a shape structure */ static void init_shape(SHAPE shape) { shape.color = 1 + (AL_RAND() % 15); /* randomly position the corners */ shape.dir1 = itofix(AL_RAND() % 256); shape.dir2 = itofix(AL_RAND() % 256); shape.dir3 = itofix(AL_RAND() % 256); shape.dist1 = itofix(AL_RAND() % 64); shape.dist2 = itofix(AL_RAND() % 64); shape.dist3 = itofix(AL_RAND() % 64); /* rand centre position and movement speed/direction */ shape.x = itofix(AL_RAND() % SCREEN_W); shape.y = itofix(AL_RAND() % SCREEN_H); shape.ac = itofix((AL_RAND() % 9) - 4); shape.xc = itofix((AL_RAND() % 7) - 2); shape.yc = itofix((AL_RAND() % 7) - 2); }
public void Copy(XRegion Item) { m_nID = Item.ID; m_eRShape = Item.RegionShape; Array.Copy(Item.Get(), p, 5); m_cBorderColor = Item.BorderColor.ToArgb(); m_cFillColor = Item.FillColor.ToArgb(); m_RCS = (uint)Item.ControlStyle; m_dBorderStyle = Item.BorderStyle; m_sCaption = Item.Caption; RegionAlign RAlign = Item.RegionAlign; if (RAlign != null) { m_eAlignTarget = RAlign.AlignTarget; m_eAlignObject = RAlign.AlignObject; if (RAlign.TargetRegion != null) { m_TargetRegionID = RAlign.TargetRegion.ID; } } }
/* updates the position of a shape structure */ static void move_shape(SHAPE shape) { shape.x += shape.xc; shape.y += shape.yc; shape.dir1 += shape.ac; shape.dir2 += shape.ac; shape.dir3 += shape.ac; if (((shape.x <= 0) && (shape.xc < 0)) || ((shape.x >= itofix(SCREEN_W)) && (shape.xc > 0))) { shape.xc = -shape.xc; shape.ac = itofix((AL_RAND() % 9) - 4); } if (((shape.y <= 0) && (shape.yc < 0)) || ((shape.y >= itofix(SCREEN_H)) && (shape.yc > 0))) { shape.yc = -shape.yc; shape.ac = itofix((AL_RAND() % 9) - 4); } }
static int Main() { BITMAP page1, page2, page3; int c; int w, h; #if ALLEGRO_DOS w = 320; h = 240; #else w = 640; h = 480; #endif if (allegro_init() != 0) { return(1); } install_timer(); install_keyboard(); install_mouse(); /* see comments in exflip.c */ #if ALLEGRO_VRAM_SINGLE_SURFACE if (set_gfx_mode(GFX_AUTODETECT, w, h, 0, h * 3) != 0) { #else if (set_gfx_mode(GFX_AUTODETECT, w, h, 0, 0) != 0) { #endif if (set_gfx_mode(GFX_SAFE, w, h, 0, 0) != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message(string.Format("Unable to set any graphic mode\n{0}\n", allegro_error)); return(1); } } set_palette(desktop_palette); /* if triple buffering isn't available, try to enable it */ if ((gfx_capabilities & GFX_CAN_TRIPLE_BUFFER) == 0) { enable_triple_buffer(); } /* if that didn't work, give up */ if ((gfx_capabilities & GFX_CAN_TRIPLE_BUFFER) == 0) { triplebuffer_not_available = true; } /* allocate three sub bitmaps to access pages of the screen */ page1 = create_video_bitmap(SCREEN_W, SCREEN_H); page2 = create_video_bitmap(SCREEN_W, SCREEN_H); page3 = create_video_bitmap(SCREEN_W, SCREEN_H); if ((!page1) || (!page2) || (!page3)) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); allegro_message("Unable to create three video memory pages\n"); return(1); } /* initialise the shapes */ for (c = 0; c < NUM_SHAPES; c++) { shapes[c] = new SHAPE(); init_shape(shapes[c]); } triple_buffer(page1, page2, page3); destroy_bitmap(page1); destroy_bitmap(page2); destroy_bitmap(page3); return(0); } }
public void ChangeShapeAndColor() { shape = (SHAPE)Random.Range((int)SHAPE.START, (int)SHAPE.END); color = (COLOR)Random.Range((int)COLOR.START, (int)COLOR.END); Renderer renderer = gameObject.GetComponent<Renderer>(); if (shape == SHAPE.CIRCLE) { switch (color) { case COLOR.RED: renderer.material.mainTexture = Resources.Load("RedCircle") as Texture; break; case COLOR.BLUE: renderer.material.mainTexture = Resources.Load("BlueCircle") as Texture; break; case COLOR.YELLOW: renderer.material.mainTexture = Resources.Load("YellowCircle") as Texture; break; default: break; } } else if (shape == SHAPE.TRIANGLE) { switch (color) { case COLOR.RED: renderer.material.mainTexture = Resources.Load("RedTri") as Texture; break; case COLOR.BLUE: renderer.material.mainTexture = Resources.Load("BlueTri") as Texture; break; case COLOR.YELLOW: renderer.material.mainTexture = Resources.Load("YellowTri") as Texture; break; default: break; } } else if (shape == SHAPE.RECT) { switch (color) { case COLOR.RED: renderer.material.mainTexture = Resources.Load("RedRect") as Texture; break; case COLOR.BLUE: renderer.material.mainTexture = Resources.Load("BlueRect") as Texture; break; case COLOR.YELLOW: renderer.material.mainTexture = Resources.Load("YellowRect") as Texture; break; default: break; } } else { } }
public XRegion(SHAPE eRShape, float _x, float _y, float _w, float _h, float _t) : base(eRShape, _x, _y, _w, _h, _t) { InitRegion(); }
// function for set a scatter plot, every dot is just a simple pyramid. public void BuildGrid(SHAPE shape = SHAPE.CYLINDER) { int nElem_x = Int32.Parse(dataNo_x.Text); int nElem_y = Int32.Parse(dataNo_y.Text); int nElem_z = Int32.Parse(dataNo_z.Text); if ((nElem_x <= 0) || (nElem_y <= 0) || (nElem_z <= 0)) { MessageBox.Show("Add at least 1 point to each axis"); return; } if ((nElem_x > 10000) || (nElem_y > 10000) || (nElem_z > 10000)) { MessageBox.Show("Too many elements"); return; } long bas_x = Int64.Parse(basis_x.Text); long bas_y = Int64.Parse(basis_y.Text); long bas_z = Int64.Parse(basis_z.Text); // 1. set the scatter plot size m_3dChart = new ScatterChart3D(); m_3dChart.SetDataNo(nElem_x * nElem_y * nElem_z); // 2. set the properties of each dot Random randomObject = new Random(); int nDataRange = 200; for (int i = 0; i < nElem_x; i++) { for (int j = 0; j < nElem_y; j++) { for (int k = 0; k < nElem_z; k++) { ScatterPlotItem plotItem = new ScatterPlotItem(); plotItem.w = 2; plotItem.h = 2; plotItem.x = (float)i * bas_x * m_nscale_factor; plotItem.y = (float)j * bas_y * m_nscale_factor; plotItem.z = (float)k * bas_z * m_nscale_factor; plotItem.shape = (int)shape; Byte nR = (Byte)randomObject.Next(256); Byte nG = (Byte)randomObject.Next(256); Byte nB = (Byte)randomObject.Next(256); plotItem.color = Color.FromRgb(nR, nG, nB); // convert [,,] -> [] //x + WIDTH * (y + DEPTH * z) ((ScatterChart3D)m_3dChart).SetVertex(i + nElem_x * (j + nElem_y * k), plotItem); } } } // 3. set axes m_3dChart.GetDataRange(); m_3dChart.SetAxes(); // 4. Get Mesh3D array from scatter plot ArrayList meshs = ((ScatterChart3D)m_3dChart).GetMeshes(); // 5. display vertex no and triangle no. UpdateModelSizeInfo(meshs); // 6. show 3D scatter plot in Viewport3d GridExplorer.Model3D model3d = new GridExplorer.Model3D(); m_nChartModelIndex = model3d.UpdateModel(meshs, null, m_nChartModelIndex, this.mainViewport); // 7. set projection matrix float viewRange = (float)nDataRange; m_transformMatrix.CalculateProjectionMatrix(0, viewRange, 0, viewRange, 0, viewRange, 0.5); TransformChart(); }
public void Set(XShape Shape) { m_eRShape = Shape.m_eRShape; Array.Copy(Shape.Get(), p, 5); }
public XShape(XShape Shape) { m_eRShape = Shape.m_eRShape; p = new float[5]; Array.Copy(Shape.Get(), p, 5); }
private void Start() { WinPanel.SetActive(false); LosePanel.SetActive(false); PausePanel.SetActive(false); m_pentagons.Clear(); m_hexagons.Clear(); var stageInfo = GameManager.Instance.GetStageInfo(); if (null != stageInfo) { m_countX = stageInfo.X; m_countY = stageInfo.Y; m_maxMineCount = stageInfo.LandMine; } bool isReverse = false; bool isIndent = true; HashSet <KeyValuePair <int, int> > minePos; GenerateMine(out minePos); for (int y = 0; y < m_countY; ++y) { SHAPE shape = (0 == y % 2) ? SHAPE.HEXAGON : SHAPE.PENTAGON; int CountX = (SHAPE.HEXAGON == shape) ? (int)((float)m_countX / 2f) : m_countX; bool reverse = isReverse; for (int x = 0; x < CountX; ++x) { Vector3 pos = Vector3.zero; LandMineController controller = null; switch (shape) { case SHAPE.HEXAGON: { float posX = (true == isIndent) ? x * m_hexagon.Width : x * m_hexagon.Width + (m_hexagon.Width / 2f); float posY = y * m_hexagon.Height - m_hexagon.ReverseHeight; pos = new Vector3(posX, posY, 0f); controller = GameObject.Instantiate <LandMineController>(m_hexagon, pos, Quaternion.identity, m_parent.transform); m_hexagons.Add(new KeyValuePair <int, int>(x, y), controller); } break; case SHAPE.PENTAGON: { float posX = x * m_pentagon.Width; float posY = (true == reverse) ? y * m_pentagon.Height - m_pentagon.ReverseHeight : y * m_pentagon.Height; pos = new Vector3(posX, posY, 0f); controller = GameObject.Instantiate <LandMineController>(m_pentagon, pos, Quaternion.identity, m_parent.transform); if (true == reverse) { controller.transform.Rotate(new Vector3(0, 0, 180f)); } m_pentagons.Add(new KeyValuePair <int, int>(x, y), controller); } break; } var isMine = minePos.Contains(new KeyValuePair <int, int>(x, y)); controller.Initialize(isMine, x, y, reverse); reverse = !reverse; } if (1 == y % 2) { isReverse = !isReverse; isIndent = !isIndent; } } foreach (var pair in m_hexagons) { var hex = pair.Value; if (false == hex.IsMine) { var near = GetNearLandMine(hex); int num = 0; foreach (var mine in near) { if (true == mine.IsMine) { ++num; } } hex.SetNumber(num); } else { hex.SetNumber(0); } } foreach (var pair in m_pentagons) { var penta = pair.Value; if (false == penta.IsMine) { var near = GetNearLandMine(penta); int num = 0; foreach (var mine in near) { if (true == mine.IsMine) { ++num; } } penta.SetNumber(num); } else { penta.SetNumber(0); } } }