Beispiel #1
0
        public ModsMenu(Manager manager, IModManager modManager)
            : base(manager)
        {
            this.Init();
            this.Width  = this.Manager.ScreenWidth;
            this.Height = this.Manager.ScreenHeight;
            this.Color  = Color.Transparent;
            GnomanEmpire.Instance.GuiManager.Add(this);
            GnomanEmpire.Instance.Graphics.DeviceReset += (sender, args) =>
            {
                Width  = manager.ScreenWidth;
                Height = manager.ScreenHeight;

                SetPosition();
            };
            _raisedPanel = new RaisedPanel(manager);
            _raisedPanel.Init();
            Add(_raisedPanel);
            AboutModsPanel aboutModsPanel = new AboutModsPanel(_raisedPanel, modManager);

            Button button = new Button(this.Manager);

            button.Init();
            button.Width  = 100;
            button.Left   = button.Margins.Left;
            button.Top    = aboutModsPanel.ModListBox.Top + aboutModsPanel.ModListBox.Height + aboutModsPanel.ModListBox.Margins.Bottom + button.Margins.Top;
            button.Text   = "Back";
            button.Click += (sender, args) => GnomanEmpire.Instance.GuiManager.MenuStack.PopWindow();
            this._raisedPanel.Add(button);

            this._raisedPanel.Width  = aboutModsPanel.ModInfoPanel.Left + aboutModsPanel.ModInfoPanel.Width + this._raisedPanel.ClientMargins.Horizontal + aboutModsPanel.ModListBox.Margins.Right;
            this._raisedPanel.Height = button.Top + button.Height + button.Margins.Bottom + this._raisedPanel.ClientMargins.Vertical;
            SetPosition();
        }
Beispiel #2
0
        public ModDialogUI(Manager manager, IModManager modManager)
            : base(manager)
        {
            Text      = "Mods";
            Width     = 750;
            Height    = 500;
            Resizable = false;
            Center();
            if (s_Position.X < 0f || s_Position.Y < 0f || s_Position.X + s_Width >= Manager.ScreenWidth || s_Position.Y + s_Height >= Manager.ScreenHeight)
            {
                s_Width      = this.Width;
                s_Height     = this.Height;
                s_Position.X = this.Left;
                s_Position.Y = this.Top;
            }
            AddPage("About", new GnomodiaPanelUI(this.Manager, modManager));
            Width  = s_Width;
            Height = s_Height;
            Left   = (int)s_Position.X;
            Top    = (int)s_Position.Y;

            Resize += (sender, args) =>
            {
                s_Width      = Width;
                s_Height     = Height;
                s_Position.X = this.Left;
                s_Position.Y = this.Top;
            };

            Move += (sender, args) =>
            {
                s_Position.X = this.Left;
                s_Position.Y = this.Top;
            };
        }
Beispiel #3
0
 public GameLevel(string path, IModManager modManager)
 {
     FilePath   = path;
     Name       = GamePathManager.GetFileNameWithoutExt(path);
     _TAG       = "GameLevel:" + Name;
     ModManager = modManager;
 }
Beispiel #4
0
        //加载GameInit基础
        private void LoadGameInitBase()
        {
            ModManager   = (IModManager)GameManager.GetManager("ModManager");
            SoundManager = (ISoundManager)GameManager.GetManager("SoundManager");
            DebugManager = (IDebugManager)GameManager.GetManager("DebugManager");

            IntroAudio = SoundManager.RegisterSoundPlayer(GameSoundType.UI, GameManager.FindStaticAssets <AudioClip>("IntroMusic"));
        }
Beispiel #5
0
            public ModDataSaveHeader(Stream stream, IEnumerable <IMod> mods, IModManager modManager)
            {
                _stream     = stream;
                _modManager = modManager;

                foreach (var mod in mods)
                {
                    _modSavePositions.Add(mod, null);
                }
            }
