Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            Task.Run(async() =>
            {
                var cancelSource = new CancellationTokenSource();
                var layout       = new ConsoleLayout
                {
                    Title           = $"Orikivo: {OriGlobal.ClientVersion}",
                    BackgroundColor = ConsoleColor.DarkCyan,
                    ForegroundColor = ConsoleColor.Cyan,
                    CursorVisible   = false
                };

                layout.Set();

                var builder = new ClientBuilder();
                builder.SetDefaultServices();

                builder.Services
                .AddSingleton <InfoService>();

                builder
                .AddEnumTypeReader <ReportTag>()
                .AddEnumTypeReader <EventType>()
                .AddEnumTypeReader <RasterizerType>()
                .AddEnumTypeReader <MeritGroup>()
                .AddEnumTypeReader <Gamma>()
                .AddEnumTypeReader <FontType>()
                .AddEnumTypeReader <PaletteType>()
                .AddEnumTypeReader <BorderAllow>()
                .AddEnumTypeReader <Casing>()
                .AddEnumTypeReader <ImageScale>()
                .AddEnumTypeReader <CardDeny>();

                builder
                .AddModule <CoreModule>()
                .AddModule <MessyModule>()
                .AddModule <DigitalModule>()
                .AddModule <GraphicsModule>()
                .AddModule <Actions>();

                Client client = builder.Build()
                                .WithStatus(UserStatus.DoNotDisturb)
                                .WithActivity("Minecraft", type: ActivityType.Listening);

                client.EnsureDefaultServices();
                await client.StartAsync(cancelSource.Token);
            }).GetAwaiter().GetResult();
        }
Exemplo n.º 2
0
        internal InstallerLayout()
        {
            ConsoleLayout = new ConsoleLayout();

            ProgressConsole       = new OutLogicalConsole(13, 1, 104, 3);
            TitleConsole          = new OutLogicalConsole(116, 1, 2, 8);
            DescriptionConsole    = new OutLogicalConsole(116, 7, 2, 10);
            AnswerConsole         = new InLogicalConsole(116, 1, 2, 20);
            StandardOutputConsole = new OutLogicalConsole(116, 11, 2, 27);

            ConsoleLayout
            .AddLogicalConsole(ProgressConsole)
            .AddLogicalConsole(TitleConsole)
            .AddLogicalConsole(DescriptionConsole)
            .AddLogicalConsole(AnswerConsole)
            .AddLogicalConsole(StandardOutputConsole)
            .BackgroundDrawer = DrawBackground;

            CoreManager.ServerCore.EventManager.StrongBind <ConsoleOutputEventArgs>("stdout:after", PrintStandardOutEvents);
        }
Exemplo n.º 3
0
        internal bool Run()
        {
            if (_steps.Count == 0)
            {
                CoreManager.ServerCore.ConsoleManager.Notice("Install", "No install tasks detected.");
                return(false);
            }

            if (_installerLayout == null)
            {
                CoreManager.ServerCore.ConsoleManager.Notice("Install", "IHI_BASIC_INSTALLER is set. Using default values.");
                CoreManager.ServerCore.ConsoleManager.Important("Install", "Installation tasks detected!");

                for (int stepNumber = 0; stepNumber < _steps.Count; stepNumber++)
                {
                    RunStep(stepNumber, true);
                }
                CoreManager.ServerCore.ConsoleManager.Important("Install", "Installation finished!");

                return(true);
            }

            ConsoleLayout originalLayout = CoreManager.ServerCore.ConsoleManager.ConsoleLayout;

            CoreManager.ServerCore.ConsoleManager.ConsoleLayout = _installerLayout.ConsoleLayout;

            CoreManager.ServerCore.ConsoleManager.Important("Install", "Installation tasks detected!");

            for (int stepNumber = 0; stepNumber < _steps.Count; stepNumber++)
            {
                RunStep(stepNumber);
            }

            CoreManager.ServerCore.ConsoleManager.Important("Install", "Installation finished!");

            CoreManager.ServerCore.ConsoleManager.ConsoleLayout = originalLayout;
            return(true);
        }
