Пример #1
0
        // Update is called once per frame
        void Update()
        {
            if ((Time.time - _lastActiveTime) > _destoryIntervalTime && (_status == CardStatusEnum.Open))
            {
                // 进行第一次缩小
                //Debug.Log("进行第一次缩小");
                _status = CardStatusEnum.Destorying;
                var nowScale = GetComponent <Transform>().localScale;
                var toScale  = nowScale * 0.6f;
                GetComponent <Transform>().DOScale(toScale, 1.5f)
                .OnComplete(() => {
                    _destoryStartTime = Time.time;
                    // ...
                });
            }

            if ((Time.time - _destoryStartTime) > DESTORY_CONFIRM_TIME && (_status == CardStatusEnum.Destorying))
            {
                //Debug.Log("进行销毁");

                _status = CardStatusEnum.DestoryingCompleted;
                // 销毁cardagent;
                GetComponent <Transform>().DOScale(Vector3.zero, 0.5f)
                .OnComplete(() => {
                    _status = CardStatusEnum.Destoryed;
                });
            }
        }
Пример #2
0
        //
        //  Init 代理
        //
        protected void InitAgency()
        {
            _recentActiveTime = Time.time;
            _cardStatus       = CardStatusEnum.NORMAL;

            //_panel_top = -(_manager.OperationPanel.rect.yMin) + _manager.OperationPanel.rect.yMax;
            //_panel_bottom = 0;
            //_panel_left = 0;
            //_panel_right = -(_manager.OperationPanel.rect.xMin) + _manager.OperationPanel.rect.xMax;


            var opposition = _manager.OperationPanel.position;

            _panel_top    = opposition.y + (_manager.OperationPanel.rect.height / 2);
            _panel_bottom = opposition.y - (_manager.OperationPanel.rect.height / 2);
            _panel_left   = opposition.x - (_manager.OperationPanel.rect.width / 2);
            _panel_right  = opposition.x + (_manager.OperationPanel.rect.width / 2);

            //print("_panel_top:" + _panel_top+ "---_panel_bottom:" + _panel_bottom+ "---_panel_left:" + _panel_left+ "---_panel_right:" + _panel_right);
            //_panel_left = _manager.OperationPanel.rect.xMin;
            //print("_manager.OperationPanel.rect.xMin; : " + _manager.OperationPanel.rect.xMin);
            //_panel_right = _panel_left + -(_manager.OperationPanel.rect.xMin) + _manager.OperationPanel.rect.xMax;


            _safe_distance_width  = GetComponent <RectTransform>().rect.width / 3;
            _safe_distance_height = GetComponent <RectTransform>().rect.height / 3;


            DoCardReset();
        }
Пример #3
0
        //
        //  恢复
        //
        private void DoRecover()
        {
            _protectAgent.DoClose();
            _cardStatus = CardStatusEnum.RECOVER;

            DoUpdate();

            // 停止销毁动画
            //Debug.Log("kill 第一次销毁动画");
            _destory_first_scale_tweener.Kill();
            Vector3 scaleVector3 = new Vector3(1f, 1f, 1f);

            // 此时会出现卡顿现象,可能是因为之前的缩小动画并未执行完毕,所以会与此语句冲突
            GetComponent <RectTransform>().DOScale(scaleVector3, 0.5f)
            .OnUpdate(() =>
            {
                _width         = GetComponent <RectTransform>().sizeDelta.x;
                _height        = GetComponent <RectTransform>().sizeDelta.y;
                _hasChangeSize = true;
                DoUpdate();
            }).OnComplete(() =>
            {
                //IsChoosing = false;
                _cardStatus = CardStatusEnum.NORMAL;
                //_cardRecoverStatus = CardRecoverStatus.Init;
                DoUpdate();
            });
        }
Пример #4
0
        // Start is called before the first frame update
        void Start()
        {
            _lastActiveTime = Time.time;
            _status         = CardStatusEnum.Open;

            _destoryStartTime = Mathf.Infinity;
        }
Пример #5
0
        public void DoMove()
        {
            DoUpdate();

            //Debug.Log("DO MOVE BUTTON");


            // 移动
            if (_cardStatus == CardStatusEnum.NORMAL)
            {
                DoUpdate();

                _cardStatus = CardStatusEnum.MOVE;
                _moveAgent.Show();

                NotifyObserver();
            }
            else if (_cardStatus == CardStatusEnum.MOVE)
            {
                DoUpdate();
                _cardStatus = CardStatusEnum.NORMAL;
                _moveAgent.Hide();

                NotifyObserver();
            }
        }
