/// <summary>
    /// Creates a new HeroParty with the given name.
    /// </summary>
    /// <param name="partyName">The (unique) name of the HeroParty to create.</param>
    /// <returns>True if the HeroParty was created, false if a HeroParty with the given name already exists.</returns>
    public bool CreateHeroParty(string partyName)
    {
        bool createdNewParty = false;

        if (!heroParties.ContainsKey(partyName))
        {
			HeroParty newParty = new HeroParty();
			newParty.OnHeroDied += HandleOnHeroDied;
            heroParties.Add(partyName, newParty);
            createdNewParty = true;

            Debug.Log("Created a new Hero Party named " + partyName);
        }

        return createdNewParty;
    }
Пример #2
0
 public FocusPanel GetFocusPanelByHeroParty(HeroParty heroParty)
 {
     foreach (FocusPanel focusPanel in GetComponentsInChildren <FocusPanel>())
     {
         // verify if there is focused object
         if (focusPanel.focusedObject)
         {
             // verify if there is link party unit UI
             if (focusPanel.focusedObject.GetComponent <PartyUnitUI>())
             {
                 // verify if party unit UI has linked party Unit
                 if (focusPanel.focusedObject.GetComponent <PartyUnitUI>().LPartyUnit)
                 {
                     // verify if HeroParty linked to focus panel is the same as we are searching for
                     if (focusPanel.focusedObject.GetComponent <PartyUnitUI>().LPartyUnit.GetComponentInParent <HeroParty>().gameObject.GetInstanceID() == heroParty.gameObject.GetInstanceID())
                     {
                         return(focusPanel);
                     }
                 }
             }
         }
     }
     return(null);
 }
Пример #3
0
 public void SetHeroParty(HeroParty hero_party)
 {
     HeroUnitListUIDisplay.hero_party = hero_party;
 }
Пример #4
0
 public override void SetPlayerParty(HeroParty party)
 {
     player_party = party;
 }
 public override ValidationResult DoDiscardModifierInContextOf(System.Object context)
 {
     // verify if context doesn't match requirements of this limiter
     if (!DoesContextMatch(context))
     {
         // context is not in scope of this limiter
         // don't limit
         return(ValidationResult.Pass());
     }
     // verify if context matches battle context
     if (context is BattleContext)
     {
         // get source hero party
         HeroParty sourceParty = BattleContext.ActivePartyUnitUI.GetComponentInParent <HeroPartyUI>().LHeroParty;
         // get destination hero party
         HeroParty destinationParty = BattleContext.DestinationUnitSlot.GetComponentInParent <HeroPartyUI>().LHeroParty;
         // verify if we need to discard modifier
         //return DoDiscardModifierInContextOf(sourceParty, destinationParty);
         return(MatchRelationsBetweenParties(sourceParty, destinationParty));
     }
     // verify if context matches battle context
     if (context is EditPartyScreenContext)
     {
         // verify if relationships match same faction
         // we assume that when edit party screen is active, then all units have the same faction
         if (MatchRelations(Relationships.State.SameFaction))
         {
             // don't limit
             return(ValidationResult.Pass());
         }
         //// loop through all required relationships
         //foreach (Relationships.State relation in requiredAnyOfRelationships)
         //{
         //    // verify if relationships match same faction
         //    // we assume that when edit party screen is active, then all units have the same faction
         //    if (relation == Relationships.State.SameFaction)
         //    {
         //        // don't limit
         //        return ValidationResult.Pass();
         //    }
         //}
         // if none of required relations match then limit modifier
         return(ValidationResult.Discard(onDiscardMessage));
     }
     // verify if context matches party unit propagation context
     if (context is PartyUnitPropagationContext)
     {
         // Get propagation context
         PartyUnitPropagationContext propagationContext = (PartyUnitPropagationContext)context;
         // get item owner party
         HeroParty itemOwnerParty = propagationContext.SourcePartyUnit.GetComponentInParent <HeroParty>();
         // get destination unit party
         HeroParty destinationUnitParty = propagationContext.DestinationPartyUnit.GetComponentInParent <HeroParty>();
         // return result of relations match
         return(MatchRelationsBetweenParties(itemOwnerParty, destinationUnitParty));
     }
     // verify if context matches city propagation context
     if (context is CityPropagationContext)
     {
         // Get propagation context
         CityPropagationContext propagationContext = (CityPropagationContext)context;
         // get destination unit party
         HeroParty destinationUnitParty = propagationContext.DestinationPartyUnit.GetComponentInParent <HeroParty>();
         // return result of relations match
         return(MatchRelationsBetweenCityAndParty(propagationContext.SourceCity, destinationUnitParty));
     }
     // default: don't limit
     return(ValidationResult.Pass());
 }
