Пример #1
0
        private static void Main()
        {
            string location = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);

            LogManager.Configuration = new XmlLoggingConfiguration(Path.Combine(location, "nlog.config"));

            Directory.SetCurrentDirectory(location);

            Console.Title = Title;
            log.Info("Initialising...");

            try
            {
                ConfigManager.Initialise(Path.Combine(Directory.GetCurrentDirectory(), "Config.json"));
                PacketManager.Initialise();
                DatabaseManager.Initialise();
                DungeonTileManager.Initialise();
                NetworkManager.Initialise();

                WorldManager.Initialise(lastTick =>
                {
                    NetworkManager.Update(lastTick);
                    FellowshipManager.Update(lastTick);
                    ChannelManager.Update(lastTick);
                });

                log.Info("Ready!");
            }
            catch (Exception exception)
            {
                log.Error(exception);
            }
        }
Пример #2
0
        public static void HandleFellowship(Session session, NetworkObject networkObject)
        {
            FellowshipAction action         = (FellowshipAction)NetworkObjectField.ReadIntField(networkObject.GetField(0));
            FellowshipObject fellowshipInfo = new FellowshipObject();

            fellowshipInfo.FromNetworkObject(networkObject.GetField(1).ReadObject());

            switch (action)
            {
            case FellowshipAction.Join:
            {
                Fellowship fellowship = FellowshipManager.GetFellowship(fellowshipInfo);
                fellowship.AddMember(session);
                break;
            }

            case FellowshipAction.Leave:
            {
                Fellowship fellowship = FellowshipManager.GetFellowship(fellowshipInfo);
                fellowship?.RemoveMember(session);
                break;
            }
            }
        }