Пример #6
0
 //
 //  关闭视频
 //
 private void CloseVideoContainer()
 {
     _cardStatus = CardStatusEnum.NORMAL;
     videoContainer.gameObject.SetActive(false);
     _videoAgent?.DoDestory();
     Destroy(_videoAgent?.gameObject);
     DoUpdate();
 }
Пример #7
0
 public BankAccount(int cardId, string name, string lastName, double amount, int bonus, CardStatusEnum cardStatus)
 {
     this.BonusAmount = bonus;
     this.CardID      = cardId;
     this.Name        = name;
     this.LastName    = lastName;
     this.Amount      = amount;
     this.CardStatus  = cardStatus;
 }
Пример #8
0
        public void CancelGoToFront(Action onFinsihed)
        {
            var cardGoToFrontMoveAni  = _tweenerManager.Get(FlockTweenerManager.Card_GoToFront_Move);
            var cardGoToFrontScaleAni = _tweenerManager.Get(FlockTweenerManager.Card_GoToFront_Scale);

            cardGoToFrontMoveAni.Kill();
            cardGoToFrontScaleAni.Kill();
            _cardStatus = CardStatusEnum.NORMAL;
        }
Пример #9
0
 // 显示 Video 的窗口
 private void OpenVideoContainer(string address, string description, string cover)
 {
     _cardStatus = CardStatusEnum.HIDE;
     videoContainer.gameObject.SetActive(true);
     _videoAgent = Instantiate(videoAgentPrefab, videoContainer);
     _videoAgent.SetData(address, description, this, cover, () => {
         //Debug.Log("video agent is update");
         //Debug.Log("current free time : " + GetFreeTime());
         DoUpdate();
     });
     _videoAgent.Init();
 }
Пример #10
0
        //
        //  第二步的销毁
        //
        private void DoDestoriedForSecondStep()
        {
            _cardStatus = CardStatusEnum.DESTORYINGSECOND;

            _protectAgent.SetDisabled();

            GetComponent <CircleCollider2D>().radius = 0;

            if (_originAgent == null)
            {
                Close();
            }
            else if (_originAgent.isStarEffect)
            {
                Close();
            }
            else
            {
                //  如果场景没有变,则回到原位置
                if ((_sceneIndex == _manager.SceneIndex) && (_originAgent != null))
                {
                    //恢复并归位
                    // 缩到很小很小
                    RectTransform cardRect = GetComponent <RectTransform>();

                    //  移到后方、缩小、透明
                    Tweener t = cardRect.DOScale(0.1f, 1f);

                    //  获取位置
                    Vector3 to = new Vector3(_originAgent.OriVector2.x - _manager.PanelOffsetX
                                             , _originAgent.OriVector2.y - _manager.PanelOffsetY, 200);

                    cardRect.DOAnchorPos3D(to, 1f)
                    .OnComplete(() =>
                    {
                        if ((_sceneIndex == _manager.SceneIndex) && (_originAgent != null))
                        {
                            // 恢复
                            _originAgent.DoRecoverAfterChoose(cardRect.position);
                        }
                        _cardStatus = CardStatusEnum.OBSOLETE;
                    });
                }
                //  直接消失
                else
                {
                    Close();
                }
            }
        }
Пример #11
0
        /// <summary>
        /// 直接关闭
        /// </summary>
        public void DirectClose()
        {
            if (_openTweener.active)
            {
                _openTweener.Kill();
            }


            _status = CardStatusEnum.DestoryingCompleted;
            // 销毁cardagent;
            GetComponent <Transform>().DOScale(Vector3.zero, 0.5f)
            .OnComplete(() => {
                _status = CardStatusEnum.Destoryed;
            }).SetEase(Ease.InBack);
        }
Пример #12
0
        public void Recover()
        {
            _status = CardStatusEnum.Recover;

            Debug.Log("进行恢复");

            Vector3 to = new Vector3(1.6f, 1.6f, 1f);

            DoUpdated();

            GetComponent <Transform>().DOScale(to, 1f)
            .OnComplete(() => {
                _status = CardStatusEnum.Open;
                DoUpdated();
            });
        }
Пример #13
0
        public BankAccount(int cardId, string name, string lastName, CardStatusEnum cardStatus)
        {
            switch ((int)cardStatus)
            {
            case 0: this.BonusAmount = 100; break;

            case 1: this.BonusAmount = 200; break;

            case 2: this.BonusAmount = 300; break;

            default: throw new ArgumentException();
            }
            this.CardID     = cardId;
            this.Name       = name;
            this.LastName   = lastName;
            this.CardStatus = cardStatus;
        }
