Ejemplo n.º 1
0
        private void OnGridInied(ElimlnateGrid grid, GridCreateInfo info)
        {
            InitedGridCount--;
            if (InitedGridCount <= 0)
            {
                InitedGridCount = 0;
                "log".Log("Grids Inied...");
                bool hasEnterAnim = !info.isDirectShow;
                if (hasEnterAnim)
                {
                    ElimlnateGrid item;
                    int           max = mElimiGamePlay.BoardGrids.GridCount;
                    for (int i = 0; i < max; i++)
                    {
                        item = mElimiGamePlay.BoardGrids.GetGridByIndex(i);
                        item.StartEffect(GameEffects.EffectInited);
                    }
                }
                else
                {
                }

#if LOG_GRIDS_MARTRIX
                Debug.Log(gridsMartrixLog);
#endif
            }
            else
            {
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 初始化图形
 /// </summary>
 /// <param name="info">创建消除格时的信息</param>
 public virtual void SetCreateInfo(GridCreateInfo info)
 {
     if (!string.IsNullOrEmpty(info.enterEffectName))
     {
         StartEffect(info.enterEffectName);
     }
     else
     {
     }
     mGridSprite.transform.localScale = mLocalScale;
 }
Ejemplo n.º 3
0
        private void CreateDyeShape(ref ElimlnateGrid rootGrid)
        {
            Vector2 pos    = rootGrid.GridPos;
            int     column = (int)pos.x;
            int     row    = (int)pos.y;

            GameObject target = ElimlnateCore.Instance.BoardGrids.GetTileItem(column, row);
            Transform  tf     = target.transform;
            Vector3    posTF  = tf.position;
            Vector2Int v      = new Vector2Int(column, row);
            //ElimlnateCore.Instance.GridCreater.CreateGrid(v, rootGrid.GridTrans.position, out GridCreateInfo info, string.Empty, true, GridType.Dye);
            GridCreateInfo info = default;

            info.gridInRawPos = rootGrid;
            //info.OnGridCreated = GridCreated;
        }
Ejemplo n.º 4
0
        /// <summary>创建可供消除的单元格</summary>
        public void CreateGrid(Vector2Int gridRowColPos, Vector3 targetPos, out GridCreateInfo info, string enterEffectName, bool isDirectShow = false, int gridType = 0)
        {
            info = GetNewGridInfo(gridType, targetPos, enterEffectName, isDirectShow);
            int column = gridRowColPos.x;
            int row    = gridRowColPos.y;

#if LOG_GRID_CREATED
            "error: GridCrateInfo is null, pos = {0}, {1}".Log(info == default, column.ToString(), row.ToString());
#endif
            info.row    = row;
            info.column = column;
            info.AddCreatedCallback(OnGridInied);

            mPosXTemp = column.ToString();
            mPosYTemp = row.ToString();
            mNameTemp = info.name;

            info.name = mNameTemp.Append(mPosXTemp, mPosYTemp);
            GridCreateCompleted?.Invoke(info.id);
        }
Ejemplo n.º 5
0
        private void OnNewGridCreated(INoticeBase <int> param)
        {
            int noticeName = param.Name;

            noticeName.Remove(OnNewGridCreated);

            IParamNotice <ElimlnateGrid> notice = param as IParamNotice <ElimlnateGrid>;
            ElimlnateGrid grid = notice.ParamValue;

            GridCreateInfo info = mGridCreatingInfo[noticeName];
            int            col = info.column, row = info.row;

#if LOG_GRID_CREATED
            "OnNewGridCreated, pos = {0},{1}".Log(col.ToString(), row.ToString());
#endif

            grid.SetGridPos(info.column, info.row);
            grid.GridTrans.SetParent(mGridParent);
            grid.SetColliderSize(CellSize);
            grid.SetCreateInfo(info);
            grid.AddDestroyCallback((g) =>
            {
                info.Clear();
                mGridCreatingInfo.Remove(noticeName);
            });

            string name = grid.GridTrans.name;
            grid.GridTrans.name = name.Append("@[", row.ToString(), "_", col.ToString(), "] #", grid.GridShapeIndex.ToString());//Sample: @[行,列] #图案索引

            if (!mElimiGamePlay.BoardGrids.HasEnoughGrids())
            {
                CreateGridOperateUI?.Invoke(grid);
            }
            else
            {
            }
            mElimiGamePlay.BoardGrids.SetGridMapper(new Vector2Int(col, row), grid, false);

            info.GridCommit(grid);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取消除格的创建信息
        /// </summary>
        /// <param name="gridType">类型</param>
        /// <param name="targetPos">位置</param>
        /// <param name="enterEffectName">是否需要展示出场动画</param>
        /// <param name="isDirectShow">是否跳过消除格的初始化特效直接显示</param>
        private GridCreateInfo GetNewGridInfo(int gridType, Vector3 targetPos, string enterEffectName, bool isDirectShow = true)
        {
            int      gridTypeValue     = gridType;
            bool     willSetShapeIndex = gridType < 0;//类型值小于 0 则将定制具体的图形索引
            GridType gridPool          = mElimiGamePlay.GridTypes.GetGridPool(gridType);

            gridType = gridPool != default ? gridPool.mainGridType : ElimlnateCore.GetNormalGridType();

            GameObject ins   = gridPool.creater.Invoke();
            Transform  trans = ins.transform;

            trans.position = targetPos;
            trans.rotation = Quaternion.identity;
            trans.SetParent(mGridParent);

            int            noticeName;
            GridCreateInfo info = new GridCreateInfo
            {
                isDirectShow    = isDirectShow,
                enterEffectName = enterEffectName,
                customShapeID   = willSetShapeIndex ? Mathf.Abs(gridTypeValue) : 0,//这里取整有可能超出图形库的长度
            };

            if (BeforeGridCreate != default)
            {
                noticeName = BeforeGridCreate(ins);
                noticeName.Add(OnNewGridCreated);
#if LOG_GRID_CREATE_NOTICE
                "Grid created, id is {0}".Log(id.ToString());
#endif
            }
            else
            {
                noticeName = ins.GetInstanceID();
            }
            info.id = noticeName;
            mGridCreatingInfo[noticeName] = info;
            return(info);
        }
Ejemplo n.º 7
0
 private void GridCreated(ElimlnateGrid target, GridCreateInfo info)
 {
     //(target as DyeGridHotFix).dyeIndex = info.gridInRawPos.shapeIndex;
 }