Exemple #1
0
        public override void InitData(OperateCardData operateCardData)
        {
            OperateCardDataSlide operateCardDataSlide = (OperateCardDataSlide)operateCardData;

            //Debug.Log("Do In slice: " + operateCardDataSlide.Title);
            _data = operateCardDataSlide;

            InitUI();

            // 初始化卡片块
            InitAgency();
            _questionTypeEnum = QuestionTypeEnum.SliceCard;

            _sliceScrollAgent.Init(_data, (data, scrollDirection) => {
                DoUpdate();
                UpdateDescription(data.Description);
                AdjustUILocation();
            }, OnClickScale, DoVideo, () => {
                // scale 部分调整完毕
                //AdjustUI();
                DoUpdate();
                ShowUI();

                var data = operateCardDataSlide.ScrollData[0];
                UpdateDescription(data.Description);
            });

            var extraDatas = operateCardDataSlide.ExtraCardData;

            InitComponents(extraDatas);
        }
Exemple #2
0
        public override void InitData(OperateCardData operateCardData)
        {
            OperateCardDataCross operateCardDataCross = (OperateCardDataCross)operateCardData;

            _cardData = operateCardDataCross;

            var _navList = new List <CrossCardNavType>();

            _navList.Add(CrossCardNavType.Index);

            if (operateCardDataCross.ScrollDic.ContainsKey(CrossCardNavType.CataLog))
            {
                _navList.Add(CrossCardNavType.CataLog);
            }

            if (operateCardDataCross.ScrollDic.ContainsKey(CrossCardNavType.Product))
            {
                _navList.Add(CrossCardNavType.Product);
            }

            if (operateCardDataCross.ScrollDic.ContainsKey(CrossCardNavType.Activity))
            {
                _navList.Add(CrossCardNavType.Activity);
            }

            if (operateCardDataCross.ScrollDic.ContainsKey(CrossCardNavType.Video))
            {
                _navList.Add(CrossCardNavType.Video);
            }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

            InitAgency();
            _questionTypeEnum = QuestionTypeEnum.CrossCard;

            _crossScrollAgent.Init(_cardData, (data, navtype, scrollDirection) => {
                DoUpdate();
                Debug.Log("Has Changed : [NAV]" + navtype + "[data]" + data);
                UpdateDescription(data.Description);

                if (scrollDirection == ScrollDirectionEnum.Left)
                {
                    _scrollBarAgent.TurnLeft();
                }
                else if (scrollDirection == ScrollDirectionEnum.Right)
                {
                    _scrollBarAgent.TurnRight();
                }
            }, OnClickScale, DoVideo);

            InitUI();

            _scrollBarAgent.Init(_navList, (dir) => {
            });
        }
Exemple #3
0
 public virtual void InitData(OperateCardData operateCardData)
 {
     //Debug.Log("Do In Parent");
 }
Exemple #4
0
        public override void InitData(OperateCardData operateCardData)
        {
            OperateCardDataSingle operateCardDataSingle = (OperateCardDataSingle)operateCardData;

            Debug.Log("Do In slice: " + operateCardDataSingle.Title);
        }
        public static CardAgent Generate(MagicWallManager magicWallManager, Vector3 position
                                         , Transform parent, int dataId, DataTypeEnum dataType, FlockAgent refFlockAgent)
        {
            IDaoService daoService = magicWallManager.daoServiceFactory.GetDaoService(refFlockAgent.daoTypeEnum);

            OperateCardData cardData   = null;
            CardAgent       cardPrefab = null;

            //magicWallManager.daoService.getac
            if (dataType == DataTypeEnum.Enterprise)
            {
                Enterprise enterprise = daoService.GetEnterpriseById(dataId);

                Debug.Log("enterprise : " + (enterprise == null));

                var activities = daoService.GetActivitiesByEnvId(enterprise.Ent_id);
                var products   = daoService.GetProductsByEnvId(enterprise.Ent_id);
                var videos     = daoService.GetVideosByEnvId(enterprise.Ent_id);
                var catalogs   = daoService.GetCatalogs(enterprise.Ent_id);
                OperateCardDataCross operateCardDataCross = EnterpriseAdapter
                                                            .Transfer(enterprise, activities, products, videos, catalogs);
                //Debug.Log(operateCardDataCross.ToString());

                //if (CheckIsSimple(operateCardDataCross))
                //{
                //    cardPrefab = magicWallManager.operateCardManager.singleCardPrefab;
                //    cardData = operateCardDataCross;

                //    Debug.Log("Generate 单个企业卡片");
                //}
                //else
                //{
                cardPrefab = magicWallManager.operateCardManager.crossCardPrefab;
                // 单个卡片的逻辑
                //OperateCardDataSingle operateCardDataSingle = new OperateCardDataSingle();

                // Debug.Log("Generate 正常企业卡片");
                cardData = operateCardDataCross;

                //cardData = (OperateCardDataSingle)operateCardDataCross;
                //}
            }
            else if (dataType == DataTypeEnum.Product || dataType == DataTypeEnum.Wine)
            {
                Product    product    = daoService.GetProductDetail(dataId);
                Enterprise enterprise = daoService.GetEnterpriseById(product.Ent_id);

                Debug.Log("enterprise : " + enterprise);

                //Debug.Log("enterprise to null : " + (enterprise == null));


                OperateCardDataSlide operateCardDataSlide = ProductAdapter.Transfer(product, enterprise);
                cardPrefab = magicWallManager.operateCardManager.sliceCardPrefab;
                cardData   = operateCardDataSlide;
            }
            else
            {
                Activity             activity             = daoService.GetActivityDetail(dataId);
                Enterprise           enterprise           = daoService.GetEnterpriseById(activity.Ent_id);
                OperateCardDataSlide operateCardDataSlide = ActivityAdapter.Transfer(activity, enterprise);
                cardPrefab = magicWallManager.operateCardManager.sliceCardPrefab;
                cardData   = operateCardDataSlide;
            }

            // 创建card
            CardAgent cardAgent = Instantiate(cardPrefab, parent);

            cardAgent.GetComponent <Transform>().position = position;
            //cardAgent.DataId = dataId;
            cardAgent.InitComponent(magicWallManager, dataId, dataType, position, refFlockAgent);
            cardAgent.InitData(cardData);
            return(cardAgent);
        }