Exemplo n.º 1
0
        public override void Load()
        {
            base.Load();

            Scheduler = new Scheduler();

            Resources = new ResourceStore <byte[]>();
            Resources.AddStore(new NamespacedResourceStore <byte[]>(new DllResourceStore(@"osu.Framework.dll"), @"Resources"));
            Resources.AddStore(new DllResourceStore(MainResourceFile));

            Textures = Textures = new TextureStore(new NamespacedResourceStore <byte[]>(Resources, @"Textures"));

            Audio = new AudioManager(new NamespacedResourceStore <byte[]>(Resources, @"Tracks"), new NamespacedResourceStore <byte[]>(Resources, @"Samples"));

            Shaders = new ShaderManager(new NamespacedResourceStore <byte[]>(Resources, @"Shaders"));

            Fonts = new TextureStore(new GlyphStore(Game.Resources, @"Fonts/OpenSans"))
            {
                ScaleAdjust = 1 / 137f
            };

            Add(userInputContainer = new UserInputManager()
            {
                Children = new[] {
                    new FlowContainer
                    {
                        Direction = Graphics.Containers.FlowDirection.VerticalOnly,
                        Padding   = new Vector2(10, 10),
                        Anchor    = Graphics.Anchor.BottomRight,
                        Origin    = Graphics.Anchor.BottomRight,
                        Depth     = float.MaxValue,

                        Children = new[] {
                            new FrameTimeDisplay(@"Input", host.InputMonitor),
                            new FrameTimeDisplay(@"Update", host.UpdateMonitor),
                            new FrameTimeDisplay(@"Draw", host.DrawMonitor)
                        }
                    },
                    new PerformanceOverlay()
                    {
                        Position = new Vector2(5, 5),
                        Anchor   = Graphics.Anchor.BottomRight,
                        Origin   = Graphics.Anchor.BottomRight,
                        Depth    = float.MaxValue
                    }
                }
            });
        }
