コード例 #1
0
        public void RefreshOneActivity(UserEncourageActVo uservo)
        {
            var encouragevo = _supporterActivityModel.EncourageRuleDic[uservo.ActId];

            //Debug.LogError(_curChooseTransform.parent.GetSiblingIndex());
            var tranparent       = _curChooseTransform.parent;
            var hassupportertran = tranparent.Find("HasSupport");

            PointerClickListener.Get(_activityList.GetChild(tranparent.GetSiblingIndex()).gameObject).parameter =
                uservo;


            RefreshActTween(_curChooseTransform, hassupportertran, tranparent.GetSiblingIndex() == 1, () =>
            {
                var hasActBg = hassupportertran.Find("HasActBG");

                hasActBg.Find("SupportAct1").gameObject.SetActive(encouragevo.MovieId == 1); //取决于要不要显示
                hasActBg.Find("SpineRoot").gameObject.SetActive(encouragevo.MovieId != 1);

                var chooseAni = encouragevo.MovieId == 1
                    ? hasActBg.Find("SupportAct1").gameObject
                    : hasActBg.Find("SpineRoot/SpineSkeletonGraphic").gameObject;
                //动画到某阶段的时候突然间改变
                chooseAni.transform.Find("02_scene")?.GetComponent <MovingTween>()?.PaseTween();
                if (encouragevo.MovieId != 1)
                {
                    SetSupporterSpine(chooseAni, GetAni(encouragevo.MovieId));
                }

                SetNotSupportData(_curChooseTransform, encouragevo, uservo);
            });
        }
コード例 #2
0
 public void RefreshStartItemData(UserEncourageActVo vo, bool isReceiveAwrad = false)
 {
     if (isReceiveAwrad)
     {
         PointerClickListener.Get(_activityList.GetChild(vo.PosIndex).gameObject).parameter = vo;
         PointerClickListener.Get(_activityList.GetChild(vo.PosIndex).gameObject).onClick   = GoToFansModule;
     }
     SetActivityItemData(_activityList.GetChild(vo.PosIndex), vo);
 }
コード例 #3
0
        private void SetActivityItemData(Transform tran, UserEncourageActVo vo) //,EncourageActDoneRuleVo donerule
        {
            var encouragevo = _supporterActivityModel.EncourageRuleDic[vo.ActId];

            var notsupporttran = tran.Find("NotSupport");
            var hassupporttran = tran.Find("HasSupport");

            var hasActBg = hassupporttran.Find("HasActBG");

            hasActBg.Find("SupportAct1").gameObject.SetActive(encouragevo.MovieId == 1); //取决于要不要显示
            hasActBg.Find("SpineRoot").gameObject.SetActive(encouragevo.MovieId != 1);

            _actAni = encouragevo.MovieId == 1
                ? hasActBg.Find("SupportAct1").gameObject
                : hasActBg.Find("SpineRoot/SpineSkeletonGraphic").gameObject;


            tran.gameObject.Show();
            SetActItemStatePos(hassupporttran, notsupporttran, vo.StartState == 0, tran.GetSiblingIndex() == 1);

            if (vo.StartState == 0)
            {
                SetNotSupportData(notsupporttran, encouragevo, vo);
                SetDefaultState(hassupporttran, false);
                notsupporttran.SetAsLastSibling();
                _actAni.transform.Find("02_scene")?.GetComponent <MovingTween>()?.PaseTween();
                if (encouragevo.MovieId != 1)
                {
                    SetSupporterSpine(_actAni, GetAni(encouragevo.MovieId));
                }
            }
            else
            {
                //变成应援活动的时候才需要切换动画
                if (vo.NeedToChangeAni)
                {
                    _supporterActivityModel.GetUserActVo(vo.Id).NeedToChangeAni = false;
                    ChangeActTween(notsupporttran, hassupporttran, tran.GetSiblingIndex() == 1, () =>
                    {
                        //动画到某阶段的时候突然间改变
                        SetHasSupportData(hassupporttran, vo, encouragevo);
                        SetDefaultState(notsupporttran, true);
                        hassupporttran.SetAsLastSibling();
                    });
                }
                else
                {
                    SetHasSupportData(hassupporttran, vo, encouragevo);
                    SetDefaultState(notsupporttran, true);
                    hassupporttran.SetAsLastSibling();
                }
            }
        }
