Пример #1
0
        public override void _Ready()
        {
            Ref = this;

            Debug = OS.IsDebugBuild();

            Shared = new SysManager();
            Server = new SysManager();
            Client = new SysManager();

            AddChild(Shared);
            AddChild(Server);
            AddChild(Client);

            LaunchArguments = OS.GetCmdlineArgs().ToList();

            AppType = new SysAppType();

            if (LaunchArguments.Contains("server"))
            {
                AppType.SetServer(true);
            }
            else
            {
                AppType.SetClient(true);
            }

            try
            {
                Shared.AddUI(new ConsoleSys(), "Console");

                ConsoleSys = Shared.GetUI <ConsoleSys>();

                Main NewCommon = new Main();
                NewCommon.AddShared();

                Shared.AddObject(new BootSys());

                Shared.GetObject <BootSys>().Add("Unary.Common", NewCommon);

                if (AppType.IsServer())
                {
                    Shared.GetObject <BootSys>().AddServer("Unary.Common");
                }
                else
                {
                    Shared.GetObject <BootSys>().AddClient("Unary.Common");
                }

                Shared.AddObject(new ModSys());

                Mod CoreMod = Shared.GetObject <ModSys>().Core.Mod;

                Shared.InitCore(CoreMod);

                if (AppType.IsServer())
                {
                    Server.InitCore(CoreMod);
                }
                else
                {
                    Client.InitCore(CoreMod);
                }

                Shared.GetObject <BootSys>().AddShared(CoreMod.ModID);

                if (AppType.IsServer())
                {
                    Shared.GetObject <BootSys>().AddServer(CoreMod.ModID);
                }
                else
                {
                    Shared.GetObject <BootSys>().AddClient(CoreMod.ModID);
                }
            }
            catch (Exception Exception)
            {
                ConsoleSys.Panic(Exception.Message);
            }
        }