Beispiel #1
0
 public void InitAllyName(System.Random rand)
 {
     allyName = new Dictionary <int, int>();
     foreach (AllyName an in VArtifactUtil.allyNameData.Values)
     {
         if (!allyNamePool.ContainsKey(an.raceId))
         {
             allyNamePool.Add(an.raceId, new List <int> ());
         }
         allyNamePool[an.raceId].Add(an.nameId);
     }
     for (int i = 1; i < AllyCount; i++)
     {
         AllyType   at     = GetAllyType(i);
         List <int> idList = allyNamePool[(int)at];
         int        index  = rand.Next(idList.Count);
         int        nameId = idList[index];
         allyName.Add(i, nameId);
         idList.Remove(index);
     }
     foreach (KeyValuePair <int, int> kvp in allyName)
     {
         Debug.Log("ally: " + kvp.Key + " nameId:" + kvp.Value);
     }
 }
Beispiel #2
0
    private void DeployAlly(AllyType type)
    {
        for (int i = 0; i < player_.Length; ++i)
        {
            player_.input[i].newCommand  = true;
            player_.input[i].commandType = CommandType.Deploy;
            player_.input[i].allyType    = type;

            switch (type)
            {
            case AllyType.Red:
                player_.input[i].selectedAlly = player_.roster[i].selectedAlly = player_.roster[i].red;
                break;

            case AllyType.Blue:
                player_.input[i].selectedAlly = player_.roster[i].selectedAlly = player_.roster[i].blue;
                break;

            case AllyType.Green:
                player_.input[i].selectedAlly = player_.roster[i].selectedAlly = player_.roster[i].green;
                break;

            case AllyType.Yellow:
                player_.input[i].selectedAlly = player_.roster[i].selectedAlly = player_.roster[i].yellow;
                break;
            }
        }
    }
Beispiel #3
0
    private void UpdateSurplusBulidIcon()
    {
        AllyType type   = VATownGenerator.Instance.GetAllyType(m_AllianceID);
        int      iconID = -1;

        switch (type)
        {
        case AllyType.Npc:
        case AllyType.Player:
            iconID = MapIcon.AdventureCamp;
            break;

        case AllyType.Puja:
            iconID = MapIcon.PujaBase;
            break;

        case AllyType.Paja:
            iconID = MapIcon.PajaBase;
            break;
        }
        if (iconID != -1)
        {
            PeMap.MapIcon mapIcon = PeMap.MapIcon.Mgr.Instance.iconList.Find(itr => (itr.id == iconID));
            m_SurplusSpr.spriteName = mapIcon != null ? mapIcon.iconName : "Null";
            m_SurplusSpr.MakePixelPerfect();
        }
    }
 public IAlly GetAlly(AllyType allyType)
 {
     switch (allyType)
     {
     case AllyType.Medic:
         return(Instantiate(Resources.Load("Medic", typeof(Ally)) as Ally));
     }
     return(null);
 }
Beispiel #5
0
 public Ally Create(
     AllyType type,
     AffineTransform transform)
 {
     return new Ally()
     {
         Model = LoadModel(type),
         Transform = transform,
         Updater = UpdaterCreator(),
         Drawer = DrawerCreator()
     };
 }
Beispiel #6
0
    public Ally SpawnAlly(AllyType allyType)
    {
        switch (_creationalPatternToUse)
        {
        case CreationalPatterns.Singleton:
            return(AllyFactory.Instance.GetAlly(allyType) as Ally);

        case CreationalPatterns.Factory:
            if (_allyFactory == null)
            {
                _allyFactory = FactoryProducer.GetFactory(FactoryType.Ally);
            }
            return(_allyFactory?.GetAlly(allyType) as Ally);
        }
        return(null);
    }
    private static List <int> GetSpawnTypeMask(bool bOnlyMonster, out int campCol)
    {
        //List<int> typeMask = new List<int>();
        campCol = -1;
        if (bOnlyMonster)
        {
            return(s_spTypes0);
        }

        if (Pathea.PeGameMgr.IsStory)
        {
            // Monster, Puja or Paja (alliance would be excluded)
            int  playerId     = (Pathea.PeCreature.Instance.mainPlayer != null) ? ((int)Pathea.PeCreature.Instance.mainPlayer.GetAttribute(Pathea.AttribType.DefaultPlayerID)) : 0;
            bool bExcludePuja = ReputationSystem.Instance.GetReputationLevel(playerId, (int)ReputationSystem.TargetType.Puja) > ReputationSystem.ReputationLevel.Neutral;
            bool bExcludePaja = ReputationSystem.Instance.GetReputationLevel(playerId, (int)ReputationSystem.TargetType.Paja) > ReputationSystem.ReputationLevel.Neutral;
            if (bExcludePuja)
            {
                return(s_spTypes02);
            }
            else if (bExcludePaja)
            {
                return(s_spTypes01);
            }
            return(UnityEngine.Random.value > 0.5f ? s_spTypes01 : s_spTypes02);
        }
        else
        {
            AllyType type = VATownGenerator.Instance.GetRandomExistEnemyType(out campCol);
            switch (type)
            {
            case AllyType.Puja:
                return(s_spTypes01);

            case AllyType.Paja:
                return(s_spTypes02);

            case AllyType.Npc:
                return(s_spTypes03);
            }
        }
        return(s_spTypes0);
    }
