/// <summary>Toggle a player profession.</summary> /// <param name="id">The profession ID.</param> /// <param name="enable">Whether to enable the profession (else disable).</param> /// <remarks>Derived from <see cref="LevelUpMenu.getImmediateProfessionPerk"/>.</remarks> private void SetProfession(int id, bool enable) { // skip if done if (enable == this.GetProfession(id)) { return; } // get health bonus for profession int healthBonus = id switch { Farmer.fighter => 15, Farmer.defender => 25, _ => 0 }; // apply Farmer player = Game1.player; if (enable) { player.maxHealth += healthBonus; player.health += healthBonus; player.professions.Add(id); } else { player.health -= healthBonus; player.maxHealth -= healthBonus; player.professions.Remove(id); } LevelUpMenu.RevalidateHealth(player); } }
private void InitMenu() { _leftProfessionDescription = LevelUpMenu.getProfessionDescription(_professionsToChoose[0]); _rightProfessionDescription = LevelUpMenu.getProfessionDescription(_professionsToChoose[1]); _leftProfessionColor = _oldProfessionId == _professionsToChoose[0] ? Color.Green : Game1.textColor; _rightProfessionColor = _oldProfessionId == _professionsToChoose[1] ? Color.Green : Game1.textColor; Game1.player.completelyStopAnimatingOrDoingAction(); Game1.player.freezePause = 100; height = 512; if (!Game1.options.SnappyMenus) { return; } var mouseHeight = (int)(height / 1.5); LeftProfession = new ClickableComponent(new Rectangle(xPositionOnScreen, yPositionOnScreen + 128, width / 2, mouseHeight), "") { myID = 102, rightNeighborID = 103 }; RightProfession = new ClickableComponent(new Rectangle(width / 2 + xPositionOnScreen, yPositionOnScreen + 128, width / 2, mouseHeight), "") { myID = 103, leftNeighborID = 102 }; populateClickableComponentList(); currentlySnappedComponent = LeftProfession; snapCursorToCurrentSnappedComponent(); }
public static bool Prefix(InventoryPage __instance, int x, int y) { var necklaceSlot = __instance.equipmentIcons.First(cc => cc.myID == 123450101); if (necklaceSlot.containsPoint(x, y)) { var necklaceItem = Game1.player.get_necklaceItem(); if (Game1.player.CursorSlotItem == null || Game1.player.CursorSlotItem is Necklace) { Item tmp = Mod.instance.Helper.Reflection.GetMethod(__instance, "takeHeldItem").Invoke <Item>(); Item held = necklaceItem.Value; if (held != null) { (held as Necklace).OnUnequip(Game1.player); } held = Utility.PerformSpecialItemGrabReplacement(held); Mod.instance.Helper.Reflection.GetMethod(__instance, "setHeldItem").Invoke(held); necklaceItem.Value = tmp; LevelUpMenu.RevalidateHealth(Game1.player); if (necklaceItem.Value != null) { (necklaceItem.Value as Necklace).OnEquip(Game1.player); Game1.playSound("crit"); } else if (Game1.player.CursorSlotItem != null) { Game1.playSound("dwop"); } } return(false); } return(true); }
public void AddMissingProfessions() { //Console.WriteLine("Adding new professions"); var professions = Game1.player.professions; List <List <int> > ProfessionsList = new List <List <int> > { FarmerLvlFive, FarmerLvlTen, FishingLvlFive, FishingLvlTen, ForagingLvlFive, ForagingLvlTen, MiningLvlFive, MiningLvlTen, CombatLvlFive, CombatLvlTen }; foreach (List <int> list in ProfessionsList) { //Console.WriteLine("iterating over lists"); if (professions.Intersect(list).Any()) { //Console.WriteLine("profession intersection found" + list.ToString()); foreach (int element in list) { //Console.WriteLine("checking element: " + element.ToString("g")); if (!professions.Contains(element)) { professions.Add(element); //Console.WriteLine("Adding profession number: " + element.ToString("g")); //adding in health bonuses that are a special case of LevelUpMenu.getImmediateProfessionPerk LevelUpMenu.getImmediateProfessionPerk(element); } } } } }
/// <summary>Raised after the game state is updated (≈60 times per second).</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void onUpdateTicked(object sender, UpdateTickedEventArgs e) { /* * if (Game1.isEating != wasEating) * { * Log.Async("Eating:" + Game1.isEating); * Log.Async(Game1.player.itemToEat + " " + ((Game1.player.itemToEat != null) ? Game1.player.itemToEat.getStack() : -1)); * Log.Async(Game1.player.ActiveObject + " " +( (Game1.player.ActiveObject != null) ? Game1.player.ActiveObject.getStack() : -1)); * } * wasEating = Game1.isEating; */ if (Game1.activeClickableMenu != null) { if (Game1.activeClickableMenu is GeodeMenu) { GeodeMenu menu = Game1.activeClickableMenu as GeodeMenu; if (menu.geodeSpot.item != null & !hadGeode) { gainLuckExp(10); } hadGeode = (menu.geodeSpot.item != null); } else if (Game1.activeClickableMenu is LevelUpMenu) { LevelUpMenu menu = Game1.activeClickableMenu as LevelUpMenu; int skill = Helper.Reflection.GetField <int>(menu, "currentSkill").GetValue(); if (skill == 5) { int level = Helper.Reflection.GetField <int>(menu, "currentLevel").GetValue(); Game1.activeClickableMenu = new LuckLevelUpMenu(skill, level); } } } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { /* * Determine the center of the screen. Initialize * the size of the window. */ m_graphics.PreferredBackBufferWidth = ScreenWidth; m_graphics.PreferredBackBufferHeight = ScreenHeight; m_graphics.ApplyChanges(); // GameManager initialization GameManager.Init(); AudioManager.Init(); // World initialization World.Init(); // User Interface initialization m_mainMenu = new MainMenu(); m_howToMenu = new HowToMenu(); m_optionsMenu = new OptionsMenu(); m_pauseMenu = new PauseMenu(); m_levelUpMenu = new LevelUpMenu(); m_gameOverMenu = new GameOverMenu(); // Effect Initialization _tvLines = new TvLines(GraphicsDevice); base.Initialize(); }
private void Awake() { LevelUpMenu = Canvas.GetComponent <LevelUpMenu>(); CurrentLevel = 1; CurrentLevelExp = 0; TotalExp = 0; ExpToNextLevel = 10; }
/// <summary>Reset all skills and professions for the local player.</summary> /// <param name="command">The console command.</param> /// <param name="args">The supplied arguments.</param> private void _ResetLocalPlayerProfessions(string command, string[] args) { Game1.player.FarmingLevel = 0; Game1.player.FishingLevel = 0; Game1.player.ForagingLevel = 0; Game1.player.MiningLevel = 0; Game1.player.CombatLevel = 0; Game1.player.newLevels.Clear(); Game1.player.professions.Clear(); LevelUpMenu.RevalidateHealth(Game1.player); }
public void OnLevelUpClick(Button button) { LevelUpMenu.SpendLevelUpPoints(); Player.LearnSpell(spellName); SpellButtons.CheckIfKnown(button); int buttonIndex = allSpellNames.IndexOf(spellName); Button castingButton = SpellButtons.GetAllCastingButtons() [buttonIndex]; SpellButtons.UpdateSpellSlots(castingButton); }
void Start() { menu = transform.parent.GetComponent <LevelUpMenu>(); #if UNITY_EDITOR if (charac == Characteristics.NbCharacteristics) { Debug.Log("charac = Characteristics.NbCharacteristics"); } #endif characLabel.text = Enum.GetName(charac.GetType(), charac); ResetValue(); }
public override void UpdateTextField() { string currentLevel = "Level " + player.GetLevel() + "!"; string levelProgress = "Level progress: " + player.GetExperience() + "/" + player.GetNextLevelXP(); if (player.GetLevel() >= player.GetMaxLevel()) { levelProgress = levelProgress + " Max level!"; } string availablePoints = "Available points: " + LevelUpMenu.GetLevelUpPoints(); textField.text = currentLevel + " " + levelProgress + " " + availablePoints; }
private void initLuckSkill(SkillsPage skills) { // Bunch of stuff from the constructor int num2 = 0; int num3 = skills.xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 * Game1.tileSize - Game1.pixelZoom; int num4 = skills.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth - Game1.pixelZoom * 3; for (int i = 4; i < 10; i += 5) { int j = 5; string text = ""; string text2 = ""; bool flag = false; int num5 = -1; flag = (Game1.player.LuckLevel > i); num5 = getLuckProfessionForSkill(i + 1); //Game1.player.getProfessionForSkill(5, i + 1); object[] args = new object[] { text, text2, LevelUpMenu.getProfessionDescription(num5) }; Helper.Reflection.GetMethod(skills, "parseProfessionDescription").Invoke(args); text = (string)args[0]; text2 = (string)args[1]; if (flag && (i + 1) % 5 == 0) { var skillBars = Helper.Reflection.GetField <List <ClickableTextureComponent> >(skills, "skillBars").GetValue(); skillBars.Add(new ClickableTextureComponent(string.Concat(num5), new Rectangle(num2 + num3 - Game1.pixelZoom + i * (Game1.tileSize / 2 + Game1.pixelZoom), num4 + j * (Game1.tileSize / 2 + Game1.pixelZoom * 6), 14 * Game1.pixelZoom, 9 * Game1.pixelZoom), null, text, Game1.mouseCursors, new Rectangle(159, 338, 14, 9), (float)Game1.pixelZoom, true)); } num2 += Game1.pixelZoom * 6; } int k = 5; int num6 = k; if (num6 == 1) { num6 = 3; } else if (num6 == 3) { num6 = 1; } string text3 = ""; if (Game1.player.LuckLevel > 0) { text3 = "Luck Increased"; } var skillAreas = Helper.Reflection.GetField <List <ClickableTextureComponent> >(skills, "skillAreas").GetValue(); skillAreas.Add(new ClickableTextureComponent(string.Concat(num6), new Rectangle(num3 - Game1.tileSize * 2 - Game1.tileSize * 3 / 4, num4 + k * (Game1.tileSize / 2 + Game1.pixelZoom * 6), Game1.tileSize * 2 + Game1.pixelZoom * 5, 9 * Game1.pixelZoom), string.Concat(num6), text3, null, Rectangle.Empty, 1f, false)); }
private static bool LevelUpMenu_draw_Prefix(LevelUpMenu __instance, SpriteBatch b) { List <CraftingRecipe> Recipes = Helper.GetHelper().Reflection.GetField <List <CraftingRecipe> >(__instance, "newCraftingRecipes").GetValue(); foreach (CraftingRecipe recipe in Recipes.ToList()) { if (IsModdedRecipe(recipe.name)) { Recipes.Remove(recipe); Recipes.Add(new CustomCraftingRecipe(recipe.name, false)); } } Helper.GetHelper().Reflection.GetField <List <CraftingRecipe> >(__instance, "newCraftingRecipes").SetValue(Recipes); return(true); }
/// <summary>Raised after a player's skill level changes.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> public override void OnLevelChanged(object sender, LevelChangedEventArgs e) { if (!e.IsLocalPlayer || e.NewLevel != 0) { return; } // ensure immediate perks get removed on skill reset var first = (int)e.Skill * 6; var last = first + 5; for (var profession = first; profession <= last; ++profession) { LevelUpMenu.removeImmediateProfessionPerk(profession); } }
public void LevelUp() { if (level < maxLevel) { level++; if (level < maxLevel) { nextLevel = levels[level]; } LevelUpMenu.GainLevelUpPoint(); ac = currentMaxAC; StartCoroutine(ShowLevelUpStuff()); } }
private void OnLevelUp(LevelUpMenu levelUpMenu) { var overHeight = (levelUpMenu.height + Game1.tileSize) - Game1.viewport.Height; if (overHeight <= 0) { return; } var newCraftingRecipes = levelUpMenu.GetField <List <CraftingRecipe> >("newCraftingRecipes"); var leftRecipes = newCraftingRecipes.Count; for (var i = leftRecipes - 1; i >= 0; --i) { overHeight -= (newCraftingRecipes[i].bigCraftable? 2 : 1) * Game1.tileSize; --leftRecipes; if (overHeight <= 0) { break; } } var copy = newCraftingRecipes.ToList(); newCraftingRecipes.Clear(); newCraftingRecipes.AddRange(copy.Take(leftRecipes)); var textRecipes = copy.Skip(leftRecipes).Select(r => r.name).ToList(); var extraInfo = $"New recipes for {string.Join(", ", textRecipes)}"; var extraInfoForLevel = levelUpMenu.GetField <List <string> >("extraInfoForLevel"); extraInfoForLevel.Add(extraInfo); overHeight += Game1.tileSize * 3 / 4; var textWidth = Game1.smallFont.MeasureString(extraInfo).X; var calcWidth = (int)Math.Min(Game1.viewport.Width - 3 * Game1.tileSize - 2 * IClickableMenu.borderWidth, textWidth + 2 * IClickableMenu.borderWidth); if (textWidth > levelUpMenu.width) { levelUpMenu.width = calcWidth; } levelUpMenu.height = Game1.viewport.Height - Game1.tileSize + overHeight; levelUpMenu.gameWindowSizeChanged(Rectangle.Empty, Rectangle.Empty); }
/// <summary>Raised after the game state is updated (≈60 times per second).</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void onUpdateTicked(object sender, UpdateTickedEventArgs e) { /* * if (Game1.isEating != wasEating) * { * Log.Async("Eating:" + Game1.isEating); * Log.Async(Game1.player.itemToEat + " " + ((Game1.player.itemToEat != null) ? Game1.player.itemToEat.getStack() : -1)); * Log.Async(Game1.player.ActiveObject + " " +( (Game1.player.ActiveObject != null) ? Game1.player.ActiveObject.getStack() : -1)); * } * wasEating = Game1.isEating; */ if (Game1.activeClickableMenu != null) { if (Game1.activeClickableMenu is GeodeMenu) { GeodeMenu menu = Game1.activeClickableMenu as GeodeMenu; if (menu.geodeSpot.item != null & !hadGeode) { gainLuckExp(10); } hadGeode = (menu.geodeSpot.item != null); } else if (Game1.activeClickableMenu is LevelUpMenu) { LevelUpMenu menu = Game1.activeClickableMenu as LevelUpMenu; int skill = (int)Util.GetInstanceField(typeof(LevelUpMenu), menu, "currentSkill"); if (skill == 5) { int level = (int)Util.GetInstanceField(typeof(LevelUpMenu), menu, "currentLevel"); Game1.activeClickableMenu = new LuckLevelUpMenu(skill, level); } } } // This can't just do when it toggles the variables get modified if (Game1.newDay && Game1.fadeToBlackAlpha > 0.95f) { cacheLevels = Game1.player.newLevels.ToList(); cacheItems = Game1.getFarm().shippingBin.ToList(); } }
protected override void AdditionalSetUp() { healthUpgradeParent = transform.Find(healthUpgradePath); armorUpgradeParent = transform.Find(armorUpgradePath); doneParent = transform.Find(donePath); titleParent = transform.Find(titlePath); levelUpMenu = GetComponent <LevelUpMenu> (); GameObject playerGameObj = GameObject.Find(Game.playerTag); if (playerGameObj != null) { player = playerGameObj.GetComponent <Player> (); } else { Debug.Log("no player object?"); } }
// Use this for initialization void Start() { myKeys.Add("Forward", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Forward", "W"))); myKeys.Add("Backward", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Backward", "S"))); myKeys.Add("Left", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Left", "A"))); myKeys.Add("Right", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Right", "D"))); myKeys.Add("Jump", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Jump", "Space"))); myKeys.Add("Crouch", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Crouch", "LeftControl"))); myKeys.Add("Sprint", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Sprint", "LeftShift"))); myKeys.Add("Interact", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Interact", "E"))); forwardTxt.text = myKeys["Forward"].ToString(); backwardTxt.text = myKeys["Backward"].ToString(); leftTxt.text = myKeys["Left"].ToString(); rightTxt.text = myKeys["Right"].ToString(); jumpTxt.text = myKeys["Jump"].ToString(); crouchTxt.text = myKeys["Crouch"].ToString(); sprintTxt.text = myKeys["Sprint"].ToString(); interactTxt.text = myKeys["Interact"].ToString(); levelUpMenu = GameObject.FindGameObjectWithTag("Player").GetComponent <LevelUpMenu>(); Time.timeScale = 1; }
//set max health to 100 //set current health to max //make sure player is alive //max exp starts at 60 //connect the Character Controller to the controller variable private void Start() { stats = new string[] { "Strength", "Dexterity", "Charisma", "Constitution", "Intelligence", "Wisdom" }; //get stats from player prefs and get hp, mp and stam values from them SetStats(); SetStatValues(); //set current hp to max hp, same with damage and stamina and mana etc currentHP = maxHP - 5; damageHP = currentHP; currentStamina = maxStamina; currentMana = maxMana; isAlive = true; maxExp = PlayerPrefs.GetInt("MaxExp", 60); currentExp = PlayerPrefs.GetFloat("CurrentExp", 0f); playerLvl = PlayerPrefs.GetInt("CharacterLevel", 0); playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterController>(); //level up must be attached to the player levelUpMenu = GetComponent <LevelUpMenu>(); }
public NewSkillsPage(int x, int y, int width, int height) : base(x, y, width, height, false) { int x1 = this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 80; int y1 = this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + (int)((double)height / 2.0) + 80; this.playerPanel = new Rectangle(this.xPositionOnScreen + 64, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder, 128, 192); if (Game1.player.canUnderstandDwarves) { List <ClickableTextureComponent> specialItems = this.specialItems; ClickableTextureComponent textureComponent = new ClickableTextureComponent("", new Rectangle(x1 + WALLET_MOVE_X, y1 + WALLET_MOVE_Y, 64, 64), (string)null, Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11587"), Game1.mouseCursors, new Rectangle(129, 320, 16, 16), 4f, true); textureComponent.myID = 10201; textureComponent.rightNeighborID = 10202; textureComponent.upNeighborID = 4; specialItems.Add(textureComponent); } if (Game1.player.hasRustyKey) { List <ClickableTextureComponent> specialItems = this.specialItems; ClickableTextureComponent textureComponent = new ClickableTextureComponent("", new Rectangle(x1 + 68 + WALLET_MOVE_X, y1 + WALLET_MOVE_Y, 64, 64), (string)null, Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11588"), Game1.mouseCursors, new Rectangle(145, 320, 16, 16), 4f, true); textureComponent.myID = 10202; textureComponent.rightNeighborID = 10203; textureComponent.leftNeighborID = 10201; textureComponent.upNeighborID = 4; specialItems.Add(textureComponent); } if (Game1.player.hasClubCard) { List <ClickableTextureComponent> specialItems = this.specialItems; ClickableTextureComponent textureComponent = new ClickableTextureComponent("", new Rectangle(x1 + 136 + WALLET_MOVE_X, y1 + WALLET_MOVE_Y, 64, 64), (string)null, Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11589"), Game1.mouseCursors, new Rectangle(161, 320, 16, 16), 4f, true); textureComponent.myID = 10203; textureComponent.rightNeighborID = 10204; textureComponent.leftNeighborID = 10202; textureComponent.upNeighborID = 4; specialItems.Add(textureComponent); } if (Game1.player.hasSpecialCharm) { List <ClickableTextureComponent> specialItems = this.specialItems; ClickableTextureComponent textureComponent = new ClickableTextureComponent("", new Rectangle(x1 + 204 + WALLET_MOVE_X, y1 + WALLET_MOVE_Y, 64, 64), (string)null, Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11590"), Game1.mouseCursors, new Rectangle(176, 320, 16, 16), 4f, true); textureComponent.myID = 10204; textureComponent.rightNeighborID = 10205; textureComponent.leftNeighborID = 10203; textureComponent.upNeighborID = 4; specialItems.Add(textureComponent); } if (Game1.player.hasSkullKey) { List <ClickableTextureComponent> specialItems = this.specialItems; ClickableTextureComponent textureComponent = new ClickableTextureComponent("", new Rectangle(x1 + 272 + WALLET_MOVE_X, y1 + WALLET_MOVE_Y, 64, 64), (string)null, Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11591"), Game1.mouseCursors, new Rectangle(192, 320, 16, 16), 4f, true); textureComponent.myID = 10205; textureComponent.rightNeighborID = 10206; textureComponent.leftNeighborID = 10204; textureComponent.upNeighborID = 4; specialItems.Add(textureComponent); } if (Game1.player.hasMagnifyingGlass) { List <ClickableTextureComponent> specialItems = this.specialItems; ClickableTextureComponent textureComponent = new ClickableTextureComponent("", new Rectangle(x1 + 340 + WALLET_MOVE_X, y1 + WALLET_MOVE_Y, 64, 64), (string)null, Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.magnifyingglass"), Game1.mouseCursors, new Rectangle(208, 320, 16, 16), 4f, true); textureComponent.myID = 10205; textureComponent.rightNeighborID = 10206; textureComponent.leftNeighborID = 10204; textureComponent.upNeighborID = 4; specialItems.Add(textureComponent); } if (Game1.player.hasDarkTalisman) { List <ClickableTextureComponent> specialItems = this.specialItems; ClickableTextureComponent textureComponent = new ClickableTextureComponent("", new Rectangle(x1 + 408 + WALLET_MOVE_X, y1 + WALLET_MOVE_Y, 64, 64), (string)null, Game1.content.LoadString("Strings\\Objects:DarkTalisman"), Game1.mouseCursors, new Rectangle(225, 320, 16, 16), 4f, true); textureComponent.myID = 10206; textureComponent.rightNeighborID = 10207; textureComponent.leftNeighborID = 10205; textureComponent.upNeighborID = 4; specialItems.Add(textureComponent); } if (Game1.player.hasMagicInk) { List <ClickableTextureComponent> specialItems = this.specialItems; ClickableTextureComponent textureComponent = new ClickableTextureComponent("", new Rectangle(x1 + 476 + WALLET_MOVE_X, y1 + WALLET_MOVE_Y, 64, 64), (string)null, Game1.content.LoadString("Strings\\Objects:MagicInk"), Game1.mouseCursors, new Rectangle(241, 320, 16, 16), 4f, true); textureComponent.myID = 10207; textureComponent.leftNeighborID = 10206; textureComponent.upNeighborID = 4; specialItems.Add(textureComponent); } if (Game1.player.eventsSeen.Contains(2120303)) { List <ClickableTextureComponent> specialItems = this.specialItems; ClickableTextureComponent textureComponent = new ClickableTextureComponent("", new Rectangle(x1 + 544 + WALLET_MOVE_X, y1 + WALLET_MOVE_Y, 64, 64), (string)null, Game1.content.LoadString("Strings\\Objects:BearPaw"), Game1.mouseCursors, new Rectangle(192, 336, 16, 16), 4f, true); textureComponent.myID = 10208; textureComponent.leftNeighborID = 10207; textureComponent.upNeighborID = 4; specialItems.Add(textureComponent); } if (Game1.player.eventsSeen.Contains(3910979)) { List <ClickableTextureComponent> specialItems = this.specialItems; ClickableTextureComponent textureComponent = new ClickableTextureComponent("", new Rectangle(x1 + 612 + WALLET_MOVE_X, y1 + WALLET_MOVE_Y, 64, 64), (string)null, Game1.content.LoadString("Strings\\Objects:SpringOnionBugs"), Game1.mouseCursors, new Rectangle(208, 336, 16, 16), 4f, true); textureComponent.myID = 10209; textureComponent.leftNeighborID = 10208; textureComponent.upNeighborID = 4; specialItems.Add(textureComponent); } int num1 = 0; int num2 = LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ru ? this.xPositionOnScreen + width - 448 - 48 + 4 : this.xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 256 - 4; int num3 = this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth - 12; int num4 = 4; while (num4 < 10) { for (int index = 0; index < (SpaceCore.instance.Helper.ModRegistry.IsLoaded("spacechase0.LuckSkill") ? 6 : 5); ++index) { string professionBlurb = ""; string professionTitle = ""; bool flag = false; int whichProfession = -1; switch (index) { case 0: flag = Game1.player.FarmingLevel > num4; whichProfession = Game1.player.getProfessionForSkill(0, num4 + 1); this.parseProfessionDescription(ref professionBlurb, ref professionTitle, LevelUpMenu.getProfessionDescription(whichProfession)); break; case 1: flag = Game1.player.MiningLevel > num4; whichProfession = Game1.player.getProfessionForSkill(3, num4 + 1); this.parseProfessionDescription(ref professionBlurb, ref professionTitle, LevelUpMenu.getProfessionDescription(whichProfession)); break; case 2: flag = Game1.player.ForagingLevel > num4; whichProfession = Game1.player.getProfessionForSkill(2, num4 + 1); this.parseProfessionDescription(ref professionBlurb, ref professionTitle, LevelUpMenu.getProfessionDescription(whichProfession)); break; case 3: flag = Game1.player.FishingLevel > num4; whichProfession = Game1.player.getProfessionForSkill(1, num4 + 1); this.parseProfessionDescription(ref professionBlurb, ref professionTitle, LevelUpMenu.getProfessionDescription(whichProfession)); break; case 4: flag = Game1.player.CombatLevel > num4; whichProfession = Game1.player.getProfessionForSkill(4, num4 + 1); this.parseProfessionDescription(ref professionBlurb, ref professionTitle, LevelUpMenu.getProfessionDescription(whichProfession)); break; case 5: flag = Game1.player.LuckLevel > num4; whichProfession = Game1.player.getProfessionForSkill(5, num4 + 1); this.parseProfessionDescription(ref professionBlurb, ref professionTitle, LevelUpMenu.getProfessionDescription(whichProfession)); break; } if (flag && (num4 + 1) % 5 == 0) { List <ClickableTextureComponent> skillBars = this.skillBars; ClickableTextureComponent textureComponent = new ClickableTextureComponent(string.Concat((object)whichProfession), new Rectangle(num1 + num2 - 4 + num4 * 36, num3 + index * 56, 56, 36), (string)null, professionBlurb, Game1.mouseCursors, new Rectangle(159, 338, 14, 9), 4f, true); textureComponent.myID = num4 + 1 == 5 ? 100 + index : 200 + index; textureComponent.leftNeighborID = num4 + 1 == 5 ? index : 100 + index; textureComponent.rightNeighborID = num4 + 1 == 5 ? 200 + index : -1; textureComponent.downNeighborID = 10201; skillBars.Add(textureComponent); } } num1 += 24; num4 += 5; } ////////////////////////////////// num1 = 0; num4 = 4; while (num4 < 10) { int index_ = SpaceCore.instance.Helper.ModRegistry.IsLoaded("spacechase0.LuckSkill") ? 6 : 5; foreach (var skillName in Skills.GetSkillList()) { var skill = Skills.GetSkill(skillName); string professionBlurb = ""; string professionTitle = ""; bool flag = false; Skills.Skill.Profession whichProfession = null; flag = Game1.player.GetCustomSkillLevel(skill) > num4; whichProfession = Skills.getProfessionFor(skill, num4 + 1);// Game1.player.getProfessionForSkill(0, num4 + 1); var profLines = new List <string>(); if (whichProfession != null) { profLines.Add(whichProfession.Name); profLines.AddRange(whichProfession.Description.Split('\n')); } this.parseProfessionDescription(ref professionBlurb, ref professionTitle, profLines); if (flag && (num4 + 1) % 5 == 0 && whichProfession != null) { List <ClickableTextureComponent> skillBars = this.skillBars; ClickableTextureComponent textureComponent = new ClickableTextureComponent("C" + whichProfession.Name, new Rectangle(num1 + num2 - 4 + num4 * 36, num3 + index_ * 56, 56, 36), (string)null, professionBlurb, Game1.mouseCursors, new Rectangle(159, 338, 14, 9), 4f, true); textureComponent.myID = num4 + 1 == 5 ? 100 + index_ : 200 + index_; textureComponent.leftNeighborID = num4 + 1 == 5 ? index_ : 100 + index_; textureComponent.rightNeighborID = num4 + 1 == 5 ? 200 + index_ : -1; textureComponent.downNeighborID = 10201; skillBars.Add(textureComponent); } ++index_; } num1 += 24; num4 += 5; } ////////////////////////////////// for (int index = 0; index < this.skillBars.Count; ++index) { if (index < this.skillBars.Count - 1 && Math.Abs(this.skillBars[index + 1].myID - this.skillBars[index].myID) < 50) { this.skillBars[index].downNeighborID = this.skillBars[index + 1].myID; this.skillBars[index + 1].upNeighborID = this.skillBars[index].myID; } } if (this.skillBars.Count > 1 && this.skillBars.Last <ClickableTextureComponent>().myID >= 200 && this.skillBars[this.skillBars.Count - 2].myID >= 200) { this.skillBars.Last <ClickableTextureComponent>().upNeighborID = this.skillBars[this.skillBars.Count - 2].myID; } for (int index = 0; index < (SpaceCore.instance.Helper.ModRegistry.IsLoaded("spacechase0.LuckSkill") ? 6 : 5); ++index) { int num5 = index; switch (num5) { case 1: num5 = 3; break; case 3: num5 = 1; break; } string hoverText = ""; switch (num5) { case 0: if (Game1.player.FarmingLevel > 0) { hoverText = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11592", (object)Game1.player.FarmingLevel) + Environment.NewLine + Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11594", (object)Game1.player.FarmingLevel); break; } break; case 1: if (Game1.player.FishingLevel > 0) { hoverText = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11598", (object)Game1.player.FishingLevel); break; } break; case 2: if (Game1.player.ForagingLevel > 0) { hoverText = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11596", (object)Game1.player.ForagingLevel); break; } break; case 3: if (Game1.player.MiningLevel > 0) { hoverText = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11600", (object)Game1.player.MiningLevel); break; } break; case 4: if (Game1.player.CombatLevel > 0) { hoverText = Game1.content.LoadString("Strings\\StringsFromCSFiles:SkillsPage.cs.11602", (object)(Game1.player.CombatLevel * 5)); break; } break; } List <ClickableTextureComponent> skillAreas = this.skillAreas; ClickableTextureComponent textureComponent = new ClickableTextureComponent(string.Concat((object)num5), new Rectangle(num2 - 128 - 48, num3 + index * 56, 148, 36), string.Concat((object)num5), hoverText, (Texture2D)null, Rectangle.Empty, 1f, false); textureComponent.myID = index; textureComponent.downNeighborID = index < 4 ? index + 1 : 10201; textureComponent.upNeighborID = index > 0 ? index - 1 : 12341; textureComponent.rightNeighborID = 100 + index; skillAreas.Add(textureComponent); } ////////////////////////////////// int index__ = (SpaceCore.instance.Helper.ModRegistry.IsLoaded("spacechase0.LuckSkill") ? 6 : 5); foreach (var skillName in Skills.GetSkillList()) { var skill = Skills.GetSkill(skillName); int num5 = index__; switch (num5) { case 1: num5 = 3; break; case 3: num5 = 1; break; } string hoverText = ""; if (Game1.player.GetCustomSkillLevel(skill) > 0) { hoverText = skill.GetSkillPageHoverText(Game1.player.GetCustomSkillLevel(skill)); } List <ClickableTextureComponent> skillAreas = this.skillAreas; ClickableTextureComponent textureComponent = new ClickableTextureComponent("C" + skill.Name, new Rectangle(num2 - 128 - 48, num3 + index__ * 56, 148, 36), string.Concat((object)num5), hoverText, (Texture2D)null, Rectangle.Empty, 1f, false); textureComponent.myID = index__; textureComponent.downNeighborID = index__ < 4 ? index__ + 1 : 10201; textureComponent.upNeighborID = index__ > 0 ? index__ - 1 : 12341; textureComponent.rightNeighborID = 100 + index__; skillAreas.Add(textureComponent); ++index__; } ////////////////////////////////// }
public override void performHoverAction(int x, int y) { this.hoverText = ""; this.hoverTitle = ""; this.professionImage = -1; foreach (ClickableTextureComponent specialItem in this.specialItems) { if (specialItem.containsPoint(x, y)) { this.hoverText = specialItem.hoverText; break; } } foreach (ClickableTextureComponent skillBar in this.skillBars) { skillBar.scale = 4f; if (skillBar.containsPoint(x, y) && skillBar.hoverText.Length > 0 && !skillBar.name.Equals("-1")) { this.hoverText = skillBar.hoverText; this.hoverTitle = skillBar.name.StartsWith("C") ? skillBar.name.Substring(1) : LevelUpMenu.getProfessionTitleFromNumber(Convert.ToInt32(skillBar.name)); this.professionImage = skillBar.name.StartsWith("C") ? 0 : Convert.ToInt32(skillBar.name); skillBar.scale = 0.0f; } } foreach (ClickableTextureComponent skillArea in this.skillAreas) { if (skillArea.containsPoint(x, y) && skillArea.hoverText.Length > 0) { this.hoverText = skillArea.hoverText; this.hoverTitle = skillArea.name.StartsWith("C") ? skillArea.name.Substring(1) : Farmer.getSkillDisplayNameFromIndex(Convert.ToInt32(skillArea.name)); break; } } if (this.playerPanel.Contains(x, y)) { this.playerPanelTimer -= Game1.currentGameTime.ElapsedGameTime.Milliseconds; if (this.playerPanelTimer > 0) { return; } this.playerPanelIndex = (this.playerPanelIndex + 1) % 4; this.playerPanelTimer = 150; } else { this.playerPanelIndex = 0; } }
// Start is called before the first frame update void Start() { levelUpMenu = GetComponentInParent <LevelUpMenu>(); hoverSelectors = transform.Find("HoverSelectors").gameObject; hoverSelectors.SetActive(false); }
internal static void LevelUpMenuPatch(LevelUpMenu __instance, List <int> ___professionsToChoose, List <string> ___leftProfessionDescription, List <string> ___rightProfessionDescription, List <string> ___extraInfoForLevel, List <CraftingRecipe> ___newCraftingRecipes, string ___title, bool ___isActive, bool ___isProfessionChooser) { try { int x = Game1.getMouseX(true), y = Game1.getMouseY(true); string leftProfession = " ", rightProfession = " ", extraInfo = " ", newCraftingRecipe = " ", toSpeak = " "; if (!__instance.informationUp) { return; } if (__instance.isProfessionChooser) { if (___professionsToChoose.Count() == 0) { return; } for (int j = 0; j < ___leftProfessionDescription.Count; j++) { leftProfession += ___leftProfessionDescription[j] + ", "; } for (int i = 0; i < ___rightProfessionDescription.Count; i++) { rightProfession += ___rightProfessionDescription[i] + ", "; } if (__instance.leftProfession.containsPoint(x, y)) { if ((MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed()) && __instance.readyToClose()) { Game1.player.professions.Add(___professionsToChoose[0]); __instance.getImmediateProfessionPerk(___professionsToChoose[0]); ___isActive = false; __instance.informationUp = false; ___isProfessionChooser = false; __instance.RemoveLevelFromLevelList(); __instance.exitThisMenu(); return; } toSpeak = $"Selected: {leftProfession} Left click to choose."; } if (__instance.rightProfession.containsPoint(x, y)) { if ((MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed()) && __instance.readyToClose()) { Game1.player.professions.Add(___professionsToChoose[1]); __instance.getImmediateProfessionPerk(___professionsToChoose[1]); ___isActive = false; __instance.informationUp = false; ___isProfessionChooser = false; __instance.RemoveLevelFromLevelList(); __instance.exitThisMenu(); return; } toSpeak = $"Selected: {rightProfession} Left click to choose."; } } else { foreach (string s2 in ___extraInfoForLevel) { extraInfo += s2 + ", "; } foreach (CraftingRecipe s in ___newCraftingRecipes) { string cookingOrCrafting = Game1.content.LoadString("Strings\\UI:LearnedRecipe_" + (s.isCookingRecipe ? "cooking" : "crafting")); string message = Game1.content.LoadString("Strings\\UI:LevelUp_NewRecipe", cookingOrCrafting, s.DisplayName); newCraftingRecipe += $"{message}, "; } } if (__instance.okButton.containsPoint(x, y)) { if (MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed()) { __instance.okButtonClicked(); } toSpeak = $"{___title} {extraInfo} {newCraftingRecipe}. Left click to close."; } if (toSpeak != " ") { MainClass.ScreenReader.SayWithMenuChecker(toSpeak, true); } else if (__instance.isProfessionChooser && currentLevelUpTitle != $"{___title}. Select a new profession.") { MainClass.ScreenReader.SayWithMenuChecker($"{___title}. Select a new profession.", true); currentLevelUpTitle = $"{___title}. Select a new profession."; } } catch (Exception e) { MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } }
private void Awake() { S = this; }
// Use this for initialization void Start() { Time.timeScale = 1; //sets the time scale to 1, so the game runs at 'regular' speed levelUpMenu = GameObject.FindGameObjectWithTag("Player").GetComponent <LevelUpMenu>(); }
public LevelUpMenu() { _instance = this; }
/// <inheritdoc/> public override void OnDayStarted(object sender, DayStartedEventArgs e) { AwesomeProfessions.EventManager.SubscribeMissingEvents(); AwesomeProfessions.EventManager.CleanUpRogueEvents(); LevelUpMenu.RevalidateHealth(Game1.player); }