Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
    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);
            }
        }
    }
Exemplo n.º 3
0
    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;
    }
Exemplo n.º 4
0
    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);
        }
    }
Exemplo n.º 5
0
    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);
    }
Exemplo n.º 6
0
    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);
    }
Exemplo n.º 7
0
    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;
    }
Exemplo n.º 8
0
    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);
    }
Exemplo n.º 9
0
    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;
    }
Exemplo n.º 10
0
    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;
    }
Exemplo n.º 11
0
    private void PlayPutAutoSkill()
    {
        rootAction = new OrderAction();

        WaitActor waitActor = new WaitActor(200);

        rootAction.AddNode(waitActor);

        List <SkillEntityInfo> skillEntitys = SkillModel.Instance.GetNewSkillEntitys();

        fightUI.ShowSkill();


        if (lastTouchCell != null && skillEntitys.Count > 0)
        {
            ParallelAction parallelAction = new ParallelAction();
            int            holdIndex      = 0;
            bool           lastIsHump     = lastTouchCell.IsHump();
            for (int i = 0; i < skillEntitys.Count; i++)
            {
                OrderAction skillOrder = new OrderAction();

                SkillEntityInfo skillEntity = skillEntitys[i];

                Vector2 addPos = new Vector2();

                for (int h = holdIndex; h < 19; h++)
                {
                    Vector2 holePos = FightConst.GetHoleByLevel(h, lastIsHump);

                    Vector2 checkPos = new Vector2(lastTouchCell.posX + holePos.x, lastTouchCell.posY - holePos.y);

                    CellInfo checkCell = CellModel.Instance.GetCellByPos((int)checkPos.x, (int)checkPos.y);

                    if (checkCell != null && checkCell.isBlank)
                    {
                        addPos    = checkPos;
                        holdIndex = h + 1;
                        break;
                    }
                }

                CellInfo addItem = CellModel.Instance.AddItem(skillEntity.seed.config_cell_item.id, (int)addPos.x, (int)addPos.y);

                SkillModel.Instance.ThrowSkillEntity(skillEntity, addItem);

                GameObject itemObj = CreateCellItem(addItem);
                itemObj.transform.SetParent(effectLayer.transform, false);
                Vector2 toPos = PosMgr.GetFightCellPos(addItem.posX, addItem.posY);
                PosMgr.SetCellPos(itemObj.transform, skillEntity.seed.seed_x, skillEntity.seed.seed_y, 1.0f);

                rootAction.AddNode(new PlaySoundActor("Useskill"));

                rootAction.AddNode(new ShowEffectActor(itemObj.transform, "effect_skill_fly"));

                rootAction.AddNode(new MoveActor((RectTransform)itemObj.transform, new Vector3(toPos.x, toPos.y, 0), 1200));

                skillOrder.AddNode(new SetLayerActor(itemObj.transform, transform));
                skillOrder.AddNode(new PlaySoundActor("PutAutoSkill"));
                skillOrder.AddNode(new ClearEffectActor(itemObj.transform, "effect_skill_fly"));
                skillOrder.AddNode(new ScaleActor((RectTransform)itemObj.transform, new Vector3(1.2f, 1.2f, 0), 0.2f));
                skillOrder.AddNode(new ScaleActor((RectTransform)itemObj.transform, new Vector3(1, 1, 0), 0.1f));

                parallelAction.AddNode(skillOrder);
            }
            rootAction.AddNode(parallelAction);
        }

        waitActor = new WaitActor(200);
        rootAction.AddNode(waitActor);
        ExecuteAction(FightStadus.auto_skill);
    }