Beispiel #8
0
    public void AddAllyToParty(PartyRoster roster, GameObject ally, AllyType type)
    {
        var command = ally.GetComponent <Command>();

        command.owner      = ally;
        command.newCommand = false;

        var combatant = ally.GetComponent <Combatant>();

        combatant.faction  = Factions.Ally;
        combatant.inBattle = false;

        var member = ally.GetComponent <PartyMember>();

        member.isActive     = false;
        member.isDeploying  = false;
        member.isRetrieving = false;
        member.deployOrder  = -1;
        member.type         = type;

        switch (type)
        {
        case AllyType.Red:
            roster.red = ally;
            break;

        case AllyType.Blue:
            roster.blue = ally;
            break;

        case AllyType.Green:
            roster.green = ally;
            break;

        case AllyType.Yellow:
            roster.yellow = ally;
            break;
        }
    }
Beispiel #9
0
    private void UpdateAllyIcon()
    {
        string   iconName = "Null";
        AllyType type     = VATownGenerator.Instance.GetAllyType(m_AllianceID);
        int      index    = VATownGenerator.Instance.GetAllyNum(m_AllianceID);

        if (index >= 0)
        {
            switch (type)
            {
            case AllyType.Npc:
            case AllyType.Player:
                if (index < AllyIcon.HummanIcon.Length)
                {
                    iconName = AllyIcon.HummanIcon[index];
                }
                break;

            case AllyType.Puja:
                if (index < AllyIcon.PujaIcon.Length)
                {
                    iconName = AllyIcon.PujaIcon[index];
                }
                break;

            case AllyType.Paja:
                if (index < AllyIcon.PajaIcon.Length)
                {
                    iconName = AllyIcon.PajaIcon[index];
                }
                break;
            }
        }
        m_IconSpr.spriteName = iconName;
        m_IconSpr.MakePixelPerfect();
    }
Beispiel #10
0
 private void UpdateListBoxAlly(ListBox field, AllyType type)
 {
     if (InvokeRequired)
     {
         BeginInvoke(new SetListBoxStatusAlly(UpdateListBoxAlly), field, type);
         return;
     }
     field.Items.Clear();
     foreach (Ally ally in settings.Ally)
     {
         if (ally.Type == type)
         {
             field.Items.Add(ally);
         }
     }
 }
Beispiel #11
0
 public Ally(Coordinates initialCoordinates, AllyType trainer)
     : base(initialCoordinates)
 {
     this.allyType = trainer;
 }
 public abstract IAlly GetAlly(AllyType allyType);
Beispiel #13
0
 /// <summary>
 /// Save the ally data to settings.
 /// </summary>
 /// <param name="fieldId">The field id.</param>
 /// <param name="fieldName">Name of the field.</param>
 /// <param name="allyType">Type of the ally.</param>
 private void InsertAllyData(Control fieldId, Control fieldName, AllyType allyType)
 {
     if ((fieldName.Text.Length > 0) && (fieldId.Text.Length > 0))
     {
         Ally ally = new Ally
             {
                 Id = Misc.String2Number(fieldId.Text.Trim()),
                 Name = fieldName.Text.Trim(),
                 Type = allyType,
             };
         foreach (Ally list in settings.Ally)
         {
             if (list.Id == ally.Id)
             {
                 return;
             }
         }
         settings.Ally.Add(ally);
         SerializeSettings();
     }
     else
     {
         MessageBox.Show("Id and Name are required!");
     }
 }
