Exemplo n.º 1
0
    private void SetFansData(CapsuleLevelVo data, List <FansVo> list)
    {
        _funsPower    = 0;
        _descTxt.text = Util.GetNoBreakingString(data.FansDescription);

        int useTotal = 0;
        int maxTotal = 0;

        _fansDict = new Dictionary <int, int>();
        _fansInfo = new Queue <string>();

        var prefab = GetPrefab("ActivityCapsuleBattle/Prefabs/FansItem");

        foreach (var item in data.FansMax)
        {
            var itemObj  = Instantiate(prefab, _fansCont, false);
            var itemData = list.Find((vo) => vo.FansId == item.Key);
            var num      = itemData.Num > item.Value ? item.Value : itemData.Num;
            itemObj.AddComponent <CapsuleBattleFansItem>().SetData(num, item.Value, itemData);
            _funsPower += num * itemData.Power;
            _fansDict.Add(itemData.FansId, num);
            _fansInfo.Enqueue(itemData.FansBigTexturePath);  //获取粉丝图片路径,入队
            useTotal += num;
            maxTotal += item.Value;
        }
    }
Exemplo n.º 2
0
    public void SetData(CapsuleLevelVo vo, int id)
    {
        var open   = transform.Find("Open").gameObject;
        var noOpen = transform.Find("NoOpen").gameObject;

        if (vo.IsOpen)
        {
            open.Show();
            noOpen.Hide();
        }
        else
        {
            open.Hide();
            noOpen.Show();
        }

        transform.GetRawImage("LevelNameIcon").texture = ResourceManager.Load <Texture>("ActivityCapsuleTemplate/Level" + id);

        PointerClickListener.Get(transform.Find("OnClick").gameObject).onClick = go =>
        {
            if (vo.IsOpen)
            {
                //触发进入战斗的事件
                EventDispatcher.TriggerEvent(EventConst.OnClickCapsuleBattleEntrance, vo);
            }
            else
            {
                FlowText.ShowMessage(I18NManager.Get("ActivityCapsuleTemplate_PleasePassLastLevel"));
            }
        };
    }
Exemplo n.º 3
0
    /// <summary>
    /// 设置购买扭蛋可玩次数窗口数据
    /// </summary>
    /// <param name="isFree">是否可以免费</param>
    /// <param name="freeNum">免费购买送的次数</param>
    /// <param name="price">单价</param>
    /// <param name="moreNum">购买更多次数</param>
    public void SetData(CapsuleLevelVo vo, ActivityVo curActivity)
    {
        _price = curActivity.ActivityExtra.LevelEachNumGem;
        Debug.LogError("单价---》" + _price);
        _buyMax   = curActivity.ActivityExtra.LevelBuyMax;
        _freeNum  = curActivity.ActivityExtra.LevelReplyNum;
        _moreNum  = curActivity.ActivityExtra.SecondBuyCount;
        _buyCount = vo.CapsuleBattleBuyCount;
        var isFree = vo.IsFree;

        if (isFree)
        {
            _freeContent.gameObject.Show();
            _costGemContent.gameObject.Hide();
            _freeDescTxt.text = I18NManager.Get("ActivityCapsuleBattle_FreeBuyDesc", _freeNum);
        }
        else
        {
            _freeContent.gameObject.Hide();
            _costGemContent.gameObject.Show();
            _costDestTxt.text = I18NManager.Get("ActivityCapsuleBattle_CostBuyDesc");
            _numTxt.text      = I18NManager.Get("ActivityCapsuleBattle_TodayResidueBuyNum", _buyMax + _freeNum - _buyCount);
            SetCostPrice(_price, _moreNum);
        }
    }
Exemplo n.º 4
0
    private CapsuleLevelVo GetNextLevelInfo(CapsuleLevelVo vo)
    {
        if (_capsuleBattleLevelDict.ContainsKey(vo.AfterLevelId))
        {
            return(_capsuleBattleLevelDict[vo.AfterLevelId]);
        }

        return(null);
    }