Exemplo n.º 4
0
        private static void Main(string[] args)
        {
            Task.Run(async() =>
            {
                Logger.DebugAllowed = true;
                var cancelSource    = new CancellationTokenSource();

                var layout = new ConsoleLayout
                {
                    Title           = $"Orikivo Arcade: {ArcadeData.Version}",
                    BackgroundColor = null,
                    ForegroundColor = null,
                    CursorVisible   = false
                };

                layout.Set();

                var builder = new ClientBuilder();

                builder.Services
                .AddSingleton <GameManager>()
                .AddSingleton <InfoService>()
                .AddSingleton <ArcadeContainer>()
                .AddSingleton <LogService>()
                .AddSingleton <EventHandler>()
                .AddSingleton <CommandHandler>()
                .AddSingleton <CasinoService>();

                builder.SocketConfig  = Orikivo.DiscordConfig.DefaultSocketConfig;
                builder.CommandConfig = Orikivo.DiscordConfig.DefaultCommandConfig;

                builder
                .AddTypeReader <Item>(new ItemTypeReader())
                .AddTypeReader <Merit>(new MeritTypeReader())
                .AddTypeReader <Recipe>(new RecipeTypeReader())
                .AddTypeReader <Quest>(new QuestTypeReader())
                .AddTypeReader <Shop>(new ShopTypeReader())
                .AddTypeReader <ArcadeUser>(new ArcadeUserTypeReader())
                .AddTypeReader <Wager>(new WagerTypeReader())
                .AddEnumTypeReader <CardDeny>()
                .AddEnumTypeReader <Casing>()
                .AddEnumTypeReader <FontType>()
                .AddEnumTypeReader <PaletteType>()
                .AddEnumTypeReader <BorderAllow>()
                .AddEnumTypeReader <ImageScale>()
                .AddEnumTypeReader <CardComponent>()
                .AddEnumTypeReader <Gamma>()
                .AddEnumTypeReader <BorderEdge>()
                .AddEnumTypeReader <LeaderboardQuery>()
                .AddEnumTypeReader <LeaderboardSort>()
                .AddEnumTypeReader <TickWinMethod>()
                .AddEnumTypeReader <StackTraceMode>()
                .AddEnumTypeReader <ChessOwner>()
                .AddEnumTypeReader <Privacy>()
                .AddEnumTypeReader <RouletteBetMode>();

                builder
                .AddModule <Core>()
                .AddModule <Modules.Casino>()
                .AddModule <Modules.Multiplayer>()
                .AddModule <Common>();

                Client client   = builder.Build();
                client.Status   = UserStatus.Online;
                client.Activity = new ActivityConfig
                {
                    Name = "your requests",
                    Type = ActivityType.Listening
                };

                client.Provider.GetRequiredService <EventHandler>();
                client.Provider.GetRequiredService <CommandHandler>();

                client.Provider.GetRequiredService <GameManager>().DefaultGameId = "trivia";
                client.Provider.GetRequiredService <GameManager>().Games         = new Dictionary <string, GameBase>
                {
                    ["trivia"]   = new TriviaGame(),
                    ["werewolf"] = new WerewolfGame(),
                    ["chess"]    = new ChessGame()
                };

                await client.StartAsync(cancelSource.Token);
            }).GetAwaiter().GetResult();
        }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConsoleLog" /> class.
 /// </summary>
 /// <param name="level">The log level.</param>
 /// <param name="layout">The layout to apply.</param>
 public ConsoleLog(LogLevel level = LogLevel.All, ILayout layout = null)
 {
     Level   = level;
     _layout = layout == null ? new ConsoleLayout() : (ConsoleLayout)layout;
 }