Exemplo n.º 1
0
        public async Task WorksWithoutFullTypeNameHandlingToo()
        {
            var simpleSerializer = new JsonSerializer(new JsonSerializerSettings());
            var message          = new RandomMessage("hei allihoppa");
            var transportMessage = await simpleSerializer.Serialize(new Message(new Dictionary <string, string>(), message));

            var roundtrippedMessage = (await simpleSerializer.Deserialize(transportMessage)).Body;

            Assert.That(roundtrippedMessage, Is.TypeOf <RandomMessage>());
        }
Exemplo n.º 2
0
        protected override void OnEnable()
        {
            //Context.Server.PlayerFactory = new xPlayerFactory() { xCore = this };
            //Context.Server.LevelManager = new LobbyManager(this);
            Log.Info("[Cristalix] xThreadPool enabled");
            Log.Info("[Cristalix] xDedicatedTaskFactory enabled");
            Log.Info("[Cristalix] LobbyManager enabled");
            Auth = new Account();
            Auth.OnEnable(this, Context);
            Log.Info("[Cristalix] AccountManager enabled");
            Lang = Auth.Lang;
            foreach (KeyValuePair <string, Lang> l in Lang.getLangs())
            {
                l.Value.AddLines(Config.GetProperty("PluginDirectory", "Plugins") + "\\lang\\xCore\\" + l.Value.Name + ".ini");
                l.Value.AddLines(Config.GetProperty("PluginDirectory", "Plugins") + "\\lang\\DynItem\\" + l.Value.Name + ".ini");
            }
            string _basepath = Config.GetProperty("PluginDirectory", "Plugins") + "\\xCore";
            string vill      = File.ReadAllText(_basepath + "\\villagers.json");

            if (vill != null)
            {
                Villagers = JsonConvert.DeserializeObject <List <xCoreVillData> >(@vill);
                foreach (var v in Villagers)
                {
                    v.NameColor = v.NameColor.Replace('&', '§');
                }
            }

            Rm = new RandomMessage("Global", Config.GetProperty("PluginDirectory", "Plugins") + "\\lang\\xCore\\RandomMessage.ini");
            //ItemSigner.DefaultItemSigner = new HashedItemSigner();
            //Log.Info("[Cristalix] PartyManager enabled");
            Games = new List <xCoreInterface>();
            Games.Add(new xCoreSkyWars(this, Context));
            //Games.Add(new xCoreBedWars(this, Context));
            //Games.Add(new xCoreHiddenJoker(this, Context));
            //Games.Add(new xCoreTNTRun(this, Context));
            //Games.Add(new xCoreBlockHunt(this, Context));
            //Games.Add(new xCoreBlockParty(this, Context));
            //Games.Add(new xCoreSurvivalGames(this, Context));
            //Chest = new Chests(this);
            Context.Server.LevelManager.GetLevel(null, "overworld");
            Log.Info("[Cristalix] CChest enabled");
            LoadLobby();
            //ServersMenu();
            //ProfileMenu();
            //ChestFun();
            //Settings();
            Log.Info("[Cristalix] AntiCheat enabled");
            //Songs = new PlayNoteBlockSong(Context.Server.LevelManager.Levels.ToArray());
            BossBar = new Boss(Context.Server.LevelManager.Levels[0]);
            Context.Server.LevelManager.EntityManager.AddEntity(BossBar);
            Log.Info("[Cristalix] xCore enabled! Version 2.0!");
        }
 public async Task Handle(RandomMessage message) => _receivedEvents.Enqueue(message.CorrelationId);