コード例 #4
0
        public void SetData(UserEncourageActVo vo, SupporterActivityModel supporterActivityModel)
        {
            _userEncourageActVo = vo;
            _encourageActRuleVo = supporterActivityModel.EncourageRuleDic[vo.ActId];
            _supporterName.text = _encourageActRuleVo.Title;
            _changeCost.text    = supporterActivityModel.GetRefreshCost(supporterActivityModel.RefreshCount + 1).Gold
                                  .ToString();
            _timeLabel.text = I18NManager.Get("SupporterActivity_Time", _encourageActRuleVo.NeedTime / 60);//"时间" + + "小时";
            //_leftEnerge.text = "消耗:" + _encourageActRuleVo.Power;
            for (int k = 0; k < 3; k++)
            {
                _fansList.GetChild(k).gameObject.Hide();
                _propList.GetChild(k).gameObject.Hide();
            }


            var i = 0;

            foreach (var v in _encourageActRuleVo.Fans)
            {
                _fansList.GetChild(i).gameObject.Show();
                SetFansData(_fansList.GetChild(i), v.Key, v.Value);
                i++;
            }

            for (int k = 0; k < _fansList.childCount; k++)
            {
                if (!_fansList.GetChild(k).gameObject.activeInHierarchy)
                {
                    _fansList.GetChild(k).gameObject.Show();
                    SetFansData(_fansList.GetChild(k), 0, 0);
                }
            }


            var j = 0;

            foreach (var v in _encourageActRuleVo.Consume)
            {
                _propList.GetChild(j).gameObject.Show();
                PointerClickListener.Get(_propList.GetChild(j).gameObject).onClick = null;
                PointerClickListener.Get(_propList.GetChild(j).gameObject).onClick = go =>
                {
                    FlowText.ShowMessage(I18NManager.Get("SupporterActivity_ItemPath"));
                };
                SetPropData(_propList.GetChild(j), v.Key, v.Value);
                j++;
            }

            SetSupporterEnergy();
        }
コード例 #5
0
        SetHasSupportData(Transform tran, UserEncourageActVo vo,
                          EncourageActRuleVo rulevo) //,EncourageActDoneRuleVo donerule
        {
            if (rulevo.MovieId == 1)
            {
                _actAni = tran.Find("HasActBG/SupportAct1").gameObject;
            }
            else
            {
                _actAni = tran.Find("HasActBG/SpineRoot/SpineSkeletonGraphic").gameObject;
            }

//        Debug.LogError(vo.StartState);
            tran.Find("SupporterActivityName").gameObject.Show();
            tran.Find("SupporterActivityName/Text").GetComponent <Text>().text = rulevo.Title;
            //tran.Find("NoSupporterBg/SupporterActivityName/Text").GetComponent<Text>().text = rulevo.Title;
            var rulebtn = tran.Find("Rule");

            rulebtn.gameObject.Show();
            var statetran = tran.Find("ActivityState");

            PointerClickListener.Get(rulebtn.gameObject).onClick = go =>
            {
                SendMessage(new Message(MessageConst.CMD_SUPPORTERACTIVITY_REWARDTIPS,
                                        Message.MessageReciverType.CONTROLLER, rulevo));
            };

            var time = rulevo.NeedTime * 60 * 1000 - (ClientTimer.Instance.GetCurrentTimeStamp() - vo.AcceptTime);

            //时间走完之前,或者非直接完成,都会出现倒计时。以下代码为核心代码!
            if (time > 0 && vo.ImmediateFinishState != 1 && vo.AwardState != 1
                ) //ClientTimer.Instance.GetCurrentTimeStamp(vo.AcceptTime)!=null)
            {
                statetran.GetChild(0).gameObject.SetActive(true);
                statetran.GetChild(1).gameObject.SetActive(false);
                statetran.GetChild(2).gameObject.SetActive(false);
                var speedup   = statetran.GetChild(0).Find("SpeedUpActivityBtn").GetComponent <Button>();
                var num       = statetran.GetChild(0).Find("SpeedUpActivityBtn/Icon/Num").GetComponent <Text>();
                var timelabel = statetran.GetChild(0).Find("TimeLabel").GetComponent <Text>();
                //Debug.LogError("剩余时间"+ClientTimer.Instance.TransformTime(donerule.Time*60*1000-(ClientTimer.Instance.GetCurrentTimeStamp()-vo.AcceptTime)));
                timelabel.text = I18NManager.Get("SupporterActivity_Left") + DateUtil.GetTimeFormat4(time);
                num.text       = "X" + _supporterActivityModel.GetGemByTime(ClientTimer.Instance.GetCurHour(time));

                speedup.onClick.RemoveAllListeners();
                speedup.onClick.AddListener(() =>
                {
                    _curChooseTransform = tran;
                    SendMessage(new Message(MessageConst.CMD_SUPPORTERACTIVITY_DONEIMMEDIATE,
                                            Message.MessageReciverType.CONTROLLER, vo));
                });

                //只有在倒计时的时候才要有动画
                _actAni.transform.Find("02_scene")?.GetComponent <MovingTween>()?.PlayTween();

                if (rulevo.MovieId != 1)
                {
                    SetSupporterSpine(_actAni, GetAni(rulevo.MovieId), true);
                }

                return;
            }


            //已完成和可领取的状态都要有动画
            _actAni.transform.Find("02_scene")?.GetComponent <MovingTween>()?.PaseTween();
            if (rulevo.MovieId != 1)
            {
                SetSupporterSpine(_actAni, GetAni(rulevo.MovieId));
            }

            switch (vo.AwardState)
            {
            case 0:
                statetran.GetChild(0).gameObject.SetActive(false);
                statetran.GetChild(1).gameObject.SetActive(true);
                statetran.GetChild(2).gameObject.SetActive(false);
                var rewardBtn = statetran.GetChild(1).Find("FinishActivityBtn").GetComponent <Button>();
                rewardBtn.onClick.RemoveAllListeners();
                rewardBtn.onClick.AddListener(() =>
                {
                    SendMessage(new Message(MessageConst.CMD_SUPPORTERACTIVITY_GETREWARD,
                                            Message.MessageReciverType.CONTROLLER, vo));
                });
                //设置为可领奖状态
                for (int i = 0; i < _useencourageActVos.Count; i++)
                {
                    if (_useencourageActVos[i].ActId == vo.ActId)
                    {
                        _useencourageActVos[i].CanReceiveAward = true;
                    }
                }


                break;

            case 1:
                statetran.GetChild(0).gameObject.SetActive(false);
                statetran.GetChild(1).gameObject.SetActive(false);
                statetran.GetChild(2).gameObject.SetActive(true);
                rulebtn.gameObject.Hide();
                break;
            }
        }
