public void InitRoadCrawl() { CellInfo centerCell = CellModel.Instance.GetCellByPos(posX, posY); List <CellInfo> cellNeighbors = CellModel.Instance.GetNeighbors(centerCell); CellInfo findCellPoint = null; for (int i = 0; i < cellNeighbors.Count; i++) { CellInfo cellNeighbor = cellNeighbors[i]; if (cellNeighbor == null) { continue; } BattleCellInfo bcellInfo = BattleModel.Instance.crtBattle.GetBattleCellByPos(cellNeighbor.posX, cellNeighbor.posY); if (bcellInfo.bg_id != special1) { continue; } findCellPoint = cellNeighbor; Vector2 fromPos = PosMgr.GetFightCellPos(posX, posY); Vector2 toPos = PosMgr.GetFightCellPos(findCellPoint.posX, findCellPoint.posY); rotate = PosMgr.VectorAngle(new Vector2(fromPos.x, fromPos.y), new Vector2(toPos.x, toPos.y)) / FightConst.ROTATE_BASE; break; } }
private GameObject CreateFgItem(int posX, int posY, int icon) { if (icon <= 0) { CellInfo cell = CellModel.Instance.GetCellByPos(posX - BattleModel.Instance.crtBattle.start_x, -posY + BattleModel.Instance.crtBattle.start_y); if (cell != null && cell.config != null) { if (cell.config.id != 10001) { return(null); } else { icon = 10302; } } else { return(null); } } GameObject item = list.NewItem(); item.name = posX + "_" + posY; FightFgItem itemCtr = item.AddComponent <FightFgItem>(); itemCtr.type = type; itemCtr.icon = icon; PosMgr.SetCellPos(item.transform, posX, posY); return(item); }
public void Flow(ActionTree actionTree) { CoverModel.Instance.Flow(); List <CoverAnimInfo> anims = CoverModel.Instance.anims[0]; for (int i = 0; i < anims.Count; i++) { CoverAnimInfo animInfo = anims[i]; FightCoverItem item = GetItemByRunId(animInfo.coverInfo.runId); if (item != null) { ParallelAction paralle = new ParallelAction(); Vector2 toPos = PosMgr.GetFightCellPos(animInfo.coverInfo.posX, animInfo.coverInfo.posY); paralle.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.3f)); OrderAction orderAction = new OrderAction(); orderAction.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0.5f, 0.5f, 1), 0.1f)); orderAction.AddNode(new WaitActor(100)); orderAction.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.1f)); paralle.AddNode(orderAction); actionTree.AddNode(paralle); } } }
public FightCoverItem CreateCoverItem(CoverInfo coverInfo) { if (coverInfo.IsNull()) { return(null); } GameObject item = list.NewItem(); item.name = coverInfo.posX + "_" + coverInfo.posY; FightCoverItem itemCtr = item.AddComponent <FightCoverItem>(); itemCtr.type = type; itemCtr.coverInfo = coverInfo; itemCtr.icon = coverInfo.config.icon; itemCtr.rate = coverInfo.rate; itemCtr.UpdateTip(); PosMgr.SetFightCellPos(item.transform, coverInfo.posX, coverInfo.posY); if (coverInfo.show_type == CoverShowType.hide) { itemCtr.gameObject.transform.localScale = new Vector3(0, 1, 1); } return(itemCtr); }
public GameObject CreateBaseItem(int posX, int posY) { GameObject item = list.NewItem(); item.name = posX + "_" + posY; item.AddComponent <BallBaseItem>(); PosMgr.SetFightCellPos(item.transform, posX, posY); return(item); }
public void ShowLine(CellInfo cellA, CellInfo cellB) { GameObject item = list.NewItem(); item.name = cellA.posX + "_" + cellA.posY + "_" + cellB.posX + "_" + cellB.posY; PosMgr.SetFightCellPos(item.transform, cellA.posX, cellA.posY); item.transform.Rotate(0, 0, PosMgr.VectorAngle(PosMgr.GetFightCellPos(cellA.posX, cellA.posY), PosMgr.GetFightCellPos(cellB.posX, cellB.posY))); }
private void InitHoleList(bool playEffect) { listHole.ClearList(); int i; SkillHoleItem findNextOpen = null; for (i = 1; i <= SkillTempletModel.MAX_LEVEL; i++) { GameObject item = listHole.NewItem(); item.name = skillTempletInfo.config.cellId + "_" + i; SkillHoleItem itemCtr = item.GetComponent <SkillHoleItem>(); itemCtr.skillGroupInfo = skillGroupInfo; itemCtr.islock = false; itemCtr.ShowName(""); itemCtr.waitAnim.enabled = false; if (i > skillTempletInfo.lv) { if (findNextOpen == null) { findNextOpen = itemCtr; itemCtr.waitAnim.enabled = true; } else { itemCtr.islock = true; } } else { if (i > 1) { itemCtr.bombImage.color = ColorMgr.GetColor(ColorMgr.MAP_PASS, 0.9f); } } Vector2 pos = SkillTempletModel.Instance.GetHolePos(i, false, skillTempletInfo.config.dir); PosMgr.SetCellPos(item.transform, (int)pos.x, (int)pos.y + 1, 1.1f); if (i == 1) { itemCtr.icon = skillTempletInfo.config.cellId; itemCtr.bombImage.gameObject.SetActive(false); } else if (i == skillTempletInfo.lv && playEffect) { itemCtr.iconImage.gameObject.SetActive(false); GameObject effectPrefab = GameMgr.resourceMgr.GetGameObject("effect.ab", "effect_fireworks"); GameObject itemEffect = GameObject.Instantiate(effectPrefab); itemEffect.transform.SetParent(itemCtr.transform, false); itemEffect.transform.SetParent(transform, true); } } }
private void CreateCellItem(int posX, int posY, int index) { GameObject item = list.NewItem(); item.name = posX + "_" + posY; PosMgr.SetCellPos(item.transform, posX, posY, 0.4f); Text nameText = item.GetComponentInChildren <Text>(); nameText.text = "" + index; }
private void CreateHiveItem(int posX, int posY, bool isScale = false) { GameObject item = list.NewItem(); item.name = posX + "_" + posY; PosMgr.SetCellPos(item.transform, posX, posY); if (isScale) { item.transform.localScale = new Vector3(1.12f, 1.12f, 1); } }
private void Filling(FightStadus fightState = FightStadus.move, int waitmillisecond = 0) { CellModel.Instance.anims = new List <List <CellAnimInfo> >(); FunMove.Move(false, isDeductStep); List <CellMoveInfo> moveAnims = CellModel.Instance.moveAnims; rootAction = new OrderAction(); ParallelAction paralle = new ParallelAction(); Dictionary <int, int> newStartPos = new Dictionary <int, int>(); for (int i = 0; i < moveAnims.Count; i++) { CellMoveInfo cellMoveInfo = moveAnims[i]; OrderAction orderAction = new OrderAction(); paralle.AddNode(orderAction); FightCellItem item = GetItemByRunId(cellMoveInfo.cellInfo.runId); if (item == null) { item = CreateCellItem(cellMoveInfo.cellInfo).GetComponent <FightCellItem>(); int xKey = (int)cellMoveInfo.paths[0].x; if (newStartPos.ContainsKey(xKey)) { int preIndex = newStartPos[xKey]; newStartPos[xKey] = preIndex - 1; } else { newStartPos.Add(xKey, -1); } PosMgr.SetFightCellPos(item.transform, xKey, newStartPos[xKey]); } for (int j = 0; j < cellMoveInfo.paths.Count; j++) { Vector2 pathPoint = cellMoveInfo.paths[j]; Vector2 toPos = PosMgr.GetFightCellPos((int)pathPoint.x, (int)pathPoint.y); float speed = isDeductStep ? 1750 : 1350; orderAction.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), speed)); } FightEffectItem effectItem = effectLayer.GetEffectItemByPos(cellMoveInfo.cellInfo.posX, cellMoveInfo.cellInfo.posY); orderAction.AddNode(new PlayCellMoveEndActor(item, effectItem, cellMoveInfo.cellInfo)); } if (waitmillisecond > 0) { rootAction.AddNode(new WaitActor(waitmillisecond)); } rootAction.AddNode(paralle); ExecuteAction(fightState); }
private void CreatTempletItem(SkillGroupInfo info, SkillTempletInfo skillTempletInfo, int index) { GameObject item = list.NewItem(); item.name = "skill_" + skillTempletInfo.config.cellId; PosMgr.SetCellPos(item.transform, 0, 0); SkillTemplet itemCtr = item.GetComponent <SkillTemplet>(); itemCtr.Init(info, skillTempletInfo); }
private void CreateItem(SkillSeedInfo seed) { GameObject item = list.NewItem(); item.name = "skill_" + seed.runId; SkillItem itemCtr = item.GetComponent <SkillItem>(); itemCtr.icon = seed.GetCellIcon(); itemCtr.SetHideId(seed.GetHideCellId()); itemCtr.ShowLock(seed.fobid); PosMgr.SetCellPos(item.transform, seed.seed_x, seed.seed_y, 1.0f); }
public GameObject ShowLine(CellInfo cellA, CellInfo cellB) { list.ForceChangeItemPrefab(lineItem); GameObject item = list.NewItem(); item.name = cellA.posX + "_" + cellA.posY + "_" + cellB.posX + "_" + cellB.posY; PosMgr.SetFightCellPos(item.transform, cellB.posX, cellB.posY); item.transform.Rotate(0, 0, PosMgr.VectorAngle(PosMgr.GetFightCellPos(cellB.posX, cellB.posY), PosMgr.GetFightCellPos(cellA.posX, cellA.posY))); return(item); }
protected virtual void CreateCoverItem(int posX, int posY, int id) { GameObject item = list.NewItem(); item.name = posX + "_" + posY; EditItem itemCtr = item.GetComponent <EditItem>(); itemCtr.type = type; itemCtr.gridPos = new Vector3(posX, posY, 0); itemCtr.icon = id; PosMgr.SetCellPos(item.transform, posX, posY, 0.4f); EventTriggerListener.Get(item).onClick = itemCtr.OnCellClick; }
private FightEffectItem CreateEffectItem(int posX, int posY) { list.ForceChangeItemPrefab(effectItem); GameObject item = list.NewItem(); FightEffectItem itemCtr = item.AddComponent <FightEffectItem>(); PosMgr.SetFightCellPos(item.transform, posX, posY); itemCtr.control_x = posX; itemCtr.control_y = posY; item.name = itemCtr.control_x + "_" + itemCtr.control_y; return(itemCtr); }
void Start() { HiveBG hiveBG = GetComponentInChildren <HiveBG>(); hiveBG.ShowList((int)PosMgr.Y_HALF_COUNT, (int)PosMgr.X_HALF_COUNT); hiveBG.DestroyList(-3, 3, 4, -3); hiveBG.DestroyListItem(-2, 4); hiveBG.DestroyListItem(-1, 4); hiveBG.DestroyListItem(0, 4); hiveBG.DestroyListItem(1, 4); hiveBG.DestroyListItem(2, 4); PosMgr.SetCellPos(closeBtn.transform, 3, 5); }
private void CreateControlItem(int posX, int posY) { GameObject item = list.NewItem(); item.name = posX + "_" + posY; FightControlItem itemCtr = item.AddComponent <FightControlItem>(); PosMgr.SetCellPos(item.transform, posX, posY); itemCtr.control_x = posX - BattleModel.Instance.crtBattle.start_x; itemCtr.control_y = -posY + BattleModel.Instance.crtBattle.start_y; EventTriggerListener.Get(item).onDown += ItemDownHander; EventTriggerListener.Get(item).onEnter += ItemEnterHander; //EventTriggerListener.Get(item).onUp += ItemUpHander; }
override protected void Awake() { base.Awake(); smallPrefab = GameMgr.resourceMgr.GetGameObject("prefab/skillmodule.ab", "SkillSmallItem"); smallList.itemPrefab = smallPrefab; groupListPrefab = GameMgr.resourceMgr.GetGameObject("prefab/skillmodule.ab", "SkillGroupList"); groupList.itemPrefab = groupListPrefab; ScreenSlider.OpenSlid(); PosMgr.SetUIPos(starButton, 12); PosMgr.SetUIPos(bottleButton, 14); PromptModel.Instance.SlideEvent = OnSlideEvent; GameObject buggerPrefab = GameMgr.resourceMgr.GetGameObject("prefab/base.ab", "Bugger"); GameObject buggerItem = GameObject.Instantiate(buggerPrefab); buggerItem.transform.SetParent(buggerPos, false); buggerItem.transform.localPosition = new Vector3(0, 1000, 0); buggerItem.transform.localScale = new Vector3(0.9f, 0.9f, 1); bugger = buggerItem.GetComponent <Bugger>(); bugger.iconId = 10101; bugger.AddPos(new BuggerPosInfo(new Vector2(0, 780), new Vector2(0, 680))); bugger.AddPos(new BuggerPosInfo(new Vector2(-279, 780), new Vector2(-279, 680))); bugger.AddPos(new BuggerPosInfo(new Vector2(279, 780), new Vector2(279, 680))); bugger.AddPos(new BuggerPosInfo(new Vector2(-558, 468), new Vector2(-458, 468))); bugger.AddPos(new BuggerPosInfo(new Vector2(-558, 312), new Vector2(-458, 312))); bugger.AddPos(new BuggerPosInfo(new Vector2(-558, 156), new Vector2(-458, 156))); bugger.AddPos(new BuggerPosInfo(new Vector2(-558, 0), new Vector2(-458, 0))); bugger.AddPos(new BuggerPosInfo(new Vector2(-558, -156), new Vector2(-458, -156))); bugger.AddPos(new BuggerPosInfo(new Vector2(558, 468), new Vector2(458, 468))); bugger.AddPos(new BuggerPosInfo(new Vector2(558, 312), new Vector2(458, 312))); bugger.AddPos(new BuggerPosInfo(new Vector2(558, 156), new Vector2(458, 156))); bugger.AddPos(new BuggerPosInfo(new Vector2(558, 0), new Vector2(458, 0))); bugger.AddPos(new BuggerPosInfo(new Vector2(558, -156), new Vector2(458, -156))); bugger.Show(); InitList(); UpdateUI(); GameMgr.audioMgr.PlayMusic("rain"); }
private void CreateSmallItem(SkillGroupInfo skillTempletGroupInfo, int index) { GameObject item = smallList.NewItem(); PosMgr.SetCellPos(item.transform, index - 2, -5); item.name = "skill_" + skillTempletGroupInfo.GetGroupId(); SkillSmallItem itemCtr = item.GetComponent <SkillSmallItem>(); itemCtr.toggle.group = smallToggleGroup; itemCtr.skillTempletGroupInfo = skillTempletGroupInfo; itemCtr.ShowName(""); itemCtr.icon = skillTempletGroupInfo.GetGroupId(); EventTriggerListener.Get(item).onClick = OnSmallClick; itemCtr.selectTempletEvent += OnSelectTemplet; }
public GameObject CreateMonsterItem(int posX, int posY, MonsterInfo monsterInfo) { if (monsterInfo.IsNull()) { return(null); } FightMonsterItem itemCtr = GetItemByRunId(monsterInfo.runId); if (itemCtr == null) { GameObject item = list.NewItem(); item.name = posX + "_" + posY; itemCtr = item.AddComponent <FightMonsterItem>(); PosMgr.SetFightCellPos(item.transform, posX, posY); } UpdateMonsterItem(itemCtr, monsterInfo); return(itemCtr.gameObject); }
protected GameObject CreateBaseItem(int posX, int posY, int icon) { if (icon <= 0) { return(null); } GameObject item = list.NewItem(); item.name = posX + "_" + posY; FightBaseItem itemCtr = item.AddComponent <FightBaseItem>(); itemCtr.type = type; itemCtr.icon = icon; PosMgr.SetFightCellPos(item.transform, posX, posY); return(item); }
private GameObject CreateFance(WallInfo wallInfo) { if (wallInfo.IsNull()) { return(null); } GameObject item = list.NewItem(); item.name = wallInfo.posY + "_" + wallInfo.posX + "_" + wallInfo.posN; FightFanceItem itemCtr = item.AddComponent <FightFanceItem>(); UpdateFance(itemCtr, wallInfo); PosMgr.SetFightWallPos(item.transform, wallInfo.posX, wallInfo.posY, wallInfo.posN); itemCtr.zrotate = GetZRotate(wallInfo.posN); return(item); }
protected GameObject CreateFloorItem(int posX, int posY, FloorInfo floorInfo) { if (floorInfo.IsNull()) { return(null); } GameObject item = list.NewItem(); item.name = posX + "_" + posY; FightFloorItem itemCtr = item.AddComponent <FightFloorItem>(); itemCtr.floorInfo = floorInfo; itemCtr.type = type; itemCtr.icon = floorInfo.config.icon; PosMgr.SetFightCellPos(item.transform, posX, posY); return(item); }
protected GameObject CreateHiderItem(HiderInfo hiderInfo) { if (hiderInfo.isNull) { return(null); } GameObject item = list.NewItem(); item.name = hiderInfo.posX + "_" + hiderInfo.posY; FightHideItem itemCtr = item.AddComponent <FightHideItem>(); itemCtr.hiderInfo = hiderInfo; itemCtr.type = type; itemCtr.icon = hiderInfo.configId; PosMgr.SetFightCellPos(item.transform, hiderInfo.posX, hiderInfo.posY); return(item); }
private Vector2 CreateBrushItem(int cX, int cY, int oX, int oY, int brushId) { GameObject item = list.NewItem(); item.name = oX + "_" + oY; PropTouchItem itemCtr = item.GetComponent <PropTouchItem>(); PosMgr.SetFightCellPos(item.transform, cX + oX, cY - oY); itemCtr.control_x = cX + oX; itemCtr.control_y = cY + oY; itemCtr.control_id = brushId; itemCtr.icon = brushId; itemCtr.valid = true; itemCtr.brushImage.gameObject.SetActive(true); EventTriggerListener.Get(item).onClick = OnClickSelectHander; return(new Vector2(cX + oX, cY - oY)); }
private void UpdateCellInfo(FightCellItem itemCtr, CellInfo cellInfo, bool create) { itemCtr.cell_info = cellInfo; if (cellInfo.changer > 0) { itemCtr.icon = cellInfo.changer; } else { itemCtr.icon = cellInfo.config.icon; } itemCtr.UpdateTip(); itemCtr.zrotate = cellInfo.config.rotate * FightConst.ROTATE_BASE; PosMgr.SetFightCellPos(itemCtr.transform, cellInfo.posX, cellInfo.posY); if (create) { itemCtr.stadus = CellItemStadus.normal; } }
private PropTouchItem CreateSelectItem(int posX, int posY, bool valid) { GameObject item = list.NewItem(); item.name = posX + "_" + posY; PropTouchItem itemCtr = item.GetComponent <PropTouchItem>(); PosMgr.SetFightCellPos(item.transform, posX, posY); itemCtr.valid = valid; itemCtr.control_x = posX; itemCtr.control_y = posY; if (itemCtr.valid) { EventTriggerListener.Get(item).onClick = OnClickSelectHander; } return(itemCtr); }
private void BuggerAppear() { float angle = PosMgr.VectorAngle(pos.fromPos, pos.toPos); cellRect.localRotation = Quaternion.Euler(0, 0, angle - 90); RectTransform rectTransform = (RectTransform)transform; rectTransform.anchoredPosition = new Vector2(pos.fromPos.x, pos.fromPos.y); if (iconId > 0) { icon.overrideSprite = GameMgr.resourceMgr.GetSprite("icon/cell.ab", "cell_" + iconId); } else { int randomValue = UnityEngine.Random.Range(10101, 10106); icon.overrideSprite = GameMgr.resourceMgr.GetSprite("icon/cell.ab", "cell_" + randomValue); } LeanTween.move(rectTransform, pos.toPos, move.appearTime).onComplete = AppearComplete; }
public override void OnExecute() { base.OnExecute(); GameObject item = layer.ShowLine(fcell, tcell); Image image = item.GetComponentInChildren <Image>(); float len = VectorLen(PosMgr.GetFightCellPos(fcell.posX, fcell.posY), PosMgr.GetFightCellPos(tcell.posX, tcell.posY)); image.rectTransform.sizeDelta = new Vector2(len, 20); image.rectTransform.localScale = new Vector3(0, 1, 1); if (forceId > 0) { image.color = ColorMgr.GetColor(ColorMgr.GetCellColorValue(forceId)); } else { image.color = ColorMgr.GetColor(ColorMgr.GetCellColorValue(fcell.config.id)); } LeanTween.scaleX(image.gameObject, 1, len / 1500.00f).onComplete = CompleteHander; }
private void Invade() { rootAction = new OrderAction(); if (!isDeductStep) { ParallelAction paralle = new ParallelAction(); List <CellAnimInfo> invadeCells = InvadeModel.Instance.EffectInvade(); for (int i = 0; i < invadeCells.Count; i++) { ParallelAction paralleMove = new ParallelAction(); CellInfo fromCell = invadeCells[i].fromInfo; CellInfo toCell = invadeCells[i].toInfo; //Vector2 fromPos = PosMgr.GetFightCellPos(fromCell.posX, fromCell.posY); Vector2 toPos = PosMgr.GetFightCellPos(toCell.posX, toCell.posY); FightCellItem item = GetItemByRunId(toCell.runId); PosMgr.SetFightCellPos(item.transform, fromCell.posX, fromCell.posY); item.icon = toCell.config.icon; item.transform.localScale = new Vector3(0.5f, 0.5f, 1); OrderAction order1 = new OrderAction(); order1.AddNode(new PlaySoundActor("Refresh")); order1.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.2f)); paralleMove.AddNode(order1); OrderAction order2 = new OrderAction(); order2.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.15f)); paralleMove.AddNode(order2); paralle.AddNode(paralleMove); } rootAction.AddNode(paralle); } ExecuteAction(FightStadus.invade); }