Ejemplo n.º 1
0
        public void OnDestroy()
        {
            // since we are using threads to do our work (networking, ..)
            // away of unity's default classes, we need to shutdown things
            // to avoid errors in the console while debugging

            if (ProtocolGame != null && ProtocolGame.IsGameRunning)
            {
                ProtocolGame.Disconnect(); // force disconnection (by trying to logout)
            }
            AppearanceStorage.UnloadSpriteProvider();

            OnSecondaryTimeCheck.RemoveAllListeners();
            CancelInvoke("SecondaryTimerCheck");
            CancelInvoke("SaveMiniMap");

            OptionStorage     = null;
            InputHandler      = null;
            AppearanceStorage = null;
            CreatureStorage   = null;
            MiniMapStorage    = null;
            MiniMapRenderer   = null;
            WorldMapStorage   = null;
            WorldMapRenderer  = null;
            ChatStorage       = null;
            MessageStorage    = null;

            WorldMapRenderingTexture.Release();
            MiniMapRenderingTexture.Release();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            ProtocolGame protocol = new ProtocolGame("127.0.0.1", 7172);

            Console.WriteLine(":::::::::::::::::::::::::::::::::");
            Console.WriteLine(":: OTSharp Game Server");
            Console.WriteLine(":: Tibia 7.6");
            Console.WriteLine(":: Copyright © Daniel Alejandro");
            Console.WriteLine(":::::::::::::::::::::::::::::::::");

            Console.WriteLine(">> Initializing protocol...");
            if (!protocol.Start())
            {
                Console.WriteLine("Error: Login Server not running!");
            }
            else
            {
                Console.WriteLine(">> Initializing channels...");
                Channels.Init();
                Console.WriteLine(">> Loading map...");
                if (!Game.Map.LoadMap())
                {
                    Console.WriteLine("Error: could not load map!");
                }
                else
                {
                    Console.WriteLine(">> Game Server running!");
                }
            }

            Console.ReadKey(false);
        }