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; }
/// <summary>从消除格上移除此特效</summary> public void Remove(ElimlnateGrid target) { if ((mMapper != default) && mMapper.ContainsKey(target)) { IGridEffectInfo effect = mMapper.Remove(target); effect?.Clean(); }
public GridSkillTrigger(ElimlnateGrid grid) { GridSelf = grid; mBoardGrids = ElimlnateCore.Instance.BoardGrids; mGridsChecked = new List <int>(); mSecondarySkillTriggers = new Queue <ISkillGridTrigger>(); }
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 { } }
/// <summary> /// 设置正在被操作的消除格 /// </summary> /// <param name="grid"></param> /// <param name="operateType"></param> public void SetOperatingGrid(int operateType) { LineInputCore inputCore = mElimiGamePlay.LineInputer; switch (operateType) { case GridOperateInfo.GRID_OPERATE_TYPE_POINTER_DOWN: inputCore.InputGridPointerDown(OperatingGrid); break; case GridOperateInfo.GRID_OPERATE_TYPE_ENTER: inputCore.InputPointerEnter(OperatingGrid); break; case GridOperateInfo.GRID_OPERATE_TYPE_POINTER_EXIT: inputCore.InputPointerExit(OperatingGrid); break; case GridOperateInfo.GRID_OPERATE_TYPE_POINTER_UP: inputCore.InputGridPointerUp(OperatingGrid); break; case GridOperateInfo.GRID_OPERATE_TYPE_POINTER_CLICK: inputCore.InputGridPointerClick(OperatingGrid); break; } OperatingGrid = default; }
/// <summary> /// 获取图形 /// </summary> /// <param name="pos">坐标</param> /// <returns></returns> public ElimlnateGrid GetBoardGrid(Vector2 pos, bool isGetDirty = false) { int column = (int)pos.x; int row = (int)pos.y; ElimlnateGrid result = default; if ((column >= 0) && (row >= 0) && (column < ColumnSize) && (row < RowSize)) { int index = GetGridIndex(column, row); if (isGetDirty) { //result = index < GridsSize ? mGridsDirty.GetGrid(index) : default; } else { result = index < GridsSize ? mGrids[index] : default; } } else { } return(result); }
/// <summary> /// 添加消除格的UI操作驱动 /// </summary> /// <param name="grid"></param> private void AddGridOperateUI(ref ElimlnateGrid grid) { mOperateLayout = UI.GridOperateLayout; GameObject prefab = UnityEngine.Object.Instantiate(UI.OperateCellItemRenderer, mOperateLayout.transform); EventTrigger eventTrigger = prefab.GetComponent <EventTrigger>(); //添加消除格UI驱动层的事件响应 SetOperateEventTrigger(ref eventTrigger, EventTriggerType.PointerDown, OnGridPointerDown); SetOperateEventTrigger(ref eventTrigger, EventTriggerType.PointerUp, OnGridPointerUp); SetOperateEventTrigger(ref eventTrigger, EventTriggerType.PointerEnter, OnGridPointerEnter); SetOperateEventTrigger(ref eventTrigger, EventTriggerType.PointerClick, OnGridPointerClick); SetOperateEventTrigger(ref eventTrigger, EventTriggerType.PointerExit, OnGridPointerExit); Vector2Int pos = grid.GridPos; int index = ElimCore.BoardGrids.GetGridIndex(pos.y, pos.x); int id = prefab.GetInstanceID(); mGridOperateMapper[id] = new GridOperateInfo() { gridPos = grid.GridPos, prefabID = id, prefab = prefab, gridIndex = index, localPos = (prefab.transform as RectTransform).position, }; mGridsUIMapper[index] = id; }
/// <summary> /// 获取可以被选中的图形 /// </summary> /// <param name="gridPos">单元格坐标</param> public List <ElimlnateGrid> CollectAllowOperateGrids(Vector2 gridPos) { GamePlay.BoardGrids.ResetAllGridsToDeactive(); List <ElimlnateGrid> result = new List <ElimlnateGrid>(); Vector2 left = new Vector2(gridPos.x - 1, gridPos.y); Vector2 right = new Vector2(gridPos.x + 1, gridPos.y); Vector2 up = new Vector2(gridPos.x, gridPos.y + 1); Vector2 down = new Vector2(gridPos.x, gridPos.y - 1); ElimlnateGrid allowComboGrid = default; AddAllowOperateGrid(ref allowComboGrid, left, ref result); AddAllowOperateGrid(ref allowComboGrid, right, ref result); AddAllowOperateGrid(ref allowComboGrid, up, ref result); AddAllowOperateGrid(ref allowComboGrid, down, ref result); if (IsInclined) { Vector2 upLeft = new Vector2(gridPos.x - 1, gridPos.y + 1); Vector2 upRight = new Vector2(gridPos.x + 1, gridPos.y + 1); Vector2 downLeft = new Vector2(gridPos.x - 1, gridPos.y - 1); Vector2 downRight = new Vector2(gridPos.x + 1, gridPos.y - 1); AddAllowOperateGrid(ref allowComboGrid, upLeft, ref result); AddAllowOperateGrid(ref allowComboGrid, upRight, ref result); AddAllowOperateGrid(ref allowComboGrid, downLeft, ref result); AddAllowOperateGrid(ref allowComboGrid, downRight, ref result); } else { } return(result); }
public virtual void SetEliminateCount(ref List <ElimlnateGrid> list) { int count = list.Count; bool flag = count > 0; ElimlnateGrid first = list[0]; int gridType = flag ? first.GridType : -1; int shapeIndex = flag ? first.GridShapeIndex : -1; FirstGridType = gridType; EliminateCount += count; if (FirstGridShapeIndex == int.MaxValue) { FirstGridShapeIndex = shapeIndex; } else { } for (int i = 0; i < count; i++) { gridType = list[i].NormalGridType; if (!mAllResult.ContainsKey(gridType)) { mAllResult[gridType] = 0; } else { } mAllResult[gridType]++; } }
protected virtual void OnEffect(ElimlnateGrid target, TweenEffectBase <GridEffectParam> tw, GridEffectParam param) { EffectCount++; GridCreateEffectItem item = new GridCreateEffectItem(); TweenCallback callback = GetCompolete(target); item.Play(ApplyEndPosition, ref target, ref tw, callback); }
protected override IEffectInfo <ElimlnateGrid, GridEffectParam> Create(ref ElimlnateGrid target) { TweenEffect tween = new TweenEffect { EffectMethod = OnEffect }; return(tween); }
private void SetGridByIndex(int index, ElimlnateGrid grid, bool isDirty = false) { if (isDirty) { //mGridsDirty.SetGridByIndex(index, ref grid); } else { mGrids[index] = grid; } }
protected override IEffectInfo <ElimlnateGrid, GridEffectParam> Create(ref ElimlnateGrid target) { TweenEffect tween = new TweenEffect { EffectMethod = OnEffect, ApplyUpdate = TweenEffectApplyUpdate, }; tween.Param.Speed = new Vector3(0f, 0f, 20f); return(tween); }
protected virtual void OnEffect(ElimlnateGrid target, TweenEffectBase <GridEffectParam> tw, GridEffectParam param) { tw.ResetTweenRefs(); Sequence seq = DOTween.Sequence(); seq.Append(target.GridTrans.DOScale(mScale_1, 0.1f)); seq.Append(target.GridTrans.DOScale(mScale_2, 0.1f)); tw.TweenRef = new Tween[] { seq }; }
private void OnEffect(ElimlnateGrid target, TweenEffectBase <GridEffectParam> tw, GridEffectParam param) { if (param.IsInited) { GridCreater gridsCreate = ElimlnateCore.Instance.GridCreater; AnimationCurve curve = gridsCreate.EnterEffectCurve; int gridID = target.GridID; float start = mStartPos[gridID]; float end = mEndDistance[gridID]; float time = mCurveTime[gridID]; float curveValue = curve.Evaluate(time / param.DuringTime); Vector3 pos = target.GridTrans.position; bool isFinished = curveValue >= 1f; if (isFinished) { mStartPos.Remove(gridID); mEndDistance.Remove(gridID); mCurveTime.Remove(gridID); pos.Set(pos.x, end, pos.z); } else { pos.Set(pos.x, end * curveValue, pos.z); time += Time.deltaTime; mCurveTime[gridID] = time; } target.GridTrans.position = pos; if (isFinished) { OnEffectCompleted(); } else { } } else { EffectCount++; tw.ResetTweenRefs(); float start = target.GridTrans.position.y; float endValue = start + EndValueOffset; mStartPos[target.GridID] = start; mEndDistance[target.GridID] = endValue; mCurveTime[target.GridID] = 0f; } }
protected override IEffectInfo <ElimlnateGrid, GridEffectParam> Create(ref ElimlnateGrid target) { TweenEffect tween = new TweenEffect { EffectMethod = OnEffect, ApplyUpdate = true, }; tween.Param.DuringTime = 0.5f; return(tween); }
private void AddAllowOperateGrid(ref ElimlnateGrid allowComboGrid, Vector2 gridPos, ref List <ElimlnateGrid> allowOperates) { allowComboGrid = GamePlay.BoardGrids.GetBoardGrid(gridPos); if (allowComboGrid != default) { allowOperates.Add(allowComboGrid); allowComboGrid.IsActive = true; } else { } }
private void CountNeedDestroyGrid(ElimlnateGrid grid) { GridNeedDestroyCount--; if (GridNeedDestroyCount <= 0) { QueueNext(); Dispose(); } else { } }
protected override IEffectInfo <ElimlnateGrid, GridEffectParam> Create(ref ElimlnateGrid target) { TweenEffect tween = new TweenEffect { EffectMethod = OnEffect, //ApplyUpdate = true, }; GridCreater creater = ElimlnateCore.Instance.GridCreater; tween.Param.DuringTime = creater.EnterEffectDuringTime; tween.Param.Curve = creater.EnterEffectCurve; return(tween); }
public void Clean() { ElimlnateGrid grid = Grid; Stop(ref grid); Param?.Clean(); ResetTweenRefs(); Param = default; Grid = default; EffectMethod = default; }
public void FillGridByRandom(out ElimlnateGrid result, Func <ElimlnateGrid, bool> randomAginFilters = default) { BoardGrids boardGrids = mElimiGamePlay.BoardGrids; int index = Utils.UnityRangeRandom(0, boardGrids.GridsSize); result = boardGrids.GetGridByIndex(index); bool flag = randomAginFilters != default ? randomAginFilters.Invoke(result) : true; if ((result == default) || result.IsDestroyed || flag) { FillGridByRandom(out result, randomAginFilters); }
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; }
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 void Stop(ref ElimlnateGrid param) { if (ApplyUpdate) { if (mUpdater != default) { UpdaterNotice.RemoveSceneUpdater(mUpdater); mUpdater.Dispose(); mUpdater = default; } else { } } else { ResetTweenRefs(); } }
protected virtual void CreatePreviewSign(ref ElimlnateGrid target, ref GameObject effect, ref GridEffectParam param) { if (effect == default) { return; } else { } Transform trans = effect.transform; target.AlignmentInGrid(trans, true, false); trans.localPosition += new Vector3(-0.1f, -0.09f, 0f); if (param.IsInited) { param.IsInited = false; trans.SetParent(default);
private void OnEffect(ElimlnateGrid target, TweenEffectBase <ElimlnateEffectParam> tw, ElimlnateEffectParam param) { Sequence queue = DOTween.Sequence(); #if APPLY_GRID_RANK float interval = 0.1f; queue.AppendInterval(interval * param.Index); #endif #if DO_PUNCH_ROT float z = Utils.RangeRandom(45f, 90f); Vector3 punch = new Vector3(0f, 0f, z); queue.Append(target.GridTrans.DOPunchRotation(punch, 0.4f, 15)); //摇晃 queue.AppendInterval(0.05f * param.Index); //摇晃后间隔时间 #endif queue.Append(target.GridTrans.DOScale(Vector3.one * 1.2f, 0.18f)); //1.5f, 0.25f queue.Append(target.GridTrans.DOScale(Vector3.zero, 0.1f)); //zero, 0.15f BeforeFinish(ref queue, ref target, ref param); #if DIRECT_FINISH queue.AppendCallback(Finish); //直接结束 #else queue.Join(target.GridSprite.DOFade(0f, 0.1f)) //褪为透明 .OnComplete(Finish); #endif void Finish() { if (UpperStrata.HasFollowUpEffect) { UpperStrata.CheckFollowEffect(); } else { UpperStrata.AfterGridEffectFinished?.Invoke(); target.WillDestroy(); queue.Kill(); } } OnPlaySound?.Invoke(); }
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); }
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); }
private void OnEffect(ElimlnateGrid target, TweenEffectBase <GridEffectParam> info, GridEffectParam param) { if (mRangeSigns.ContainsKey(target)) { Transform trans = mRangeSigns[target].transform; ApplyPriviewSign(ref trans, ref target, ref param); } else { ShipDockApp.Instance.Effects.CreateEffect(RangeSignResPoolName, out GameObject effect); CreatePreviewSign(ref target, ref effect, ref param); if (effect != default) { mRangeSigns[target] = effect; } else { } } }