Beispiel #1
0
    /// <summary>
    /// 购买僵尸按钮
    /// </summary>
    /// <param name="btn"></param>
    private void btnCardsOnClick(Button btn)
    {
        var p = BattleManager.Instance.leftPlayer;

        if (p._ZombieMgr.GetAllZombie().Count == BattleManager.Instance.maxBagZombie)
        {
            TipsManager.Instance.TipsShow("背包数量已满无法购买");
        }
        if (int.Parse(btn.transform.Find("gold/Text").GetComponent <Text>().text) <= p.GetGold())
        {
            CardConfig  card   = CardConfigData.Instance.GetCard(Intercept.Instance.GetIdForBuyName(btn.name));
            SkillConfig skill  = SkillConfigData.Instance.GetSkill(card.skill);
            ZombieInfo  zombie = new ZombieInfo();
            //zombie.id = type;
            //type++;
            zombie.cardId   = card.id;
            zombie.cardName = card.cardName;
            zombie.gold     = card.gold;
            zombie.profile  = skill.profile;
            zombie.atk      = card.atk;
            zombie.maxHp    = card.hp;
            zombie.atkSpeed = card.atkSpeed;
            zombie.atkRange = card.atkRange;
            zombie.level    = card.level;
            p._ZombieMgr.AddZombie(zombie, 1);
            EventManager.getMe().GoldRemove(card.gold); //p.RemoveGold(card.gold);
            BagWndUIController.getMe().Notify();
            // ChooseCard(BattleWndUIController.GetRound());
            Notify();
        }
    }
Beispiel #2
0
    /// <summary>
    /// 收回背包
    /// </summary>
    private void btnOnRecoverClick()
    {
        int count = 0;

        switch (zombie.level)
        {
        case 1:
            p._ZombieMgr.AddZombie(zombie, 1);
            count = 1;
            break;

        case 2:
            p._ZombieMgr.AddZombie(zombie, 3);
            count = 3;
            break;

        case 3:
            p._ZombieMgr.AddZombie(zombie, 9);
            count = 9;
            break;
        }

        BagWndUIController.getMe().Notify();

        MoveZombieNodeToGround(zombie);

        p._ZombieMgr.DeleteZombie(p._ZombieMgr.GetZombieController(id));
        TipsManager.Instance.TipsShow("获得" + count + "个" + zombie.cardName);
        onBack();
    }
Beispiel #3
0
 private void btnExitYes()
 {
     StartWndUIController.ShowOrHide(true);
     ClearAllZombie();
     p._ZombieMgr.RemoveAllZombie();
     p.ClearGold();
     p.DestroyEvent();
     BagWndUIController.getMe().gameObject.SetActive(false);
 }
Beispiel #4
0
    /// <summary>
    /// 注册地图图标
    /// </summary>
    /// <param name="btn"></param>
    private void btnOnClick(Button btn)
    {
        //

        if (uiMgr.getMe().FindUI(MenuWndUIController.ui_name) != null)
        {
            if (MenuWndUIController.getMe().MovePutDown() == true)
            {
                return;
            }
        }


        if (p._ZombieMgr.GetAllZombie().Count < 1)
        {
            return;
        }
        //if (uiMgr.getMe().FindUI(BagWndUIController.ui_name) == null)
        //{
        //    BagWndUIController.ShowOrHide(true);
        //}
        //else
        //{
        uiMgr.Instance.setTopUI(BagWndUIController.ui_name);
        BagWndUIController.getMe().SetFirstBtnOnNode();
        //}
        //Debug.Log("btn");
        //var g = BagWndUIController.getMe().getCurButton().name;


        ZombieInfo thisCard = p._ZombieMgr.GetZombie(Intercept.Instance.GetCardIdForBagName(BagWndUIController.getMe().getCurButton().name)).zombie;

        if (thisCard == null)
        {
            return;
        }
        BagWndUIController.getMe().SetCardShow(thisCard);
    }
    //private void btnOnEnter(Button btn)
    //{
    //    btn.image.color = Color.white;
    //}

    //private void btnOnExit(Button btn)
    //{
    //    btn.image.color = Color.grey;
    //}

    //单机模式
    private void btnSingleOnClick()
    {
        GroundManager.getMe().ClearNum();
        BattleManager.Instance.leftPlayer.Init();
        if (uiMgr.getMe().FindUI(MenuWndUIController.ui_name) != null)
        {
            MenuWndUIController.getMe().isPingpong = false;
        }


        if (uiMgr.getMe().FindUI(BagWndUIController.ui_name) != null)
        {
            BagWndUIController.getMe().gameObject.SetActive(true);
            BagWndUIController.getMe().Notify();
            uiMgr.getMe().setTopUI(BagWndUIController.ui_name);
        }
        BagWndUIController.ShowOrHide(true);

        if (uiMgr.getMe().FindUI(BattleWndUIController.ui_name) != null)
        {
            BattleWndUIController.getMe().gameObject.SetActive(true);
            BattleWndUIController.getMe().SetFirstBtnOnNode();
            EventManager.getMe().GoldAdd(8);
        }

        BattleWndUIController.ShowOrHide(true);

        if (uiMgr.getMe().FindUI(BuyWndUIController.ui_name) != null)
        {
            BuyWndUIController.getMe().gameObject.SetActive(true);
            uiMgr.getMe().setTopUI(BuyWndUIController.ui_name);
            BuyWndUIController.getMe().Notify();
        }
        BuyWndUIController.ShowOrHide(true);

        StartWndUIController.ShowOrHide(false);
    }
