コード例 #1
0
ファイル: ModEntry.cs プロジェクト: M3ales/ChestNaming
 private void ChangeNameExit(string s)
 {
     if (selectedLabelledChest != null)
     {
         selectedLabelledChest.ChestName = s;
     }
     else
     {
         if (selectedChest != null)
         {
             selectedLabelledChest = new LabelledChest(selectedChest.boundingBox.X, selectedChest.boundingBox.Y, s, Game1.player.currentLocation.Name);
             LabelledChests.Add(selectedLabelledChest);
         }
     }
     Game1.exitActiveMenu();
     SaveData(null, null);
 }
コード例 #2
0
ファイル: ModEntry.cs プロジェクト: M3ales/ChestNaming
 public bool CheckForLabelledChest(int xTile, int yTile, out Chest chest, out LabelledChest label)
 {
     chest = null;
     label = null;
     if (Game1.player == null || Game1.player.currentLocation == null)
     {
         return(false);
     }
     StardewValley.Object objectAtTile = Game1.player.currentLocation.getObjectAtTile(xTile, yTile);
     if (objectAtTile != null)
     {
         if (objectAtTile is Chest)
         {
             chest = (Chest)objectAtTile;
             if (chest.playerChest.Value)
             {
                 foreach (LabelledChest c in LabelledChests)
                 {
                     if (c.EqualsChest(chest))
                     {
                         label = c;
                         return(true);
                     }
                 }
                 return(true);
             }
             chest = null;
         }
     }
     else
     {
         objectAtTile = Game1.player.currentLocation.getObjectAtTile(xTile, yTile + 1);
         if (objectAtTile != null)
         {
             return(CheckForLabelledChest(xTile, yTile + 1, out chest, out label));
         }
     }
     return(false);
 }