private void OnEffect(ElimlnateGrid target, TweenEffectBase <GridEffectParam> tw, GridEffectParam param) { if (GamePlayCore == default) { GamePlayCore = ElimlnateCore.Instance; } else { } if (!param.IsInited) { Vector2Int pos = target.GridPos; param.IsInited = true; ElimlnateGrid grid1 = GamePlayCore.BoardGrids.GetGridByRowColumn(pos.x, pos.y - 1); ElimlnateGrid grid2 = GamePlayCore.BoardGrids.GetGridByRowColumn(pos.x - 1, pos.y - 1); ElimlnateGrid grid3 = GamePlayCore.BoardGrids.GetGridByRowColumn(pos.x + 1, pos.y - 1); if (!grid2.IsObstacle || !grid3.IsObstacle) { } else { } } else { } }
public void Clean() { mCore = default; mGridOperate = default; mAllowLineGrids?.Clear(); mLinedGridList?.Clear(); mLinedGridStack?.Clear(); mSkillTriggers?.Clear(); mSecondarySkillListDels?.Clear(); mSkillGridRanges?.Clear(); AfterInit = default; AfterHasInput = default; InputEnabledChanged = default; OnGridChoosen = default; OnGridLinedCancel = default; InputEventData = default; mHeaderGrid = default; mLastGridTrans = default; mPointerUpTrans = default; mTransTemp = default; mPrevAddGrid = default; mLining = default; mHeaderGridTrans = default; }
public LineInputCore() { mCore = ElimlnateCore.Instance; mLinedGridList = new List <ElimlnateGrid>(); mLinedGridStack = new Stack <ElimlnateGrid>(); mSecondarySkillListDels = new Queue <ISkillGridTrigger>(); mSkillGridRanges = new List <int>(); mSkillTriggers = new List <ISkillGridTrigger>(); }
public override void Init() { base.Init(); mGridsUIMapper = new KeyValueList <int, int>(); mGridOperateMapper = new KeyValueList <int, GridOperateInfo>(); ElimCore = ElimlnateCore.Instance; mEliminateData = ElimCore.Data; mEliminateData.AddListener(EliminateData.N_CREATE_GRID_OPERATE_UI, OnCreateGridOperateUI); mEliminateData.AddListener(EliminateData.N_UPDATE_PLAY_CORE_INPUT_ENABLED, OnUpdateInputEnabled); }
public void Dispose() { if (!IsDestroyed) { IsDestroyed = true; CancelLineShow(); Purge(); ShapeSkillTrigger?.Clean(); List <GridEffect> effects = mEffectMapper.Values; int max = effects.Count; for (int i = 0; i < max; i++) { effects[i].Remove(this); } Sprite[] list = GridSpriteList; Utils.Reclaim(ref list); Action <GameObject> destroy = mCore.DestroyGrid; if (GridTrans != default) { GridTrans.gameObject.SetActive(false); if (destroy == default) { UnityEngine.Object.Destroy(GridTrans.gameObject, 0.5f); } else { destroy.Invoke(GridTrans.gameObject); } } else { } mCore.DestroyGrid = default; mGridBg = default; mGridSprite = default; ShapeSkillTrigger = default; mEffectMapper = default; mDestroyCallback = default; mCore = default; } else { } }
private Vector2Int GetRandomGridPos() { Vector2Int result; ElimlnateCore core = ElimlnateCore.Instance; int index = Utils.UnityRangeRandom(0, core.BoardGrids.GridsSize); ElimlnateGrid grid = core.BoardGrids.GetGridByIndex(index); if (grid.IsObstacle || grid.HasGridSkill) { result = GetRandomGridPos(); } else { result = grid.GridPos; } return(result); }
public ElimlnateGrid() { mCore = ElimlnateCore.Instance; mEffectMapper = mCore.GridEffects.GetEffectsMapper(); string[] list = GetNamesOfPreparedEffect(); int max = list.Length; string temp; GridEffect item; for (int i = 0; i < max; i++) { temp = list[i]; item = mEffectMapper[temp]; item?.Commit(this, false); } IndependentChildren = new IndependentChildren(GridTrans); }
public override void Start(ref List <ElimlnateGrid> grids, string triggerGridEffect = null) { if (GamePlayCore == default) { GamePlayCore = ElimlnateCore.Instance; } else { } KeyValueList <int, List <int> > gridsEmpty = new KeyValueList <int, List <int> >(); BoardGrids boardGrids = GamePlayCore.BoardGrids; int max = boardGrids.GridsSize; for (int i = 0; i < max; i++) { List <int> emptysInCol; ElimlnateGrid grid = boardGrids.GetGridByIndex(i); if (grid == default) { int col = i % boardGrids.RowSize; if (gridsEmpty[col] == default) { emptysInCol = new List <int>(); gridsEmpty[col] = emptysInCol; } else { emptysInCol = gridsEmpty[col]; } emptysInCol.Add(i); } else { } } base.Start(ref grids, triggerGridEffect); }
/// <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); }
public void Clean() { var enumer = mGridCreatingInfo.GetEnumerator(); int max = mGridCreatingInfo.Count; for (int i = 0; i < max; i++) { enumer.MoveNext(); enumer.Current.Value.Clear(); } mGridCreatingInfo.Clear(); BeforeGridCreate = default; CreateGridOperateUI = default; GridCreateCompleted = default; GetGridTypeDuringCreate = default; EnterEffectCurve = default; mBoardParent = default; mGridParent = default; TileResRaw = default; mElimiGamePlay = default; }
public EliminateData(ElimlnateCore gamePlay) { mElimiGamePlay = gamePlay; }
public GridCreater() { mElimiGamePlay = ElimlnateCore.Instance; mGridCreatingInfo = new Dictionary <int, GridCreateInfo>(); }