Пример #6
0
        /// <summary>
        /// Load all content!
        /// This includes monsters, heroes, cards, equipment, dice and the map.
        /// </summary>
        /// <param name="game">
        /// The game object
        /// </param>
        public static void LoadContent(Game game)
        {
            Contract.Requires(game != null);

            FullModel.game = game;
            heroParty = new HeroParty();
            overlordCards = new List<OverlordCard>();

            LoadDice(game);
            LoadMonsters(game);
            LoadEquipment(game);
            LoadMap(game);
            LoadHeroes(game);
            LoadOverlordCards(game);
            LoadSkillCards(game);
        }
Пример #7
0
    void ActivateCityView()
    {
        // get hero party in city, if it is present
        HeroParty   heroParty   = LCity.GetHeroPartyByMode(PartyMode.Party);
        HeroPartyUI heroPartyUI = null;

        // verify if there is party in a city
        if (heroParty != null)
        {
            // Get HeroParty UI
            heroPartyUI = transform.root.Find("MiscUI/LeftHeroParty").GetComponent <HeroPartyUI>();
            // assign HeroParty to left hero party UI
            heroPartyUI.GetComponent <HeroPartyUI>().LHeroParty = heroParty;
            // activate left hero party UI
            heroPartyUI.gameObject.SetActive(true);
            // assign party leader to left focus panel
            if (transform.root.Find("MiscUI/LeftFocus") == null)
            {
                Debug.LogWarning("1");
            }
            if (transform.root.Find("MiscUI/LeftFocus").GetComponent <FocusPanel>() == null)
            {
                Debug.LogWarning("2");
            }
            if (transform.root.Find("MiscUI/LeftFocus").GetComponent <FocusPanel>().focusedObject == null)
            {
                Debug.LogWarning("3");
            }
            if (heroPartyUI == null)
            {
                Debug.LogWarning("4");
            }
            if (heroPartyUI.GetPartyLeaderUI() == null)
            {
                Debug.LogWarning("5");
            }
            if (heroPartyUI.GetPartyLeaderUI().gameObject == null)
            {
                Debug.LogWarning("6");
            }
            transform.root.Find("MiscUI/LeftFocus").GetComponent <FocusPanel>().focusedObject = heroPartyUI.GetPartyLeaderUI().gameObject;
            // activate left Focus panel
            transform.root.Find("MiscUI/LeftFocus").gameObject.SetActive(true);
        }
        else
        {
            // activate left Focus panel
            // without linked hero it will trigger no-party info
            transform.root.Find("MiscUI/LeftFocus").gameObject.SetActive(true);
            // activate hire hero panel
            transform.root.Find("MiscUI/HireHeroPanel").gameObject.SetActive(true);
        }
        // Get HeroParty UI
        heroPartyUI = transform.root.Find("MiscUI/RightHeroParty").GetComponent <HeroPartyUI>();
        // assign City garnizon HeroParty to right hero party UI
        heroPartyUI.LHeroParty = LCity.GetHeroPartyByMode(PartyMode.Garnizon);
        // activate right hero party UI
        heroPartyUI.gameObject.SetActive(true);
        // activate hire common units panel
        transform.root.Find("MiscUI/HireCommonUnitButtons").gameObject.SetActive(true);
        // assign city to right focus panel
        transform.root.Find("MiscUI/RightFocus").GetComponent <FocusPanel>().focusedObject = LCity.gameObject;
        // activate right Focus panel
        transform.root.Find("MiscUI/RightFocus").gameObject.SetActive(true);
    }
Пример #8
0
 public void EncountEnemy(HeroParty h_party, EnemyParty e_party)
 {
     abst_manager.SetPlayerParty(h_party);
     abst_manager.SetEnemyParty(e_party);
     abst_manager.BattleStart();
 }
Пример #9
0
 public void SetPlayerParty(HeroParty party)
 {
     abst_manager.SetPlayerParty(party);
 }
Пример #10
0
 public abstract void SetPlayerParty(HeroParty party);
Пример #11
0
 private void InitializeRPG()
 {
     Party = new HeroParty();
 }