Exemplo n.º 5
0
    private void OpenBattleWindow(CapsuleLevelVo vo)
    {
        var level = vo;

        if (level.IsPass && !GuideManager.IsPass1_9())
        {
            FlowText.ShowMessage(I18NManager.Get("Guide_Battle6", "1-9"));
            return;
        }
        var capsuleBattleIntroductionPopup = PopupManager.ShowWindow <CapsuleBattleIntroductionPopup>("ActivityCapsuleBattle/Prefabs/CapsuleBattleIntroductionPopup");

        capsuleBattleIntroductionPopup.Init(level, _curActivity, EnterCapsuleBattle);
        capsuleBattleIntroductionPopup.MaskColor = new Color(0, 0, 0, 0.5f);
        ClientData.CustomerSelectedCapsuleLevel  = level;
    }
Exemplo n.º 6
0
    private CapsuleLevelVo GetNewLevel(CapsuleLevelVo levelVo)
    {
        if (levelVo.BeforeLevelId == 0 && levelVo.IsPass == false)
        {
            return(levelVo);
        }
        CapsuleLevelVo level = GetNextLevelInfo(levelVo);

        if (level == null)
        {
            return(null);
        }

        if (level.IsPass)
        {
            return(GetNewLevel(level));
        }

        return(level);
    }
Exemplo n.º 7
0
    public void SetData(CapsuleLevelVo vo, int id)
    {
        _data = vo;
        string level     = "ActivityMusicTemplate/Level_" + id;
        string levelLock = "ActivityMusicTemplate/LevelLock_" + id;

        _enterBtn.transform.GetRawImage("Icon").texture = ResourceManager.Load <Texture>(level, ModuleConfig.MODULE_ACTIVITYMUSICTEMPLATE, true);
        _lockBtn.transform.GetRawImage("Icon").texture  = ResourceManager.Load <Texture>(levelLock, ModuleConfig.MODULE_ACTIVITYMUSICTEMPLATE, true);

        if (vo.IsOpen)
        {
            _enterBtn.gameObject.SetActive(true);
            _lockBtn.gameObject.SetActive(false);
        }
        else
        {
            _enterBtn.gameObject.SetActive(false);
            _lockBtn.gameObject.SetActive(true);
        }
    }
Exemplo n.º 8
0
    private void SetGoodsData(CapsuleLevelVo data)
    {
        var prefab = GetPrefab("ActivityCapsuleBattle/Prefabs/CapsuleSupportItem");
        var index  = 0;

        foreach (var item in data.ItemMax)
        {
            var        itemObj            = Instantiate(prefab, _supportItemCont, false);
            UserPropVo propVo             = GlobalData.PropModel.GetUserProp(item.Key);
            ItemPB     itemPb             = GlobalData.PropModel.GetPropBase(item.Key);
            int        useNum             = propVo.Num > item.Value ? item.Value : propVo.Num;
            var        capsuleSupportItem = itemObj.AddComponent <CapsuleSupportItem>();
            string     iconPath           = GlobalData.PropModel.GetPropPath(item.Key);
            capsuleSupportItem.SetData(itemPb, useNum, item.Value, iconPath);
            capsuleSupportItem.GetComponent <ItemShowEffect>().OnShowEffect(index * 0.2f);
            index++;
        }

        SumGoodsPower();
    }
Exemplo n.º 9
0
    private void JudgeChaptersOpen()
    {
        for (int i = 0; i < _chapterList.Count; i++)
        {
            CapsuleChapterVo chapter = _chapterList[i];
            var firstLevel           = chapter.LevelList[0];
            int beforeLevelId        = firstLevel.BeforeLevelId;

            if (beforeLevelId == 0)
            {
                _firstNormalLevel    = firstLevel;
                chapter.IsNormalOpen = true;
            }
            else
            {
                var level = GetLevelInfo(beforeLevelId);
                chapter.IsNormalOpen = level.IsPass;
            }
        }

        _newNormalLevel = GetNewLevel(_firstNormalLevel);
    }
