public virtual void SendMessage(XEventArgs data) { data.OriginatorID = ID; var packet = new NetcodeMetadataPacket(data); SendRawData(packet.ConsolidateBytes()); }
public void OnCurrencyChanged(XEventArgs args) { if (myTower != null && upgradeButton != null) { upgradeButton.interactable = BattleField.instance.currency.CanAfford(myTower.GetCostForNextLevel()); } }
/// <summary> /// User UI click handler. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void UserUiClick(XEventArgs args) { // If clicked on UI instead game map if (myState == MyState.WaitForClick) { Destroy(gameObject); } }
private void OnCloseUpEnd(XEventArgs e) { XCameraActionEvent arg = new XCameraActionEvent(); arg.To_Rot_X = _pre_x; arg.To_Rot_Y = _pre_y; XEventMgr.singleton.FireEvent(arg); }
private void OnCameraAction(XEventArgs e) { XCameraActionEvent ev = e as XCameraActionEvent; _manual_x = _camera.Root_R_X; _manual_y = _camera.Root_R_Y; _tx = ev.To_Rot_X; _ty = ev.To_Rot_Y; _auto = false; }
private void SpawningEnemies(XEventArgs args) { foreach (int towerId in GameData.gameInfo.towersInfo) { TargetSpawnButton button = Instantiate(towerSpawnButton, transform); button.InitializeButton(towerId); button.buttonTapped += OnButtonTapped; button.draggedOff += OnButtonDraggedOff; } }
private void OnDetachHost(XEventArgs e) { for (EPartType part = EPartType.ECombinePartStart; part < EPartType.EMountEnd; ++part) { var p = parts[(int)part]; if (p != null) { p.Reset(); } } }
/// <summary> /// Action start handler. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void ActionStart(XEventArgs args) { GameObject obj = args.GetData <GameObject>(); if (obj == activeUserAction) { activeUserAction = null; highlightIcon.SetActive(false); StartCooldown(); } }
/// <summary> /// Actions cancel handler. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void ActionCancel(XEventArgs args) { GameObject obj = args.GetData <GameObject>(); if (obj == activeUserAction) { activeUserAction = null; highlightIcon.SetActive(false); myState = MyState.Active; } }
public void Buy(object sender, EventArgs e) { Phone phone = (Phone)sender; Console.WriteLine($"this is {phone.Name}"); XEventArgs xEventArgs = (XEventArgs)e; Console.WriteLine($"之前的价格{xEventArgs.OldPrice}"); Console.WriteLine($"现在的价格{xEventArgs.NewPrice}"); Console.WriteLine("买下来"); }
public void Popularize(object sender, EventArgs e) { Lesson lesson = (Lesson)sender; Console.WriteLine($"This is {lesson.Name} Lesson"); XEventArgs args = (XEventArgs)e; Console.WriteLine($"之前价格{args.OldPrice}"); Console.WriteLine($"现在价格{args.NewPrice}"); Console.WriteLine("广大用户请留意!!!"); }
private void OnGestureCancel(XEventArgs e) { if (XGesture.singleton.Working) { _manual_x = _camera.Root_R_X; _manual_y = _camera.Root_R_Y; int scale = 1 << 5; _ty = _manual_y + _tx * scale; _tx = _manual_x; _auto = false; } }
void OnWaveChanged(XEventArgs args) { int waveNumber = args.GetData <int>(0); int timeToNextWave = args.GetData <int>(1); int wavesCount = args.GetData <int>(2); currentWaveText.text = waveNumber.ToString(); currentWaveFinishTime = timeToNextWave; maxWaveNumberText.text = wavesCount.ToString(); isStartWave = true; StartCoroutine("HighlightTimer"); }
private void Captured(XEventArgs args) { if (beforeLooseCounter > 0) { beforeLooseCounter--; SetDefeatAttempts(beforeLooseCounter); if (beforeLooseCounter <= 0) { XEventBus.Instance.Post(EventId.GameResult, new XEventArgs(LevelState.Lose)); GoToDefeatMenu(); } } }
/// <summary> /// Enemy reached capture point. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void Captured(XEventArgs args) { if (beforeLooseCounter > 0) { beforeLooseCounter--; uiManager.SetDefeatAttempts(beforeLooseCounter); if (beforeLooseCounter <= 0) { ChangeLevelState(LevelState.Lose); uiManager.GoToDefeatMenu(); } } }
private void MapIcon_MouseTooltip(Object sender, XEventArgs <Boolean> e) { WorldMapIcon worldMapIcon = (WorldMapIcon)sender; if (e.Value) { TooltipManager.Instance.Show(this, LocaManager.GetText(worldMapIcon.Data.StaticData.NameKey), m_UserMapNoteController.GetUserMapNoteText(Input.mousePosition), worldMapIcon.transform.position, new Vector3(24f, 24f, 0f)); } else { TooltipManager.Instance.Hide(this); } }
/// <summary> /// Disable tower raycast and close building tree on game pause. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void GamePaused(XEventArgs args) { string param = args.GetData <string>(1); if (param == bool.TrueString) // Paused { CloseBuildingTree(); bodyCollider.enabled = false; } else // Unpaused { bodyCollider.enabled = true; } }
/// <summary> /// User click handler. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void UserClick(XEventArgs args) { GameObject obj = args.GetData <GameObject>(); HideUnitInfo(); if (obj != null) { // Cliced object has info for displaing UnitInfo unitInfo = obj.GetComponent <UnitInfo>(); if (unitInfo != null) { ShowUnitInfo(unitInfo); } } }
private void GameResult(XEventArgs args) { LevelState levelState = args.GetData <LevelState>(0); switch (levelState) { case LevelState.Win: GoToVictoryMenu(); break; case LevelState.Lose: GoToDefeatMenu(); break; } }
private void OnEndSkill(XEventArgs e) { XAIEndSkillEventArgs skillarg = e as XAIEndSkillEventArgs; if (skillarg.IsCaster) { _is_casting_skill = false; _cast_skillid = 0; _is_hurt_oppo = false; } else // 别人放技能 { _is_oppo_casting_skill = false; } }
private void OnCloseUp(XEventArgs e) { XDebug.Log(_camera.CameraTrans); XCameraCloseUpEvent ev = e as XCameraCloseUpEvent; XEntity target = ev.Target; _pre_x = _camera.Root_R_X; _pre_y = _camera.Root_R_Y; Vector3 base_v = XCommon.singleton.Horizontal(target.Position - XEntityMgr.singleton.Player.Position); Vector3 rot_v = XCommon.singleton.HorizontalRotateVetor3(base_v, -45); XCameraActionEvent arg = new XCameraActionEvent(); arg.To_Rot_X = _camera.Root_R_X; arg.To_Rot_Y = rot_v.y; XEventMgr.singleton.FireEvent(arg); }
/// <summary> /// User UI click handler. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void UserUiClick(XEventArgs args) { GameObject obj = args.GetData <GameObject>(); if (obj == gameObject) // Clicked on this icon { if (myState == MyState.Active) { highlightIcon.SetActive(true); activeUserAction = Instantiate(userActionPrefab); myState = MyState.Highligted; } } else if (myState == MyState.Highligted) // Clicked on other UI { highlightIcon.SetActive(false); myState = MyState.Active; } }
private void OnStartSkill(XEventArgs e) { XAIStartSkillEventArgs skillarg = e as XAIStartSkillEventArgs; if (skillarg.IsCaster)//自己放技能 { _is_hurt_oppo = false; _is_casting_skill = true; _cast_skillid = skillarg.SkillId; if (_tree != null) { _tree.SetVariable(AITreeArg.SkillID, (int)_cast_skillid); } } else // 别人放技能 { _is_oppo_casting_skill = true; } }
public void SendMessage(XEventArgs data) { if (IsServer) { if (ModSystem.ServerAdapter.ConnectedClients.Any()) { Manager.Debug($"Server sending packet {data.EventID}: {data.EventName}."); ModSystem.ServerAdapter.SendMessage(data); } } else { if (ModSystem.ClientAdapter.CurrentStatus == ConnectionStatus.Connected) { Manager.Debug($"Client sending packet {data.EventID}: {data.EventName}."); ModSystem.ClientAdapter.SendMessage(data); } } }
/// <summary> /// On user click. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void UserClick(XEventArgs args) { GameObject obj = args.GetData <GameObject>(); if (obj == gameObject) // This tower is clicked { // Show attack range ShowRange(true); // Open building tree if it is not OpenBuildingTree(); } else // Other click { // Hide attack range ShowRange(false); // Close active building tree CloseBuildingTree(); } }
public void HandleEvent(XEventArgs args, IXExecutionContextHandler context) { // Инициализируем подсистему безопасности SecurityProvider provider = new SecurityProvider(XFactory.Instance.StorageController["ROConnection"]); XSecurityManager.Instance.SecurityProvider = provider; // Инициализируем подсистему иерархий XTreeController.Initialize(context.Connection.MetadataManager); // Инициализируем подсистему application-триггеров // Примечание: обращение к классу вызовет срабатывание статического конструктора, в котором инициализируется подсистема object o = XTriggersController.Instance; // Инициализируем объект для хранения настроек приложения ApplicationSettingsInitializationParams initParam = new ApplicationSettingsInitializationParams(); // : Дата периода блокирования списаний object vValue = context.Connection.CreateCommand("SELECT Max(BlockDate) FROM TimeSpentBlockPeriod").ExecuteScalar(); if (vValue != null && vValue != DBNull.Value) { initParam.GlobalBlockPeriodDate = (DateTime)vValue; } ApplicationSettings.Initialize(initParam); // получаем имя конфига для проверки наличия объектов в БД string sFileName = context.Config.SelectNodeTextValue("dbc:dbcheck/dbc:config-file"); string sFullFileName = Path.Combine(context.Config.BaseConfigPath, sFileName); // проверяем наличие объектов в БД //DbCheckResult dbcResult = DbCheckFacade.Check(context.Connection, sFullFileName); //if (!dbcResult.Success) { // throw new ApplicationException(dbcResult.ErrorsText); } // запускаем планировщик заданий JobsSheduler.Run(); // запускаем команду рассылки //context.ExecCommandAsync(new XRequest("SendNotificationsAsync"),false); }
public NetcodeMetadataPacket(XEventArgs args) { if (args == null) { MetadataDefined = false; OriginatorID = 0; EventID = -1; EventNameLength = 0; EventName = ""; Payload = new byte[0]; } else { MetadataDefined = true; OriginatorID = args.OriginatorID; EventID = args.EventID; EventNameLength = (byte)Encoding.UTF8.GetByteCount(args.EventName); EventName = args.EventName; Payload = args.SerializeToBitstream(); } }
public bool FireEvent(XEventArgs args) { if (pool != null) { if (pool.ContainsKey(args.ArgsDefine)) { var objs = pool[args.ArgsDefine]; var e = objs.GetEnumerator(); while (e.MoveNext()) { e.Current.DispatchEvent(args); } if (!args.ManualRecycle) { args.Recycle(); } return(true); } } return(false); }
/// <summary> /// User click handler. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void UserClick(XEventArgs args) { GameObject obj = args.GetData <GameObject>(); if (myState == MyState.WaitForClick) { // If clicked not on tower if (obj == null || obj.CompareTag("Tower") == false) { // Create FX transform.position = (Vector2)Camera.main.ScreenToWorldPoint(Input.mousePosition); GameObject effect = Instantiate(effectPrefab, transform.position, Quaternion.identity); Destroy(effect, effectDuration); XEventBus.Instance.Post(EventId.ActionStart, new XEventArgs(gameObject)); // Start damege coroutine StartCoroutine(DamageCoroutine()); myState = MyState.WaitForFX; } else // Clicked on tower { Destroy(gameObject); } } }
public virtual bool DispatchEvent(XEventArgs e) { if (!Deprecated && _eventMap != null) { if (_eventMap.ContainsKey(e.ArgsDefine)) { var etor = _eventMap.GetEnumerator(); while (etor.MoveNext()) { EventHandler eh = etor.Current.Value; if (eh.eventDefine == e.ArgsDefine) { XEventHandler func = eh.handler; if (func != null) { func(e); } return(true); } } } } return(false); }
private void NameChanged(object Sender, XEventArgs e) { MessageBox.Show(" Name Changed"); }