Пример #14
0
        private static string GetStatusString(CardStatusEnum status)
        {
            switch (status)
            {
            case CardStatusEnum.NotVerify:
                return("CARD_STATUS_NOT_VERIFY");

            case CardStatusEnum.VerifyFall:
                return("CARD_STATUS_VERIFY_FALL");

            case CardStatusEnum.VerifyOk:
                return("CARD_STATUS_VERIFY_OK");

            case CardStatusEnum.Delete:
                return("CARD_STATUS_USER_DELETE");

            case CardStatusEnum.Dispatch:
                return("CARD_STATUS_USER_DISPATCH");
            }
            throw new NotSupportedException("不支持的卡券状态类型:" + status);
        }
Пример #15
0
        private void Close()
        {
            // 慢慢缩小直到消失
            Vector3 vector3 = Vector3.zero;

            GetComponent <RectTransform>().DOScale(vector3, 1.5f)
            .OnUpdate(() =>
            {
                _width  = GetComponent <RectTransform>().sizeDelta.x;
                _height = GetComponent <RectTransform>().sizeDelta.y;
            })
            .OnComplete(() =>
            {
                _cardStatus = CardStatusEnum.OBSOLETE;

                if (!(_originAgent.flockStatus == FlockStatusEnum.PREPARED))
                {
                    _originAgent.flockStatus = FlockStatusEnum.OBSOLETE;
                }

                Debug.Log("直接删除");
            });
        }
Пример #16
0
        /// <summary>
        /// 销毁第一阶段
        /// </summary>
        private void DoDestoriedForFirstStep()
        {
            //Debug.Log(gameObject.name + " 进行第一次销毁。");

            // 如果当前处于移动中,则将移动关闭
            if (_cardStatus == CardStatusEnum.MOVE)
            {
                DoMove();
            }

            _protectAgent.DoActive(ProtectUpdatedInToDestory);

            //  缩放
            Vector3 scaleVector3 = new Vector3(0.7f, 0.7f, 0.7f);

            _cardStatus = CardStatusEnum.DESTORYINGFIRST;

            _destory_first_scale_tweener = GetComponent <RectTransform>().DOScale(scaleVector3, 2f)
                                           .OnUpdate(() =>
            {
                _width         = GetComponent <RectTransform>().sizeDelta.x;
                _height        = GetComponent <RectTransform>().sizeDelta.y;
                _hasChangeSize = true;
            }).OnComplete(() =>
            {
                // 设置第一次缩小的点
                _destoryFirstStageCompleteTime = Time.time;

                _cardStatus = CardStatusEnum.DestoryFirstCompleted;

                //Debug.Log(_originAgent.flockStatus);
            }).OnKill(() => {});


            _tweenerManager.Add("d", _destory_first_scale_tweener);
            //Debug.Log(gameObject.name + " 第一次销毁结束,增加了tweener。");
        }
Пример #17
0
        /// <summary>
        /// 批量查询卡列表。
        /// </summary>
        /// <param name="skip">查询卡列表的起始偏移量,从0开始,即offset: 5是指从从列表里的第六个开始读取。</param>
        /// <param name="take">需要查询的卡片的数量(数量最大50)。</param>
        /// <param name="status">支持开发者拉出指定状态的卡券列表,例:仅拉出通过审核的卡券。</param>
        /// <returns>卡券信息。</returns>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="take"/> 等于0或者大于50。</exception>
        public CardListResult GetCardList(uint skip, ushort take, CardStatusEnum[] status = null)
        {
            if (take > 50 || take == 0)
                throw new ArgumentOutOfRangeException("take", "查询的数量必须大于0小等于50。");

            var url = "https://api.weixin.qq.com/card/batchget?access_token=" + _accountModel.GetAccessToken();

            object postData;
            if (status == null)
            {
                postData = new { offset = skip, count = take };
            }
            else
            {
                postData = new { offset = skip, count = take, status_list = status.Select(GetStatusString).ToArray() };
            }

            return WeiXinHttpHelper.PostResultByJson<CardListResult>(url, postData);
        }
Пример #18
0
 public CardApiModel(int num, TypeCardEnum type, CardStatusEnum status)
 {
     IdCard     = num;
     Type       = type;
     CardStatus = status;
 }
Пример #19
0
        private static string GetStatusString(CardStatusEnum status)
        {
            switch (status)
            {
                case CardStatusEnum.NotVerify:
                    return "CARD_STATUS_NOT_VERIFY";

                case CardStatusEnum.VerifyFall:
                    return "CARD_STATUS_VERIFY_FALL";

                case CardStatusEnum.VerifyOk:
                    return "CARD_STATUS_VERIFY_OK";

                case CardStatusEnum.Delete:
                    return "CARD_STATUS_USER_DELETE";

                case CardStatusEnum.Dispatch:
                    return "CARD_STATUS_USER_DISPATCH";
            }
            throw new NotSupportedException("不支持的卡券状态类型:" + status);
        }