Beispiel #6
0
    /// <summary>
    /// 升级 优先升到最高级
    /// </summary>
    private void btnOnUpLevelClick()
    {
        var myZombie = p._ZombieMgr.GetZombie(zombie);

        if (myZombie == null)
        {
            TipsManager.Instance.TipsShow("你没有该种类的僵尸!!!");
            //uiTip.ShowOrHide("僵尸数量不够");
            onBack();
            return;
        }

        //Debug.Log(zombie.level);
        if (zombie.level == 3)
        {
            TipsManager.Instance.TipsShow("已为最高级");
            onBack();
            return;
        }
        else if (myZombie.count >= 8 && zombie.level < 2)
        {
            p._ZombieMgr.RemoveZombie(myZombie.zombie, 8);
            myZombie.zombie.zc.LevelUp(2);
        }
        else if (myZombie.count >= 2)
        {
            p._ZombieMgr.RemoveZombie(myZombie.zombie, 2);
            myZombie.zombie.zc.LevelUp(1);
        }
        else
        {
            TipsManager.Instance.TipsShow("僵尸数量不够");
            onBack();
            return;
            //uiTip.ShowOrHide("僵尸数量不够");
        }
        BagWndUIController.getMe().Notify();
        onBack();
        // zombies = p._ZombieMgr.GetAllZombieController();

        //var allBagZombies = BattleManager.getMe().leftPlayer.GetAllZombie();
        //遍历场上zombie
        //foreach (var item in p._ZombieMgr.GetAllZombieController())
        //{
        //    //不能扣自己当前要升级的
        //    if (item.Value.zombie.cardId == zombie.cardId && item.Value.zombie.level == zombie.level && item.Value.zombie.id != zombie.id)
        //    {
        //        needZombies.Add(item.Value.zombie);
        //    }
        //    if (item.Value.zombie.id != zombie.id)
        //    {
        //        battleZombie.Add(item.Value);
        //    }
        //}
        //for (int i = 0; i < zombies.Length; i++)
        //{
        //    //不能扣自己当前要升级的
        //    if (zombies[i].zombie.cardId == zombie.cardId && zombies[i].zombie.level == zombie.level && zombies[i].zombie.id != zombie.id)
        //    {
        //        needZombies.Add(zombies[i].zombie);
        //    }
        //    if (zombies[i].zombie.id != zombie.id)
        //    {
        //        battleZombie.Add(zombies[i]);
        //    }
        //}
        //遍历背包里zombie
        //var zombies = p._ZombieMgr.GetAllZombie();
        //for (int i = 0; i < zombies.Count; i++)
        //{
        //    if (zombies[i].zombie.cardId == zombie.cardId)
        //    {

        //        // needZombies.Add(p._ZombieMgr.GetAllZombie()[i]);
        //    }
        //}
        //如果有2个或以上 去除前两个升级
        //if (needZombies.Count >= 2)
        //{
        //    for (int i = 0; i < 2; i++)
        //    {
        //        if (battleZombie[i].zombie.id == needZombies[i].id)
        //        {
        //            p._ZombieMgr.DeleteZombie(battleZombie[i]);
        //        }
        //        else if (p._ZombieMgr.GetAllZombie().Contains(needZombies[i]))
        //        {
        //            p._ZombieMgr.RemoveZombie(needZombies[i]);
        //            BagWndUIController.getMe().Notify();
        //        }
        //    }

        //zombie.LevelUp();

        //p._ZombieMgr.GetZombieController(id).GetComponent<BaseSpine>().setSkin("goblin");
        // npcMgr.getMe().getNpc("");

        //btn.GetComponent<Image>().overrideSprite = CardResource.Instance.GetCardSprite(zombie.cardId, zombie.level);
        //btn.transform.parent.Find("Spine").GetComponent<basespine>().setSkin("goblin");// = "goblin";
        //var a = btn.GetComponent<Image>().sprite;
        //var b = btn.GetComponent<Image>().overrideSprite;
        //p._ZombieMgr.GetZombieController(id).transform.name = "zombie" + "_" + zombie.id + "_" + zombie.level;
        //onBack();
        //}
        //else
        //{
        // TextShow("抱歉同类型怪物不够三个");
        //}
        //needZombies.Clear();
        //battleZombie.Clear();
    }