コード例 #6
0
        private void SetNotSupportData(Transform tran, EncourageActRuleVo encouragevo, UserEncourageActVo uservo)
        {
            var nametran = tran.Find("SupporterActivityName/Text");

            nametran.gameObject.Show();
            var name     = nametran.GetComponent <Text>();
            var timetran = tran.Find("SandGlasss/TimeLabel");

            timetran.gameObject.Show();
            var timeLabel = timetran.GetComponent <Text>();

            name.text      = encouragevo.Title;
            timeLabel.text = I18NManager.Get("SupporterActivity_Time", encouragevo.NeedTime / 60);//"时间:" +  + "小时";

            var rewardList = tran.Find("RewardList");
            var changeBtn  = tran.Find("ChangeBtn").GetButton();
            var costText   = tran.Find("Icon/Num").GetText();

            costText.text = lastcost.ToString();

            changeBtn.onClick.RemoveAllListeners();
            changeBtn.onClick.AddListener(() =>
            {
                //FlowText.ShowMessage("更换活动协议!");
                _curChooseTransform = tran;
                if (uservo.StartState == 0)
                {
                    SendMessage(new Message(MessageConst.CMD_SUPPORTERACTIVITY_REFRESH,
                                            Message.MessageReciverType.CONTROLLER, uservo));
                }
            });

            //可能三种情况:1.只出现粉丝2.只出现钻石。3.只出现道具。
            for (int i = 0; i < rewardList.childCount; i++)
            {
                rewardList.GetChild(i).gameObject.Hide();
            }

            //刷新的时候就会出现BUG了
            RepeatedField <AwardPB> enactaward = new RepeatedField <AwardPB>();

            enactaward.Clear();

            if (encouragevo.RandomFansNum > 0)
            {
                enactaward.Add(new AwardPB()
                {
                    Num = encouragevo.RandomFansNum, Resource = ResourcePB.Fans, ResourceId = 1
                });
            }
            enactaward.Add(encouragevo.Awards);

            for (int i = 0; i < enactaward.Count; i++)
            {
                rewardList.GetChild(i).gameObject.Show();
                SetPropData(rewardList.GetChild(i), enactaward[i]);
            }
        }