Exemplo n.º 10
0
 /// <summary>
 /// 进入扭蛋战斗
 /// </summary>
 /// <param name="num"></param>
 /// <param name="arg2"></param>
 private void EnterCapsuleBattle(int num, CapsuleLevelVo level)
 {
     _lastPlayLevel = level;
     if (num == 0)
     {
         Main.ChangeMenu(MainMenuDisplayState.HideAll);
         ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_ACTIVITYCAPSULEBATTLE, false, true, level,
                                            GlobalData.LevelModel.CommentRule, GlobalData.LevelModel.CardNumRules);
     }
     else
     {
         //发送扫荡
         byte[] data = NetWorkManager.GetByteData(new ActivityLevelSweepReq()
         {
             ActivityId = level.ActivityId,
             LevelId    = level.LevelId,
             Num        = num
         });
         LoadingOverlay.Instance.Show();
         NetWorkManager.Instance.Send <ActivityLevelSweepRes>(CMD.ACTIVITYCAPSULEC_SWEEP, data, OnSweep);
     }
 }
Exemplo n.º 11
0
    private void SendCapsuleBattleChallenge(CapsuleLevelVo level, List <BattleUserCardVo> cards)
    {
        int activityId = level.ActivityId;
        int levelId    = level.LevelId;

        ChallengeActivityLevelReq req = new ChallengeActivityLevelReq();

        req.ActivityId = activityId;
        req.LevelId    = levelId;

        foreach (var vo1 in cards)
        {
            req.CardIds.Add(vo1.UserCardVo.CardId);
        }

        CapsuleBattleModel model = GetData <CapsuleBattleModel>();

        req.Fans.Add(model.FansDict);
        req.Items.Add(model.ItemsDict);

        byte[] data = NetWorkManager.GetByteData(req);
        NetWorkManager.Instance.Send <ChallengeActivityLevelRes>(CMD.ACTIVITYSTENCILC_CHALLENGE, data, OnGetCapsuleChallenge, OnCapsuleChallengeError);
    }
Exemplo n.º 12
0
    /// <summary>
    /// 设置扭蛋战斗关卡Data
    /// </summary>
    /// <param name="pbs"></param>
    /// <param name="plotRule"></param>
    /// <param name="infoRule"></param>
    public void SetCapsuleBattleData(ActivityVo curActivity)
    {
        _curActivity = curActivity;
        var pbs = GetLevelRule(curActivity.ActivityId);//GlobalData.ActivityModel.BaseTemplateActivityRule.ActivityLevelRules;

        _capsuleBattleLevelDict = new Dictionary <int, CapsuleLevelVo>();
        _chapterList            = new List <CapsuleChapterVo>();

        CapsuleChapterVo chapter = null;

        Dictionary <int, CapsuleChapterVo> chapterDict = new Dictionary <int, CapsuleChapterVo>();

        var plotRule = GlobalData.LevelModel.PlotRule;
        var infoRule = GlobalData.LevelModel.InfoRule;

        foreach (var t in pbs)
        {
            var level = new CapsuleLevelVo();
            level.SetData(t, plotRule, infoRule);
            _capsuleBattleLevelDict.Add(level.LevelId, level);

            if (chapterDict.ContainsKey(level.ChapterGroup) == false)
            {
                chapter = new CapsuleChapterVo();
                chapterDict[level.ChapterGroup] = chapter;
                chapter.LevelList     = new List <CapsuleLevelVo>();
                chapter.HardLevelList = new List <CapsuleLevelVo>();
                chapter.ChapterId     = level.ChapterGroup;

                for (int j = 0; j < infoRule.Count; j++)
                {
                    var info = infoRule[j];
                    if (info.InfoType == 1 && info.InfoId == level.ChapterGroup)
                    {
                        chapter.ChapterName = info.LevelName;
                        chapter.ChapterDesc = info.LevelDesc;
                        break;
                    }
                }
            }

            if (level.Hardness == GameTypePB.Difficult)
            {
                chapterDict[level.ChapterGroup].HardLevelList.Add(level);
            }
            else
            {
                chapterDict[level.ChapterGroup].LevelList.Add(level);
            }
        }

        foreach (var chapterVo in chapterDict)
        {
            _chapterList.Add(chapterVo.Value);
            if (chapterDict.ContainsKey(chapterVo.Value.ChapterId + 1))
            {
                chapterVo.Value.NextChapterVo = chapterDict[chapterVo.Value.ChapterId + 1];
            }

            if (chapterDict.ContainsKey(chapterVo.Value.ChapterId - 1))
            {
                chapterVo.Value.PrevChapterVo = chapterDict[chapterVo.Value.ChapterId - 1];
            }
        }

        Debug.LogError("ChapterList.Count===>" + _chapterList.Count);
    }
