Beispiel #1
0
    /// <summary>
    /// 创建奖励列表
    /// </summary>
    /// <param name="rewardIcon"></param>
    /// <param name="rewardCharacterData"></param>
    /// <param name="rewardContent"></param>
    private void CreateWinReward(Sprite rewardIcon, CharacterBean rewardCharacterData, string rewardContent)
    {
        //生成奖励列表
        GameObject objItem = Instantiate(objResultContainer, objResultWinModel);
        ItemMiniGameEndResultWinCpt itemWin = objItem.GetComponent <ItemMiniGameEndResultWinCpt>();

        if (rewardIcon != null)
        {
            itemWin.SetIcon(rewardIcon);
        }
        if (rewardCharacterData != null)
        {
            itemWin.SetCharacterUI(rewardCharacterData);
        }
        itemWin.SetContent(rewardContent);
        //设置动画
        objItem.transform.DOScale(new Vector3(0f, 0f, 0f), 0.5f).From().SetEase(Ease.OutBack);
    }
Beispiel #2
0
    /// <summary>
    /// 创建胜利数据
    /// </summary>
    private void CreateWinItems()
    {
        CptUtil.RemoveChildsByActive(objResultContainer.transform);
        if (miniGameData == null)
        {
            return;
        }
        //通常列表
        string     reasonStr     = "";
        GameObject objReasonItem = Instantiate(objResultContainer, objResultWinModel);
        ItemMiniGameEndResultWinCpt itemReasonWin = objReasonItem.GetComponent <ItemMiniGameEndResultWinCpt>();

        switch (miniGameData.gameReason)
        {
        case MiniGameReasonEnum.Improve:
            //晋升成功
            reasonStr = TextHandler.Instance.manager.GetTextById(43);
            //数据添加
            Sprite attributeIcon          = null;
            string attributeRewardContent = "";
            foreach (MiniGameCharacterBean miniGameCharacterData in miniGameData.listUserGameData)
            {
                switch (miniGameData.gameType)
                {
                case MiniGameEnum.Cooking:
                    attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Cook) + " +5";
                    miniGameCharacterData.characterData.baseInfo.chefInfo.LevelUp(miniGameCharacterData.characterData.attributes);
                    break;

                case MiniGameEnum.Barrage:
                    attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Speed) + " +5";
                    miniGameCharacterData.characterData.baseInfo.waiterInfo.LevelUp(miniGameCharacterData.characterData.attributes);
                    break;

                case MiniGameEnum.Account:
                    attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Account) + " +5";
                    miniGameCharacterData.characterData.baseInfo.accountantInfo.LevelUp(miniGameCharacterData.characterData.attributes);
                    break;

                case MiniGameEnum.Debate:
                    attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Charm) + " +5";
                    miniGameCharacterData.characterData.baseInfo.accostInfo.LevelUp(miniGameCharacterData.characterData.attributes);
                    break;

                case MiniGameEnum.Combat:
                    attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Force) + " +5";
                    miniGameCharacterData.characterData.baseInfo.beaterInfo.LevelUp(miniGameCharacterData.characterData.attributes);
                    break;
                }
            }
            //创建属性奖励
            attributeIcon = IconDataHandler.Instance.manager.GetIconSpriteByName("keyboard_button_up_1");
            CreateWinReward(attributeIcon, null, attributeRewardContent);
            break;

        case MiniGameReasonEnum.Fight:
            //决斗胜利
            reasonStr = TextHandler.Instance.manager.GetTextById(44);
            break;

        case MiniGameReasonEnum.Recruit:
            //决斗胜利
            reasonStr = TextHandler.Instance.manager.GetTextById(45);
            break;

        default:
            reasonStr = TextHandler.Instance.manager.GetTextById(901);
            break;
        }
        itemReasonWin.SetContent(reasonStr);
        itemReasonWin.SetIcon(IconDataHandler.Instance.manager.GetIconSpriteByName("text_win_1"));
        //添加奖励
        RewardTypeEnumTools.CompleteReward(miniGameData.GetListUserCharacterData(), miniGameData.listReward);
        //遍历奖励列表
        foreach (var itemReward in miniGameData.listReward)
        {
            CreateWinReward(itemReward.spRewardIcon, itemReward.workerCharacterData, itemReward.rewardDescribe);
        }
    }