Пример #1
0
 public ContentPackLoader(ICoreApi api)
 {
     this._api = api;
 }
Пример #2
0
 public ContentPackTranslationHelper(ICoreApi api, IContentSource contentSource)
 {
     this._api                 = api;
     this._contentSource       = contentSource;
     this._defaultTranslations = this._api.Json.ReadJson <Dictionary <string, string> >("i18n/default.json", this._contentSource, settings => { }) ?? new Dictionary <string, string>();
 }
Пример #3
0
 /// <summary>
 ///   Creates a new controller.
 /// </summary>
 public NameController(ICoreApi ipfs) : base(ipfs)
 {
 }
Пример #4
0
 /// <summary>
 ///   Creates a new controller.
 /// </summary>
 public FileSystemController(ICoreApi ipfs) : base(ipfs)
 {
 }
Пример #5
0
 /// <summary>
 ///   Creates a new controller.
 /// </summary>
 public DhtController(ICoreApi ipfs) : base(ipfs)
 {
 }
Пример #6
0
 public bool OnInitialize(ICoreApi api, string lastVersion, IReadOnlyDictionary <string, string> settings)
 {
     _api = api;
     return(true);
 }
 public CoreApiInitializer(ICoreApi coreApi)
 {
     this.CoreApi = coreApi;
 }
Пример #8
0
 public ApiHelper(ICoreApi coreApi, string apiName)
 {
     this.CoreApi  = coreApi;
     this._apiName = apiName;
 }
Пример #9
0
 public JsonAssetsItemProvider(ICoreApi coreApi, IJsonAssetsApi jsonAssetsApi)
 {
     this._coreApi       = coreApi;
     this._jsonAssetsApi = jsonAssetsApi;
 }
Пример #10
0
 /// <summary>
 ///   Creates a new controller.
 /// </summary>
 public KeyController(ICoreApi ipfs) : base(ipfs)
 {
 }
Пример #11
0
 /// <summary>
 ///   Creates a new controller.
 /// </summary>
 public StatsController(ICoreApi ipfs) : base(ipfs)
 {
 }
Пример #12
0
 public IpfsStorageService(IpfsStorageConfig config, ILogger <IStorageService> logger)
 {
     this.config = config;
     this.logger = logger;
     this.ipfs   = new IpfsClient(config.IpfsHost);
 }
Пример #13
0
 /// <summary>
 ///   Creates a new instance of the controller.
 /// </summary>
 /// <param name="ipfs">
 ///   An implementation of the IPFS Core API.
 /// </param>
 public IpfsController(ICoreApi ipfs)
 {
     IpfsCore = ipfs;
 }
Пример #14
0
 /// <summary>
 ///     Creates a new controller.
 /// </summary>
 public ObjectController(ICoreApi dfs) : base(dfs)
 {
 }
Пример #15
0
        private void RegisterConsoleCommands(ICoreApi coreApi)
        {
            // Toggle sprite sheet command
            bool spriteSheetVisible = false;

            this.Helper.ConsoleCommands.Add("tcm_togglespritesheet", "Toggles drawing the custom item sprite sheet in the top left corner of the screen.", (s, strings) => {
                spriteSheetVisible = !spriteSheetVisible;
                if (spriteSheetVisible)
                {
                    this.Helper.Events.Display.RenderingHud += this.OnRenderingHud_DisplaySpriteSheet;
                }
                else
                {
                    this.Helper.Events.Display.RenderingHud -= this.OnRenderingHud_DisplaySpriteSheet;
                }
            });

            // Add item spawning command
            this.Helper.ConsoleCommands.Add("tcm_additem", "Adds an item to the player's inventory.\nUsage: core_additem <mod_id>:<item_name> [quantity]\n- mod_id: The unique ID of the mod that created the item\n- item_name: The key the item was registered as for that mod.\n- quantity: The quantity of the item to add to your inventory. Only applicable to stackable objects.", (s, args) => {
                // Check for arguments
                if (!args.Any())
                {
                    this.Monitor.Log("Invalid usage: missing item key.", LogLevel.Error);
                    return;
                }

                // Item key
                if (!coreApi.Items.TryParseKey(args[0], out ItemKey itemKey))
                {
                    this.Monitor.Log("Invalid usage: Item key is invalid.", LogLevel.Error);
                    return;
                }

                // Quantity
                if (args.Length <= 1 || !int.TryParse(args[1], out int quantity))
                {
                    quantity = 1;
                }

                // Add items
                while (quantity-- > 0)
                {
                    if (!coreApi.Items.TryCreate(itemKey, out Item item))
                    {
                        this.Monitor.Log($"Invalid usage: Item key doesn't correspond to an item in this save: {itemKey}");
                        return;
                    }

                    Game1.player.addItemToInventory(item);
                }
            });

            // Add item list command
            this.Helper.ConsoleCommands.Add("tcm_listitems", "Lists all items registered through the item API.", (s, args) => {
                // Sort the registered item keys
                IOrderedEnumerable <ItemKey> registeredKeys = this._itemDelegator.GetRegisteredKeys().OrderBy(k => k.ToString(), StringComparer.OrdinalIgnoreCase);

                // Output each item
                this.Monitor.Log("Registered items:", LogLevel.Info);
                foreach (ItemKey key in registeredKeys)
                {
                    string index = coreApi.Items.TryCreate(key, out Item item) ? $"#{item.ParentSheetIndex}" : "No index assigned";
                    this.Monitor.Log($" - {key} ({index})", LogLevel.Info);
                }

                // Disclaimer
                this.Monitor.Log("Note: Only items registered through the API are listed. Some items may be registered through other mods and still have keys assigned to them.");
            });
        }
 /// <summary>
 ///   Creates a new controller.
 /// </summary>
 public ConfigController(ICoreApi ipfs) : base(ipfs)
 {
 }