Exemplo n.º 2
0
        public override void Load()
        {
            base.Load();

            Scheduler = new Scheduler();

            Resources = new ResourceStore <byte[]>();
            Resources.AddStore(new NamespacedResourceStore <byte[]>(new DllResourceStore(@"osu.Framework.dll"), @"Resources"));
            Resources.AddStore(new DllResourceStore(MainResourceFile));

            Textures = new TextureStore(new RawTextureLoaderStore(new NamespacedResourceStore <byte[]>(Resources, @"Textures")));

            Audio = new AudioManager(new NamespacedResourceStore <byte[]>(Resources, @"Tracks"), new NamespacedResourceStore <byte[]>(Resources, @"Samples"));

            Shaders = new ShaderManager(new NamespacedResourceStore <byte[]>(Resources, @"Shaders"));

            Fonts = new TextureStore(new GlyphStore(Game.Resources, @"Fonts/OpenSans"))
            {
                ScaleAdjust = 1 / 100f
            };

            Add(userInputContainer = new UserInputManager
            {
                Children = new[]
                {
                    performanceContainer = new PerformanceOverlay
                    {
                        Position  = new Vector2(5, 5),
                        Direction = FlowDirection.VerticalOnly,
                        Alpha     = 0,
                        Padding   = new Vector2(10, 10),
                        Anchor    = Anchor.BottomRight,
                        Origin    = Anchor.BottomRight,
                        Depth     = float.MaxValue
                    }
                }
            });
        }
        public override void Load()
        {
            // Load movedb

            BaseMove.LoadMoveDb();

            // Initalize Discord RP on Mod Load
            if (!Main.dedServ)
            {
                client        = new DiscordRpcClient("790364236554829824");
                client.Logger = new ConsoleLogger()
                {
                    Level = LogLevel.Warning
                };
                //

                Logger.Info("Attempting to establish Discord RP connection");

                // Subscribe to events
                client.OnReady += (sender, e) =>
                {
                    Logger.Info("Established connection");
                    Console.WriteLine("Received Ready from user {0}", e.User.Username);
                };

                client.OnPresenceUpdate += (sender, e) =>
                {
                    Console.WriteLine("Received Update! {0}", e.Presence);
                };

                client.OnError += (sender, e) =>
                {
                    Logger.Error("Could not start Discord RP. Reason: " + e.Message);
                };

                //Connect to the RPC
                client.Initialize();

                client.SetPresence(new RichPresence()
                {
                    Details = "In Menu",
                    State   = "Playing v0.4.2",
                    Assets  = new Assets()
                    {
                        LargeImageKey  = "largeimage2",
                        LargeImageText = "Merry Christmas!"
                    }
                });
            }

            BaseMove._mrand = new UnifiedRandom(BaseMove._seed = new Random().Next());
            //Load all mons to a store
            LoadPokemons();

            if (Main.netMode != NetmodeID.Server)
            {
                if (Localisation == null)
                {
                    Localisation = new LocalisationManager(locale);
                }
                locale = new Bindable <string>(Language.ActiveCulture.Name);

                storage = new ModStorage("Terramon");                                                                  //Initialise local resource store
                Store   = new ResourceStore <byte[]>(new EmbeddedStore());                                             //Make new instance of ResourceStore with dependency what loads data from ModStore
                Store.AddStore(new StorageCachableStore(storage, new WebStore()));                                     //Add second dependency what checks if data exist in local store.
                                                                                                                       //If not and provided URL load data from web and save it on drive
                Textures = new Texture2DStore(Store);                                                                  //Initialise cachable texture store in order not creating new texture each call

                Localisation.AddLanguage(GameCulture.English.Name, new LocalisationStore(Store, GameCulture.English)); //Adds en-US.lang file handling
                Localisation.AddLanguage(GameCulture.Russian.Name, new LocalisationStore(Store, GameCulture.Russian)); //Adds ru-RU.lang file handling
#if DEBUG
                UseWebAssets = true;
                var ss = Localisation.GetLocalisedString(new LocalisedString(("title", "Powered by broken code")));//It's terrible checking in ui from phone, so i can ensure everything works from version string
                //Main.versionNumber = ss.Value + "\n" + Main.versionNumber;
#endif
                Ref <Effect> screenRef      = new Ref <Effect>(GetEffect("Effects/ShockwaveEffect")); // The path to the compiled shader file.
                Ref <Effect> whiteShaderRef = new Ref <Effect>(GetEffect("Effects/whiteshader"));     // The path to the compiled shader file.
                Filters.Scene["Shockwave"] = new Filter(new ScreenShaderData(screenRef, "Shockwave"), EffectPriority.VeryHigh);
                Filters.Scene["Shockwave"].Load();
                GameShaders.Misc["WhiteTint"] = new MiscShaderData(whiteShaderRef, "ArmorBasic");

                ChooseStarter = new ChooseStarter();
                ChooseStarter.Activate();
                ChooseStarterBulbasaur = new ChooseStarterBulbasaur();
                ChooseStarterBulbasaur.Activate();
                ChooseStarterCharmander = new ChooseStarterCharmander();
                ChooseStarterCharmander.Activate();
                ChooseStarterSquirtle = new ChooseStarterSquirtle();
                ChooseStarterSquirtle.Activate();
                PokegearUI = new PokegearUI();
                PokegearUI.Activate();
                PokegearUIEvents = new PokegearUIEvents();
                PokegearUIEvents.Activate();
                evolveUI = new EvolveUI();
                evolveUI.Activate();
                UISidebar = new UISidebar();
                UISidebar.Activate();
                Moves = new Moves();
                Moves.Activate();
                PartySlots = new PartySlots();
                PartySlots.Activate();
                _exampleUserInterface    = new UserInterface();
                _exampleUserInterfaceNew = new UserInterface();
                PokegearUserInterfaceNew = new UserInterface();
                evolveUserInterfaceNew   = new UserInterface();
                _uiSidebar  = new UserInterface();
                _moves      = new UserInterface();
                _partySlots = new UserInterface();
                _battle     = new UserInterface();
                ParentPokemonNPC.HighlightTexture = new Dictionary <string, Texture2D>();
                ParentPokemon.HighlightTexture    = new Dictionary <string, Texture2D>();

                //_exampleUserInterface.SetState(ChooseStarter); // Choose Starter
#if DEBUG
                _exampleUserInterface.SetState(new TestState());
#endif
                _exampleUserInterfaceNew.SetState(PokegearUI);       // Pokegear Main Menu
                PokegearUserInterfaceNew.SetState(PokegearUIEvents); // Pokegear Events Menu
                evolveUserInterfaceNew.SetState(evolveUI);
                _uiSidebar.SetState(UISidebar);
                _moves.SetState(Moves);
                _partySlots.SetState(PartySlots);
                _battle.SetState(BattleMode.UI = new BattleUI());// Automatically assign shortcut

                summaryUI = new AnimatorUI();
                summaryUI.Activate();

                summaryUIInterface = new UserInterface();
                summaryUIInterface.SetState(summaryUI);
            }


            if (Main.dedServ)
            {
                return;
            }

            Scheduler = new Scheduler(Thread.CurrentThread, schedulerClock = new GameTimeClock());

            FirstPKMAbility  = RegisterHotKey("First Pokémon Move", Keys.Z.ToString());
            SecondPKMAbility = RegisterHotKey("Second Pokémon Move", Keys.X.ToString());
            ThirdPKMAbility  = RegisterHotKey("Third Pokémon Move", Keys.C.ToString());
            FourthPKMAbility = RegisterHotKey("Fourth Pokémon Move", Keys.V.ToString());

            CompressSidebar = RegisterHotKey("Compress Sidebar", Keys.RightShift.ToString());

            PartyCycle = RegisterHotKey("Quick Spawn First Party Pokémon", Keys.RightAlt.ToString());
        }