Esempio n. 1
0
        /// <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));
        }
Esempio n. 2
0
 /// <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);
        }
Esempio n. 4
0
        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));
            }
        }
Esempio n. 5
0
    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"));
        }
    }
Esempio n. 6
0
        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);
            }
        }
Esempio n. 7
0
        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);
                }
            }
Esempio n. 8
0
        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());
        }
Esempio n. 9
0
 /// <inheritdoc />
 public void RemoveLocation(CharacterKey key)
 {
     this.locations.Remove(key);
 }
Esempio n. 10
0
 /// <inheritdoc />
 public PlayerLocation GetLocation(CharacterKey key)
 {
     PlayerLocation location;
     this.locations.TryGetValue(key, out location);
     return location;
 }
Esempio n. 11
0
 public GuestJoinedRoomEvent(RoomId roomId, PlayerId playerId, string userName, CharacterKey characterKey)
 {
     RoomId       = roomId;
     PlayerId     = playerId;
     UserName     = userName;
     CharacterKey = characterKey;
 }
Esempio n. 12
0
 public AddGuestFailedEvent(RoomId roomId, PlayerId playerId, string userName, CharacterKey characterKey)
 {
     RoomId       = roomId;
     PlayerId     = playerId;
     UserName     = userName;
     CharacterKey = characterKey;
 }
Esempio n. 13
0
 private IPlayer GetPlayerOrNull(CharacterKey key)
 {
     IPlayer player;
     if (this.players.TryGetValue(key, out player))
     {
         return player;
     }
     else
     {
         return default(IPlayer);
     }
 }
Esempio n. 14
0
 /// <inheritdoc />
 public void RemoveLocation(CharacterKey key)
 {
     _locations.Remove(key);
 }
Esempio n. 15
0
 public async Task Handle(PickCharacter command)
 {
     var character = CharacterKey.Parse(command.Character);
 }
Esempio n. 16
0
 public RoomPlayer(PlayerId playerId, string userName, CharacterKey characterKey, int latency)
 {
     PlayerId          = playerId;
     UserName          = userName;
     SelectedCharacter = characterKey;
 }
Esempio n. 17
0
 public RoomCreatedEvent(RoomId roomId, RoomCode roomCode, PlayerId hostPlayerId, CharacterKey hostCharacterKey)
 {
     RoomId           = roomId;
     RoomCode         = roomCode;
     HostPlayerId     = hostPlayerId;
     HostCharacterKey = hostCharacterKey;
 }