예제 #1
0
    public CharacterForFamilyBean CreateChild(string name, CharacterBean userData, CharacterBean mateData)
    {
        GameDataBean           gameData  = GameDataHandler.Instance.manager.GetGameData();
        CharacterForFamilyBean childData = new CharacterForFamilyBean(gameData.gameTime);

        childData.baseInfo.name = name;

        childData.body.eye        = UnityEngine.Random.Range(0, 2) == 0 ? userData.body.eye : mateData.body.eye;
        childData.body.eyeColor   = UnityEngine.Random.Range(0, 2) == 0 ? userData.body.eyeColor : mateData.body.eyeColor;
        childData.body.hair       = UnityEngine.Random.Range(0, 2) == 0 ? userData.body.hair : mateData.body.hair;
        childData.body.hairColor  = UnityEngine.Random.Range(0, 2) == 0 ? userData.body.hairColor : mateData.body.hairColor;
        childData.body.mouth      = UnityEngine.Random.Range(0, 2) == 0 ? userData.body.mouth : mateData.body.mouth;
        childData.body.mouthColor = UnityEngine.Random.Range(0, 2) == 0 ? userData.body.mouthColor : mateData.body.mouthColor;
        childData.body.skin       = UnityEngine.Random.Range(0, 2) == 0 ? userData.body.skin : mateData.body.skin;
        childData.body.skinColor  = UnityEngine.Random.Range(0, 2) == 0 ? userData.body.skinColor : mateData.body.skinColor;

        childData.attributes.cook    = 1;
        childData.attributes.speed   = 1;
        childData.attributes.account = 1;
        childData.attributes.charm   = 1;
        childData.attributes.force   = 1;
        childData.attributes.lucky   = 1;
        childData.attributes.life    = 50;

        int sex = UnityEngine.Random.Range(0, 2);

        if (sex == 0)
        {
            childData.SetFamilyType(FamilyTypeEnum.Son);
            childData.body.SetSex(SexEnum.Man);
        }
        else
        {
            childData.SetFamilyType(FamilyTypeEnum.Daughter);
            childData.body.SetSex(SexEnum.Woman);
        }

        listChildCharacter.Add(childData);
        return(childData);
    }
예제 #2
0
    public void Submit(DialogView dialogView, DialogBean dialogBean)
    {
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        //送礼
        if (dialogView is PickForItemsDialogView)
        {
            //获取选择物品
            PickForItemsDialogView pickForItemsDialog = dialogView as PickForItemsDialogView;
            pickForItemsDialog.GetSelectedItems(out ItemsInfoBean itemsInfo, out ItemBean itemData);
            //获取赠送人
            CharacterBean             characterData         = NpcInfoHandler.Instance.manager.GetCharacterDataById(mTalkNpcInfo.id);
            CharacterFavorabilityBean characterFavorability = gameData.GetCharacterFavorability(mTalkNpcInfo.id);
            int addFavorability;
            int favorabilityForTalk;
            //根据物品稀有度增加好感
            switch (itemsInfo.GetItemRarity())
            {
            case RarityEnum.Normal:
                addFavorability     = 1;
                favorabilityForTalk = 1;
                break;

            case RarityEnum.Rare:
                addFavorability     = 3;
                favorabilityForTalk = 3;
                break;

            case RarityEnum.SuperRare:
                addFavorability     = 6;
                favorabilityForTalk = 3;
                break;

            case RarityEnum.SuperiorSuperRare:
                addFavorability     = 10;
                favorabilityForTalk = 3;
                break;

            case RarityEnum.UltraRare:
                addFavorability     = 15;
                favorabilityForTalk = 3;
                break;

            default:
                addFavorability     = 1;
                favorabilityForTalk = 1;
                break;
            }
            //增加送礼次数
            characterFavorability.AddGiftNumber(1);
            //删减物品
            gameData.AddItemsNumber(itemData.itemId, -1);
            //增加每日限制
            GameCommonInfo.DailyLimitData.AddGiftNpc(mTalkNpcInfo.id);
            //通过增加好感查询对话
            TextInfoHandler.Instance.manager.listTextData = TextInfoHandler.Instance.manager.GetGiftTalkByFavorability(favorabilityForTalk);
            ShowText(TextInfoHandler.Instance.manager.listTextData);

            //文本里面会默认加好感
            //先减去文本加的好感 再添加实际的好感加成
            characterFavorability.AddFavorability(-favorabilityForTalk);
            characterFavorability.AddFavorability(addFavorability);
        }
        //求婚
        else
        {
            //减去信物
            gameData.AddItemsNumber(99900021, -1);
            //弹窗提示
            ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1341));
            //设置3天后结婚
            FamilyDataBean familyData = gameData.GetFamilyData();
            familyData.timeForMarry = GameTimeHandler.Instance.GetAfterDay(3);
            //设置妻子数据
            CharacterForFamilyBean characterData = new CharacterForFamilyBean(mTalkNpcInfo, familyData.timeForMarry);
            characterData.SetFamilyType(FamilyTypeEnum.Mate);
            familyData.mateCharacter = characterData;
        }
    }