Пример #17
0
 /// <summary>
 ///   Creates a new controller.
 /// </summary>
 public ObjectController(ICoreApi ipfs) : base(ipfs)
 {
 }
Пример #18
0
 /// <summary>
 ///   Creates a new instance of the controller.
 /// </summary>
 public IndexModel(ICoreApi ipfs)
 {
     this.ipfs = ipfs;
 }
Пример #19
0
 public GreenSlimeManager(ICoreApi coreApi) : base(coreApi, "Green Slime")
 {
     this._winterHat = coreApi.ContentSource.Load <Texture2D>($@"assets\{this.SlimeName}\hats\winter.png");
 }
 /// <summary>
 ///   Creates a web host that bridges IPFS and HTTP on "http://127.0.0.1:8080"
 /// </summary>
 /// <param name="ipfs">
 ///   The IPFS core features.
 /// </param>
 /// <remarks>
 ///   This starts the web host on a separate thread.  Use the Dispose method to
 ///   stop the web host.
 /// </remarks>
 public GatewayHost(ICoreApi ipfs)
     : this(ipfs, "http://127.0.0.1:8080")
 {
 }
Пример #21
0
 public CoreTranslationHelper(ICoreApi coreApi)
 {
     this._coreApi = coreApi;
 }
Пример #22
0
 /// <summary>
 ///   Creates a new instance of the controller.
 /// </summary>
 /// <param name="ipfs">
 ///   An object that implements the ICoreApi, typically an IpfsEngine.
 /// </param>
 public IpfsModel(ICoreApi ipfs)
 {
     this.ipfs = ipfs;
 }
Пример #23
0
 public ModRecipePart(ICoreApi coreApi, ItemKey key, int quantity = 1)
 {
     this.Quantity = quantity;
     this._coreApi = coreApi;
     this._key     = key;
 }
 /// <summary>
 ///   Creates a new instance of the controller.
 /// </summary>
 public GenericController(ICoreApi ipfs) : base(ipfs)
 {
 }
Пример #25
0
        public override bool OnInitialize(ICoreApi api, string lastVersion, IReadOnlyDictionary <string, string> settings)
        {
            int x = 0;

            return(true);
        }
 /// <summary>
 ///   Creates a new controller.
 /// </summary>
 public BootstrapController(ICoreApi ipfs) : base(ipfs)
 {
 }
Пример #27
0
 public WeaponRecipePart(ICoreApi coreApi, int index, int quantity = 1)
 {
     this._index   = index;
     this.Quantity = quantity;
     this.Sprite   = coreApi.Drawing.WeaponSpriteSheet.TryGetSprite(index, out ISprite sprite) ? sprite : throw new ArgumentOutOfRangeException(nameof(index));
 }
Пример #28
0
 public override bool OnInitialize(ICoreApi api, string lastVersion, IReadOnlyDictionary <string, string> settings)
 {
     // This won't actually be called
     return(false);
 }