Beispiel #14
0
 IModel LoadModel(AllyType type)
 {
     return ModelFactory.Instance.Create(ModelNameDic[type]);
 }
 public IAlly GetAlly(AllyType allyType)
 {
     return(null);
 }
Beispiel #16
0
 public void CreateAlly(AllyType type, AffineTransform transform)
 {
     AliveList.Add(Creator.Create(type, transform));
 }
Beispiel #17
0
    //function for writing stats to the UI object
    private void SetStatSheet(GameObject statSheet, Stats stats, AllyType type)
    {
        var obj  = statSheet.transform.Find("Stats/AttackStat/Value");
        var text = obj.gameObject.GetComponent <Text>();

        text.text = stats.damage.x.ToString();

        obj       = statSheet.transform.Find("Stats/DefenseStat/Value");
        text      = obj.gameObject.GetComponent <Text>();
        text.text = stats.defense.x.ToString();

        obj       = statSheet.transform.Find("Stats/SpeedStat/Value");
        text      = obj.gameObject.GetComponent <Text>();
        text.text = stats.speed.x.ToString();

        obj       = statSheet.transform.Find("Stats/LifeStat/Value");
        text      = obj.gameObject.GetComponent <Text>();
        text.text = stats.health.x.ToString();

        obj       = statSheet.transform.Find("EffectStats/AttackEffect/ResistanceValue");
        text      = obj.gameObject.GetComponent <Text>();
        text.text = stats.redEffect.x.ToString();
        obj       = statSheet.transform.Find("EffectStats/AttackEffect/DamageValue");
        text      = obj.gameObject.GetComponent <Text>();
        text.text = stats.redResistance.x.ToString();

        obj       = statSheet.transform.Find("EffectStats/DefenseEffect/ResistanceValue");
        text      = obj.gameObject.GetComponent <Text>();
        text.text = stats.blueEffect.x.ToString();
        obj       = statSheet.transform.Find("EffectStats/DefenseEffect/DamageValue");
        text      = obj.gameObject.GetComponent <Text>();
        text.text = stats.blueResistance.x.ToString();

        obj       = statSheet.transform.Find("EffectStats/SpeedEffect/ResistanceValue");
        text      = obj.gameObject.GetComponent <Text>();
        text.text = stats.yellowEffect.x.ToString();
        obj       = statSheet.transform.Find("EffectStats/SpeedEffect/DamageValue");
        text      = obj.gameObject.GetComponent <Text>();
        text.text = stats.yellowResistance.x.ToString();

        obj       = statSheet.transform.Find("EffectStats/LifeEffect/ResistanceValue");
        text      = obj.gameObject.GetComponent <Text>();
        text.text = stats.greenEffect.x.ToString();
        obj       = statSheet.transform.Find("EffectStats/LifeEffect/DamageValue");
        text      = obj.gameObject.GetComponent <Text>();
        text.text = stats.greenResistance.x.ToString();

        obj  = statSheet.transform.Find("Name");
        text = obj.gameObject.GetComponent <Text>();
        switch (type)
        {
        case AllyType.Red:
            text.text = "Red";
            break;

        case AllyType.Blue:
            text.text = "Blue";
            break;

        case AllyType.Green:
            text.text = "Green";
            break;

        case AllyType.Yellow:
            text.text = "Yellow";
            break;
        }
    }
Beispiel #18
0
 /// <summary>
 /// Removes the selected ally from listbox.
 /// </summary>
 /// <param name="field">The field.</param>
 /// <param name="type"><see cref="AllyType"/></param>
 private void RemoveSettingsAlly(ListBox field, AllyType type)
 {
     if (field.SelectedItems.Count > 0)
     {
         Ally ally = field.SelectedItem as Ally;
         if (ally != null)
         {
             List<Ally> newList = new List<Ally>();
             foreach (Ally oldAlly in settings.Ally)
             {
                 if (oldAlly.Id != ally.Id)
                 {
                     newList.Add(oldAlly);
                 }
             }
             settings.Ally.Clear();
             settings.Ally.AddRange(newList);
             SerializeSettings();
             UpdateListBoxAlly(field, type);
         }
     }
 }