コード例 #1
0
        internal CoreApiFactory(IMod mod, ItemDelegator itemDelegator)
        {
            this._itemDelegator = itemDelegator;

            // Create texture tracker
            this._textureTracker = new TextureTracker(mod);
            mod.Helper.Content.AssetEditors.Add(this._textureTracker);
        }
コード例 #2
0
        public ModCore()
        {
            // Patch needs to happen in constructor otherwise it doesn't work with Better Artisan Good Icons for some reason.
            // If that mod patches SObject.drawWhenHeld before this mod patches SpriteBatch.Draw, then the items don't appear
            // in the farmer's hands when held.
            DrawingDelegator.PatchIfNeeded();

            // Create the item delegator
            this._itemDelegator = new ItemDelegator(this);
        }
コード例 #3
0
ファイル: CoreApi.cs プロジェクト: somnomania/smapi-mod-dump
        public CoreApi(IMod owner, ItemDelegator itemDelegator, TextureTracker textureTracker)
        {
            this.Owner             = owner;
            this.ContentSource     = new ModContentSource(owner);
            this.TranslationHelper = new CoreTranslationHelper(this);

            // Create the APIs
            this._drawing = new Lazy <IDrawingApi>(() => new DrawingApi(new ApiHelper(this, "Drawing"), textureTracker));
            this._items   = new Lazy <IItemApi>(() => new ItemApi(new ApiHelper(this, "Items"), itemDelegator));
            this._json    = new Lazy <IJsonApi>(() => new JsonApi(new ApiHelper(this, "Json")));
        }
コード例 #4
0
        public CommonItemRegistry(IApiHelper apiHelper, ItemDelegator itemDelegator)
        {
            // Object registry
            SObjectRegistry objectRegistry = new SObjectRegistry(apiHelper, itemDelegator);

            this.Objects = objectRegistry;
            itemDelegator.AddProvider(_ => this.Objects);
            apiHelper.Owner.Helper.Content.AssetEditors.Add(objectRegistry);

            // Weapon registry
            WeaponRegistry weaponRegistry = new WeaponRegistry(apiHelper, itemDelegator);

            this.Weapons = weaponRegistry;
            itemDelegator.AddProvider(_ => this.Weapons);
            apiHelper.Owner.Helper.Content.AssetEditors.Add(weaponRegistry);
        }