Exemplo n.º 13
0
    /// <summary>
    /// 设置扭蛋战斗我的关卡Data
    /// </summary>
    /// <param name="pbs"></param>
    public void SetMyCapsuleBattleLevelData()
    {
        _myCapsuleLevelInfoList = new List <MyCapsuleLevelVo>();
        MyCapsuleLevelVo lastLevel = null;
        int myLevel = GlobalData.PlayerModel.PlayerVo.Level;

        foreach (var t in UserActivityLevelInfos())
        {
            var level = new MyCapsuleLevelVo();
            level.SetData(t);
            _myCapsuleLevelInfoList.Add(level);
            CapsuleLevelVo item = GetLevelInfo(level.LevelId);
            item.ChallangeTimes        = level.Count;
            item.CapsuleBattleBuyCount = level.BuyCount;
            item.CurPlayNum            = item.Count - level.Count;
            if (item.CurPlayNum < 0)
            {
                item.CurPlayNum = 0;
            }

            item.IsFree = level.BuyCount == 0;

            if (level.Star > 0)
            {
                item.IsPass      = true;
                item.CurrentStar = level.Star;
                item.Score       = level.Score;
            }

            if (item.Hardness == GameTypePB.Ordinary)
            {
                if (myLevel >= item.DepartmentLevel)
                {
                    lastLevel = level;
                }
            }
        }

        JudgeChaptersOpen();

        foreach (var levelVo in _capsuleBattleLevelDict)
        {
            if (levelVo.Value.BeforeLevelId == 0)
            {
                if (levelVo.Value.Hardness == GameTypePB.Difficult)
                {
                    List <CapsuleLevelVo> list = _chapterList[levelVo.Value.ChapterGroup - 1].LevelList;
                    levelVo.Value.IsOpen = list[list.Count - 1].IsPass;
                }
                else
                {
                    levelVo.Value.IsOpen = true;
                }
            }
            else
            {
                var beforeLevel = GetLevelInfo(levelVo.Value.BeforeLevelId);
                if (levelVo.Value.Hardness == GameTypePB.Ordinary)
                {
                    levelVo.Value.IsOpen = beforeLevel.IsPass;
                }
                else if (levelVo.Value.Hardness == GameTypePB.Difficult && beforeLevel.IsPass)
                {
                    levelVo.Value.IsOpen = _chapterList[levelVo.Value.ChapterGroup - 1].IsHardOpen;
                }
            }
        }

        if (JumpData != null)
        {
            ActiveLevel = FindLevel(JumpData);
            if (ActiveLevel != null)
            {
                DoJump = true;
                ClientData.CustomerSelectedCapsuleLevel = ActiveLevel;
                return;
            }
        }
        DoJump = false;

        if (ClientData.CustomerSelectedCapsuleLevel == null)
        {
            if (lastLevel != null)
            {
                CapsuleLevelVo levelVo = GetLevelInfo(lastLevel.LevelId);
                if (levelVo.IsPass && levelVo.AfterLevelId != 0)
                {
                    CapsuleLevelVo tempLevel = GetLevelInfo(levelVo.AfterLevelId);
                    if (myLevel >= tempLevel.DepartmentLevel)
                    {
                        levelVo = tempLevel;
                    }
                }
                ActiveLevel = levelVo;
                ClientData.CustomerSelectedCapsuleLevel = ActiveLevel;
            }
            else
            {
                if (_myCapsuleLevelInfoList.Count == 0)
                {
                    ActiveLevel = _chapterList[0].LevelList[0];
                }
            }
        }

        if (ClientData.CustomerSelectedCapsuleLevel != null)
        {
            ActiveLevel = ClientData.CustomerSelectedCapsuleLevel;
        }

        foreach (var t in _capsuleBattleLevelDict)
        {
            Debug.LogError(t.Key + ";IsOpen===>" + t.Value.IsOpen + ";IsPass===>" + t.Value.IsPass + ";Id===>" + t.Value.ActivityId);
        }
    }
