private void 멈추기SToolStripMenuItem_Click(object sender, EventArgs e) { if (MoveTimer.Enabled) { toolStop.Text = "움직이기(&S)"; if (hling == null) { hling = new Thread(new ThreadStart(Howling)); hling.Start(); } else { hling.Abort(); hling = new Thread(new ThreadStart(Howling)); hling.Start(); } MoveTimer.Stop(); } else { toolStop.Text = "멈추기(&S)"; MoveTimer.Start(); } if (dir != 4) { dir = 4; } else { dir = 0; } }
public override void Subscribe() { GUIForm.Paint += OnPaint; MoveTimer.Tick += OnMoveTimerTick; MoveTimer.Start(); Destroyed += OnDestroyed; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!UseOpacity) { Opacity = 1; } SetupText(); //Width = 200; //Height = 60; Width = 400; Height = 100; //Location = new Point( // Screen.PrimaryScreen.Bounds.Width - Width, // Screen.PrimaryScreen.Bounds.Height - Height * (1 + StartingOffsetIndex) + ((StartingOffsetIndex == 0) ? 0 : (Screen.PrimaryScreen.WorkingArea.Height - Screen.PrimaryScreen.Bounds.Height))); OpacityStep = (float)(((float)SystemInformation.WorkingArea.Height / (float)SystemInformation.VirtualScreen.Height) / 10.0); MoveTimer.Start(); Play(SoundLocation); }
private void Gameover() { vreme.Stop(); SpawnTimer.Stop(); MoveTimer.Stop(); ReduceSpeed.Stop(); GameOver go = new GameOver(lbScore.Text); DialogResult res = go.ShowDialog(); if (res == System.Windows.Forms.DialogResult.Retry) { veg.Clear(); score = 0; lbTime.Text = "60"; lbScore.Text = "0"; vreme.Start(); SpawnTimer.Start(); MoveTimer.Start(); pb1.Visible = true; pb2.Visible = true; pb3.Visible = true; canvas.Invalidate(); SpawnTimer.Interval = 10; progress.Value = 60; isPressed = false; ReduceSpeed.Start(); } }
public GameBoard() { InitializeComponent(); KeyDown += new KeyEventHandler(GameBoard_KeyDown); MoveTimer.Interval = 100; MoveTimer.Start(); }
public Bear() { InitializeComponent(); LoadImage(); MoveTimer.Interval = 500; MoveTimer.Start(); this.AllowDrop = true; this.DragEnter += new DragEventHandler(Form1_DragEnter); this.DragDrop += new DragEventHandler(Form1_DragDrop); }
public Bear(int cnt) { InitializeComponent(); LoadImage(); MoveTimer.Interval = 500; MoveTimer.Start(); this.AllowDrop = true; this.DragEnter += new DragEventHandler(Form1_DragEnter); this.DragDrop += new DragEventHandler(Form1_DragDrop); name.Text = (++cnt).ToString(); }
public static void Start() { MoveTimer.Start(); PMoveTimer.Start(); GenCarTimer.Start(); WorkTimer.Start(); GenPeopleTimer.Start(); LightsTimer.Start(); TrafficLight.CreateLight(); IsReady = true; }
private void Igra_Load(object sender, EventArgs e) { SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); vreme.Start(); SpawnTimer.Start(); MoveTimer.Start(); ReduceSpeed.Start(); }
private void button1_Click(object sender, EventArgs e) { for (int i = 0; i < 25; i++) { var code = Rnd.Next(9 * RubikCube.N); var move = new TMove(); move.Decode(code); Moves.Add(move); } MoveTimer.Start(); }
public override void DoSomethingSpecial(Mobile from) { foreach (Item item in GetItemsInRange(8)) { if (item.ItemID == 0x3660 && item.Hue == 1000) //Dark Globe of Sosaria { Timer m_timerA = new MoveTimer(item, 1); m_timerA.Start(); } } }
public Form1() { InitializeComponent(); DoubleBuffered = true; paused = false; actions = new Queue <Actions>(); WindowState = FormWindowState.Maximized; KeyPreview = true; doc = new PlatformRunDoc(Width, Height - 200 - 2 * Platform.height); MoveTimer.Start(); }
public static void Start() { MoveTimer.Start(); GenCarTimer.Start(); WorkTimer.Start(); LightsTimer.Start(); CurrentRoad = new Road(1, 1, 1, 1); CurrentRoadTransit = new RoadTransit(false, false, false, false, 1, 1, 1, 1); TrafficLight.CreateLight(); IsReady = true; }
public void WaitingForMove() { if (Game.CurrentPerson.IsAI) { MoveTimer.Start(); } else { graphic.Wait4Move(); } }
public override void DoSomethingSpecial( Mobile from ) { foreach ( Item item in GetItemsInRange( 8 ) ) { if ( item.ItemID == 0x3660 && item.Hue == 1000 ) //Dark Globe of Sosaria { Timer m_timerA = new MoveTimer( item, 1 ); m_timerA.Start(); } } }
private void pauseToolStripMenuItem_Click(object sender, EventArgs e) { if (paused) { MoveTimer.Stop(); } else { MoveTimer.Start(); } paused = !paused; }
public GameBoard(int speed) // sets timer intervals and starts key click event handler { InitializeComponent(); KeyDown += new KeyEventHandler(GameBoard_KeyDown); Speed = speed; MoveTimer.Interval = 100 / speed; MoveTimer.Start(); CollisionTimer.Interval = 100 / speed; CollisionTimer.Start(); }
private void StartTravel(PlayerMobile pm, BBTravel BBT) { if (New_Map == null || New_Map == Map.Internal) { return; } if (pm != null && BBT != null) { Move_Timer = new MoveTimer(pm, BBT); Move_Timer.Start(); } }
private void buttonPlay_Click(object sender, EventArgs e) { PlayerAnimate.Start(); virusStartScreen.Visible = false; labelTitle.Visible = false; buttonPlay.Visible = false; this.Height = 460; this.Width = 760; int rand1 = rand.Next(30, 730); int rand2 = rand.Next(30, 430); Player.Location = new Point(rand1, rand2); MoveTimer.Start(); }
protected virtual void OnRespawnTimerTick(object sender, EventArgs e) { RespawnFrame += 64; if (RespawnFrame == 896) { RespawnFrame = 0; RespawnTimer.Stop(); MoveTimer.Start(); ImmortalDelay = 4000; Immortal = true; } GUIForm.Invalidate(Rect); }
protected virtual bool BeginMove(Direction dir, SpeedCode speed) { if (speed == SpeedCode.Stop) { return(false); } if (_currentMoveTimer != null) { _currentMoveTimer.Stop(); } _moving = dir; _speed = speed; _currentMoveTimer = new MoveTimer(this, timespanDictionary[speed], speed); _currentMoveTimer.Start(); return(true); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!UseOpacity) { Opacity = 1; } SetupText(); Width = 400; Height = 100; OpacityStep = (float)(((float)SystemInformation.WorkingArea.Height / (float)SystemInformation.VirtualScreen.Height) / 10.0); MoveTimer.Start(); Play(SoundLocation); }
protected virtual bool BeginMove(Direction dir, SpeedCode speed) { if (speed == SpeedCode.Stop) { return(false); } if (m_MoveTimer != null) { m_MoveTimer.Stop(); } m_Moving = dir; m_Speed = speed; m_MoveTimer = new MoveTimer(this, m_TimespanDictionary[speed], speed); m_MoveTimer.Start(); return(true); }
} // Sonraki hamleyi gerçekleştiren fonksiyon private void TurnSystem() { if (MoveTimer.Enabled == false) { if (playerTurn > 4) { playerTurn = 1; } turnMoveTEMP = 1; Player player = playerList.Where(p => p.playerdID == playerTurn).SingleOrDefault(); int remainingGold = goldList.Where(p => p.isTaken == false && p.isSecret == false).Count(); int remainingSecretGold = goldList.Where(p => p.isTaken == false).Count(); Player playerC = playerList.Where(p => p.playerdID == 3).Single(); int eliminatedPlayerNumber = playerList.Where(p => p.stat != 5).Count(); if (remainingGold == 0 && playerC.playerGold < findTargetCost[2] || remainingGold == 0 && remainingSecretGold == 0 || eliminatedPlayerNumber == 4) { TurnTimer.Stop(); Player winnerPlayer = playerList.Where(t => t.playerGold == playerList.Select(p => p.playerGold).Max()).FirstOrDefault(); ScoreBoard scr = new ScoreBoard(playerList); scr.ShowDialog(); WriteText(); } else { if (player.target != 0 && player.playerGold > turnCost[playerTurn - 1]) { player.playerGold -= turnCost[playerTurn - 1]; player.spentGold += turnCost[playerTurn - 1]; addLog(player.playerName + " Oyuncusu hamle yapmak için " + turnCost[player.playerdID - 1] + " Altın ödedi"); MoveTimer.Start(); } else if (player.target == 0 && player.playerGold >= findTargetCost[playerTurn - 1] && player.playerGold > turnCost[playerTurn - 1]) { FindNextTarget(player); if (player.target != 0) { addLog(player.playerName + " Oyuncusu hedef olarak " + player.target + ". kareyi belirledi ve bunun için " + turnCost[player.playerdID - 1] + " Altın Harcadı "); addLog(player.playerName + " Oyuncusu hamle yapmak için " + turnCost[player.playerdID - 1] + " Altın ödedi"); player.playerGold -= findTargetCost[playerTurn - 1]; player.playerGold -= turnCost[playerTurn - 1]; player.spentGold += findTargetCost[playerTurn - 1] + turnCost[playerTurn - 1]; MoveTimer.Start(); } else { playerTurn++; } } else { if (player.stat == 5) { player.stat = countLivePlayers; addLog(player.playerName + " Oyuncusunun oynamak için yeterli altını kalmadı ve oyunu " + player.stat + ". olarak tamamladı"); countLivePlayers--; } playerTurn++; } (pictureBox2.Controls["textPlayer" + player.playerName + "Coin"] as Label).Text = player.playerGold.ToString(); } } } // Oyun sırasını belirleyen fonksiyon
public static void Start() { MoveTimer.Start(); LightsTimer.Start(); GenCarTimer.Start(); }
void Solve() { var best = new RubikGenome(); best.Fitness = HighScore; foreach (var solution in Solutions) { var genome = new RubikGenome(); var cube = new RubikCube(RubikCube); for (int i = 0; i < solution.Value.Count; i++) { var move = solution.Value[i]; cube.MakeMove(move); genome.Genes[i] = move.Encode(); } genome.Fitness = cube.Evaluate(); if (genome.Fitness < best.Fitness) { best = genome; } } if (best.Fitness >= HighScore) { TChromosome.GenesLength = 30; TChromosome.MinGenes = new double[TChromosome.GenesLength]; TChromosome.MaxGenes = new double[TChromosome.GenesLength]; for (int i = 0; i < TChromosome.MaxGenes.Length; i++) { TChromosome.MaxGenes[i] = 9 * RubikCube.N; } TGA <RubikGenome> .GenerationsCount = 50; TGA <RubikGenome> .MutationRatio = 0.2; TGA <RubikGenome> .WinnerRatio = 0.1; var ga = new TGA <RubikGenome>(); ga.Evaluate = OnEvaluate; ga.Progress = OnProgress; ga.Execute(); best = ga.Best; if (best.Fitness == 0) { SaveSolution(best); } } if (best.Fitness < HighScore) { Moves.Clear(); for (int i = 0; i < best.MovesCount; i++) { var move = new TMove(); move.Decode((int)best.Genes[i]); Moves.Add(move); } HighScore = best.Fitness; } MoveTimer.Start(); }
public void button2_Click_1(object sender, EventArgs e) { button2.Enabled = false; dataGridView1.Rows.Clear(); using var con = new SQLiteConnection(cs); con.Open(); using var cmd = new SQLiteCommand(con); string line = String.Empty; cmd.CommandText = "SELECT pic_name, CASE WHEN is_full = 0 THEN 'EMPTY' END as 'DATA' FROM data;"; SQLiteDataReader r = cmd.ExecuteReader(); while (r.Read()) { pic_number = r["pic_name"].ToString(); line = r["DATA"].ToString(); if (line == "EMPTY") { break; } } r.Close(); temp = getPictureBoxByName(pic_number); if (temp.Location.X > stage1.X) { Xdirection = 1; Sprava = false; } else { Xdirection = -1; Sprava = true; } if (temp.Location.Y > stage1.Y) { height = stage1.Y; } else if (temp.Location.Y > stage2.Y && temp.Location.Y < stage1.Y) { height = stage2.Y; } else //(temp.Location.Y<stage2.Y && temp.Location.Y>stage3.Y) { height = stage3.Y; } cmd.CommandText = "UPDATE data SET is_full=1,dateFrom= :dateFrom,DateTo= :DateTo ,weight= :weight,phone_number= :phone_number,price= :price WHERE pic_name = :pic_number"; cmd.Parameters.AddWithValue("dateFrom", ourDays.ToString()); cmd.Parameters.AddWithValue("DateTo", randomDate.ToString()); cmd.Parameters.AddWithValue("weight", item_weight); cmd.Parameters.AddWithValue("pic_number", pic_number); cmd.Parameters.AddWithValue("phone_number", phone_number); cmd.Parameters.AddWithValue("price", Math.Abs(price)); cmd.ExecuteNonQuery(); Task = true; MoveTimer.Start(); }