/// <inheritdoc /> public void BroadcastFromChannel(int channelId, CharacterKey[] targets, byte[] data) { var channels = from entry in this.channelContainer where entry.ChannelId != channelId select entry; channels.AsParallel().ForAll(c => c.BroadcastIntoChannel(targets, data)); }
/// <inheritdoc /> public void SetLocation(CharacterKey key, int channelId, int mapId) { var location = new PlayerLocation(channelId, mapId); if (this.locations.ContainsKey(key)) { this.locations[key] = location; } else { this.locations.Add(key, location); } }
private CharacterSpecification GetOrCreateCharacterData(Vector2 size, char character) { // build the dictionary look up key var lookUpKey = new CharacterKey(character, size); // get the entry (creates it if it does not exist) CharacterSpecification characterData; if (!sizedCharacterToCharacterData.TryGetValue(lookUpKey, out characterData)) { characterData = new CharacterSpecification(character, FontName, size, Style, AntiAlias); sizedCharacterToCharacterData[lookUpKey] = characterData; } return(characterData); }
public static string GetTowers() { var sheet = new CharacterKey(4355544, "0knl1LoJnR1ycZqSaPUCB9iXF2fwqEfISLHQcbpzrCJD0uE5lMSKnbY7dzVoj9Yj"); var events = GetCalendarEvents().Where(s => s.EventTitle.ToLower().Contains("control tower") && (s.EventDate - DateTime.UtcNow).Days <= 7 ).Select(s => string.Concat(s.EventDateAsString, ": ", s.EventTitle)).ToArray <string>(); if (events.Count() == 0) { return("AIN'T GOT NO TOWERS GOIN' OFFLINE, FOOL!"); } else { return(string.Join("\r\n", events)); } }
public void InitWithKey(CharacterKey key) { Key = key; StoryFeed[] _storyFeeds = FindObjectsOfType <StoryFeed>(); foreach (StoryFeed storyFeed in _storyFeeds) { if (storyFeed.CharacterKey == key) { _storyFeed = storyFeed; break; } } TextAsset inkStoryJson = Resources.Load <TextAsset>(ResourcePaths.StoryEngineInkJsonPath); _inkStory = Story.CreateWithJson(inkStoryJson.text); StoryScene debugSceneToPlay = StoryManager.Instance.GetScene(DebugSettings.Instance.LoadIntoScene); if (debugSceneToPlay == null && string.IsNullOrEmpty(DebugSettings.Instance.LoadIntoScene) == false) { int i; if (int.TryParse(DebugSettings.Instance.LoadIntoScene, out i)) { debugSceneToPlay = StoryManager.Instance.GetScene(Key, i); _nextSceneIndex = i + 1; } } if (debugSceneToPlay != null) { StartScene(debugSceneToPlay); } else { // todo - load the first scene! StartScene(StoryManager.Instance.GetScene("intro")); } }
public List <Character> GetCharacters(long keyid, string vcode) { _logger.Debug("{method} {keyid}", "GetCharacters", keyid); try { var key = new CharacterKey(keyid, vcode); var chars = key.Characters; return(chars.ToList()); } catch (Exception e) { if (e.ToString().Contains("Authentication failure")) { throw new UserException(strings.ErrorAuthenticationFailure, e); } _logger.Error("{method} {@exception}", "GetCharacters", e.ToString()); throw new UserException(strings.ErrorCallingEveApi, e); } }
public async Task Handle(JoinRoom command) { if (RoomCode.TryParse(command.RoomCode, out RoomCode code, out string error)) { var room = await _fetcher.Fetch(code); if (room == null) { await _eventHub.Dispatch(new JoinRoomFailed() { PlayerId = command.PlayerId, RoomCode = command.RoomCode, UserName = command.UserName, Reason = "Room not found" }); } else { room.AddGuest(new PlayerId(command.PlayerId), command.UserName, CharacterKey.Parse(command.SelectedCharacter)); await _persister.TryStore(room); await _eventHub.DispatchAll(room); } }
public static List <Event> GetCalendarEvents() { var sheet = new CharacterKey(Properties.Settings.Default.APIKey, Properties.Settings.Default.VCode); return(sheet.Characters.First().GetUpcomingCalendarEvents().Result.Events.ToList()); }
/// <inheritdoc /> public void RemoveLocation(CharacterKey key) { this.locations.Remove(key); }
/// <inheritdoc /> public PlayerLocation GetLocation(CharacterKey key) { PlayerLocation location; this.locations.TryGetValue(key, out location); return location; }
public GuestJoinedRoomEvent(RoomId roomId, PlayerId playerId, string userName, CharacterKey characterKey) { RoomId = roomId; PlayerId = playerId; UserName = userName; CharacterKey = characterKey; }
public AddGuestFailedEvent(RoomId roomId, PlayerId playerId, string userName, CharacterKey characterKey) { RoomId = roomId; PlayerId = playerId; UserName = userName; CharacterKey = characterKey; }
private IPlayer GetPlayerOrNull(CharacterKey key) { IPlayer player; if (this.players.TryGetValue(key, out player)) { return player; } else { return default(IPlayer); } }
/// <inheritdoc /> public void RemoveLocation(CharacterKey key) { _locations.Remove(key); }
public async Task Handle(PickCharacter command) { var character = CharacterKey.Parse(command.Character); }
public RoomPlayer(PlayerId playerId, string userName, CharacterKey characterKey, int latency) { PlayerId = playerId; UserName = userName; SelectedCharacter = characterKey; }
public RoomCreatedEvent(RoomId roomId, RoomCode roomCode, PlayerId hostPlayerId, CharacterKey hostCharacterKey) { RoomId = roomId; RoomCode = roomCode; HostPlayerId = hostPlayerId; HostCharacterKey = hostCharacterKey; }