Exemplo n.º 14
0
 private void OnClickMusicCapsuleBattleEntrance(CapsuleLevelVo vo)
 {
     OpenBattleWindow(vo);
 }
Exemplo n.º 15
0
    public void SetData(RepeatedField <GameResultPB> result, CapsuleLevelVo customerSelectedLevel, int exp)
    {
        transform.Find("Title/Text").GetComponent <Text>().text = customerSelectedLevel.LevelName;
        _total = 0;
        _drawActivityDropItemDict = new Dictionary <string, DrawActivityDropItemVo>();

        for (int i = 0; i < result.Count; i++)
        {
            GameResultPB pb = result[i];
            Dictionary <int, RewardVo> rewardDict = new Dictionary <int, RewardVo>();
            for (int j = 0; j < pb.Awards.Count; j++)
            {
                RewardVo vo = new RewardVo(pb.Awards[j], true);
                if (rewardDict.ContainsKey(vo.Id))
                {
                    rewardDict[vo.Id].Num += vo.Num;
                }
                else
                {
                    rewardDict.Add(vo.Id, vo);
                }
            }
            RectTransform listItem = _content.GetChild(i).GetComponent <RectTransform>();
            var           isOnVip  = GlobalData.PlayerModel.PlayerVo.IsOnVip;
            if (isOnVip)
            {
                listItem.Find("Title/Text2").GetComponent <Text>().text = "+" + exp + I18NManager.Get("Common_VIPExp");
            }
            else
            {
                listItem.Find("Title/Text2").GetComponent <Text>().text = "+" + exp + I18NManager.Get("Common_Exp");
            }
            listItem.gameObject.Show();
            List <RewardVo> arr  = rewardDict.Values.ToList();
            var             prop = arr[arr.Count - 1];
            if (prop.Resource == ResourcePB.Item && prop.Id >= PropConst.CardUpgradePropSmall && prop.Id <= PropConst.CardUpgradePropLarge)
            {
                arr.Insert(1, prop);
                arr.RemoveAt(arr.Count - 1);
            }

            if (pb.DroppingItem != null && pb.DroppingItem.Count > 0)
            {
                for (int k = 0; k < pb.DroppingItem.Count; k++)
                {
                    DrawActivityDropItemVo vo = new DrawActivityDropItemVo(pb.DroppingItem[k], arr, HolidayModulePB.ActivityCareer);
                    _drawActivityDropItemDict.Add(i + "_" + vo.DisplayIndex, vo);
                    if (vo.TotalNum > _total)
                    {
                        _total = vo.TotalNum;
                    }
                }
            }

            SetItemReward(listItem, arr, _drawActivityDropItemDict);

            float height = 440;
            if (arr.Count > 3)
            {
                //2行的情况
                height = 766;
            }
            float lineY = -height + 5;

            listItem.sizeDelta = new Vector2(listItem.sizeDelta.x, height);
            RectTransform linePos = listItem.Find("Line").GetComponent <RectTransform>();
            linePos.anchoredPosition = new Vector2(linePos.anchoredPosition.x, lineY);
        }
        //显示最终值
        foreach (var dropItemVo in _drawActivityDropItemDict)
        {
            dropItemVo.Value.TotalNum = _total;
        }
    }
Exemplo n.º 16
0
 public void SetData(CapsuleLevelVo data, List <FansVo> list)
 {
     SetFansData(data, list);
     SetGoodsData(data);
 }