public PersonalityModel(PersonalityModel _source)
 {
     id      = _source.id;
     name_ch = _source.name_ch;
     enhance = _source.enhance;
     reduce  = _source.reduce;
 }
        public override DeferredProcessExitCode Execute(MessageBroker messageBroker)
        {
            try
            {
                JavaScriptSerializer jss = new JavaScriptSerializer();
                campaign = jss.Deserialize <EmailCampaign>(modelJson);
                model    = jss.Deserialize <PersonalityModel>(modelJson);
                UserProfileClient  upc      = new UserProfileClient();
                List <UserProfile> profiles = new List <UserProfile>(upc.GetAllByPartition(PartitionKey));
                List <UserProfile> filtered = new List <UserProfile>(profiles.Where(x => !string.IsNullOrEmpty(x.Email) && IsValidEmail(x.Email) &&
                                                                                    (string.IsNullOrEmpty(campaign.GradYears) || (!string.IsNullOrEmpty(x.GradYear) && campaign.GradYears.Contains(x.GradYear))) &&
                                                                                    model.GetType().GetProperties().All(y => (y.GetValue(model, null) == null || (x.GetType().GetProperty(y.Name).GetValue(x, null) != null && y.GetValue(model, null).ToString() == x.GetType().GetProperty(y.Name).GetValue(x, null).ToString())))));
                foreach (UserProfile user in filtered)
                {
                    (new DeferredEmailSender {
                        FromDisplay = campaign.FromDiplay, FromEmail = campaign.FromEmail, Body = campaign.Body, Subject = campaign.Subject, To = user.Email
                    }).Run(messageBroker);
                }

                string body = "<p>Subject Line: " + campaign.Subject + "</p>" +
                              "<p>Partition: " + PartitionKey + "</p>" +
                              "<p>Emails to be sent: " + filtered.Count + "</p>";

                (new DeferredEmailSender {
                    FromDisplay = "Admin", FromEmail = "*****@*****.**", Body = body, Subject = "Partition " + PartitionKey, To = "*****@*****.**"
                }).Execute(messageBroker);
                return(DeferredProcessExitCode.Success);
            }
            catch
            {
                return(DeferredProcessExitCode.Error);
            }
        }
Exemplo n.º 3
0
    private void OnBattleStartMessage(NetworkMessage netMsg)
    {
        netMsg.reader.SeekZero();
        BattleStartMessage msg    = netMsg.ReadMessage <BattleStartMessage>();
        PokemonModel       pModel = PublicDataManager.instance.GetPokemonModel(msg.pokemonId);

        Debug.Log("Opp Pokemon" + pModel.name_ch);
        pModel.attack     = msg.attackAv;
        pModel.defense    = msg.defenceAv;
        pModel.hp         = msg.hpAv;
        pModel.sp_attack  = msg.sp_attackAv;
        pModel.sp_defense = msg.sp_defenceAv;
        pModel.speed      = msg.speedAv;
        CharacterModel   cModel   = PublicDataManager.instance.GetCharacterModel(msg.charavterId);
        PersonalityModel perModel = PublicDataManager.instance.GetPersonalityModel(msg.personalityId);
        ItemModel        iModel   = PublicDataManager.instance.GetItemModel(msg.itemId);

        SkillModel[] sModel = new SkillModel[4];
        for (int i = 0; i < msg.skillIds.Length; i++)
        {
            sModel[i] = PublicDataManager.instance.GetSkillModel(msg.skillIds[i]);
        }
        Pokemon p = new Pokemon(pModel, cModel, perModel, iModel, sModel);

        RuntimeData.SetCurrentOppIndex(msg.index);
        RuntimeData.SetCurrentOppPokemon(p);
        if (RuntimeData.IsOppPokemonsFull())
        {
            UIManager.instance.ClosePage(PageCollection.StartPage);
            UIManager.instance.OpenPage(PageCollection.BattlePage);
        }
    }
Exemplo n.º 4
0
 public void SetupPersonality(PersonalityModel model, int personalityIdx)
 {
     if (model == null)
     {
         Debug.LogError("model is null");
     }
     this.model = model;
     SetTraitList(model.getPersonalityTraits(personalityIdx));
 }
Exemplo n.º 5
0
    private int dodgeRate; //闪避等级

    public Pokemon(PokemonModel _pokemon, CharacterModel _character, PersonalityModel _personality, ItemModel _item, SkillModel[] _skills)
    {
        model       = _pokemon;
        currentHp   = _pokemon.hp;
        character   = new Character(_character);
        personality = new Personality(_personality);
        item        = new Item(_item);
        skills      = new Skill[4];
        for (int i = 0; i < skills.Length; i++)
        {
            skills[i] = new Skill(_skills[i]);
        }
    }
Exemplo n.º 6
0
    private void CreatePersonalityModel()
    {
        HashSet <PersonalityFactor> factors = new HashSet <PersonalityFactor> (personalityFactors);

        personalityModel = new PersonalityModel(factors);
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        sb.AppendLine("== List of Personalities ==");
        for (int i = 0; i < personalityModel.PersonalityCnt; i++)
        {
            string traitsStr = "";
            foreach (Trait trait in personalityModel.getPersonalityTraits(i))
            {
                if (!System.String.IsNullOrEmpty(traitsStr))
                {
                    traitsStr += ",";
                }
                traitsStr += trait;
            }
            sb.AppendLine("[" + i + "]=" + traitsStr);
        }
        Debug.Log(sb);
    }
Exemplo n.º 7
0
    public BattleStartMessage(Pokemon _pokemon, int _index)
    {
        index = _index;
        PokemonModel     pM   = _pokemon.GetModel();
        CharacterModel   cM   = _pokemon.GetCharacter().GetModel();
        PersonalityModel perM = _pokemon.GetPersonality().GetModel();
        ItemModel        iM   = _pokemon.GetItem().GetModel();

        Skill[] skM = _pokemon.GetSkills();//固定为4个技能
        pokemonId     = pM.id;
        hpAv          = pM.hp;
        attackAv      = pM.attack;
        defenceAv     = pM.defense;
        sp_attackAv   = pM.sp_attack;
        sp_defenceAv  = pM.sp_defense;
        speedAv       = pM.speed;
        charavterId   = cM.id;
        personalityId = perM.id;
        itemId        = iM.id;
        for (int i = 0; i < 4; i++)
        {
            skillIds[i] = skM[i].GetModel().id;
        }
    }
Exemplo n.º 8
0
 public void CopyPersonality(Personality personalityToCopy)
 {
     SetTraitList(personalityToCopy.traits);
     model = personalityToCopy.model;
 }
 //选择性格
 private void OnSelectPersonality()
 {
     personality = PublicDataManager.instance.GetPersonalityModel(personalityDP.captionText.text);
     RefreshAbilityValue();
 }
 public Personality(PersonalityModel _model)
 {
     model = _model;
 }