private void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { var sprite = GetComponent<Sprite>(ComponentType.Sprite); if (sprite == null) { return; } //switch (e.Input) //{ // case Input.Left: // sprite.Move(-1.5f, 0); // break; // case Input.Right: // sprite.Move(1.5f, 0); // break; // case Input.Up: // sprite.Move(0, -1.5f); // break; // case Input.Down: // sprite.Move(0, 1.5f); // break; // case Input.N: // break; // } //sprite.Destination = e.Point; System.IO.File.AppendAllText(@"C:\WriteText.txt", "lst.Add(new Vector2("+e.Point.X.ToString()+","+e.Point.Y.ToString()+"));"); System.IO.File.AppendAllText(@"C:\WriteText.txt", Environment.NewLine); }
public void Handler(object sender, MyEventArgs e) { Console.WriteLine("Event " + e.EventNum + " received by an X object."); Console.WriteLine("Source is " + sender); Console.WriteLine(); }
private void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { var sprite = GetComponent<Sprite>(ComponentType.Sprite); if (sprite == null) { return; } var collision = GetComponent<Collision>(ComponentType.Collision); var x = 0f; var y = 0f; switch (e.Input) { case Input.Left: x = -1.5f; break; case Input.Right: x = 1.5f; break; case Input.Up: y = -1.5f; break; case Input.Down: y = 1.5f; break; } if (collision == null || !collision.CheckCollision(new Rectangle((int) (sprite.Position.X + x), (int) (sprite.Position.Y + y), sprite.Width, sprite.Height))) { sprite.Move(x, y); } }
void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { if(e.Input == Input.Enter) { ManagerScreen.LoadNewScreen(new ScreenWorld(ManagerScreen)); } }
void managerMouse_MouseEventHandler(object sender, MyEventArgs.MouseEventArgs e) { if (_sprite.Rectangle.Intersects(e.SelectRectangle)) _selected = true; else _selected = false; }
void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { switch (e.Input) { case Input.Left: ManagerNetwork.SendInput(Keys.Left); break; case Input.Right: ManagerNetwork.SendInput(Keys.Right); break; case Input.Up: ManagerNetwork.SendInput(Keys.Up); break; case Input.Down: ManagerNetwork.SendInput(Keys.Down); break; case Input.None: break; case Input.Enter: break; case Input.A: break; case Input.S: break; case Input.Select: break; case Input.Start: break; default: throw new ArgumentOutOfRangeException(); } }
public virtual void RaiseClick(MyEventArgs b) { if(ClickEvent != null) { ClickEvent(this, b); } }
// This raises SomeEvent. public void OnSomeEvent() { MyEventArgs arg = new MyEventArgs(); if (SomeEvent != null) { arg.EventNum = count++; SomeEvent(this, arg); } }
void PlayerUpdate(object sender, MyEventArgs.PlayerUpdateEventArgs e) { foreach (var player in e.Players) { var baseObject = _players.FirstOrDefault(b => b.Username == player.Username); if (baseObject != null) { var sprite = baseObject.GetComponent<Sprite>(ComponentType.Sprite); sprite.UpdatePosition(player, e.CameraUpdate); } else { CreateObject(player); } } }
void EnemyUpdate(object sender, MyEventArgs.EnemyUpdateEventArgs e) { foreach (var enemy in e.Enemies) { var baseObject = _enemies.FirstOrDefault(en => en.Username == enemy.UniqueId.ToString()); if (baseObject != null) { var sprite = baseObject.GetComponent<Sprite>(ComponentType.Sprite); sprite.UpdatePosition(enemy, e.CameraUpdate); } else { CreateObject(enemy); } } }
private void btnLogin_Click(object sender, EventArgs e) { MyEventArgs myEventArgs = new MyEventArgs(); myEventArgs.LoginName = this.txtLoginName.Text; myEventArgs.LoginPwd = this.txtPwd.Text; myEventArgs.Result = false; //this指的是btnLogin这个控件 MyLoginDelegate(this, myEventArgs); if (myEventArgs.Result) { this.txtLoginName.BackColor = Color.Green; this.txtPwd.BackColor = Color.Green; } else { this.txtLoginName.BackColor = Color.Red; this.txtPwd.BackColor = Color.Red; } }
private void MaxReached(object obj, MyEventArgs e) { _myEventRaised = true; }
static void NewDeviceAdded(object source, MyEventArgs e) { Console.WriteLine("New Device Attached at Port : " + e.ComPort); }
void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { switch (e.Input) { case Input.Left: _cursorPosition.X--; if (_cursorPosition.X < 0) { _cursorPosition.X = 1; _cursorPosition.Y--; if (_cursorPosition.Y < 0) { _cursorPosition.Y = 7; } } break; case Input.Right: _cursorPosition.X++; if (_cursorPosition.X > 1) { _cursorPosition.X = 0; _cursorPosition.Y++; if (_cursorPosition.Y > 7) _cursorPosition.Y = 0; } break; case Input.Down: _cursorPosition.Y++; if (_cursorPosition.Y > 7) { _cursorPosition.X = 0; _cursorPosition.Y = 0; } break; case Input.Up: _cursorPosition.Y--; if (_cursorPosition.Y < 0) { _cursorPosition.X = 1; _cursorPosition.Y = 7; } break; case Input.Select: ManagerScreen.GoBackOneScreen(); break; case Input.A: _equipment.SwitchEquipment(ItemSlot.A, _cursorPosition); break; case Input.S: _equipment.SwitchEquipment(ItemSlot.B, _cursorPosition); break; } }
internal void SomeHandler(object sender, MyEventArgs e) { }
private void MyEventHandlerMethod(object sender, MyEventArgs e) //okay, event handler { }
private void OnFooBar(object sender, MyEventArgs e) { Debug.Log("Method OnFoobar Event"); }
public void OnLoad(object sender, EventArgs e) { MyEventArgs args = e as MyEventArgs; if (IsLoaded && (args == null || args.Type != MyEventArgs.Types.ForceReload)) { return; } Cursor.Current = Cursors.WaitCursor; Options.LoadedUltimaClass["TileData"] = true; Options.LoadedUltimaClass["Art"] = true; Options.LoadedUltimaClass["Animdata"] = true; Options.LoadedUltimaClass["Hues"] = true; if (!IsLoaded) // only once { Plugin.PluginEvents.FireModifyItemShowContextMenuEvent(contextMenuStrip1); } _showFreeSlots = false; showFreeSlotsToolStripMenuItem.Checked = false; listView1.BeginUpdate(); listView1.Clear(); List <ListViewItem> itemcache = new List <ListViewItem>(); if (Files.UseHashFile && Files.CompareHashFile("Art", Options.AppDataPath) && !Art.Modified) { string path = Options.AppDataPath; string fileName = Path.Combine(path, "UOFiddlerArt.hash"); if (File.Exists(fileName)) { using (FileStream bin = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) { unsafe { byte[] buffer = new byte[bin.Length]; bin.Read(buffer, 0, (int)bin.Length); fixed(byte *bf = buffer) { int *poffset = (int *)bf; int offset = *poffset + 4; int *dat = (int *)(bf + offset); int i = offset; while (i < buffer.Length) { int j = *dat++; ListViewItem item = new ListViewItem(j.ToString(), 0) { Tag = j }; itemcache.Add(item); i += 4; } } } } listView1.Items.AddRange(itemcache.ToArray()); } } else { int staticlength = Art.GetMaxItemID() + 1; for (int i = 0; i < staticlength; ++i) { if (Art.IsValidStatic(i)) { ListViewItem item = new ListViewItem(i.ToString(), 0) { Tag = i }; itemcache.Add(item); } } listView1.Items.AddRange(itemcache.ToArray()); if (Files.UseHashFile) { MakeHashFile(); } } listView1.TileSize = new Size(Options.ArtItemSizeWidth, Options.ArtItemSizeHeight); listView1.EndUpdate(); if (!IsLoaded) { ControlEvents.FilePathChangeEvent += OnFilePathChangeEvent; ControlEvents.ItemChangeEvent += OnItemChangeEvent; ControlEvents.TileDataChangeEvent += OnTileDataChangeEvent; } IsLoaded = true; Cursor.Current = Cursors.Default; }
protected virtual void OnClientDisconnected(MyEventArgs e) { ClientDisconnected?.Invoke(this, e); }
protected virtual void OnShapeChanged(MyEventArgs e) { ShapeChanged?.Invoke(this, e); }
void Ok(object sender, MyEventArgs e) { if ((UserControl)sender is Login) { if (File.Exists("users.txt")) { sr = new StreamReader("users.txt"); string name = e.name; bool exist = false; while (sr.Peek() > -1) { sr.ReadLine(); if (name == sr.ReadLine()) { exist = true; if (e.password == sr.ReadLine()) { MessageBox.Show("Добро пожаловать"); } else { MessageBox.Show("Не верный пароль"); } break; } sr.ReadLine(); sr.ReadLine(); sr.ReadLine(); } sr.Close(); if (!exist) { MessageBox.Show("Такого пользователя не существует"); } } else { MessageBox.Show("Такого пользователя не существует"); } //MessageBox.Show(string.Format("OkLog {0}", e.name)); } if ((UserControl)sender is Registration) { if (File.Exists("users.txt")) { sr = new StreamReader("users.txt"); string name = e.name; bool exist = false; while (sr.Peek() > -1) { sr.ReadLine(); if (name == sr.ReadLine()) { exist = true; MessageBox.Show("Пользователь уже существует"); break; } sr.ReadLine(); sr.ReadLine(); sr.ReadLine(); } sr.Close(); if (!exist) { sw = new StreamWriter("users.txt", true); sw.WriteLine(); sw.WriteLine(e.name); sw.WriteLine(e.password); sw.WriteLine(e.quastion); sw.WriteLine(e.answer); sw.Close(); MessageBox.Show("Вы зарегистрированы"); } } else { sw = new StreamWriter("users.txt", true); sw.WriteLine(); sw.WriteLine(e.name); sw.WriteLine(e.password); sw.WriteLine(e.quastion); sw.WriteLine(e.answer); sw.Close(); MessageBox.Show("Вы зарегистрированы"); } //MessageBox.Show(string.Format("OkReg {0}", e.name)); } if ((UserControl)sender is Restore) { if (File.Exists("users.txt")) { sr = new StreamReader("users.txt"); string name = e.name; bool exist = false; while (sr.Peek() > -1) { sr.ReadLine(); if (name == sr.ReadLine()) { exist = true; string pass = sr.ReadLine(); if (e.quastion == sr.ReadLine() && e.answer == sr.ReadLine()) { MessageBox.Show(string.Format("Ваш пароль: {0}", pass)); } else { MessageBox.Show("Не верный вопрос || не верный ответ на него "); } break; } sr.ReadLine(); sr.ReadLine(); sr.ReadLine(); } sr.Close(); if (!exist) { MessageBox.Show("Такого пользователя не существует"); } } else { MessageBox.Show("Такого пользователя не существует"); } //MessageBox.Show(string.Format("OkRes {0}", e.name)); } }
protected virtual void OnReceivedMessage(MyEventArgs e) { RecievedMessage?.Invoke(this, e); }
public void Reaction(Object sender, MyEventArgs e) { Console.WriteLine("Event{0}:\t{1}\n" ,Number ,e.Message); }
private void DoReflashData(object sender, MyEventArgs e) { ReflashData(); }
public void button1_Click(object sender, MyEventArgs e) { var arg = e.Arg1; return; }
void center2_11_OnPageClicked(object sender, MyEventArgs e) { switch (e.Action) { case 11: { index--; //if (index < 0) // index = 0; if (index >= 0) { SRRC_ResourceEntity ent = lvic[index].Tag as SRRC_ResourceEntity; this.PicId = ent.Id; this.inPutBuffer(ent.Serverip + ent.Path, 0); this.center2_11.SetSelectedState(index); this.right1.SetBiaoJiStatusByString(this.PicId.ToString()); } else { index = 0; MessageBox.Show("已是第一张"); } } break; case 12: { index++; if (lvic.Count > index) { SRRC_ResourceEntity ent = lvic[index].Tag as SRRC_ResourceEntity; this.PicId = ent.Id; this.inPutBuffer(ent.Serverip + ent.Path, 0); this.center2_11.SetSelectedState(index); this.right1.SetBiaoJiStatusByString(this.PicId.ToString()); } else { index = lvic.Count - 1; MessageBox.Show("已是最后一张"); } } break; case 13: { this.inPutBuffer(strPic, -1); } break; case 14: { this.inPutBuffer(strPic, 0); } break; case 15: { this.inPutBuffer(strPic, 0); } break; case 16://显示图片 { if (String.IsNullOrEmpty(e.Parameter.ToString()) == false) { //1:1显示 String[] arrls = e.Parameter.ToString().Split(new char[] { '|' }); index = SRLibFun.StringConvertToInt32(arrls[1]); PicId = SRLibFun.StringConvertToInt32(arrls[2]); inPutBuffer(arrls[0], 0); this.right1.SetBiaoJiStatusByString(this.PicId.ToString()); } } break; default: break; } }
// PlayerAtEdge Event method. void PlayerAtEdge(object source, MyEventArgs e) { Vector3 testPosition = UnityTools.Ceiling(transform.position + (transform.forward * ((chunkLength / 2) - 1)), chunkLength); }
public void InvokeAnEvent(MyEventArgs arg2) { InvokeExternal(AnEvent, this, arg2); }
void MyEventHandler(Object sender, MyEventArgs e) { // This will get fired when B's event is raised }
void OnValueChanged(object sender, MyEventArgs ea) { Console.WriteLine($"OnValueChanged {ea.Value}"); }
public static void ThrowException(MyEventArgs args) { throw new Exception("Деление на ноль("); }
void LoadMap(object sender, MyEventArgs.MapNameEventArgs e) { _tiles = new Manager.ManagerMap(e.MapName, _managerCamera); _tiles.LoadContent(); _tiles.LoadCollisionTexture(); }
private void GridLayoutHelper_Trigger(object sender, MyEventArgs e) { Debug.WriteLine(string.Join(" | ", e.LayoutChangedTypes)); }
void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { var sprite = GetComponent<Sprite>(ComponentType.Sprite); if (sprite == null) return; var collision = GetComponent<Collision>(ComponentType.Collision); var x = 0f; var y = 0f; var camera = GetComponent<Camera>(ComponentType.Camera); if (camera == null) return; var animation = GetComponent<Animation>(ComponentType.Animation); Equipment equipment; if (!camera.CameraInTransition()) { switch (e.Input) { case Input.Up: y = -1.5f; break; case Input.Down: y = 1.5f; break; case Input.Left: x = -1.5f; break; case Input.Right: x = 1.5f; break; case Input.A: if(animation.CurrentState == State.Walking) animation.StopAnimation(); equipment = GetComponent<Equipment>(ComponentType.Equipment); equipment.FireItem(ItemSlot.A); break; case Input.S: if (animation.CurrentState == State.Walking) animation.StopAnimation(); //ManagerEvents.AddEvents(new List<IGameEvent> {new GameEventMessage("I just started a new event with my s button")}); equipment = GetComponent<Equipment>(ComponentType.Equipment); equipment.FireItem(ItemSlot.B); break; case Input.Start: _managerScreen.LoadNewScreen( new ScreenMainMenu(_managerScreen, GetComponent<Stats>(ComponentType.Stats), GetComponent<Equipment>(ComponentType.Equipment))); break; case Input.Select: camera = GetComponent<Camera>(ComponentType.Camera); if(camera != null) _managerScreen.LoadNewScreen(new ScreenOverworldMap(_managerScreen,_managerPlayer, camera.CameraTilePositon)); break; default: return; } } if(collision == null || !collision.CheckCollisionWithTiles(new Rectangle((int) (sprite.Position.X + x), (int) (sprite.Position.Y + y),sprite.Width,sprite.Height))) sprite.Move(x, y); Vector2 position; if(!camera.GetPosition(sprite.Position,out position)) { camera.MoveCamera(animation.CurrentDirection); UpdateMap(camera, animation.CurrentDirection); } }
void MyEventHandlerMethod(object sender, MyEventArgs e) //okay, event handler { }
private void DoRerflashData(object sender, MyEventArgs e) { new PA.ViewModel.ViewModel_科目管理().UpdateMainSubjectsFee(DoubleClickSubject); TabControl_五大科目_SelectionChanged(null, null); }
public static void OnMyEvent(object o, MyEventArgs msg) { Console.WriteLine($"I heard {msg.num}"); }
static void DeviceRemoved(object source, MyEventArgs e) { Console.WriteLine("Device Removed at Port : " + e.ComPort); }
void btn_EnterHandler(object sender, MyEventArgs e) { Console.WriteLine(e.Message); Console.WriteLine(e.Sender); }
public static void RaiseEvent(this EventMarshalDel @event, IMyEventActions sender, MyEventArgs e) { if (@event != null) { @event(sender, e); } }
private static void MaxReached(object obj, MyEventArgs e) { Console.WriteLine(e.ToString()); }
//Metodo per lanciare gli eventi. public void CastEvent(MyIndexEvent eventToCast, MyEventArgs e) { myEvents[(int)eventToCast].Invoke(e); }
void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { if (e.Error == null) { textBlock_addText(e.Result); //textBlock1.Text = e.Result; } // 注册事件,下面的两种方法是一样的 MyEevent += this.WebService_MyEevent; //MyEevent += new MyEventHandler(WebService_MyEevent); // something happened if (MyEevent != null) { MyEventArgs arg = new MyEventArgs(36); //MyEevent.BeginInvoke(null, null, null, null); //compact .Net framework does not support BeginInvoke MyEevent(this, arg); } }
public virtual void RaiseOnEnter(MyEventArgs e) { if (EnterHandler != null) { EnterHandler(this, e); } }
private void WorkerOnWorkComplete(object sender, MyEventArgs eventArgs) { // Do something with result here }
void onUpdateHandler(MyEventArgs args) { //anyone listening? if (this.updateEvent == null) return; MyEventArgs a = args; this.updateEvent(this, a); }
public void Receive(object sender, MyEventArgs param) { ++Count; }
//右边事件 void right1_OnPageClicked(object sender, MyEventArgs e) { SROperation2.Instance.CenterLanZhiTemp = ""; if (SROperation2.Instance.KeywordFilter.Length == 0)//无关键字 { recEntList = null; } else //有关键字 { //and if (SROperation2.Instance.KeywordLogical == "and") { int count = SROperation2.Instance.KeywordFilter.Split(',').Length; recEntList = DataBase.Instance.tSRRC_Resource.Get_EntityCollectionBySQL("select * from SRRC_Resource where id in (SELECT Resource_id FROM SRRC_Resourcebiaojirel WHERE Biaoji_id IN (" + SROperation2.Instance.KeywordFilter + ") GROUP BY Resource_id HAVING COUNT(*)=" + count + ")"); } //or if (SROperation2.Instance.KeywordLogical == "or") { recEntList = DataBase.Instance.tSRRC_Resource.Get_EntityCollectionBySQL("select * from SRRC_Resource where id in (SELECT Resource_id FROM SRRC_Resourcebiaojirel WHERE Biaoji_id IN (" + SROperation2.Instance.KeywordFilter + ") GROUP BY Resource_id)"); } } if (recEntList != null && recEntList.Count > 0) { foreach (SRRC_ResourceEntity item in recEntList) { SROperation2.Instance.CenterLanZhiTemp += item.Id + ","; } } SROperation2.Instance.CenterLanZhiTemp = SROperation2.Instance.CenterLanZhiTemp.Trim(','); if (SROperation2.Instance.CenterLanZhiTemp == "") SROperation2.Instance.CenterLanZhiTemp = "0"; this.center2_11.BindData(); }
private static void OnNewMail(object sender, MyEventArgs e) { Console.WriteLine("New mail! : {0}",e.Letter); }
void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { if (Done || !Active || e.Input != Input.Enter) return; //_currentIndex++; //Just for now Done = true; Active = false; }
private void PagerCtrl1_OnNextPageClicked(object sender, MyEventArgs <int> e) { loadGridData(e.Value1 + 1); }
void managerMouse_MouseClickEventHandler(object sender, MyEventArgs.MouseClickEventArgs e) { if (_selected) _movement.Move(e.XTile, e.YTile); }
void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { if(e.Input == Input.Select) ManagerScreen.GoBackOneScreen(); switch (e.Input) { case Input.Left: if (_cursorPosition.X - 1 < 0) return; if (!_managerPlayer.TileExplored((int)_cursorPosition.X - 1, (int)_cursorPosition.Y)) return; _cursorPosition = new Vector2(_cursorPosition.X - 1, _cursorPosition.Y); break; case Input.Right: if (_cursorPosition.X + 1 > 15) return; if (!_managerPlayer.TileExplored((int)_cursorPosition.X + 1, (int)_cursorPosition.Y)) return; _cursorPosition = new Vector2(_cursorPosition.X + 1, _cursorPosition.Y); break; case Input.Up: if (_cursorPosition.Y - 1 < 0) return; if (!_managerPlayer.TileExplored((int)_cursorPosition.X, (int)_cursorPosition.Y - 1)) return; _cursorPosition = new Vector2(_cursorPosition.X, _cursorPosition.Y - 1); break; case Input.Down: if (_cursorPosition.Y + 1 > 15) return; if (!_managerPlayer.TileExplored((int)_cursorPosition.X, (int)_cursorPosition.Y + 1)) return; _cursorPosition = new Vector2(_cursorPosition.X, _cursorPosition.Y + 1); break; } }
public static void btnClick(object sender, MyEventArgs e) { Console.WriteLine(e.Message); Console.WriteLine(e.Sender); }
public void OnChange(MyEventArgs e) { EventHandler<MyEventArgs> temp = Interlocked.CompareExchange(ref myEvent, null, null); if (temp != null) temp(this, e); }
/// <summary> /// Quote Dispatcher /// </summary> /// <param name="e"></param> private void QuoteDispatcher(MyEventArgs<Tick> e) { // 1. strategies _feedstrategyquoteservice.FeedStrategies(e.Value); // 2. tick archive _tickarchiveservice.newTick(e.Value); // 3. Views _quoteviewupdateservice.UpdateViews(e.Value); }
void Foo_Changed(object sender, MyEventArgs args) // the Handler { string s = args.Info;
void eventMethod(MyEventArgs e) { e.Value = false; }
void center2_11_OnPageClicked(object sender, MyEventArgs e) { switch (e.Action) { case 11: { index--; //if (index < 0) // index = 0; if (index >= 0) { SRRC_ResourceEntity ent = lvic[index].Tag as SRRC_ResourceEntity; this.PicId = ent.Id; this.inPutBuffer(ent.Serverip + ent.Path, 0); this.center2_11.SetSelectedState(index); this.right1.SetBiaoJiStatusByString(this.PicId.ToString()); } else { index = 0; MessageBox.Show("已是第一张"); } } break; case 12: { index++; if (lvic.Count > index) { SRRC_ResourceEntity ent = lvic[index].Tag as SRRC_ResourceEntity; this.PicId = ent.Id; this.inPutBuffer(ent.Serverip + ent.Path, 0); this.center2_11.SetSelectedState(index); this.right1.SetBiaoJiStatusByString(this.PicId.ToString()); } else { index = lvic.Count - 1; MessageBox.Show("已是最后一张"); } } break; case 13: { this.inPutBuffer(strPic, -1); } break; case 14: { this.inPutBuffer(strPic, 0); } break; case 15: { this.inPutBuffer(strPic, 0); } break; case 16: //显示图片 { if (String.IsNullOrEmpty(e.Parameter.ToString()) == false) { //1:1显示 String[] arrls = e.Parameter.ToString().Split(new char[] { '|' }); index = SRLibFun.StringConvertToInt32(arrls[1]); PicId = SRLibFun.StringConvertToInt32(arrls[2]); inPutBuffer(arrls[0], 0); this.right1.SetBiaoJiStatusByString(this.PicId.ToString()); } } break; default: break; } }