Beispiel #6
0
 public ModDataSaver(Stream stream, IModManager modManager)
 {
     _stream = stream;
     _modManager = modManager;
     _saveableMods = modManager.CreateOrGetAllMods()
         .Where(mod => mod.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
             .Union<MemberInfo>(mod.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
             .Count(mi => mi.GetCustomAttributes(typeof(SaveObjectAttribute), false).Any()) == 1)
         .ToDictionary(mod => mod, mod => mod.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
             .Union<MemberInfo>(mod.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
             .Single(mi => mi.GetCustomAttributes(typeof(SaveObjectAttribute), false).Any()));
 }
Beispiel #7
0
 public ModDataSaver(Stream stream, IModManager modManager)
 {
     _stream       = stream;
     _modManager   = modManager;
     _saveableMods = modManager.CreateOrGetAllMods()
                     .Where(mod => mod.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
                            .Union <MemberInfo>(mod.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
                            .Count(mi => mi.GetCustomAttributes(typeof(SaveObjectAttribute), false).Any()) == 1)
                     .ToDictionary(mod => mod, mod => mod.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
                                   .Union <MemberInfo>(mod.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
                                   .Single(mi => mi.GetCustomAttributes(typeof(SaveObjectAttribute), false).Any()));
 }
Beispiel #8
0
        private void DoInit()
        {
            ModManager = ((IModManager)GameManager.GetManager("ModManager"));

            if (!LuaInit())
            {
                enabled = false;
                GameLogger.Warning(TAG + ":" + Name, "LuaObject {0} disabled because load error", Name);
            }
            else
            {
                if (awakeCalledBeforeInit && awake != null)
                {
                    awake(self);
                }
                if (startCalledBeforeInit && start != null)
                {
                    start(self, gameObject);
                }
            }
        }
    public ModListItemViewModel(
        IModSelectionViewModel parent,
        ModInfo mod,
        IModManager modManager,
        IModPatchingService modPatcher,
        IDialogService dialogService,
        IPluginLoader pluginLoader,
        IModServiceGetterFactory modKernelFactory)
    {
        _modKernelFactory = modKernelFactory;
        _parentVm         = parent;
        _modService       = modManager;
        _dialogService    = dialogService;
        _modPatcher       = modPatcher;
        Mod         = mod;
        PluginItems = pluginLoader.LoadPlugins(out var _);

        PatchRomCommand         = new RelayCommand(() => PatchRom(Mod));
        ExportModCommand        = new RelayCommand(() => ExportMod(Mod));
        EditModInfoCommand      = new RelayCommand(() => EditModInfo(Mod));
        CreateModBasedOnCommand = new RelayCommand(() => CreateModBasedOn(Mod));
        DeleteModCommand        = new RelayCommand(() => DeleteMod(Mod));
        RunPluginCommand        = new RelayCommand <PluginInfo>(parameter => RunPlugin(Mod, parameter));
    }
Beispiel #10
0
        /// <summary>
        /// 创建预制的天空盒
        /// </summary>
        /// <param name="s">天空盒名字,(必须是 A~K ,对应原版游戏11个天空)</param>
        /// <returns>返回创建好的天空盒材质</returns>
        public static Material MakeSkyBox(string s)
        {
            if (ModManager == null)
            {
                ModManager = (IModManager)GameManager.GetManager("ModManager");
            }
            if (skyAssetPack == null)
            {
                skyAssetPack = ModManager.FindGameMod("core.assets.skys");
            }
            if (skyAssetPack == null)
            {
                GameLogger.Error(TAG, "MakeSkyBox failed because skybase pack core.assets.skys not load !");
                return(null);
            }

            Texture SkyLeft  = skyAssetPack.GetAsset <Texture>("Sky_" + s + "_Left.BMP");
            Texture SkyRight = skyAssetPack.GetAsset <Texture>("Sky_" + s + "_Right.BMP");
            Texture SkyFront = skyAssetPack.GetAsset <Texture>("Sky_" + s + "_Front.BMP");
            Texture SkyBack  = skyAssetPack.GetAsset <Texture>("Sky_" + s + "_Back.BMP");
            Texture SkyDown  = skyAssetPack.GetAsset <Texture>("Sky_" + s + "_Down.BMP");

            return(MakeCustomSkyBox(SkyLeft, SkyRight, SkyFront, SkyBack, SkyDown, null));
        }
Beispiel #11
0
 public CreateModCommand(IModManager modManager, ISettingService settingService)
 {
     _modManager     = modManager;
     _settingService = settingService;
 }
Beispiel #12
0
 public UpdateModCommand(ICurrentModService currentModService, IModManager modManager)
 {
     _currentModService = currentModService;
     _modManager        = modManager;
 }
Beispiel #13
0
 public GnomodiaPanelUI(Manager manager, IModManager modManager)
     : base(manager)
 {
     _modManager = modManager;
 }
Beispiel #14
0
 public ImportModCommand(IModManager modManager, ISettingService settingService)
 {
     _modManager     = modManager;
     _settingService = settingService;
 }
Beispiel #15
0
 public ListModsCommand(IModManager modManager, ISettingService settingService)
 {
     _modManager     = modManager;
     _settingService = settingService;
 }
Beispiel #16
0
        public AboutModsPanel(Panel containingPanel, IModManager modManager, int desiredHeight = 500, int desiredWidth = 750)
        {
            _modManager = modManager;

            ModListBox = new ListBox(containingPanel.Manager);
            ModListBox.Init();
            ModListBox.Top           = ModListBox.Margins.Top;
            ModListBox.Left          = ModListBox.Margins.Left;
            ModListBox.Width         = 250;
            ModListBox.Height        = desiredHeight - containingPanel.ClientMargins.Vertical - ModListBox.Top - ModListBox.Margins.Bottom;
            ModListBox.HideSelection = false;

            ModListBox.c81fb310624c15a101535d14adc9ec383.Add("Gnomodia");
            ModListBox.ItemIndexChanged += ModListBoxOnItemIndexChanged;

            foreach (var modMetadata in modManager.ModMetadata)
            {
                ModListBox.c81fb310624c15a101535d14adc9ec383.Add(modMetadata.Name);
            }

            containingPanel.Add(ModListBox);

            ModInfoPanel = new LoweredPanel(containingPanel.Manager);
            ModInfoPanel.Init();
            ModInfoPanel.Left       = ModListBox.Left + ModListBox.Width + ModListBox.Margins.Right + ModInfoPanel.Margins.Left;
            ModInfoPanel.Top        = ModInfoPanel.Margins.Top;
            ModInfoPanel.Width      = desiredWidth - ModInfoPanel.Left - ModInfoPanel.Margins.Right;
            ModInfoPanel.Height     = desiredHeight - containingPanel.ClientMargins.Vertical - ModInfoPanel.Top - ModInfoPanel.Margins.Bottom;
            ModInfoPanel.AutoScroll = true;
            ModInfoPanel.HorizontalScrollBarEnabled = false;
            ModInfoPanel.VerticalScrollBarShow      = true;
            containingPanel.Add(this.ModInfoPanel);

            _titleLabel = new Label(containingPanel.Manager);
            _titleLabel.Init();
            _titleLabel.Top    = _titleLabel.Margins.Top;
            _titleLabel.Left   = _titleLabel.Margins.Left;
            _titleLabel.Height = 14;
            _titleLabel.Width  = ModInfoPanel.ClientWidth - _titleLabel.Margins.Horizontal;
            _titleLabel.Text   = "";
            ModInfoPanel.Add(_titleLabel);

            _versionLabel = new Label(containingPanel.Manager);
            _versionLabel.Init();
            _versionLabel.Left   = _versionLabel.Margins.Left;
            _versionLabel.Height = 14;
            _versionLabel.Width  = ModInfoPanel.Width - _versionLabel.Margins.Horizontal;
            _versionLabel.Top    = _titleLabel.Top + _titleLabel.Height + _titleLabel.Margins.Bottom + _versionLabel.Margins.Top;
            _versionLabel.Text   = "";
            ModInfoPanel.Add(_versionLabel);

            _authorLabel = new Label(containingPanel.Manager);
            _authorLabel.Init();
            _authorLabel.Left   = _authorLabel.Margins.Left;
            _authorLabel.Height = 14;
            _authorLabel.Width  = ModInfoPanel.Width - _authorLabel.Margins.Horizontal;
            _authorLabel.Top    = _versionLabel.Top + _versionLabel.Height + _versionLabel.Margins.Bottom + _authorLabel.Margins.Top;
            _authorLabel.Text   = "";
            ModInfoPanel.Add(_authorLabel);

            _infoLabel           = new MultilineLabel(containingPanel.Manager);
            _infoLabel.Left      = _infoLabel.Margins.Left;
            _infoLabel.Height    = 0;
            _infoLabel.Top       = _authorLabel.Top + _authorLabel.Height + _authorLabel.Margins.Bottom + _infoLabel.Margins.Top;
            _infoLabel.Width     = ModInfoPanel.ClientWidth - _infoLabel.Margins.Horizontal;
            _infoLabel.Anchor    = Anchors.Top | Anchors.Left | Anchors.Right;
            _infoLabel.Alignment = Alignment.TopLeft;
            ModInfoPanel.Add(_infoLabel);

            ModListBox.ItemIndex = 0;
        }
 public CurrentModService(ISettingService settingService, IModManager modManager, IModServiceGetterFactory modKernelFactory)
 {
     _modServiceGetterFactory      = modKernelFactory;
     _currentConsoleModSlotSetting = settingService.Get <CurrentConsoleModSlotSetting>();
     _modManager = modManager;
 }
Beispiel #18
0
        public AboutModsPanel(Panel containingPanel, IModManager modManager, int desiredHeight = 500, int desiredWidth = 750)
        {
            _modManager = modManager;

            ModListBox = new ListBox(containingPanel.Manager);
            ModListBox.Init();
            ModListBox.Top = ModListBox.Margins.Top;
            ModListBox.Left = ModListBox.Margins.Left;
            ModListBox.Width = 250;
            ModListBox.Height = desiredHeight - containingPanel.ClientMargins.Vertical - ModListBox.Top - ModListBox.Margins.Bottom;
            ModListBox.HideSelection = false;

            ModListBox.c81fb310624c15a101535d14adc9ec383.Add("Gnomodia");
            ModListBox.ItemIndexChanged += ModListBoxOnItemIndexChanged;

            foreach (var modMetadata in modManager.ModMetadata)
            {
                ModListBox.c81fb310624c15a101535d14adc9ec383.Add(modMetadata.Name);
            }

            containingPanel.Add(ModListBox);

            ModInfoPanel = new LoweredPanel(containingPanel.Manager);
            ModInfoPanel.Init();
            ModInfoPanel.Left = ModListBox.Left + ModListBox.Width + ModListBox.Margins.Right + ModInfoPanel.Margins.Left;
            ModInfoPanel.Top = ModInfoPanel.Margins.Top;
            ModInfoPanel.Width = desiredWidth - ModInfoPanel.Left - ModInfoPanel.Margins.Right;
            ModInfoPanel.Height = desiredHeight - containingPanel.ClientMargins.Vertical - ModInfoPanel.Top - ModInfoPanel.Margins.Bottom;
            ModInfoPanel.AutoScroll = true;
            ModInfoPanel.HorizontalScrollBarEnabled = false;
            ModInfoPanel.VerticalScrollBarShow = true;
            containingPanel.Add(this.ModInfoPanel);

            _titleLabel = new Label(containingPanel.Manager);
            _titleLabel.Init();
            _titleLabel.Top = _titleLabel.Margins.Top;
            _titleLabel.Left = _titleLabel.Margins.Left;
            _titleLabel.Height = 14;
            _titleLabel.Width = ModInfoPanel.ClientWidth - _titleLabel.Margins.Horizontal;
            _titleLabel.Text = "";
            ModInfoPanel.Add(_titleLabel);

            _versionLabel = new Label(containingPanel.Manager);
            _versionLabel.Init();
            _versionLabel.Left = _versionLabel.Margins.Left;
            _versionLabel.Height = 14;
            _versionLabel.Width = ModInfoPanel.Width - _versionLabel.Margins.Horizontal;
            _versionLabel.Top = _titleLabel.Top + _titleLabel.Height + _titleLabel.Margins.Bottom + _versionLabel.Margins.Top;
            _versionLabel.Text = "";
            ModInfoPanel.Add(_versionLabel);

            _authorLabel = new Label(containingPanel.Manager);
            _authorLabel.Init();
            _authorLabel.Left = _authorLabel.Margins.Left;
            _authorLabel.Height = 14;
            _authorLabel.Width = ModInfoPanel.Width - _authorLabel.Margins.Horizontal;
            _authorLabel.Top = _versionLabel.Top + _versionLabel.Height + _versionLabel.Margins.Bottom + _authorLabel.Margins.Top;
            _authorLabel.Text = "";
            ModInfoPanel.Add(_authorLabel);

            _infoLabel = new MultilineLabel(containingPanel.Manager);
            _infoLabel.Left = _infoLabel.Margins.Left;
            _infoLabel.Height = 0;
            _infoLabel.Top = _authorLabel.Top + _authorLabel.Height + _authorLabel.Margins.Bottom + _infoLabel.Margins.Top;
            _infoLabel.Width = ModInfoPanel.ClientWidth - _infoLabel.Margins.Horizontal;
            _infoLabel.Anchor = Anchors.Top | Anchors.Left | Anchors.Right;
            _infoLabel.Alignment = Alignment.TopLeft;
            ModInfoPanel.Add(_infoLabel);

            ModListBox.ItemIndex = 0;
        }
Beispiel #19
0
 public UpgradeModsCommand(IModManager modManager)
 {
     _modManager = modManager;
 }
Beispiel #20
0
 public GnomodiaPanelUI(Manager manager, IModManager modManager)
     : base(manager)
 {
     _modManager = modManager;
 }
Beispiel #21
0
        public ModDialogUI(Manager manager, IModManager modManager)
            : base(manager)
        {
            Text = "Mods";
            Width = 750;
            Height = 500;
            Resizable = false;
            Center();
            if (s_Position.X < 0f || s_Position.Y < 0f || s_Position.X + s_Width >= Manager.ScreenWidth || s_Position.Y + s_Height >= Manager.ScreenHeight)
            {
                s_Width = this.Width;
                s_Height = this.Height;
                s_Position.X = this.Left;
                s_Position.Y = this.Top;
            }
            AddPage("About", new GnomodiaPanelUI(this.Manager, modManager));
            Width = s_Width;
            Height = s_Height;
            Left = (int)s_Position.X;
            Top = (int)s_Position.Y;

            Resize += (sender, args) =>
            {
                s_Width = Width;
                s_Height = Height;
                s_Position.X = this.Left;
                s_Position.Y = this.Top;
            };

            Move += (sender, args) =>
            {
                s_Position.X = this.Left;
                s_Position.Y = this.Top;
            };
        }
Beispiel #22
0
            public ModDataSaveHeader(Stream stream, IEnumerable<IMod> mods, IModManager modManager)
            {
                _stream = stream;
                _modManager = modManager;

                foreach (var mod in mods)
                {
                    _modSavePositions.Add(mod, null);
                }
            }
Beispiel #23
0
        public ModsMenu(Manager manager, IModManager modManager)
            : base(manager)
        {
            this.Init();
            this.Width = this.Manager.ScreenWidth;
            this.Height = this.Manager.ScreenHeight;
            this.Color = Color.Transparent;
            GnomanEmpire.Instance.GuiManager.Add(this);
            GnomanEmpire.Instance.Graphics.DeviceReset += (sender, args) =>
            {
                Width = manager.ScreenWidth;
                Height = manager.ScreenHeight;

                SetPosition();
            };
            _raisedPanel = new RaisedPanel(manager);
            _raisedPanel.Init();
            Add(_raisedPanel);
            AboutModsPanel aboutModsPanel = new AboutModsPanel(_raisedPanel, modManager);

            Button button = new Button(this.Manager);
            button.Init();
            button.Width = 100;
            button.Left = button.Margins.Left;
            button.Top = aboutModsPanel.ModListBox.Top + aboutModsPanel.ModListBox.Height + aboutModsPanel.ModListBox.Margins.Bottom + button.Margins.Top;
            button.Text = "Back";
            button.Click += (sender, args) => GnomanEmpire.Instance.GuiManager.MenuStack.PopWindow();
            this._raisedPanel.Add(button);

            this._raisedPanel.Width = aboutModsPanel.ModInfoPanel.Left + aboutModsPanel.ModInfoPanel.Width + this._raisedPanel.ClientMargins.Horizontal + aboutModsPanel.ModListBox.Margins.Right;
            this._raisedPanel.Height = button.Top + button.Height + button.Margins.Bottom + this._raisedPanel.ClientMargins.Vertical;
            SetPosition();
        }