예제 #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
파일: Main.cs 프로젝트: stebee/FocalPointer
        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);
 }