public bool UpdateIsDeletePackageCoin(Package_CoinBO package, int packageID, int coinID, int isDelete) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { bool rs = false; string sql = "SP_DeletePackageCoin"; SqlParameter[] pa = new SqlParameter[5]; pa[0] = new SqlParameter("@packageID", packageID); pa[1] = new SqlParameter("@coinID", coinID); pa[2] = new SqlParameter("@isDelete", isDelete); pa[3] = new SqlParameter("@deleteDate", package.DeleteDate); pa[4] = new SqlParameter("@deleteUser", package.DeleteUser); SqlCommand command = helper.GetCommand(sql, pa, true); int row = command.ExecuteNonQuery(); if (row > 0) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(false); } finally { helper.destroy(); } }
public bool IsPlanePicked(int mouseX, int mouseY) { // Construct our ray Ray ray = Utilitys.CalculateRayFromCursor(Game.GraphicsDevice, Camera, mouseX, mouseY); Vector3 min = new Vector3(Vertices[0].Position.X, Vertices[0].Position.Y, Vertices[0].Position.Z); Vector3 max = new Vector3(Vertices[Vertices.Length - 1].Position.X, Vertices[Vertices.Length - 1].Position.Y, Vertices[Vertices.Length - 1].Position.Z); BoundingBox bb = new BoundingBox(min, max); if (bb.Intersects(ray) > 0) { // TODO: This needs reworking because we should almost segregate the difference between a Vertice Picking operation and the whole Object Picking operation! // Invoke our delegate so we can manipulate this from outside our class if (PickingOperation != null) { PickingOperation.Invoke(0); } } return(false); }
IEnumerator Loading(Action start = default(Action), Action end = default(Action)) { MOperateManager.ActiveHandController(false); int[] nums = Utilitys.GetRandomSequence(LoadData.SpriteDatas.Count, LoadData.loadCount); for (int i = 0; i < nums.Length; i++) { SetBackground(LoadData.SpriteDatas[nums[i]].Value); yield return(new WaitForSeconds(LoadData.loadTime)); if (i == 0 && start != null) { start(); } } MOperateManager.ActiveHandController(true); if (end != null) { end(); yield return(new WaitForSeconds(1.0f)); } }
protected override void OnRenderFrame(FrameEventArgs e) { GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); Utilitys.CheckGLError("GL.Clear"); if (EngineIsReady) { gl.Enable(EnableCap.DepthTest); OGame.Draw(e); gl.Disable(EnableCap.DepthTest); _GUIRender.TickRender(); } SwapBuffers(); Utilitys.CheckGLError("Window SwapBuffers"); Time.FPS = (int)(1f / e.Time); Time._Time++; Time._Tick = Time._Time % 60; if (Time._Time >= double.MaxValue) { Time._Time = -Time._Time; } Thread.Sleep(60 / 5); base.OnRenderFrame(e); }
public bool CheckPackageID_CoinIDExist(int packageID, int coinID) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { bool rs = false; string sql = "SP_CheckPackageID_CoinIDExist"; SqlParameter[] pa = new SqlParameter[2]; pa[0] = new SqlParameter("@packageID", packageID); pa[1] = new SqlParameter("@coinID", coinID); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, "Exception CheckPackageID_CoinIDExist admin : " + ex.Message); return(false); } finally { helper.destroy(); } }
IEnumerator RandomLoading(float time, float startTime, Action start = default(Action), float endTime = 0.5f, Action end = default(Action), Action endDelay = default(Action)) { MOperateManager.ActiveHandController(false); var value = Utilitys.GetRandomSequence(LoadData.SpriteDatas.Count, 1)[0]; SetBackground(LoadData.SpriteDatas[value].Value); yield return(new WaitForSeconds(startTime)); if (start != null) { start(); } yield return(new WaitForSeconds(time)); if (end != null) { end(); yield return(new WaitForSeconds(endTime)); if (endDelay != null) { endDelay(); } UIManager.Instance.HideUI("Loading"); } MOperateManager.ActiveHandController(true); //UIManager.Instance.HideUI(); }
public bool CheckExistTransactionBitcoin(string strTransactionID) { Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { bool rs = false; string sql = "SP_CheckExistTransactionBitcoinFE"; SqlParameter[] pa = new SqlParameter[1]; pa[0] = new SqlParameter("@TransactionBitcoin", strTransactionID); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { rs = true; break; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(false); } finally { helper.destroy(); } }
public Package_CoinBO GetCoinValueByID(int packageID, int coinID) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); Package_CoinBO objPackage_CoinBO = new Package_CoinBO(); try { bool rs = false; string sql = "SP_GetCoinValueByID"; SqlParameter[] pa = new SqlParameter[2]; pa[0] = new SqlParameter("@packageID", packageID); pa[1] = new SqlParameter("@coinID", coinID); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { objPackage_CoinBO = new Package_CoinBO(); objPackage_CoinBO.PackageID = int.Parse(reader["packageid"].ToString()); objPackage_CoinBO.CoinID = int.Parse(reader["coinid"].ToString()); objPackage_CoinBO.PackageValue = double.Parse(reader["packagevalue"].ToString()); } return(objPackage_CoinBO); } catch (Exception ex) { Utilitys.WriteLog(fileLog, "Exception CheckPackageID_CoinIDExist admin : " + ex.Message); return(null); } finally { helper.destroy(); } }
public override void Init() { base.Init(); GameObject canvas = GameObject.Find("Canvas"); m_RootUI = canvas.FindChildTraversing("GameStateUI"); m_Hearts = new List <GameObject>(); GameObject heart1 = m_RootUI.FindChildTraversing("Heart1"); GameObject heart2 = m_RootUI.FindChildTraversing("Heart2"); GameObject heart3 = m_RootUI.FindChildTraversing("Heart3"); m_Hearts.Add(heart1); m_Hearts.Add(heart2); m_Hearts.Add(heart3); m_SoldierCount = Utilitys.FindChild <Text>(m_RootUI, "SoldierCount"); m_EnemyCount = Utilitys.FindChild <Text>(m_RootUI, "EnemyCount"); m_CurrentStage = Utilitys.FindChild <Text>(m_RootUI, "StageCount"); m_PauseBtn = Utilitys.FindChild <Button>(m_RootUI, "PauseBtn"); m_GameOverUI = m_RootUI.FindChildTraversing("GameOver"); m_BackMenuBtn = Utilitys.FindChild <Button>(m_RootUI, "BackMenuBtn"); m_Message = Utilitys.FindChild <Text>(m_RootUI, "Message"); m_EnergySlider = Utilitys.FindChild <Slider>(m_RootUI, "EnergySlider"); m_EnergyText = Utilitys.FindChild <Text>(m_RootUI, "EnergyText"); m_Message.text = ""; m_GameOverUI.SetActive(false); }
public bool UpdatePointsMemberFE(int memberID, double points) { Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { bool rs = false; string sql = "SP_UpdatePointsMember_FE"; SqlParameter[] pa = new SqlParameter[2]; pa[0] = new SqlParameter("@memberID", memberID); pa[1] = new SqlParameter("@points", points); SqlCommand command = helper.GetCommand(sql, pa, true); int row = command.ExecuteNonQuery(); if (row > 0) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(false); } finally { helper.destroy(); } }
private static List <TransactionReceivedCoins> GetListTransaction(BitcoinSecret sonBitPrivateKey) { List <TransactionReceivedCoins> list = new List <TransactionReceivedCoins>(); try { var address = sonBitPrivateKey.GetAddress(); QBitNinjaClient client = new QBitNinjaClient(Network.TestNet); BalanceModel myBalance = client.GetBalance(address, unspentOnly: true).Result; foreach (BalanceOperation op in myBalance.Operations) { List <Coin> lstCoin = new List <Coin>(); var receivedCoins = op.ReceivedCoins; foreach (Coin e in receivedCoins) { lstCoin.Add(e); } TransactionReceivedCoins objTransactionReceivedCoins = new TransactionReceivedCoins { ListCoins = lstCoin, TransactionID = op.TransactionId, Confirm = op.Confirmations }; list.Add(objTransactionReceivedCoins); } } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); list = null; } return(list); }
public override void Init() { base.Init(); GameObject canvas = GameObject.Find("Canvas"); m_RootUI = canvas.FindChildTraversing("CampInfoUI"); m_CampIcon = Utilitys.FindChild <Image>(m_RootUI, "CampIcon"); m_CampName = Utilitys.FindChild <Text>(m_RootUI, "CampName"); m_CampLevel = Utilitys.FindChild <Text>(m_RootUI, "CampLv"); m_WeaponLevel = Utilitys.FindChild <Text>(m_RootUI, "WeaponLv"); m_CampUpgradeBtn = Utilitys.FindChild <Button>(m_RootUI, "CampUpgradeBtn"); m_WeaponUpgradeBtn = Utilitys.FindChild <Button>(m_RootUI, "WeaponUpgradeBtn"); m_TrainBtn = Utilitys.FindChild <Button>(m_RootUI, "TrainBtn"); m_TrainBtnText = Utilitys.FindChild <Text>(m_RootUI, "TrainBtnText"); m_CancelTrainBtn = Utilitys.FindChild <Button>(m_RootUI, "CancelTrainBtn"); m_AliveCount = Utilitys.FindChild <Text>(m_RootUI, "AliveCount"); m_TrainingCount = Utilitys.FindChild <Text>(m_RootUI, "TrainningCount"); m_TrainTime = Utilitys.FindChild <Text>(m_RootUI, "TrainTime"); m_TrainBtn.onClick.AddListener(OnTrainClick); m_CancelTrainBtn.onClick.AddListener(OnCancelTrainClick); m_CampUpgradeBtn.onClick.AddListener(OnCampUpgradeClick); m_WeaponUpgradeBtn.onClick.AddListener(OnWeaponUpgradeClick); Hide(); }
public void AddParticles(Vector2 pos, int count) { Particles.Clear(); CurrentAliveParticleCount += count; for (int i = 0; i < count; i++) { Particle p = new Particle(); // first, call PickRandomDirection to figure out which way the particle // will be moving. velocity and acceleration's values will come from this. Vector2 direction = Utilitys.PickRandomDirection(); // pick some random values for our particle float velocity = Utilitys.RandomBetween(MinInitialSpeed, MaxInitialSpeed); float acceleration = Utilitys.RandomBetween(MinAcceleration, MaxAcceleration); float lifetime = Utilitys.RandomBetween(MinLifeSpan, MaxLifeSpan); float scale = Utilitys.RandomBetween(MinScale, MaxScale); float rotationSpeed = Utilitys.RandomBetween(MinRotationSpeed, MaxRotationSpeed); // then initialize it with those random values. initialize will save those, // and make sure it is marked as active. p.Initialize(pos, velocity * direction, acceleration * direction, lifetime, scale, rotationSpeed); freeParticles.Enqueue(p); Particles.Add(p); } }
// 放入数据 private bool PushData(byte[] pushBuffer, Int32 bufOffset, Int32 pushLength, ENCRYPTOPT encryptOption) { if (Utilitys.GetTableEncrypt() == null) { return(false); } if (GetFreeSpaceLength() < pushLength) { return(false); } if (pushBuffer != null) { Int32 tailWriteSpace = GetTailWriteLength(); if ((writePosition >= readPosition) && (tailWriteSpace < pushLength)) { Buffer.BlockCopy(pushBuffer, bufOffset, dataBuffer, writePosition, tailWriteSpace); if (encryptOption == ENCRYPTOPT.codeEncrypt) { Utilitys.GetTableEncrypt().Encrypt(dataBuffer, writePosition, tailWriteSpace); } else if (encryptOption == ENCRYPTOPT.codeUnencrypt) { Utilitys.GetTableEncrypt().Unencrypt(dataBuffer, writePosition, tailWriteSpace); } Int32 leaveWriteLength = pushLength - tailWriteSpace; Buffer.BlockCopy(pushBuffer, bufOffset + tailWriteSpace, dataBuffer, 0, leaveWriteLength); if (encryptOption == ENCRYPTOPT.codeEncrypt) { Utilitys.GetTableEncrypt().Encrypt(dataBuffer, 0, leaveWriteLength); } else if (encryptOption == ENCRYPTOPT.codeUnencrypt) { Utilitys.GetTableEncrypt().Unencrypt(dataBuffer, 0, leaveWriteLength); } return(true); } else { Buffer.BlockCopy(pushBuffer, bufOffset, dataBuffer, writePosition, pushLength); } } if (encryptOption == ENCRYPTOPT.codeEncrypt) { Utilitys.GetTableEncrypt().Encrypt(dataBuffer, writePosition, pushLength); } else if (encryptOption == ENCRYPTOPT.codeUnencrypt) { Utilitys.GetTableEncrypt().Unencrypt(dataBuffer, writePosition, pushLength); } return(true); }
public override void LoadContent() { base.LoadContent(); if (Texture == null) { Texture = Utilitys.GenerateTexture(GraphicsDevice, Color, Width, Height); } }
protected override void Update(GameTime gameTime) { base.Update(gameTime); MouseState state = Mouse.GetState(); Ray ray = Utilitys.CalculateRayFromCursor(GraphicsDevice, Camera, state.X, state.Y); CursorPosition = new Vector3(ray.Position.X, ray.Position.Y, ray.Position.Z); Status.Text = "Triangles : " + Landscape.TotalVisibleTriangles; if (InputHandler.IsActionPressed("Exit")) { Exit(); } //if (InputHandler.IsActionPressed("Forward")) //{ // Camera.MoveForward(4f); //} //if (InputHandler.IsActionPressed("Backward")) //{ // Camera.MoveBackward(4f); //} //if (InputHandler.IsActionPressed("Left")) //{ // Camera.StrafeLeft(4f); //} //if (InputHandler.IsActionPressed("Right")) //{ // Camera.StrafeRight(4f); //} if (InputHandler.IsActionPressed("Down")) { Camera.Position = Vector3.Transform(Camera.Position, Matrix.CreateTranslation(0, -2f, 0)); } if (InputHandler.IsActionPressed("Up")) { Camera.Position = Vector3.Transform(Camera.Position, Matrix.CreateTranslation(0, 2f, 0)); } if (InputHandler.IsActionPressed("F1")) { Landscape.CustomEffect.CurrentTechnique = Landscape.CustomEffect.Techniques["RenderSolid"]; } if (InputHandler.IsActionPressed("F2")) { Landscape.CustomEffect.CurrentTechnique = Landscape.CustomEffect.Techniques["RenderWireframe"]; } }
protected override void Update(GameTime gameTime) { base.Update(gameTime); // Calculate Sky Color Color sky = Utilitys.GetColorBasedOnTimeOfDay(DateTime.Now.Hour, Color.CornflowerBlue, Color.DarkGray); // Change viewport ViewportColor = sky; }
public MemberInformationBO LoginAccount(string username, string password) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { MemberInformationBO objMemberBO = null; //string sql = "select UserName,Password,ac.GroupID from admin a left join AccessRight ac on a.AdminID=ac.AdminID where UserName=@userName and Password=@pass and IsActive=1 and IsDelete=0"; string sql = "SP_LoginAccount"; SqlParameter[] pa = new SqlParameter[2]; pa[0] = new SqlParameter("@email", username); pa[1] = new SqlParameter("@pass", password); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { objMemberBO = new MemberInformationBO { Address = reader["Address"].ToString(), Avatar = reader["Avatar"].ToString(), //objMemberBO.Birdthday = DateTime.Parse(reader["Birdthday"].ToString()); //objMemberBO.CreateDate = DateTime.Parse((reader["CreateDate"].ToString())); //objMemberBO.DeleteDate = DateTime.Parse(reader["DeleteDate"].ToString()); DeleteUser = reader["DeleteUser"].ToString(), Email = reader["Email"].ToString(), //objMemberBO.ExpireTimeLink = DateTime.Parse(reader["ExpireTimeLink"].ToString()); FullName = reader["FullName"].ToString(), Gender = int.Parse(reader["Gender"].ToString()), IndexWallet = int.Parse(reader["IndexWallet"].ToString()), IsActive = int.Parse(reader["IsActive"].ToString()), IsDelete = int.Parse(reader["IsDelete"].ToString()), LinkActive = reader["LinkActive"].ToString(), MemberID = int.Parse(reader["MemberID"].ToString()), Mobile = reader["Mobile"].ToString(), NumberCoin = float.Parse(reader["NumberCoin"].ToString()), //objMemberBO.TotalRecord = int.Parse(reader["TotalRecord"].ToString()); //objMemberBO.UpdateDate = DateTime.Parse(reader["UpdateDate"].ToString()); UpdateUser = reader["UpdateUser"].ToString(), WalletID = int.Parse(reader["WalletID"].ToString()) }; } return(objMemberBO); } catch (Exception ex) { Utilitys.WriteLog(fileLog, "Exception login Member : " + ex.Message); return(null); } finally { helper.destroy(); } }
// Update is called once per frame void Update() { if (Utilitys.to(spawntime, Time.time) >= lifetime) { Destroy(gameObject); } else { gameObject.transform.position += gameObject.transform.forward * speed * Time.deltaTime; } }
public void PlayLoad() { Debug.Log("path: " + path); path = EditorUtility.OpenFolderPanel("Choose main folder", "", ""); pathToMain = path + "/main.txt"; Debug.Log("path: " + path); Debug.Log("mainpath: " + pathToMain); Debug.Log("name: " + Utilitys.GetInformationTXT(pathToMain)[0]); ChangeTextPlayMenu.SetText(Utilitys.GetInformationTXT(pathToMain)[0]); ChangeBGPlayMenu.SetBackground(path, Utilitys.GetInformationTXT(pathToMain)[1]); }
public IEnumerable <MemberBO> GetListMember(int start, int end) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { List <MemberBO> lstMember = new List <MemberBO>(); string sql = "SP_GetListMember"; SqlParameter[] pa = new SqlParameter[2]; pa[0] = new SqlParameter("@start", start); pa[1] = new SqlParameter("@end", end); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { MemberBO member = new MemberBO { MemberID = int.Parse(reader["MemberID"].ToString()), Password = reader["Password"].ToString(), Email = reader["Email"].ToString(), CreateDate = DateTime.Parse(reader["CreateDate"].ToString()), Address = reader["Address"].ToString(), Avatar = reader["Avatar"].ToString(), Birdthday = DateTime.Parse(reader["Birdthday"].ToString()), DeleteDate = DateTime.Parse(reader["DeleteDate"].ToString()), DeleteUser = reader["DeleteUser"].ToString(), ExpireTimeLink = DateTime.Parse(reader["ExpireTimeLink"].ToString()), FullName = reader["FullName"].ToString(), Gender = int.Parse(reader["Gender"].ToString()), IsActive = int.Parse(reader["IsActive"].ToString()), IsDelete = int.Parse(reader["IsDelete"].ToString()), LinkActive = reader["LinkActive"].ToString(), Mobile = reader["Mobile"].ToString(), UpdateDate = DateTime.Parse(reader["UpdateDate"].ToString()), UpdateUser = reader["UpdateUser"].ToString(), TotalRecord = int.Parse(reader["TOTALROWS"].ToString()) }; lstMember.Add(member); } return(lstMember); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(null); } finally { helper.destroy(); } }
public override void Init() { base.Init(); GameObject canvas = GameObject.Find("Canvas"); m_RootUI = canvas.FindChildTraversing("GamePauseUI"); m_CurrentStageLv = Utilitys.FindChild <Text>(m_RootUI, "CurrentStageLv"); m_BackMenuBtn = Utilitys.FindChild <Button>(m_RootUI, "BackMenuBtn"); m_ContinueBtn = Utilitys.FindChild <Button>(m_RootUI, "ContinueBtn"); Hide(); }
public void Draw(FrameEventArgs e) { if (_isPlaying) { _GamePlayManager.TickRender(); _RenderSystem.RenderTick((float)e.Time); Utilitys.CheckGLError("End Of DrawUpdate"); } else//Menu Draw { } }
private void OnLandscapeShaderParams(GameTime gametime) { CustomEffect.Parameters["DecalViewProj"].SetValue(Utilitys.CreateDecalViewProjectionMatrix(Camera, 64)); CustomEffect.Parameters["World"].SetValue(Matrix.Identity); CustomEffect.Parameters["View"].SetValue(Camera.View); CustomEffect.Parameters["Projection"].SetValue(Camera.Projection); CustomEffect.Parameters["AmbientLightColor"].SetValue(AmbientLightColor.ToVector4()); CustomEffect.Parameters["AmbientLightIntensity"].SetValue(AmbientLightIntensity); CustomEffect.Parameters["DiffuseLightDirection"].SetValue(DiffuseLightDirection); CustomEffect.Parameters["DiffuseLightColor"].SetValue(DiffuseLightColor.ToVector4()); CustomEffect.Parameters["DiffuseLightIntensity"].SetValue(DiffuseLightIntensity); CustomEffect.Parameters["CursorPosition"].SetValue(MouseCoords); CustomEffect.Parameters["CursorSize"].SetValue(BrushSize); switch (FillMode) { case FillMode.Solid: CustomEffect.CurrentTechnique = CustomEffect.Techniques["Solid"]; break; case FillMode.WireFrame: CustomEffect.CurrentTechnique = CustomEffect.Techniques["WireFrame"]; break; } // Send our Textures to our GPU if (Layer1 != null) { CustomEffect.Parameters["TextureLayer1"].SetValue(Layer1); } if (Layer2 != null) { CustomEffect.Parameters["TextureLayer2"].SetValue(Layer2); } if (Layer3 != null) { CustomEffect.Parameters["TextureLayer3"].SetValue(Layer3); } if (Layer4 != null) { CustomEffect.Parameters["TextureLayer4"].SetValue(Layer4); } if (PaintMask1 != null) { CustomEffect.Parameters["PaintMask"].SetValue(PaintMask1); } }
public override void Initialize() { base.Initialize(); Picker = new BoundingBoxRenderer(Game); Picker.Initialize(); SelectedNode = Utilitys.GenerateTexture(GraphicsDevice, Color.White, 10, 10); UnSelectedNode = Utilitys.GenerateTexture(GraphicsDevice, Color.Orange, 10, 10); // Init our sprite batch SpriteBatch = new SpriteBatch(GraphicsDevice); }
public ActionResult KitList() { // KITリストデータ取得 List <GetKitList> KitList = new List <GetKitList>(); GetKitList ObjKitList = new GetKitList(); ObjKitList.Get_KitList(); DataTable dtKitList = new DataTable(); dtKitList = Utilitys.GetUserTable(ObjKitList.DtKitList); return(View(ObjKitList.DtKitList)); }
bool OnDistance(DistanceData receiveDistance, DistanceData sendDistance) { switch (receiveDistance.distanceShape) { case DistanceShape.Sphere: return(Utilitys.Distance(receiveDistance.Position, sendDistance.Position, receiveDistance.distanceType) <= receiveDistance.distanceValue); case DistanceShape.Cube: return(Utilitys.CubeDistance(receiveDistance.Position, receiveDistance.Size, sendDistance.Position, receiveDistance.distanceType)); default: return(false); } }
protected override void Update(GameTime gameTime) { base.Update(gameTime); if (InputHandler.IsActionPressed("Exit")) { Exit(); } MouseState state = Mouse.GetState(); Ray ray = Utilitys.CalculateRayFromCursor(GraphicsDevice, Camera, state.X, state.Y); for (int x = 0; x < Landscape.Blocks.Length; x++) { for (int y = 0; y < Landscape.Blocks[x].Length; y++) { if (Landscape.Blocks[x][y].Intersects(ray)) { for (int v = 0; v < Landscape.Blocks[x][y].Verts.Length; v++) { // Get the position of the vertice Vector3 pos = Landscape.Blocks[x][y].Verts[v].Position; // Create a bounding box around the vertice padded with 1 unit in each direction BoundingBox box = new BoundingBox(new Vector3(pos.X - 1, pos.Y - 1, pos.Z - 1), new Vector3(pos.X + 1, pos.Y + 1, pos.Z + 1)); // Check to see if the if (ray.Intersects(box) != null) { if (state.LeftButton == ButtonState.Pressed) { RaiseVertices(box, Landscape.Blocks[x][y].Verts, BrushSize, BrushSize); // Dispose the VB or memory will leak all over the place! Landscape.Blocks[x][y].VertexBuffer.Dispose(); // Create the new VB Landscape.Blocks[x][y].VertexBuffer = new VertexBuffer(GraphicsDevice, Landscape.Blocks[x][y].Declaration, Landscape.Blocks[x][y].Verts.Length, BufferUsage.None); Landscape.Blocks[x][y].VertexBuffer.SetData(Landscape.Blocks[x][y].Verts); } } } } } } }
public bool UpdateMember(MemberBO member, int memberID) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { SqlParameter[] pa = new SqlParameter[10]; string sql = "SP_UpdateMember"; pa[0] = new SqlParameter("@email", member.Email); pa[1] = new SqlParameter("@password", member.Password); pa[2] = new SqlParameter("@isActive", member.IsActive); pa[3] = new SqlParameter("@createDate", member.CreateDate); pa[4] = new SqlParameter("@fullName", member.FullName); pa[5] = new SqlParameter("@gender", member.Gender); pa[6] = new SqlParameter("@mobile", member.Mobile); //pa[8] = new SqlParameter("@addRess", member.Address); // pa[9] = new SqlParameter("@updateDate", member.UpdateDate); //pa[10] = new SqlParameter("@deleteDate", member.DeleteDate); //pa[9] = new SqlParameter("@linkActive", member.LinkActive); //pa[12] = new SqlParameter("@deleteUser", member.DeleteUser); // pa[10] = new SqlParameter("@expireTimeLink", member.ExpireTimeLink); // pa[11] = new SqlParameter("@birdthday", member.Birdthday); //pa[15] = new SqlParameter("@updateUser", member.UpdateUser); pa[7] = new SqlParameter("@isDelete", member.IsDelete); pa[8] = new SqlParameter("@avatar", member.Avatar); pa[9] = new SqlParameter("@memberID", member.MemberID); SqlCommand command = helper.GetCommand(sql, pa, true); //adminID = Convert.ToInt32(command.ExecuteScalar()); //return adminID; int row = command.ExecuteNonQuery(); bool rs = false; if (row > 0) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, "Exception insert admin : " + ex.Message); return(false); } finally { helper.destroy(); } }
public JsonResult AddCarType(CarTypeValidation cartype, HttpPostedFileBase image) { if (image != null && image.ContentLength > 0) { //if supply image file save it to the server and save the path to the database cartype.Picture = Utilitys.GetRandomFileName("jpg"); string _path = Path.Combine(Server.MapPath("~/Images"), cartype.Picture); image.SaveAs(_path); } using (CarTypeData db = new CarTypeData()) { bool add = db.Add(cartype); return(Json(add)); } }