Ejemplo n.º 1
0
        private void VanillaRegistrations()
        {
            var fdict = _content.Load <Dictionary <int, string> >("Data\\Furniture");

            _furnitureDefaultDesc = _content.LoadString("Strings\\StringsFromCSFiles:Furniture.cs.12623");
            foreach (var i in fdict.Keys)
            {
                var plac = Placeable.ParseFromFurnitureString(fdict[i], _furnitureDefaultDesc);
                if (plac.IsError())
                {
                    GemfruitMod.Logger.Log(LogLevel.Error, "PlaceableRegistry", plac.UnwrapError().Message);
                }
                else
                {
                    var val = plac.Unwrap();
                    var r   = val.Rect;
                    r.Location = VanillaSpritesheetHelper.FurnitureIdToLocation(i);
                    val.AssignSpriteSheetReference(new ResourceKey("TileSheets\\furniture"), r);

                    val.Key = new ResourceKey(StringUtility.SanitizeName(val.Name));
                    if (_dictionary.ContainsKey(val.Key))
                    {
                        val.Key = new ResourceKey(StringUtility.SanitizeName(val.Name) + "_" + i);
                    }

                    Register(val.Key, val);
                }
            }

            var cdict = _content.Load <Dictionary <int, string> >("Data\\BigCraftablesInformation");

            foreach (var i in cdict.Keys)
            {
                var plac = Placeable.ParseFromBigCraftableString(cdict[i]);
                if (plac.IsError())
                {
                    GemfruitMod.Logger.Log(LogLevel.Error, "PlaceableRegistry", plac.UnwrapError().Message);
                }
                else
                {
                    var val = plac.Unwrap();
                    var r   = val.Rect;
                    r.Location = VanillaSpritesheetHelper.CraftableIdToLocation(i);
                    val.AssignSpriteSheetReference(new ResourceKey("TileSheets\\Craftables"), r);

                    val.Key = new ResourceKey(StringUtility.SanitizeName(val.Name));
                    if (_dictionary.ContainsKey(val.Key))
                    {
                        val.Key = new ResourceKey(StringUtility.SanitizeName(val.Name) + "_" + i);
                    }

                    Register(val.Key, val);
                }
            }
        }
Ejemplo n.º 2
0
        public void robinConstructionMessage()
        {
            this.exitThisMenu(true);
            Game1.player.forceCanMove();
            if (this.magicalConstruction)
            {
                return;
            }
            string str1 = "Data\\ExtraDialogue:Robin_" + (this.upgrading ? "Upgrade" : "New") + "Construction";

            if (Utility.isFestivalDay(Game1.dayOfMonth + 1, Game1.currentSeason))
            {
                str1 += "_Festival";
            }
            NPC characterFromName           = Game1.getCharacterFromName("Robin", false);
            LocalizedContentManager content = Game1.content;
            string path = str1;

            object[] objArray = new object[2]
            {
                (object)(LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.de ? this.CurrentBlueprint.displayName : this.CurrentBlueprint.displayName.ToLower()),
                null
            };
            int    index = 1;
            string str2;

            if (LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.de)
            {
                if (LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.pt && LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.es)
                {
                    str2 = ((IEnumerable <string>) this.CurrentBlueprint.displayName.ToLower().Split(' ')).Last <string>();
                }
                else
                {
                    str2 = ((IEnumerable <string>) this.CurrentBlueprint.displayName.ToLower().Split(' ')).First <string>();
                }
            }
            else
            {
                str2 = ((IEnumerable <string>)((IEnumerable <string>) this.CurrentBlueprint.displayName.Split(' ')).Last <string>().Split('-')).Last <string>();
            }
            objArray[index] = (object)str2;
            string dialogue = content.LoadString(path, objArray);

            Game1.drawDialogue(characterFromName, dialogue);
        }
Ejemplo n.º 3
0
        public new void robinConstructionMessage()
        {
            this.exitThisMenu(true);
            Game1.player.forceCanMove();
            if (this.magicalConstruction)
            {
                return;
            }
            string str1 = "Data\\ExtraDialogue:Robin_" + (this.upgrading ? "Upgrade" : "New") + "Construction";

            if (Utility.isFestivalDay(Game1.dayOfMonth + 1, Game1.currentSeason))
            {
                str1 += "_Festival";
            }
            if (this.CurrentBlueprint.daysToConstruct <= 0)
            {
                Game1.drawDialogue(Game1.getCharacterFromName("Robin", false), Game1.content.LoadString("Data\\ExtraDialogue:Robin_Instant", LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.de ? (object)this.CurrentBlueprint.displayName : (object)this.CurrentBlueprint.displayName.ToLower()));
            }
            else
            {
                NPC characterFromName           = Game1.getCharacterFromName("Robin", false);
                LocalizedContentManager content = Game1.content;
                string path = str1;
                string str2 = LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.de ? this.CurrentBlueprint.displayName : this.CurrentBlueprint.displayName.ToLower();
                string str3;
                switch (LocalizedContentManager.CurrentLanguageCode)
                {
                case LocalizedContentManager.LanguageCode.pt:
                case LocalizedContentManager.LanguageCode.es:
                    str3 = ((IEnumerable <string>) this.CurrentBlueprint.displayName.ToLower().Split(' ')).First <string>();
                    break;

                case LocalizedContentManager.LanguageCode.de:
                    str3 = ((IEnumerable <string>)((IEnumerable <string>) this.CurrentBlueprint.displayName.Split(' ')).Last <string>().Split('-')).Last <string>();
                    break;

                default:
                    str3 = ((IEnumerable <string>) this.CurrentBlueprint.displayName.ToLower().Split(' ')).Last <string>();
                    break;
                }
                string dialogue = content.LoadString(path, (object)str2, (object)str3);
                Game1.drawDialogue(characterFromName, dialogue);
            }
        }