コード例 #1
0
ファイル: PyTKMod.cs プロジェクト: jonathanchancey/DecentDew
        private void testing()
        {
            CustomObjectData.newBigObject("Platonymous.BigTest", Game1.bigCraftableSpriteSheet.clone().setSaturation(0), Color.Aquamarine, "Test Machine", "Test Description", 24, craftingData: new CraftingData("Test Machine"));
            CustomObjectData.newObject("Platonymous.Rubici", Game1.objectSpriteSheet.clone().setSaturation(0), Color.Yellow, "Rubici", "Rubici Test", 16, "Rubici", "Minerals -2", 50, -300);
            new CustomObjectData("Platonymous.Rubico" + Color.Red.ToString(), "Rubico/250/-300/Minerals -2/Rubico/A precious stone that is sought after for its rich color and beautiful fluster.", Game1.objectSpriteSheet.clone().setSaturation(0), Color.Red, 16);

            Keys.K.onPressed(() => Monitor.Log($"Played: {Game1.currentGameTime.TotalGameTime.Minutes} min"));
            ButtonClick.UseToolButton.onTerrainClick <Grass>(o => Monitor.Log($"Number of Weeds: {o.numberOfWeeds}", LogLevel.Info));
            new InventoryItem(new Chest(true), 100).addToNPCShop("Pierre");
            new ItemSelector <SObject>(p => p.name == "Chest").whenAddedToInventory(l => l.useAll(i => i.name = "Test"));
            Helper.Content.Load <Texture2D>($"Maps/MenuTiles", ContentSource.GameContent).setSaturation(0).injectAs($"Maps/MenuTiles");
            Game1.objectSpriteSheet.clone().setSaturation(0).injectTileInto($"Maps/springobjects", 74);
            Game1.objectSpriteSheet.clone().setSaturation(0).injectTileInto($"Maps/springobjects", new Range(129, 166), new Range(129, 166));

            Func <string, GameLocation, Vector2, string, bool> tileActionTest = (s, l, t, ly) =>
            {
                List <string> strings = s.Split(' ').ToList();
                strings.Remove(strings[0]);
                Game1.activeClickableMenu = new DialogueBox(String.Join(" ", s));
                return(true);
            };

            Action mapMergeTest = delegate()
            {
                "Beach".toLocation().Map.mergeInto("Town".toLocation().Map, new Vector2(60, 30), new Rectangle(15, 15, 20, 20)).injectAs(@"Maps/Town");
                "Town".toLocation().clearArea(new Rectangle(60, 30, 20, 20));
                "Town".toLocation().Map.addAction(new Vector2(18, 60), new TileAction("testaction", tileActionTest).register(), "Smells interesting");
            };

            SaveEvents.AfterLoad += (s, e) => mapMergeTest();
        }
コード例 #2
0
        public void LoadCritters(object sender, UpdateTickedEventArgs e)
        {
            BugNetData data = _helper.Data.ReadJsonFile <BugNetData>("Assets/critters.json");
            int        Id   = -666;

            AllCritters = new List <CritterEntry>();
            Dictionary <int, string> AssetData = new Dictionary <int, string>();

            foreach (CritterEntry critter in data.AllCritters)
            {
                AllCritters.AddOrReplace(critter);
                CritterEntry.Register(critter);
                var bugModel = new BugModel();
                bugModel = critter.BugModel;
                //is this V necessary ?
                bugModel.ParentSheetIndex = Id;
                AllBugs.AddOrReplace(bugModel);
                CustomObjectData.newObject(bugModel.FullId, bugModel.SpriteData.getTexture(), Color.White, bugModel.Name, bugModel.Description, bugModel.SpriteData.TileIndex, price: bugModel.Price, customType: typeof(Bug));
                //AssetData[bugData.sdvId] = bugModel.QuickItemDataString;
                Monitor.Log("Added: " + bugModel.Name + " id " + bugModel.FullId.ToString());
                Id--;
            }

            foreach (NetModel netModel in data.AllNets)
            {
                AllNets.AddOrReplace(netModel);
                //net.ParentSheetIndex = Id;

                CustomObjectData.newBigObject(netModel.FullId, netModel.getTexture(), Color.White, netModel.Name, netModel.Description, netModel.TileIndex, netModel.Name, false, 0, false, false, "Crafting -9", 0, -300, new CraftingData(netModel.Name, netModel.Recipe), typeof(BugNetTool));
                Log.info($"adding {netModel.FullId} with recipe {netModel.Recipe}");

                //CustomObjectData.newObject($"{netModel.FullId}.Tool", new BugNetTool(netModel).loadTexture(), Color.White, netModel.Name, netModel.Description, netModel.TileIndex, "", "Net", 1, -300, craftingData: new CraftingData($"{netModel.FullId}.Tool", netModel.Recipe), customType: typeof(BugNetTool));
            }

            //_helper.Data.WriteJsonFile("data\\bugs.json", AssetData);
            _helper.Events.GameLoop.UpdateTicked -= LoadCritters;
        }