public static List <long> GetPlayerEventsNotByPlayer(PlayerEvent searchPlayerEvents) { string query = "select id from Events where id not IN (select eventId from PlayerEvents where playerId = @PlayerId);"; IEnumerable <long> result = DBConnection.Instance.Connection.Query <long>(query, searchPlayerEvents); return(result.ToList()); }
public void ExecuteChoice(string choiceKey) { var fullChoiceKey = "BranchResult-" + choiceKey; var res = branch.results[fullChoiceKey]; foreach (string evTxt in res.events) { sim.AddEvent(PlayerEvent.Story(evTxt)); } // TODO: Parse loot key if (res.thenToEventGroup) { var eventGroupKey = tpd.RemoveSubString(res.thenTo, Constants.eventGroupLabel); CreateEvents(eventGroupKey); } if (res.thenToPromptPull) { sim.RequireInput(); } if (res.thenToEndInteraction) { sim.RemoveInteraction(); sim.RequireInput(); } }
public static PlayerEvent GetPlayerEvent(PlayerEvent playerEvent) { string query = "select * from PlayerEvents where eventId = @EventId and playerId = @PlayerId;"; IEnumerable <PlayerEvent> result = DBConnection.Instance.Connection.Query <PlayerEvent>(query, playerEvent); return(result.FirstOrDefault()); }
void BasicAttack() { // Calc damage HitType hitType = HitType.Hit; var damage = AddVariance(player.dps); if (tpd.RollPercent(ChanceToMiss())) { hitType = HitType.Miss; damage = 0f; } else if (tpd.RollPercent(ChanceToGlance())) { hitType = HitType.Glance; damage *= 0.5f; } else if (tpd.RollPercent(ChanceToCrit())) { hitType = HitType.Crit; damage *= 2f; } // TODO: Adjust value up and down for def //mob.ChangeStat(Stat.hp, -damage); var ev = new PlayerEvent(); ev.type = PlayerEvent.Type.PlayerBasicAttack; ev.data[PlayerEvent.mobKey] = mob; ev.data[PlayerEvent.damageKey] = damage; ev.data[PlayerEvent.hitTypeKey] = hitType; sim.AddEvent(ev); }
public static void Log(PlayerEvent label, bool midlevel, Dictionary <string, string> customAttributes = null, Dictionary <string, double> customMetrics = null) { if (!track) { return; } if (label == PlayerEvent.Error && customAttributes != null) { customAttributes["attribute_1"] = Encoding.UTF8.GetString(Encoding.Default.GetBytes(customAttributes["attribute_1"])); customAttributes["attribute_2"] = Encoding.UTF8.GetString(Encoding.Default.GetBytes(customAttributes["attribute_2"])); } if (customAttributes != null) { if (customAttributes.ContainsKey("attribute_2") && customAttributes["attribute_2"].Length > 255) { customAttributes["attribute_2"] = customAttributes["attribute_2"].Substring(0, 254); } if (customAttributes.ContainsKey("attribute_1") && customAttributes["attribute_1"].Length > 255) { customAttributes["attribute_1"] = customAttributes["attribute_1"].Substring(0, 254); } } customAttributes = (customAttributes == null) ? new Dictionary <string, string>() : customAttributes; customMetrics = (customMetrics == null) ? new Dictionary <string, double>() : customMetrics; Central.Instance.myAWSManager.logEvent(label, midlevel, customAttributes, customMetrics); }
public override void run() { try { Account player = this._client._player; if (player == null) { return; } PlayerEvent playerEvent = player._event; GoodItem good = ShopManager.getGood(this.goodId); if (good == null || playerEvent == null) { return; } PlayTimeModel runningEvent = EventPlayTimeSyncer.getRunningEvent(); if (runningEvent == null) { return; } uint rewardCount = (uint)runningEvent.GetRewardCount(this.goodId); if (playerEvent.LastPlaytimeFinish != 1 || rewardCount <= 0U || !ComDiv.updateDB("player_events", "last_playtime_finish", (object)2, "player_id", (object)this._client.player_id)) { return; } playerEvent.LastPlaytimeFinish = 2; this._client.SendPacket((SendPacket) new INVENTORY_ITEM_CREATE_PAK(1, player, new ItemsModel(good._item._id, good._item._category, "Playtime reward", good._item._equip, rewardCount, 0L))); } catch (Exception ex) { Logger.info("EVENT_PLAYTIME_REWARD_REC] " + ex.ToString()); } }
private static void OnPlayerEvent(Player player, PlayerEvent playerEvent) { if (playerEvent.eventType == PLAYER_EVENT_TYPE.DZ_PLAYER_EVENT_RENDER_TRACK_UNDERFLOW) { player.Next(); } }
/// <summary> /// Adds the external player. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> private void AddExternalPlayer(object sender, PlayerEvent e) { var player = this._playerBank.GetExternalPlayer(e.PlayerName); if (player == null) { this._playerBank.ExternalPlayers.Add(new Player() { Name = e.PlayerName, Levels = new List <int> { 0 } }); this.Save(); } var knownPlayer = this._playerBank.GetKnownPlayer(e.PlayerName); if (knownPlayer != null) { this.RemovePlayer(knownPlayer); if (this.FirstPlayer != null) { this.PlayerChanged?.Invoke(this, this.FirstPlayer); } this.Save(); } }
public Player() : base() { ID = "player"; PlayerEventCallback = null; _lastEvent = PlayerEvent.None; RenderLayer = Render_Layer; RenderDepth = Render_Depth; _mapBounds = Rectangle.Empty; CollisionBoundingCircle = new Circle(Vector2.Zero, Body_Collision_Radius); Collidable = true; Visible = true; _motionEngine = new PlayerMotionEngine(); MotionEngine = _motionEngine; _isSmashingSmashBlocks = false; _hasTouchedGoalFlag = false; IsExitingLevel = false; LastRaceRestartPointTouched = null; TutorialStepTrigger = null; ResetCollisionFlags(); }
private void OnPlayerChat(PlayerEvent e) { if (e is PlayerChatEvent) { var chat = (PlayerChatEvent)e; if (chat is PlayerWhisperEvent) { return; } if (chat is GuildMessageEvent) { return; } if (chat is PlayerLocalChatEvent) { return; } if (CheckPlayerOoc(e.Player)) { string message = chat.Player.ChatFormat.Replace("%name%", chat.Player.DisplayName).Replace("%message%", chat.Message); PrintToChat(chatPrefix + message); chat.Cancel(); } } }
//private void OnPlayerRespawn(PlayerRespawnEvent e) //{ // if (LogEvents == false) return; // string entityPosition = e.Player.Entity.Position.x + "," + e.Player.Entity.Position.y + "," + e.Player.Entity.Position.x; // string str = ""; // str += e.Player.DisplayName + " has respawned at [" + entityPosition + "]."; // Log("Events", str); //} private void OnPlayerChat(PlayerEvent e) { if (LogChat == false) { return; } string str = ""; if (e is GuildMessageEvent) { var chat = (GuildMessageEvent)e; str += "[" + chat.GuildName + "] " + chat.PlayerName + ": " + chat.Message; Log("Chat.Guild", str); } else if (e is PlayerChatEvent) { var chat = (PlayerChatEvent)e; str += chat.PlayerName + ": " + chat.Message; Log("Chat.Global", str); } }
public void CreatePlayerEvent(Player player) { PlayerEvent playerEvent = null; if (!player.EventsPraticipating.ContainsKey(Id)) { if (EventType == EventTypes.SCOREMAGEDDON) { playerEvent = new ScoreMageddon(player, Id); } else if (EventType == EventTypes.SPACEBALL) { playerEvent = new Spaceball(player, Id); } else if (EventType == EventTypes.BINARY_BOT) { playerEvent = new BinaryBotEvent(player, Id); } if (playerEvent != null) { player.EventsPraticipating.TryAdd(Id, playerEvent); } } else { playerEvent = player.EventsPraticipating[Id]; } playerEvent.Start(); }
/// <summary> /// Remove Player by Name /// </summary> /// <param name="Name">Player Name</param> /// <param name="Reason">Reason</param> public void Remove(string Name, string Reason) { Player Player = GetPlayer(Name); Player.Network.IsActive = false; if (Player.isGameJoltPlayer) { Core.Player.SendToAllPlayer(new Package(Package.PackageTypes.ChatMessage, Core.Setting.Token("SERVER_GAMEJOLT", Player.Name, Player.GameJoltID.ToString(), "left the server."), null)); Core.Logger.Log(Core.Setting.Token("SERVER_GAMEJOLT", Player.Name, Player.GameJoltID.ToString(), "left the server with the following reason: " + Reason), Logger.LogTypes.Info); OnlineSetting OnlineSetting = (from OnlineSetting p in Core.Setting.OnlineSettingListData where p.GameJoltID == Player.GameJoltID select p).FirstOrDefault(); OnlineSetting.Save(); Core.Setting.OnlineSettingListData.Remove(OnlineSetting); } else { Core.Player.SendToAllPlayer(new Package(Package.PackageTypes.ChatMessage, Core.Setting.Token("SERVER_NOGAMEJOLT", Player.Name, "left the server."), null)); Core.Logger.Log(Core.Setting.Token("SERVER_NOGAMEJOLT", Player.Name, "left the server with the following reason: " + Reason), Logger.LogTypes.Info); } Core.Player.SendToAllPlayer(new Package(Package.PackageTypes.DestroyPlayer, Player.ID.ToString(), null)); if (Reason != Core.Setting.Token("SERVER_PLAYERLEFT")) { Core.Player.SentToPlayer(new Package(Package.PackageTypes.Kicked, Reason, Player.Network.Client)); } Core.RCONPlayer.SendToAllPlayer(new RCON_Client_Listener.Packages.Package(RCON_Client_Listener.Packages.Package.PackageTypes.RemovePlayer, $"{Player.ID},{Player.ToString()}", null)); Player.Network.ThreadPool3.WaitForIdle(); PlayerEvent.Invoke(PlayerEvent.Types.Remove, $"{Player.ID},{Player.ToString()}"); Core.Player.Remove(Player); }
private void LoadEventForFilterByEvent(String eventNumber) { String searchEventNumber = eventNumber; Event sEventByNumber = DataBase.GetEventByNumber(searchEventNumber); if (sEventByNumber != null) { PlayerEvent searchMe = new PlayerEvent(sEventByNumber.Id, 0); List <PlayerEvent> playerEventsByEvent = DataBase.GetPlayerEventsByEvent(searchMe); List <Player> players = DataBase.GetPlayersForPlayerEvents(playerEventsByEvent); if (players.Count > 0) { bindingSourceFilteredPlayersOnEvent.DataSource = players; bindingSourceFilteredPlayersOnEvent.ResetBindings(false); } else { bindingSourceFilteredPlayersOnEvent.DataSource = null; bindingSourceFilteredPlayersOnEvent.ResetBindings(false); } labelCurrentEventFBE.Text = sEventByNumber.FullName; } else { statusViewer.Update("Event \"" + searchEventNumber + "\" not found", Status.INFO); } }
public ServerEvent Process(PlayerEvent e) { if (!(e is LeaveFactionEvent typedEvent)) { _logger.LogError("LeaveFactionEventProcessor received an event of wrong type: " + e.GetType()); return(new ErrorEvent("Internal error.", e.SourceId)); } PlayerState player; try { player = _game.GetPlayerStateById(typedEvent.PlayerId); } catch (PlayerNotFoundException exception) { return(new ErrorEvent(exception.Message, e.SourceId)); } if (!player.Factions.Contains(typedEvent.FactionId)) { return(new ErrorEvent(string.Format(Constants.Messages.NotInThisFactionTemplate, typedEvent.FactionId), typedEvent.PlayerId)); } player.Factions.Remove(typedEvent.FactionId); _game.UpdatePlayerState(player); return(new PlayerLeftFactionEvent(player, typedEvent.FactionId)); }
/// <summary> /// Cancel a player event /// </summary> /// <param name="e">The event that you want to cancel</param> /// <param name="p">The Player that event is related to</param> public static void CancelPlayerEvent(PlayerEvent e, Player p) { //TODO //Add some more events to be canceled switch (e) { case PlayerEvent.BlockChange: p.cancelBlock = true; break; case PlayerEvent.PlayerChat: p.cancelchat = true; break; case PlayerEvent.PlayerCommand: p.cancelcommand = true; break; case PlayerEvent.PlayerMove: p.cancelmove = true; break; case PlayerEvent.MYSQLSave: p.cancelmysql = true; break; case PlayerEvent.PlayerRankChange: Group.cancelrank = true; break; case PlayerEvent.MessageRecieve: p.cancelmessage = true; break; } }
void OnPlayerChat(PlayerEvent e) { List <string> ForbiddenWordsList = Config["ForbiddenWords"] as List <string>; Player player = e.Player; string message = e.ToString(); string censored = ""; bool isCensored = false; if (message.StartsWith("/")) { return; } foreach (string word in ForbiddenWordsList) { censored = ""; for (int i = 0; i < word.Length; i++) { censored = censored + "*"; } if (message.ToLower().Contains(word.ToLower())) { message = message.ToLower().Replace(word.ToLower(), censored); isCensored = true; } } if (isCensored) { BroadcastChat(player.DisplayName, message); e.Cancel(); } }
private void ExecuteEvent(PlayerEvent playerEvent) { switch (playerEvent.GetType().Name) { case "PlayerMovementEvent": ExecuteEvent(playerEvent as PlayerMovementEvent); break; case "PlayerDroppedItemEvent": ExecuteEvent(playerEvent as PlayerDroppedItemEvent); break; case "PlayerDashStartedEvent": ExecuteEvent(playerEvent as PlayerDashStartedEvent); break; case "PlayerDashStoppedEvent": ExecuteEvent(playerEvent as PlayerDashStoppedEvent); break; case "PlayerQuitEvent": ExecuteEvent(playerEvent as PlayerQuitEvent); break; } }
private void Process(PlayerEvent pEvent) { switch (pEvent.type) { case PlayerEvent.Type.Hit: Debug.Log("player " + _otherPlayer.id + " hitted " + pEvent.player); OtherPlayersStatesProvider.Instance.DamagePlayer(pEvent.player); break; case PlayerEvent.Type.Shoot: Debug.Log("player " + _otherPlayer.id + " shoted and missed"); break; case PlayerEvent.Type.ThrowGranade: Debug.Log("player " + _otherPlayer.id + "Threw a grenade"); GrenadeStatesProvider.Instance.GenerateGrenade(_otherPlayer.id, pEvent.direction); break; case PlayerEvent.Type.Connect: Debug.Log("Request to connect from " + _otherPlayer.id); PlayerEventChannel.SendEvent(PlayerEvent.Connected()); break; case PlayerEvent.Type.Respawn: Debug.Log("Request to respawn player " + _otherPlayer.id); ServerGameManager.Instance.RespawnPlayer(_otherPlayer.id); break; } }
void Awake() { if (_eventCanRecieve == null) { _eventCanRecieve = new PlayerEvent(); } }
public static PlayerEvent Info(string text) { PlayerEvent ev = new PlayerEvent(text); ev.type = Type.Info; return(ev); }
void RevealTile(PlayerEvent ev) { Tile tile = (Tile)ev.data[PlayerEvent.tileKey]; tile.tileObj.transform.Find("Fog").gameObject.SetActive(false); NextEvent(); }
void OnPlayerChat(PlayerEvent e) { Player player = e.Player; string colortag = Convert.ToString(Config["GuildTagColor"]); player.DisplayNameFormat = "(" + colortag + player.GetGuild().Name + "[FFFFFF]" + ") %name%"; }
public static PlayerEvent Story(string text) { PlayerEvent ev = new PlayerEvent(text); ev.type = Type.Story; return(ev); }
public PlayerMessage(PlayerEvent @event, int id, string name, AtBatRecord atBatRecord) { Event = @event; Id = id; Name = name; AtBatRecord = atBatRecord; }
GameObject InstantiatePrefab(GameObject prefab, PlayerEvent playerEvent) { var eventObj = (GameObject)Instantiate(prefab); eventObj.GetComponent <EventView>().playerEvent = playerEvent; return(eventObj); }
void BasicAttack() { // Calc damage HitType hitType = HitType.Hit; var damage = AddVariance(player.dps); if (tpd.RollPercent(ChanceToMiss())) { hitType = HitType.Miss; damage = 0f; } else if (tpd.RollPercent(ChanceToGlance ())) { hitType = HitType.Glance; damage *= 0.5f; } else if (tpd.RollPercent(ChanceToCrit())) { hitType = HitType.Crit; damage *= 2f; } // TODO: Adjust value up and down for def //mob.ChangeStat(Stat.hp, -damage); var ev = new PlayerEvent(); ev.type = PlayerEvent.Type.PlayerBasicAttack; ev.data[PlayerEvent.mobKey] = mob; ev.data[PlayerEvent.damageKey] = damage; ev.data[PlayerEvent.hitTypeKey] = hitType; sim.AddEvent(ev); }
protected async void GameReset(object sender, PlayerEvent e) { players.ForEach(p => p.Vote = null); voteComplete = false; StateHasChanged(); if (!observing) { var options = new ModalOptions() { HideCloseButton = true, DisableBackgroundCancel = true }; var voteModal = Modal.Show <VotingModal>("Cast your vote!", options); var modalResult = await voteModal.Result; await ScrumPokerHub.VoteAsync((string)modalResult.Data); } else { await ScrumPokerHub.VoteAsync("🕵"); } StateHasChanged(); }
public static List <PlayerEvent> GetPlayerEventsByEvent(PlayerEvent searchedPlayerEvent) { string query = "select * from PlayerEvents where eventId = @EventId;"; IEnumerable <PlayerEvent> result = DBConnection.Instance.Connection.Query <PlayerEvent>(query, searchedPlayerEvent); return(result.ToList()); }
private void WriteVisitEvent(EventVisitModel ev) { PlayerEvent playerEvent = this.c._event; if (ev != null && (playerEvent.LastVisitSequence1 < ev.checks && playerEvent.NextVisitDate <= int.Parse(DateTime.Now.ToString("yyMMdd")) || playerEvent.LastVisitSequence2 < ev.checks && playerEvent.LastVisitSequence2 != playerEvent.LastVisitSequence1)) { this.writeD(ev.id); this.writeC((byte)playerEvent.LastVisitSequence1); this.writeC((byte)playerEvent.LastVisitSequence2); this.writeH((short)0); this.writeD(ev.startDate); this.writeS(ev.title, 60); this.writeC((byte)2); this.writeC((byte)ev.checks); this.writeH((short)0); this.writeD(ev.id); this.writeD(ev.startDate); this.writeD(ev.endDate); for (int index = 0; index < 7; ++index) { VisitBox visitBox = ev.box[index]; this.writeD(visitBox.RewardCount); this.writeD(visitBox.reward1.good_id); this.writeD(visitBox.reward2.good_id); } } else { this.writeB(new byte[172]); } }
private static void VerifyEventMask(PlayerEvent eventMask) { if (eventMask <= PlayerEvent.None || eventMask > event_all_mask) { throw new ArgumentOutOfRangeException("eventMask", "A valid event mask must be provided"); } }
public async Task LeaveGame(PlayerEvent playerLeft) { var currentGame = _gameTracker.Games.FirstOrDefault(g => g.Id == playerLeft.GameId); if (currentGame != null) { var targetPlayer = currentGame.Players.FirstOrDefault(p => p.Id == playerLeft.UserId); if (targetPlayer == null) { return; } currentGame.Players.Remove(targetPlayer); if (currentGame.OwnerId == playerLeft.UserId) { await Clients.Group(playerLeft.GameId).SendAsync(SignalRConstants.GameEnded, playerLeft); _gameTracker.Games.Remove(currentGame); } else { await Clients.Group(playerLeft.GameId).SendAsync(SignalRConstants.RemovePlayer, playerLeft); } } await Groups.RemoveFromGroupAsync(Context.ConnectionId, playerLeft.GameId); }
private void ReactToEvent(PlayerEvent playerEvent) { switch (playerState) { case PlayerState.OnGround: switch (playerEvent) { case PlayerEvent.Jumped: movementVector.Y = 0; movementVector -= jumpStrength; playerState = PlayerState.InAir; break; } break; case PlayerState.InAir: switch (playerEvent) { case PlayerEvent.Jumped: remainingJumps--; movementVector.Y = 0; movementVector -= jumpStrength; break; case PlayerEvent.CollidedWithGround: remainingJumps = 1; playerState = PlayerState.OnGround; break; } break; } }
public void TriggerEvent(PlayerEvent ev) { foreach (Trigger trigger in ev.Triggers) { var triggerProcessor = new TriggerProcessor(sim, trigger); triggerProcessor.Process(); ev.hasTriggered = true; ev.Update(); } }
public void TriggerChoice(PlayerEvent ev, string choiceKey) { Debug.Log ("Trigger choice " + choiceKey + " for event " + ev.Content); var interactionProcessor = new InteractionProcessor(sim); interactionProcessor.StoreChoice(choiceKey); NotificationCenter.PostNotification(Constants.OnUpdateEvents); }
public void AddEvent(PlayerEvent ev) { currentEventId = ev.Id; newEvents.Add(ev); if (ev.requiresInput) { RequireInput(); } EventStore.Save(ev); }
void RenderMoveEvent(PlayerEvent ev) { Vector3 delta = (Vector3)ev.data[PlayerEvent.movementDeltaKey]; string mover = (string)ev.data[PlayerEvent.moverKey]; if (mover == Constants.playerContentKey) { MovePlayer(delta); } else if (mover == Constants.mobContentKey) { string mobId = (string)ev.data[PlayerEvent.moverIdKey]; MoveMob(mobId, delta); } }
public void HandleAction(PlayerEvent _ev, string _actionKey) { ev = _ev; actionKey = _actionKey; if (actionKey == Constants.c_Pickup) { ev.chosenKey = Constants.c_Pickup; PickUp(ev); } else if (actionKey == Constants.c_Equip) { ev.chosenKey = Constants.c_Equip; Equip(ev); } }
public void Equip(PlayerEvent ev) { /* Debug.Log ("Loot processor is equipping " + eq.Name); SlotType slotType = eq.SlotType; Slot playerSlot = sim.player.Slots[slotType.Key]; var prevEquipment = playerSlot.Equipment; playerSlot.Equipment = eq; SubtractPrevEquipment(prevEquipment); AddNewEquipment(eq); NotificationCenter.PostNotification(Constants.OnUpdateStats); */ }
public void TriggerAction(PlayerEvent ev, string actionName) { Debug.Log ("Trigger action " + actionName + " for event " + ev.Content); if (ev.type == PlayerEvent.Type.Equipment) { var equipmentActionProcessor = new EquipmentActionProcessor(sim); equipmentActionProcessor.HandleAction(ev, actionName); } if (ev.type == PlayerEvent.Type.Consumable) { var consumableActionProcessor = new ConsumableActionProcessor(sim); consumableActionProcessor.HandleAction(ev, actionName); } NotificationCenter.PostNotification(Constants.OnUpdateEvents); }
void BasicAttack() { // Calc damage // TODO: Miss chance? // TODO: Crit chance // TODO: Adjust value up and down for def //var damage = mob.GetStatValue(Stat.dps); var damage = 10f; var ev = new PlayerEvent(); ev.type = PlayerEvent.Type.MobBasicAttack; ev.data[PlayerEvent.mobKey] = mob; ev.data[PlayerEvent.damageKey] = damage; var trigger = new Trigger(Trigger.Type.PlayerStatChange); //trigger.data[Trigger.statKey] = Stat.hp; trigger.data[Trigger.statChangeAmountKey] = -damage; ev.Triggers.Add(trigger); sim.AddEvent(ev); }
GameObject CreatePlayerEventView(PlayerEvent playerEvent) { GameObject prefab = eventPrefab; GameObject eventObj = null; switch (playerEvent.type) { case PlayerEvent.Type.Info: eventObj = InstantiatePrefab(eventInfoPrefab, playerEvent); break; case PlayerEvent.Type.Transition: eventObj = InstantiatePrefab(eventTransitionPrefab, playerEvent); break; case PlayerEvent.Type.Equipment: eventObj = InstantiatePrefab(eventEquipmentPrefab, playerEvent); break; case PlayerEvent.Type.Choice: eventObj = InstantiatePrefab(eventChoicePrefab, playerEvent); break; case PlayerEvent.Type.PlayerBasicAttack: eventObj = InstantiatePrefab(eventPlayerBasicAttackPrefab, playerEvent); break; case PlayerEvent.Type.MobBasicAttack: eventObj = InstantiatePrefab(eventMobBasicAttackPrefab, playerEvent); break; case PlayerEvent.Type.Story: eventObj = InstantiatePrefab(eventStoryPrefab, playerEvent); break; case PlayerEvent.Type.Consumable: eventObj = InstantiatePrefab(eventConsumablePrefab, playerEvent); break; default: break; } return eventObj; }
public static PlayerEvent Story(string text) { PlayerEvent ev = new PlayerEvent(text); ev.type = Type.Story; return ev; }
public static PlayerEvent Transition(string name) { PlayerEvent ev = new PlayerEvent(name); ev.type = Type.Transition; return ev; }
protected abstract void ShowPlayerStatus(IAudioPlayer player, string status, PlayerEvent playerEvent);
private static void VerifyEventMask(PlayerEvent eventMask) { if (eventMask <= PlayerEvent.None || eventMask > event_all_mask) { throw new ArgumentOutOfRangeException ("eventMask", "A valid event mask must be provided"); } }
public void ModifyEvent(PlayerEvent eventMask, PlayerEventHandler handler) { lock (event_handlers) { VerifyEventMask (eventMask); LinkedListNode<PlayerEventHandlerSlot> node = FindEventNode (handler); if (node != null) { PlayerEventHandlerSlot slot = node.Value; slot.EventMask = eventMask; node.Value = slot; } } }
void SetPlayerEvent(PlayerEvent ev) { _playerEvent = ev; if (leftActionView != null) { leftActionView.playerEvent = ev; } if (rightActionView != null) { rightActionView.playerEvent = ev; } }
public PlayerEventHandlerSlot(PlayerEvent mask, PlayerEventHandler handler) { EventMask = mask; Handler = handler; }
protected override Serializer Deserialize(Serializer serializer) { serializer.KnownSerializedObjects.Add(_motionEngine); base.Deserialize(serializer); _hasLandedOnBlock = serializer.GetDataItem<bool>("has-landed-on-block"); _didNotLandSafely = serializer.GetDataItem<bool>("did-not-land-safely"); _hasTouchedGoalFlag = serializer.GetDataItem<bool>("has-touched-goal"); _hasAlreadyTouchedGoalFlag = serializer.GetDataItem<bool>("already-touched-goal"); _isSmashingSmashBlocks = serializer.GetDataItem<bool>("smashing-blocks"); _motionEngine = serializer.GetDataItem<PlayerMotionEngine>("motion-engine"); _lastEvent = serializer.GetDataItem<PlayerEvent>("last-event"); return serializer; }
public PlayerEventArgs(PlayerEvent @event) { this.@event = @event; }
protected override void ShowPlayerStatus(IAudioPlayer player, string status, PlayerEvent playerEvent) { if (!IsEnabled) { return; } bool showAfterWithDelay = false; switch (playerEvent) { case PlayerEvent.Next: status = Localization.Current.Next; showAfterWithDelay = true; break; case PlayerEvent.Prev: status = Localization.Current.Previous; showAfterWithDelay = true; break; case PlayerEvent.Playing: status = TextWithIcon(">", status); break; case PlayerEvent.Current: status = TextWithIcon("\x07", status); break; case PlayerEvent.Voice: status = TextWithIcon("*", status); break; case PlayerEvent.Settings: status = TextWithIcon("*", status); showAfterWithDelay = true; break; } ShowPlayerStatus(player, status); if (showAfterWithDelay) { ShowPlayerStatusWithDelay(player); } }
private object IOnPlayerChat(PlayerEvent e) { if (e.SenderId == 9999999999) return null; return Interface.CallHook("OnPlayerChat", e); }
private void OnPlayerChat(PlayerEvent e) { if (e is PlayerChatEvent) { var chat = (PlayerChatEvent)e; HookCalled("OnPlayerChat"); Puts(chat.PlayerName + " : " + chat.Message); } if (e is GuildMessageEvent) { var chat = (GuildMessageEvent)e; HookCalled("OnPlayerChat"); Puts("[Guild: " + chat.GuildName + "] " + chat.PlayerName + " : " + chat.Message); } }
public void ConnectEvent(PlayerEventHandler handler, PlayerEvent eventMask) { ConnectEvent (handler, eventMask, false); }
public void ConnectEvent(PlayerEventHandler handler, PlayerEvent eventMask, bool connectAfter) { lock (event_handlers) { VerifyEventMask (eventMask); PlayerEventHandlerSlot slot = new PlayerEventHandlerSlot (eventMask, handler); if (connectAfter) { event_handlers.AddLast (slot); } else { event_handlers.AddFirst (slot); } } }
protected void OnEventChanged (PlayerEvent evnt) { OnEventChanged (new PlayerEventArgs (evnt)); }