private void MMessageBus_AvatarMovedEvent(object sender, MoveEvent e) { if (_terrainHandler == null) { return; } CurrentTileIndex = GetTileFromPoint(e.Position); Vector3d LonLat = GetLonLatOnShere(e.Position); //Console.WriteLine(AvatarDistanceToSurface); CurrentTile = _terrainHandler.GetTile((int)CurrentTileIndex.X, (int)CurrentTileIndex.Y, ZoomLevel); //If we're near enough to a planet to see the surface detail, show any nearby tiles if (AvatarDistanceToSurface < DistanceToPlanetThreshold) { int NumTiles = Settings.MaxTerrains; _terrainHandler.GetPOI((int)CurrentTileIndex.X, (int)CurrentTileIndex.Y, LonLat); for (int y = -NumTiles; y <= NumTiles; y++) { for (int x = -NumTiles; x <= NumTiles; x++) { _terrainHandler.UpdateTileMesh((int)CurrentTileIndex.X + x, (int)CurrentTileIndex.Y + y, (int)CurrentTileIndex.Z, LonLat); } } } }
public void UpdateMoveList(MoveEvent moveEvent) { //if (MoveListView) //{ // DisplayMoveList(moveEvent); //} }
/// <summary> /// When an entity moves around we'll remove it from its old node and add it to its new node (if applicable) /// </summary> /// <param name="moveEvent"></param> private void HandleEntityMove(MoveEvent moveEvent) { if (moveEvent.Sender.Deleted || moveEvent.NewPosition.GetGridId(EntityManager) == GridId.Invalid || !moveEvent.NewPosition.IsValid(EntityManager)) { HandleEntityRemove(moveEvent.Sender); return; } if (!_lastKnownNodes.TryGetValue(moveEvent.Sender, out var oldNodes)) { return; } // Memory leak protection var gridBounds = _mapManager.GetGrid(moveEvent.Sender.Transform.GridID).WorldBounds; if (!gridBounds.Contains(moveEvent.Sender.Transform.WorldPosition)) { HandleEntityRemove(moveEvent.Sender); return; } var bounds = GetEntityBox(moveEvent.Sender); var newNodes = GetOrCreateNodes(moveEvent.NewPosition, bounds); if (oldNodes.Count == newNodes.Count && oldNodes.SetEquals(newNodes)) { return; } var toRemove = oldNodes.Where(oldNode => !newNodes.Contains(oldNode)); var toAdd = newNodes.Where(newNode => !oldNodes.Contains(newNode)); foreach (var node in toRemove) { node.RemoveEntity(moveEvent.Sender); } foreach (var node in toAdd) { node.AddEntity(moveEvent.Sender); } var newIndices = new Dictionary <GridId, List <Vector2i> >(); foreach (var node in newNodes) { if (!newIndices.TryGetValue(node.ParentChunk.GridId, out var existing)) { existing = new List <Vector2i>(); newIndices[node.ParentChunk.GridId] = existing; } existing.Add(node.Indices); } _lastKnownNodes[moveEvent.Sender] = newNodes; EntityManager.EventBus.RaiseEvent(EventSource.Local, new TileLookupUpdateMessage(newIndices)); }
/// <summary> /// If pilot is moved then we'll stop them from piloting. /// </summary> private void HandlePilotMove(EntityUid uid, PilotComponent component, ref MoveEvent args) { if (component.Console == null) { return; } RemovePilot(component); }
void OnMoveToEvent(MoveEvent e) { MoveTo(e.position); // Inform the scene e.agent = this; Scene.Dispatch <MoveEvent>(e); }
private static void OnMoveCompletedBroadcast(MoveEvent move) { //Debug.Log("SharedDataHandler: OnMoveCompletedBroadcast called"); if (OnMoveCompleted != null) { OnMoveCompleted(move); } }
private void handleRunnigFromBattle(MoveEvent _Move, Dictionary <string, object> _data) { if (_data != null && _data.ContainsKey("runFromBattle") && _Move.getSender() != SC_MenuLogic.Instance.userId) { MessageState = GlobalEnums.MessageBoxState.EnemyRanAway; ManageMessageBox(); } }
protected void SendFilteredPosition(Entity entity) { EventMessage.CounterEventReceive.Increment(); var moveEvent = new MoveEvent(entity.Name, entity.Position); IEventData eventData = new EventData((byte)EventCode.FilteredPosition, moveEvent); m_AttachedEntity.SendEvent(eventData, PositionSendParameters); }
private void Box_Click(object sender, RoutedEventArgs e, Box box, Grid gridPlay) { MoveEvent.Click(box); if (Checker.IsTrue(this, rows, cols)) { SetGrid.SetDefault(gridPlay); SetGrid.SetImage(gridPlay, image); } }
/// <summary> /// Called every time the guardian moves: makes sure it's not out of it's allowed distance /// </summary> private void OnGuardianMove(EntityUid uid, GuardianComponent component, ref MoveEvent args) { if (!component.GuardianLoose) { return; } CheckGuardianMove(component.Host, uid, guardianComponent: component); }
private void TryTriggerEvent(MoveEvent moveEvent) { int num = GetPlayedNum(moveEvent); if (moveEvent.playOnce == false || num == 0) { TriggerEvent(moveEvent); } }
private void MMessageBus_TeleportCompleteHandler(object sender, MoveEvent e) { //throw new NotImplementedException(); if (Globals.Avatar.Target != null) { MGravityCalculator.CalculateGravityAtAvatar(); Globals.Avatar.SetRotation(Globals.LocalUpRotation()); } }
private void UpdateEvent(DateTime _start) { Event item = DragDropHelper.Item.Event; TimeSpan duration = item.End - item.Start; item.Start = _start; item.End = _start.Add(duration); MoveEvent?.Invoke(item); }
void Start() { if (_event == null) { _event = new MoveEvent(); } body = GetComponent <Rigidbody2D>(); controllers = GetComponents <MoveController>(); }
void HandleCommand(MoveCommand moveCommand) { MoveEvent moveEvent = MoveEventsManager.GetMoveEvent(moveCommand.type); if (moveEvent == null) { return; } moveEvent.Exec(moveCommand.value); }
private void WindowEventCallback(IntPtr hWinEventHook, SWEH_Events eventType, IntPtr hWnd, SWEH_ObjectId idObject, long idChild, uint dwEventThread, uint dwmsEventTime) { if (hWnd == windowHandle) { if (eventType == SWEH_Events.EVENT_OBJECT_LOCATIONCHANGE && idObject == (SWEH_ObjectId)SWEH_CHILDID_SELF) { MoveEvent?.Invoke(this, new MoveEventArgs()); } } }
private void OnPullerMove(EntityUid uid, SharedPullerComponent component, ref MoveEvent args) { if (component.Pulling == null || !TryComp <SharedPullableComponent>(component.Pulling.Value, out var pullable)) { return; } _pullableSystem.StopMoveTo(pullable); }
/// <summary> /// This method receives a move and changing turns between clients respectively. /// If a client didn't make any move in 30 seconds then end game and set the other client as the winner. /// If a move is made and the game is not initialize yet, then initialize the game. /// If a move is made and the game already initialized, then simulate a shot for the desirable client. /// </summary> /// <param name="_Move"></param> public void OnMoveCompleted(MoveEvent _Move) { //Debug.Log("OnMoveCompleted " + _Move.getMoveData() + " | " + _Move.getNextTurn()); if (_Move.getNextTurn() == DefinedVariables.userName) { IsPlayerTurn = true; } else { IsPlayerTurn = false; } if (_Move.getMoveData() != null) { if (_Move.getSender() != DefinedVariables.userName && IsGameOver == false) { _receivedPlayData = MiniJSON.Json.Deserialize(_Move.getMoveData()) as Dictionary <string, object>; if (_receivedPlayData != null) { if (IsMultiplayerInitiated == false) { SendGameInitializationData(); if (_receivedPlayData.ContainsKey("i1") && _receivedPlayData.ContainsKey("i2") && _receivedPlayData.ContainsKey("i3")) { MultiplayerInit(int.Parse(_receivedPlayData["i1"].ToString()), int.Parse(_receivedPlayData["i2"].ToString()), _receivedPlayData["i3"].ToString()); } IsMultiplayerInitiated = true; } else { if (_receivedPlayData.ContainsKey("v1") && _receivedPlayData.ContainsKey("v2") && _receivedPlayData.ContainsKey("v3")) { SimulateOpponentMove(int.Parse(_receivedPlayData["v1"].ToString()), StringToVector3(_receivedPlayData["v2"].ToString()), int.Parse(_receivedPlayData["v3"].ToString())); IsPuckMoving = true; } } } } } else { if (_Move.getNextTurn() == DefinedVariables.userName) { uiObject["Text_WinnerName"].GetComponent <Text>().text = DefinedVariables.userName; } else { uiObject["Text_WinnerName"].GetComponent <Text>().text = uiObject["Text_Computer"].GetComponent <Text>().text; } EndGame(); } }
public void MoveCall(float _x, float _y) { x = _x; y = _y; MoveEvent moveEventInfo = new MoveEvent(); moveEventInfo.eventName = "Move Event"; moveEventInfo.baseGO = transform.gameObject; moveEventInfo.FireEvent(); }
public void onMoveCompleted(MoveEvent move) { Log(move.getMoveData()); /*string Move = move.getMoveData (); * int i = int.Parse (Move [0].ToString()); * int j = int.Parse (Move [1].ToString()); * int k = int.Parse (Move [2].ToString()); * Log (i + " " + j + " " + k); */ }
public MoveEvent Move(float x, float y) { MoveEvent e = new MoveEvent { X = x, Y = y }; _moveQueue.Enqueue(e); return(e); }
private void InvokeMoveEvent(MoveDirection move) { if (MoveEvent != null) { MoveEvent.Invoke(new BoardEvent { BoardEventType = BoardEventType.PlayerMoved, Move = move }); } }
void Update() { foreach (var key in _inputs.Keys) { if (Input.GetKeyDown(key)) { MoveEvent?.Invoke(this, new InfoEventArgs <Direction>(_inputs[key])); break; } } }
private void Network_TeleportHandler(object sender, MoveEvent e) { if (e.InstanceID == null) { return; } if (e.InstanceID.Equals(Globals.UserAccount.UserID)) { Reset(); } }
public void onMoveCompleted(MoveEvent move) { if (appwarp.isTexassGame) { texassGameManager.highLightTurnPlayer(move.getNextTurn()); } else { waGameManager.highLightTurnPlayer(move.getNextTurn()); } }
/// <summary> /// Called every time the host moves, to make sure the distance between the host and the guardian isn't too far /// </summary> private void OnHostMove(EntityUid uid, GuardianHostComponent component, ref MoveEvent args) { if (component.HostedGuardian == null || !TryComp(component.HostedGuardian, out GuardianComponent? guardianComponent) || !guardianComponent.GuardianLoose) { return; } CheckGuardianMove(uid, component.HostedGuardian.Value, component); }
private void switchTurns(MoveEvent _Move) { if (_Move.getNextTurn() == SC_MenuLogic.Instance.userId) { currentTurn = GlobalEnums.Turns.PlayersTurn; } else { currentTurn = GlobalEnums.Turns.FoesTurn; } }
private void BackForm_Load(object sender, EventArgs e) { CategoryInfo info = new CategoryInfo(); info.CategoryId = 1; info.CategoryName = "Restriction Operators"; info.ExampleCount = 3; //TypingTestForm form = new TypingTestForm(TestMode.Single, info); MoveEvent.MoveToForm(new StartForm()); }
private void Network_TeleportHandler(object sender, MoveEvent e) { MSceneObject mo = (MSceneObject)MScene.ModelRoot.FindModuleByInstanceID(e.InstanceID); if (mo != null) { mo.SetPosition(e.Position); mo.SetRotation(e.Rotation); } //throw new NotImplementedException(); MMessageBus.TeleportComplete(this, e.InstanceID, e.Position, e.Rotation); }
private bool ValidateMove(MoveEvent moveEvent) { try { GetCurrentGameState().AvailableMoves.First(x => x.XIndex == (int)moveEvent.MyMove.Column); return(true); } catch { return(false); } }
public void onMoveCompleted(MoveEvent moveEvent) { if (moveEvent.getRoomId().Equals(GlobalContext.GameRoomId)) { if(moveEvent.getMoveData()!=null) MoveMessage.buildMessage(System.Text.Encoding.UTF8.GetBytes(moveEvent.getMoveData())); if (moveEvent.getNextTurn().ToString().Equals(GlobalContext.localUsername)) { GlobalContext.IsMyTurn = true; if (RemoteUserPaused != null) Deployment.Current.Dispatcher.BeginInvoke(new UICallback(ChangeTurnCallback)); } else { GlobalContext.IsMyTurn = false; if (RemoteUserPaused != null) Deployment.Current.Dispatcher.BeginInvoke(new UICallback(ChangeTurnCallback)); } } }
public void onMoveCompleted(MoveEvent moveEvent){}
public void onGetMoveHistoryDone(byte result, MoveEvent[] moves) { }
public void OnMoveCompleted(MoveEvent move) { Debug.Log("move recieved from " + move.getSender()); Debug.Log("OnMoveCompleted next turn is of player" + " " + move.getNextTurn()); if (move.getSender() != userName) { Debug.Log("received move " + move.getMoveData().ToString()); ParseEnemyMove(move.getMoveData()); } }
public void onMoveCompleted(MoveEvent move) { notifications+="onMoveCompleted username" + move.getSender()+ " move "+move.getMoveData()+"\n"; Debug.Log ("onMoveCompleted by : " + move.getSender()); }
public void onMoveCompleted(MoveEvent moveEvent) { throw new NotImplementedException(); }
static NetControl() { MoveNotify = null; }
void OnMoveEvent( MoveEvent e) { }
//CALLED WHEN SEND MOVE WAS SENT public void OnMoveCompleted(MoveEvent move) { Debug.Log ("OnMoveComplete : " + move.getMoveData ()); //not my turn if (move.getNextTurn () == userName) { Dictionary<string,object> _recData = Json.Deserialize (move.getMoveData ()) as Dictionary<string,object>; float _xPos = float.Parse (_recData ["x position"].ToString ()); float _zPos = float.Parse (_recData ["z position"].ToString ()); float _fPos = float.Parse (_recData ["final position"].ToString ()); float _fforce = float.Parse (_recData ["init force"].ToString ()); int _totalMoveCount = int.Parse (_recData ["totalMoveCount"].ToString ()); OpponentLogic (_xPos, _zPos,_fPos,_fforce,_totalMoveCount); Defined_Vars.isMyTurn = true; } }
///Invoked when a response for a getMoveHistory request is received. public void onGetMoveHistoryDone(byte result, MoveEvent[] history) { if (OnGetMoveHistoryDone != null) OnGetMoveHistoryDone(result, history); }
//other players in the room get the last move public void onMoveCompleted(MoveEvent move) { if (OnMoveCompleted != null) OnMoveCompleted(move); }
public void onMoveCompleted(MoveEvent move) { Log ("onMoveCompleted by : " + move.getSender()); Debug.Log ("OnMoveCompleted"+move.getMoveData()); if(move.getMoveData()!=null) m_apppwarp.moveCompleted (move.getSender (), move.getMoveData (), move.getNextTurn ()); }
public void onMoveCompleted(MoveEvent move) { Log ("onMoveCompleted by : " + move.getSender()); }
public void onMoveCompleted(MoveEvent moveEvent) { //throw new System.NotImplementedException (); }
public void OnMoveCompleted(MoveEvent move) { Debug.Log("OnMoveCompleted" + " " + move.getNextTurn() + " " + move.getMoveData()); if (move.getNextTurn () == userName) isMyTurn = true; else isMyTurn = false; }
public void OnMoveCompleted(MoveEvent move) { Debug.Log("Data: " + move.getMoveData()); Debug.Log("OnMoveCompleted" + ", Next turn: " + move.getNextTurn() + ", Data: " + move.getMoveData() + " current Time: " + Time.time); if (move.getNextTurn() == userName) { Dictionary<string, object> _recData = Json.Deserialize(move.getMoveData()) as Dictionary<string, object>; OpponentLogic(_recData); isMyTurn = true; } else { isMyTurn = false; } }