Exemplo n.º 1
0
    //扫荡回包
    private void OnSweep(ActivityLevelSweepRes res)
    {
        GlobalData.CapsuleLevelModel.UpdateUserActivityLevelInfo(res.UserActivityLevelInfo);
        LoadingOverlay.Instance.Hide();
        EventDispatcher.RemoveEvent(EventConst.ShowLastCapsuleBattleWindow);
        EventDispatcher.AddEventListener(EventConst.ShowLastCapsuleBattleWindow, OnSweepEnd);

        RepeatedField <GameResultPB> result = res.GameResult;
        CapsuleBattleSweepWindow     win    = PopupManager.ShowWindow <CapsuleBattleSweepWindow>("ActivityCapsuleBattle/Prefabs/CapsuleBattleSweepWindow");

        win.SetData(res.GameResult, ClientData.CustomerSelectedCapsuleLevel, result[0].Exp);
        win.MaskColor = new Color(0, 0, 0, 0.5f);
        if (GlobalData.CapsuleLevelModel.JumpData != null &&
            GlobalData.PropModel.GetUserProp(GlobalData.CapsuleLevelModel.JumpData.RequireId).Num >=
            GlobalData.CapsuleLevelModel.JumpData.RequireNum)
        {
            FlowText.ShowMessage(I18NManager.Get("MainLine_Hint1"));
        }

        for (int i = 0; i < result.Count; i++)
        {
            GameResultPB pb = result[i];
            GlobalData.PlayerModel.AddExp(pb.Exp);
        }

        View.RefreshNum();
    }
Exemplo n.º 2
0
    private void OnSweepHandler(VisitingSweepRes res)
    {
        LoadingOverlay.Instance.Hide();
        VisitModel _model = GetData <VisitModel>();

        EventDispatcher.RemoveEvent(EventConst.ShowLastVisitBattleWindow);
        EventDispatcher.AddEventListener <int>(EventConst.ShowLastVisitBattleWindow, OnSweepEnd);

        _model.UpdateMyLevel(res.UserLevel);
        int levelId = res.UserLevel.LevelId;
        RepeatedField <GameResultPB> result = res.GameResult;

        VisitBattleSweepWindow win = PopupManager.ShowWindow <VisitBattleSweepWindow>("Visit/Prefabs/VisitBattleSweepWindow");

        win.SetData(res.GameResult, _model.GetVisitLevelVoById(levelId, _model.GetMyLevelByLevelId(levelId).NpcId), result[0].Exp);
        win.MaskColor = new Color(0, 0, 0, 0.5f);

        for (int i = 0; i < result.Count; i++)
        {
            GameResultPB pb = result[i];
            GlobalData.PlayerModel.AddExp(pb.Exp);
        }

        GetData <VisitModel>().UpdateMyWeather(res.UserWeather);
        GlobalData.PlayerModel.UpdateUserPower(res.UserPower);

        VisitLevelView.SetLeftTime();
    }
Exemplo n.º 3
0
        private void SetData(GameResultPB pb)
        {
            if (pb != null)
            {
                Star       = pb.Star;
                Cap        = pb.Cap;
                Exp        = pb.Exp;
                CardExp    = pb.CardExp;
                CreateTime = pb.CreateTime;
                RewardList = new List <RewardVo>();
                for (int i = 0; i < pb.Awards.Count; i++)
                {
                    //道具在外部已经更新了
                    RewardVo vo = new RewardVo(pb.Awards[i], pb.Awards[i].Resource != ResourcePB.Item);
                    RewardList.Add(vo);
                }

                DrawActivityDropItemDict = new Dictionary <int, DrawActivityDropItemVo>();
                if (pb.DroppingItem != null)
                {
                    for (int i = 0; i < pb.DroppingItem.Count; i++)
                    {
                        DrawActivityDropItemVo vo = new DrawActivityDropItemVo(pb.DroppingItem[i], RewardList, HolidayModulePB.ActivityVisiting);
                        DrawActivityDropItemDict.Add(vo.DisplayIndex, vo);
                    }
                }

                UserCards = pb.UserCards;
            }
            else
            {
                Star       = 0;
                Cap        = 0;
                Exp        = 0;
                CardExp    = 0;
                CreateTime = 0;
                RewardList = null;
                UserCards  = null;
            }
        }
Exemplo n.º 4
0
    private void OnSweep(SweepRes res)
    {
        _model.UpdateMyLevel(res.UserLevel);

        LoadingOverlay.Instance.Hide();

        EventDispatcher.RemoveEvent(EventConst.ShowLastBattleWindow);
        EventDispatcher.AddEventListener(EventConst.ShowLastBattleWindow, OnSweepEnd);

        RepeatedField <GameResultPB> result = res.GameResult;
        BattleSweepWindow            win    = PopupManager.ShowWindow <BattleSweepWindow>("MainLine/Prefabs/BattleSweepWindow");

        win.SetData(res.GameResult, ClientData.CustomerSelectedLevel, result[0].Exp);
        win.MaskColor = new Color(0, 0, 0, 0.5f);

        if (_model.JumpData != null && GlobalData.PropModel.GetUserProp(_model.JumpData.RequireId).Num >=
            _model.JumpData.RequireNum)
        {
            FlowText.ShowMessage(I18NManager.Get("MainLine_Hint1"));
        }

        for (int i = 0; i < result.Count; i++)
        {
            GameResultPB pb = result[i];
            GlobalData.PlayerModel.AddExp(pb.Exp);
        }

        GlobalData.PlayerModel.UpdateUserPower(res.UserPower);

        GlobalData.RandomEventModel.AddEnergy(ClientData.CustomerSelectedLevel.CostEnergy * result.Count);

        if (GlobalData.RandomEventModel.CheckTrigger(7002, 7003))
        {
            new TriggerService().ShowNewGiftWindow().Execute();
        }
    }
Exemplo n.º 5
0
        public void SetData(RepeatedField <GameResultPB> result, LevelVo 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;
            }
        }