Exemplo n.º 1
0
        public void Init(SceneConfig sceneConfig, MagicWallManager manager, Action onSceneCompleted)
        {
            _manager          = manager;
            _onSceneCompleted = onSceneCompleted;

            _cutEffect = CutEffectFactory.GetCutEffect(sceneConfig.sceneType); // 设置过场效果
            _cutEffect.Init(_manager, sceneConfig
                            , OnCutEffectCreateAgentCompleted,
                            () => {
                // on effect completed

                _runEntrance = false;
            }, () =>
            {
                // on display Start

                _runDisplay       = true;
                _displayStartTime = Time.time;
            }
                            );
            _dataType = sceneConfig.dataType; // 设置类型

            //  显示
            _displayBehavior = DisplayBehaviorFactory.GetBehavior(sceneConfig.displayBehavior);

            // 销毁
            _destoryBehavior = DestoryBehaviorFactory.GetBehavior(sceneConfig.destoryBehavior);
            _destoryBehavior.Init(_manager, this, OnDestoryCompleted, sceneConfig);

            _sceneConfig = sceneConfig;

            _magicSceneEnumStatus = MagicSceneEnum.Running;

            _runEntrance = true;
        }
Exemplo n.º 2
0
        //
        //  Init
        //
        public void Init(MagicWallManager manager, SceneConfig sceneConfig,
                         Action <DisplayBehaviorConfig> OnCreateAgentCompleted,
                         Action OnEffectCompleted, Action OnDisplayStart
                         )
        {
            //  初始化 manager
            _manager     = manager;
            _sceneConfig = sceneConfig;

            _dataTypeEnum = sceneConfig.dataType;

            _daoService = _manager.daoServiceFactory.GetDaoService(sceneConfig.daoTypeEnum);

            if (sceneConfig.isKinect == 0)
            {
                row_set = _manager.managerConfig.Row;
            }
            else
            {
                row_set = _manager.managerConfig.KinectRow;
            }


            _onCreateAgentCompleted = OnCreateAgentCompleted;
            _onEffectCompleted      = OnEffectCompleted;
            _onDisplayStart         = OnDisplayStart;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        public void InitData(List <SearchBean> searchBeans, string title, MagicWallManager manager, CardAgent cardAgent)
        {
            Reset();

            _title.text = title;
            _manager    = manager;
            _cardAgent  = cardAgent;

            _moveBtnComponent.Init(DoMove, _cardAgent);

            int count = searchBeans.Count;

            if (count == 0)
            {
                _noResultContainer.gameObject.SetActive(true);
            }
            else
            {
                _noResultContainer.gameObject.SetActive(false);

                // 根据 search beans 进行初始化内容
                for (int i = 0; i < searchBeans.Count; i++)
                {
                    CreateItem(searchBeans[i]);
                }

                // 获取高度
                SetContentSize();

                // 初始化滚动条
                _searchResultScrollBarAgent.Init(_onUpdated);
            }
        }
Exemplo n.º 4
0
        public void Init(MagicWallManager manager)
        {
            _manager = manager;
            var config = _manager.daoServiceFactory.GetConfig();

            SetMWConfig(config);
        }
Exemplo n.º 5
0
        /// <summary>
        ///     创建
        /// </summary>

        public static FlockAgent Generate(MagicWallManager manager, Vector2 position
                                          , AgentContainerType parent, float ori_x, float ori_y,
                                          int row, int column, float width, float height, FlockData flockData, DaoTypeEnum daoTypeEnum)
        {
            //Debug.Log("aa");


            FlockAgent _flockAgent = manager.agentManager.GetFlockAgent(parent);

            _flockAgent.name = "[" + manager.SceneIndex + "]Agent" + row + "-" + column;

            //Debug.Log("bb");


            //  定面板位置
            Vector2 ori_position = new Vector2(ori_x, ori_y);


            //Debug.Log("Generate flock data : " + flockData.GetId());

            _flockAgent.Initialize(manager, ori_position, position,
                                   row, column, width, height, flockData.GetId(), flockData.GetCover(), false,
                                   flockData.GetDataType(), parent, daoTypeEnum);

            manager.agentManager.AddItem(_flockAgent);

            //CardAgent cardAgent = Instantiate(cardPrefab, parent);



            return(_flockAgent);
        }
Exemplo n.º 6
0
        private void InitUI()
        {
            MagicWallManager manager = GameObject.Find("MagicWall").GetComponent <MagicWallManager>();

            if (manager.screenTypeEnum == ScreenTypeEnum.Screen1080P)
            {
                // 提示按钮
                _questionContainer.anchoredPosition = new Vector2(391, 243);

                // 描述模块
            }
            else
            {
                _questionContainer.anchoredPosition = new Vector2(391, 243);
            }

            /// 设置主题相关

            // 设置遮罩图片
            _backgroundImg.sprite = _manager.themeManager.GetService().GetCardBackShade(FlockCardTypeEnum.CrossCard);
            // 设置标题
            _title.color = _manager.themeManager.GetService().GetFontColor();
            // 设置描述
            _description.color = _manager.themeManager.GetService().GetFontColor();
            // 设置scroll
            _scrollImg.sprite = _manager.themeManager.GetService().GetScrollBarSprite();
        }
Exemplo n.º 7
0
        /// <summary>
        ///         初始化 Agent 信息,在生成浮动块时调用
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="originVector">在屏幕上显示的位置</param>
        /// <param name="genVector">出生的位置</param>
        /// <param name="row">x</param>
        /// <param name="column">y</param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="dataId"></param>
        /// <param name="dataImg"></param>
        /// <param name="dataIsCustom"></param>
        /// <param name="dataType"></param>
        public virtual void Initialize(MagicWallManager manager, Vector2 originVector, Vector2 genVector, int row,
                                       int column, float width, float height, int dataId, string dataImg, bool dataIsCustom, DataTypeEnum dataTypeEnum, AgentContainerType agentContainerType, DaoTypeEnum daoTypeEnum)
        {
            InitBase(manager, dataId, dataTypeEnum, daoTypeEnum);
            _manager   = manager;
            OriVector2 = originVector;

            //  出生位置
            GenVector2 = genVector;
            GetComponent <RectTransform>().anchoredPosition = genVector;

            _nextVector2 = genVector;

            _x      = row;
            _y      = column;
            _width  = width;
            _height = height;

            // 设置组件长宽
            GetComponent <RectTransform>().sizeDelta = new Vector2(_width, _height);

            _data_img      = dataImg;
            _data_iscustom = dataIsCustom;

            // 设置显示图片
            //GetComponent<RawImage>().texture = TextureResource.Instance.GetTexture(AppUtils.GetFullFileAddressOfImage(DataImg));
            GetComponent <Image>().sprite = SpriteResource.Instance.GetData(AppUtils.GetFullFileAddressOfImage(DataImg));

            // 定义 agent 的名字
            int si = _manager.SceneIndex;

            _sceneIndex = si + 0;

            _agentContainerType = agentContainerType;
        }
Exemplo n.º 8
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init(MagicWallManager magicWallManager)
        {
            _manager = magicWallManager;

            if (_kinectType == KinectType.Kinect2)
            {
                _kinectService = _kinect2Service;
            }
            else if (_kinectType == KinectType.AzureKinect)
            {
                // 缺失 kinect 3
            }

            _kinectAgents = new List <KinectAgent>();

            _startSuccessAction = StartKinectSuccess;
            _startFailedAction  = StartKinectFailed;


            if (isMock)
            {
                Debug.Log("开启 kinect 模拟模式。");

                // 模拟创建实体,实际使用kinect需注释  结束
            }
            else
            {
                _kinectService.Init(_agentContainer, _kinectAgentPrefab, _manager);
                //StartMonitoring();
            }

            Debug.Log("@@@ Kinecet 初始化成功");
        }
Exemplo n.º 9
0
        public void Init(OperateCardDataSlide data, Action <ScrollData, ScrollDirectionEnum> onChanged,
                         Action <string> onScale, Action <string, string, string> onPlayVideo, Action onInitCompleted)
        {
            _isPrepared      = false;
            _data            = data;
            _manager         = GameObject.Find("MagicWall").GetComponent <MagicWallManager>();
            _onChanged       = onChanged;
            _onScale         = onScale;
            _onPlayVideo     = onPlayVideo;
            _onInitCompleted = onInitCompleted;

            _scrollPanelAgents = new List <SliceScrollPanelAgent>();
            _scrollPanelAgents.Add(_scrollPanelLeft);
            _scrollPanelAgents.Add(_scrollPanelRight);
            _scrollPanelAgents.Add(_scrollPanelMiddle);
            _scrollPanelAgents.Add(_scrollPanelPrepare);
            for (int i = 0; i < _scrollPanelAgents.Count; i++)
            {
                _scrollPanelAgents[i].Init(this);
            }

            // 设置首图
            var firstData = data.ScrollData[0];

            _scrollPanelMiddle.SetData(firstData);


            // 初始化内容
            _index = 0;
        }
Exemplo n.º 10
0
        //float minX;
        //float maxX;

        public void Init(RectTransform container, KinectAgent agentPrefab, MagicWallManager manager)
        {
            _parentRectTransform = container;
            _kinectAgentPrefab   = agentPrefab.gameObject;
            _manager             = manager;
            //print("KinectService Init");
        }
Exemplo n.º 11
0
        void Awake()
        {
            _manager    = GameObject.Find("MagicWall").GetComponent <MagicWallManager>();
            aniTime     = 0.5f;
            aniFadeTime = 0.25f;

            if (_manager.screenTypeEnum == ScreenTypeEnum.Screen1080P)
            {
                LeftPosition   = new Vector2(-195, 0);
                RightPosition  = new Vector2(195, 0);
                MiddlePosition = new Vector2(0, 0);


                MaxWidth  = 600f;
                MaxHeight = 600f;
            }
            else if (_manager.screenTypeEnum == ScreenTypeEnum.Screen720P)
            {
                // TODO
                LeftPosition   = new Vector2(-195, 0);
                RightPosition  = new Vector2(195, 0);
                MiddlePosition = new Vector2(0, 0);

                MaxWidth  = 9f / 16f * 600f;
                MaxHeight = 9f / 16f * 600f;
            }
        }
Exemplo n.º 12
0
        public void Init(OperateCardDataCross data, Action <ScrollData, CrossCardNavType, ScrollDirectionEnum> onChanged, Action <string> onScale, Action <string, string, string> onPlayVideo)
        {
            _isPrepared  = false;
            _data        = data;
            _manager     = GameObject.Find("MagicWall").GetComponent <MagicWallManager>();
            _onChanged   = onChanged;
            _onScale     = onScale;
            _onPlayVideo = onPlayVideo;

            _scrollPanelAgents = new List <ScrollPanelAgent>();
            _scrollPanelAgents.Add(_scrollPanelTop);
            _scrollPanelAgents.Add(_scrollPanelBottom);
            _scrollPanelAgents.Add(_scrollPanelLeft);
            _scrollPanelAgents.Add(_scrollPanelRight);
            _scrollPanelAgents.Add(_scrollPanelMiddle);
            _scrollPanelAgents.Add(_scrollPanelPrepare);
            for (int i = 0; i < _scrollPanelAgents.Count; i++)
            {
                _scrollPanelAgents[i].Init(this);
            }

            // 设置首图
            var firstData = data.ScrollDic[CrossCardNavType.Index];

            _scrollPanelMiddle.SetData(firstData[0]);

            // 初始化内容
            _currentNavType = CrossCardNavType.Index;
            _index          = 0;
            _navIndex       = 0;
        }
Exemplo n.º 13
0
        public Vector2 CalculatePosition(Vector2 position, Vector2 positionWithOffset, Vector2 targetPosition, float distance, float effectDistance,
                                         float width, float height, MagicWallManager manager)
        {
            if (distance > effectDistance)
            {
                return(Vector2.zero);
            }
            else
            {
                // 获取offset_x;offset_y
                float offset_x = Mathf.Abs(positionWithOffset.x - targetPosition.x);
                float offset_y = Mathf.Abs(positionWithOffset.y - targetPosition.y);

                //
                //  上下移动的偏差值
                //
                float move_offset_y = offset_y * ((height / 2) / effectDistance);
                move_offset_y += height / 10 * manager.flockBehaviorConfig.CommonOffsetInfluenceFactor;

                float move_offset_x = offset_x * ((width / 2) / effectDistance);
                move_offset_x += width / 10 * manager.flockBehaviorConfig.CommonOffsetInfluenceFactor;

                float to_y, to_x;
                if (positionWithOffset.y > targetPosition.y)
                {
                    to_y = position.y + move_offset_y;
                }
                else if (positionWithOffset.y < targetPosition.y)
                {
                    to_y = position.y - move_offset_y;
                }
                else
                {
                    to_y = position.y;
                }

                if (positionWithOffset.x > targetPosition.x)
                {
                    to_x = position.x + move_offset_x;
                }
                else if (positionWithOffset.x < targetPosition.x)
                {
                    to_x = position.x - move_offset_x;
                }
                else
                {
                    to_x = position.x;
                }

                Vector2 to = new Vector2(to_x, to_y); //目标位置

                Func <float, float> defaultEasingFunction = EasingFunction.Get(manager.flockBehaviorConfig.CommonEaseEnum);
                float k = defaultEasingFunction((effectDistance - distance) / effectDistance);

                Vector2 r = Vector2.Lerp(position, to, k);

                return(r);
            }
        }
Exemplo n.º 14
0
        public void Awake()
        {
            MagicWallManager manager = GameObject.Find("MagicWall").GetComponent <MagicWallManager>();

            _manager = manager;

            InitUI();
        }
Exemplo n.º 15
0
        //
        //  初始化 (参数:内容类型,row)
        //
        public void Init(DisplayBehaviorConfig displayBehaviorConfig)
        {
            _displayBehaviorConfig = displayBehaviorConfig;

            _manager = displayBehaviorConfig.Manager;

            flag = false;
        }
Exemplo n.º 16
0
        public void Init()
        {
            _manager = GameObject.Find("MagicWall").GetComponent <MagicWallManager>();


            InitUI();
            _init = true;
        }
Exemplo n.º 17
0
        //
        //  初始化 (参数:内容类型,row)
        //
        public void Init(DisplayBehaviorConfig displayBehaviorConfig)
        {
            _displayBehaviorConfig = displayBehaviorConfig;
            _manager    = _displayBehaviorConfig.Manager;
            _daoService = _manager.daoServiceFactory.GetDaoService(displayBehaviorConfig.sceneConfig.daoTypeEnum);

            flag = false;
        }
Exemplo n.º 18
0
        private void InitUI()
        {
            _manager = GameObject.Find("MagicWall").GetComponent <MagicWallManager>();

            _title.color          = _manager.themeManager.GetService().GetFontColor();
            _none_item_text.color = _manager.themeManager.GetService().GetFontColor();
            _backImage.sprite     = _manager.themeManager.GetService().GetCardBackShade(FlockCardTypeEnum.SearchCard);
        }
Exemplo n.º 19
0
        public override void UpdateContent(SliceCardCellData cellData)
        {
            //Debug.Log("Width : " + _coverContainer.rect.width + " | Height : " + _coverContainer.rect.height);


            SetupData(cellData);

            _manager = cellData.magicWallManager;

            _cellData = cellData;
            _index    = cellData.Index;

            gameObject.name = "SliceCardScrollCell" + cellData.Index;
            // 需要判断是否为视频还是图片

            if (cellData.IsImage)
            {
                _cover.gameObject.SetActive(true);

                // 配置图片
                string address;
                if (cellData.IsProduct())
                {
                    address = MagicWallManager.FileDir + cellData.Image;
                }
                else
                {
                    address = MagicWallManager.FileDir + cellData.Image;
                }

                _cover.texture = TextureResource.Instance.GetTexture(address);
                CanvasExtensions.SizeToParent(_cover);
                videoContainer.gameObject.SetActive(false);


                // 调整 Like 按钮
                if (cellData.IsProduct())
                {
                    _likes = _manager.daoServiceFactory.GetLikes(_cellData.Image);
                }
                else
                {
                    _likes = _manager.daoServiceFactory.GetLikes(_cellData.Image);
                }
            }
            else
            {
                Debug.Log("video");

                videoContainer.gameObject.SetActive(true);
                string address = MagicWallManager.FileDir + cellData.Image;

                _video_cover.texture = TextureResource.Instance.GetTexture(address);
                CanvasExtensions.SizeToParent(_video_cover);

                _cover.gameObject.SetActive(false);
            }
        }
        void Init()
        {
            _roundMoveBehavior       = new CollisionRoundMoveBehavior();
            _commonMoveBehavior      = new CollisionRoundMoveBehavior();
            _kinectRoundMoveBehavior = new CollisionKinectRoundMoveBehavior();
            _hasInit = true;

            _manager = GameObject.Find("MagicWall").GetComponent <MagicWallManager>();
        }
Exemplo n.º 21
0
        public void InitData(MagicWallManager manager, CardAgent cardAgent)
        {
            _manager    = manager;
            _cardAgent  = cardAgent;
            _flockAgent = cardAgent.OriginAgent;


            _moveBtnComponent.Init(DoMove, cardAgent);
        }
Exemplo n.º 22
0
        public void Init(MagicWallManager manager)
        {
            //effectAgent = new List<FlockAgent>();
            _agents  = new List <FlockAgent>();
            _manager = manager;

            _agentChooseBehavior.Init(_manager);

            PrepareAgentPool();
        }
Exemplo n.º 23
0
        public override void UpdateContent(CrossCardCellData cellData)
        {
            if (cellData == null)
            {
                Debug.Log("cell data = null");
            }

            if (cellData.Image == null)
            {
                Debug.Log("cell data image = null");
            }

            if (cellData.Category == CrossCardCategoryEnum.CATALOG)
            {
                Debug.Log("加载CATALOG");
            }


            _manager = cellData.magicWallManager;

            System.Diagnostics.Stopwatch sw2 = new System.Diagnostics.Stopwatch();
            sw2.Start();


            _cellData = cellData;
            _index    = cellData.Index;
            _title    = cellData.Title;

            gameObject.name = "CSS" + cellData.Category + " - " + cellData.Index + " - " + cellData.Description;

            if (!cellData.IsImage)
            {
                videoContainer.gameObject.SetActive(true);
                _cover.gameObject.SetActive(false);
                _video_cover.sprite = SpriteResource.Instance.GetData(MagicWallManager.FileDir + cellData.Image);

                CanvasExtensions.SizeToParent(_video_cover);
                //crossCardCellData.IsImage = false;
            }
            else
            {
                //  设置 Image

                _cover.gameObject.SetActive(true);
                _cover.sprite = SpriteResource.Instance.GetData(MagicWallManager.FileDir + cellData.Image);

                CanvasExtensions.SizeToParent(_cover);

                // 关闭视频框
                videoContainer.gameObject.SetActive(false);
            }

            sw2.Stop();
            //Debug.Log("[" + _title  + "] Sub Cell Time : " + sw2.ElapsedMilliseconds / 1000f);
        }
Exemplo n.º 24
0
        /// <summary>
        /// 生成动画
        /// </summary>
        public void Init(long userId, MagicWallManager magicWallManager)
        {
            _userId        = userId;
            _manager       = magicWallManager;
            _ignoreValue   = FindObjectOfType <MKinectManager>().ignoreValue;
            _moveDelayTime = FindObjectOfType <MKinectManager>().agentMoveDelayTime;
            SetMoveBehavior(_manager.collisionMoveBehaviourFactory.GetMoveBehavior(CollisionMoveBehaviourType.KinectRound, 1));

            _status = KinectAgentStatusEnum.Creating;

            InitUI();
        }
Exemplo n.º 25
0
        /// <summary>
        ///     初始化基础数据
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="dataId"></param>
        /// <param name="type"></param>
        /// <param name="isCard"></param>
        protected void InitBase(MagicWallManager manager, int dataId, DataTypeEnum dataType, DaoTypeEnum daoTypeEnum)
        {
            //Debug.Log("Init Base : " + dataId);

            _manager     = manager;
            _data_id     = dataId;
            _dataType    = dataType;
            _daoTypeEnum = daoTypeEnum;

            _flockTweenerManager = new FlockTweenerManager();
            _flockStatus         = FlockStatusEnum.NORMAL;
        }
Exemplo n.º 26
0
        public void InitData(SearchBean searchBean, MagicWallManager manager)
        {
            _manager = manager;

            string address = MagicWallManager.FileDir + searchBean.cover;

            _image.texture = TextureResource.Instance.GetTexture(address);

            _id   = searchBean.id;
            _type = searchBean.type;

            _searchBean = searchBean;
        }
Exemplo n.º 27
0
        public void Init(SceneConfig sceneConfig, MagicWallManager manager, Action onSceneCompleted)
        {
            _manager = manager;
            //_daoService = manager.daoService;
            _durtime    = sceneConfig.durtime;
            _dataType   = sceneConfig.dataType;
            _daoService = _manager.daoServiceFactory.GetDaoService(sceneConfig.daoTypeEnum);
            //_itemFactory = manager.itemsFactoryAgent.GetItemsFactoryByContentType(_dataType);
            _sceneUtil = new SceneUtils(_manager, sceneConfig.isKinect);

            _onSceneCompleted = onSceneCompleted;
            _sceneConfig      = sceneConfig;
        }
Exemplo n.º 28
0
        public void Init(SceneConfig sceneConfig, MagicWallManager manager, Action onSceneCompleted)
        {
            _manager          = manager;
            _sceneConfig      = sceneConfig;
            _onSceneCompleted = onSceneCompleted;


            Debug.Log("sceneConfig daoTypeEnum : " + sceneConfig.daoTypeEnum);

            // 销毁
            _destoryBehavior = DestoryBehaviorFactory.GetBehavior(sceneConfig.destoryBehavior);
            _destoryBehavior.Init(_manager, null, OnDestoryCompleted, sceneConfig);
        }
Exemplo n.º 29
0
        void Awake()
        {
            _manager = GameObject.Find("MagicWall").GetComponent <MagicWallManager>();

            if (_manager.screenTypeEnum == ScreenTypeEnum.Screen1080P)
            {
                _imageWidth  = 600f;
                _imageHeight = 400f;
            }
            else if (_manager.screenTypeEnum == ScreenTypeEnum.Screen720P)
            {
                _imageWidth  = 600f * 9f / 16f;
                _imageHeight = 400f * 16f / 9f;
            }
        }
Exemplo n.º 30
0
        public void Init(MagicWallManager manager, CommonScene commonScene, Action onDestoryCompleted, SceneConfig sceneConfig)
        {
            _manager            = manager;
            _commonScene        = commonScene;
            _onDestoryCompleted = onDestoryCompleted;
            _sceneConfig        = sceneConfig;

            feiyueLogo = Resources.Load <Sprite>("UI/6ping-feiyue-logo");
            aiqiLogo   = Resources.Load <Sprite>("UI/6ping-aiqi-logo");

            logoOriginalIsActive = _manager.BgLogo.gameObject.activeInHierarchy;
            logoOriginalSprite   = _manager.BgLogo.GetComponent <Image>().sprite;
            logoOriginalSize     = _manager.BgLogo.GetComponent <RectTransform>().sizeDelta;
            logoOriginalColor    = _manager.BgLogo.GetComponent <Image>().color;
        }