Exemplo n.º 1
0
 void GuideAttack()
 {
     SetTouchState(true);
     defKey = TOUCH_KEY.Attack;
     ShowGuidePanel(3);
     ShowGuide(FightTouch._instance.ShowFightBtn(TOUCH_KEY.Attack));
 }
Exemplo n.º 2
0
 void FightTouchDelegate(TOUCH_KEY key)
 {
     if (null != OnTouchBtn)
     {
         OnTouchBtn(key);
     }
 }
Exemplo n.º 3
0
 public void Touch(TOUCH_KEY key, ref int compKey)
 {
     if (OnKeyChanged != null && !IsTouched(key))
     {
         OnKeyChanged(TouchEvent.Down, key);
     }
     compKey |= (int)key;
 }
Exemplo n.º 4
0
 public void Release(TOUCH_KEY key, ref int compKey)
 {
     if (OnKeyChanged != null && IsTouched(key))
     {
         OnKeyChanged(TouchEvent.Up, key);
     }
     compKey &= ~(int)key; //0&0为0  1&0为0
 }
Exemplo n.º 5
0
    void ForciblySummonGuide(TOUCH_KEY key)
    {
        SkillBtnCD summonBtn = null;

        switch (key)
        {
        case TOUCH_KEY.Summon1:
            summonBtn = fightTouchIns.summon1;
            break;

        case TOUCH_KEY.Summon2:
            summonBtn = fightTouchIns.summon2;
            break;

        case TOUCH_KEY.Summon3:
            summonBtn = fightTouchIns.summon3;
            break;
        }

        if (null == summonBtn)
        {
            Debug.Log("summonBtn is null");
            return;
        }

        copyBtn = Instantiate(summonBtn.gameObject) as GameObject;

        if (null == copyBtn)
        {
            Debug.Log("copyBtn is null");
            return;
        }
        copyBtn.transform.parent     = mask.transform;
        copyBtn.transform.localScale = Vector3.one;
        copyBtn.transform.position   = summonBtn.transform.position;
        copyBtn.transform.FindComponent <UISprite>("CD").enabled = false;
        ShowGuide(copyBtn.transform);

        if (mask.activeSelf)
        {
            mask.transform.Find("Sprite").GetComponent <UISprite>().alpha = 1f;
        }
        else
        {
            mask.SetActive(true);
        }

        fightTouchIns.CopySummonBtn(copyBtn.GetComponent <SkillBtnCD>(), key);

        for (int i = 0; i < elite.Count; i++)
        {
            elite[i].GetComponent <CharacterState>().moveSpeed = 0;
        }

        player.moveSpeed = 0;
    }
Exemplo n.º 6
0
 void CheckKey(KeyCode k, TOUCH_KEY tk)
 {
     if (Input.GetKeyDown(k))
     {
         TouchHandler.GetInstance().Touch(tk);
     }
     if (Input.GetKeyUp(k))
     {
         TouchHandler.GetInstance().Release(tk);
     }
 }
Exemplo n.º 7
0
 void SummonHero()
 {
     CancelInvoke("SummonHero");
     fightTouchIns.ClearAttackBtn();
     block.ChangeCount();
     Summon1     = true;
     defKey      = TOUCH_KEY.Summon1;
     summonIndex = 5;
     //Invoke("InvokeSummon", 5f);
     ShowGuidePanel(5);
     fightTouchIns.ShowFightBtn(TOUCH_KEY.Summon1);
     ForciblySummonGuide(defKey);
 }
Exemplo n.º 8
0
    public void CopySummonBtn(SkillBtnCD summonBtn, TOUCH_KEY key)
    {
        switch (key)
        {
        case TOUCH_KEY.Summon1:
            InitSummonBtnState(summonBtn, 5);
            break;

        case TOUCH_KEY.Summon2:
            InitSummonBtnState(summonBtn, 6);
            break;

        case TOUCH_KEY.Summon3:
            InitSummonBtnState(summonBtn, 7);
            break;
        }
    }
Exemplo n.º 9
0
    void SummonTargetNil(TOUCH_KEY key)
    {
        switch (key)
        {
        case TOUCH_KEY.Summon1:
            summonIndex = 5;
            break;

        case TOUCH_KEY.Summon2:
            summonIndex = 6;
            break;

        case TOUCH_KEY.Summon3:
            summonIndex = 7;
            break;
        }
        isForce = true;
    }
Exemplo n.º 10
0
    public void HideSummonHero(TOUCH_KEY key)
    {
        switch (key)
        {
        case TOUCH_KEY.Summon1:
            SetBtnState(summon1.GetComponent <UISprite>(), false);
            break;

        case TOUCH_KEY.Summon2:
            SetBtnState(summon2.GetComponent <UISprite>(), false);
            break;

        case TOUCH_KEY.Summon3:
            summon1.SetCd(15);
            summon2.SetCd(15);
            summon3.SetCd(15);
            SetBtnState(summon1.GetComponent <UISprite>());
            SetBtnState(summon2.GetComponent <UISprite>());
            SetBtnState(summon3.GetComponent <UISprite>());
            break;
        }
    }
Exemplo n.º 11
0
 void RefreshSpawn()
 {
     indexSpawn++;
     count = 0;
     if (indexSpawn == 2)
     {
         defKey = TOUCH_KEY.Skill4;
         ShowGuidePanel(4);
         ShowGuide(fightTouchIns.ShowFightBtn(TOUCH_KEY.Skill4));
     }
     for (int i = 0; i < spwanList.Count; i++)
     {
         if (spwanList[i].distance == indexSpawn && spwanList[i].tag != Tag.boss)
         {
             count++;
             spwanList[i].OnCreatMonster += (GameObject go, CharacterData cd) =>
             {
                 if (indexSpawn == 3)
                 {
                     if (setSummon)
                     {
                         setSummon = false;
                         Summon1   = false;
                         //Invoke("SummonHero", 5f);
                     }
                     elite.Add(go.GetComponent <Monster_AI>());
                 }
                 go.GetComponent <CharacterState>().OnDead += (CharacterState cs) => { count--; };
             };
             spwanList[i].StartSpawn();
         }
     }
     if (elite.Count > 0 && player.currentHp <= player.maxHp * 0.7f)
     {
         SetMonsterAttack();
     }
 }
Exemplo n.º 12
0
    public Transform ShowFightBtn(TOUCH_KEY key)
    {
        if (!Globe.isFightGuide)
        {
            return(null);
        }
        switch (key)
        {
        case TOUCH_KEY.Attack:
            attack.gameObject.SetActive(true);
            return(attack.transform);

        case TOUCH_KEY.Skill1:
        case TOUCH_KEY.Skill2:
        case TOUCH_KEY.Skill3:
        case TOUCH_KEY.Skill4:
            skill1.gameObject.SetActive(true);
            skill2.gameObject.SetActive(true);
            skill3.gameObject.SetActive(true);
            skill4.gameObject.SetActive(true);
            return(skill4.transform);

        case TOUCH_KEY.Summon1:
            summon1.gameObject.SetActive(true);
            return(summon1.transform);

        case TOUCH_KEY.Summon2:
            summon2.gameObject.SetActive(true);
            return(summon2.transform);

        case TOUCH_KEY.Summon3:
            summon3.gameObject.SetActive(true);
            return(summon3.transform);
        }
        return(null);
    }
Exemplo n.º 13
0
 public void Release(TOUCH_KEY key) //松开
 {
     Release(key, ref mKeyValue);
 }
Exemplo n.º 14
0
        public void OnTouch(TouchEvent action, TOUCH_KEY key)
        {
            switch (key)
            {
            case TOUCH_KEY.Attack:
                switch (action)
                {
                case TouchEvent.Down:         //持续按住按键不会触发按下
                    if (LockAttackTarget())
                    {
                        int targetMobaID = target.GetComponent <CharacterComponent>().mobaID;
                        //SessionComponent.Instance.Session.Send(new A1013_Attack_C2M() { MobaID = targetMobaID });
                        target.GetComponent <CharacterComponent>().OnTargeted();
                        myGamer.GetComponent <CharacterComponent>().OnAttack(targetMobaID, 1);
                    }
                    break;

                case TouchEvent.Up:
                    break;

                default:
                    break;
                }
                break;

            case TOUCH_KEY.Idle:
                switch (action)
                {
                case TouchEvent.Down:
                    break;

                default:
                    break;
                }
                break;

            case TOUCH_KEY.Run:     //关于移动
                switch (action)
                {
                case TouchEvent.Down:         //开始移动
                    break;

                case TouchEvent.Up:         //停止移动
                    break;

                case TouchEvent.Press:         //持续移动
                    break;

                default:
                    break;
                }
                break;

            case TOUCH_KEY.Skill1:
                switch (action)
                {
                case TouchEvent.Down:
                    break;

                case TouchEvent.Up:
                    break;

                default:
                    break;
                }
                break;

            case TOUCH_KEY.Skill2:
                switch (action)
                {
                case TouchEvent.Down:
                    break;

                case TouchEvent.Up:
                    break;

                default:
                    break;
                }
                break;

            case TOUCH_KEY.Skill3:
                switch (action)
                {
                case TouchEvent.Down:
                    break;

                case TouchEvent.Up:
                    break;

                default:
                    break;
                }
                break;

            case TOUCH_KEY.Skill4:
                switch (action)
                {
                case TouchEvent.Down:
                    break;

                case TouchEvent.Up:
                    break;

                default:
                    break;
                }
                break;

            case TOUCH_KEY.Summon1:
                switch (action)
                {
                case TouchEvent.Down:
                    break;

                default:
                    break;
                }
                break;

            case TOUCH_KEY.Summon2:
                switch (action)
                {
                case TouchEvent.Down:
                    break;

                default:
                    break;
                }
                break;

            case TOUCH_KEY.Summon3:
                switch (action)
                {
                case TouchEvent.Down:
                    break;

                default:
                    break;
                }
                break;

            default:
                throw new Exception("没有注册这个按键");
            }
        }
Exemplo n.º 15
0
    void HideGuide(TOUCH_KEY key)
    {
        if (yd_guangq.activeSelf && defKey == key)
        {
            yd_guangq.SetActive(false);
        }

        if (key == TOUCH_KEY.Run)
        {
            touchRotate = false;
        }
        else if (key == TOUCH_KEY.Attack)
        {
            if (guideIndex == 3)
            {
                CloseGuidePanel();
                guideIndex = 0;
            }
        }
        else if (key == TOUCH_KEY.Skill4)
        {
            if (guideIndex == 4)
            {
                CloseGuidePanel();
                guideIndex = 0;
            }
        }
        else if (key == TOUCH_KEY.Summon1)
        {
            HideForcibly();

            //CancelInvoke("InvokeSummon");
            for (int i = 0; i < elite.Count; i++)
            {
                elite[i].StartEscape(airWallPos);
            }
            PlotLinesNode plot = FSDataNodeTable <PlotLinesNode> .GetSingleton().FindDataByType(71);

            SceneUIManager.instance.InsDialogBubble(elite[0].gameObject, plot.Content, plot.Intervaltime);
            RetuenAttr();

            CharacterState cs = null;
            for (int i = 0; i < elite.Count; i++)
            {
                //elite[i].GetComponent<CharacterState>().InitHp(1000);
                cs = elite[i].GetComponent <CharacterState>();
                if (null != cs)
                {
                    cs.Hp(cs.currentHp > 1000 ? cs.currentHp - 1000 : 1000 - cs.currentHp);
                }
            }

            CDTimer.GetInstance().AddCD(2, (int count, long cid) =>
            {
                defKey      = TOUCH_KEY.Summon2;
                summonIndex = 6;
                //Invoke("InvokeSummon", 5f);
                ShowGuidePanel(6);
                fightTouchIns.ShowFightBtn(TOUCH_KEY.Summon2);
                ForciblySummonGuide(defKey);
            });
        }
        else if (key == TOUCH_KEY.Summon2)
        {
            HideForcibly();
            //CancelInvoke("InvokeSummon");
            CDTimer.GetInstance().AddCD(2, (int count, long cid) =>
            {
                //Invoke("InvokeSummon", 5f);
                defKey      = TOUCH_KEY.Summon3;
                summonIndex = 7;
                ShowGuidePanel(7);
                fightTouchIns.ShowFightBtn(TOUCH_KEY.Summon3);
                ForciblySummonGuide(defKey);
            });
        }
        else if (key == TOUCH_KEY.Summon3)
        {
            //CancelInvoke("InvokeSummon");
            HideForcibly(true);
            //Globe.isFightGuide = false;
            fightTouchIns.OnBtnTargetNil -= SummonTargetNil;
            fightTouchIns.OnTouchBtn     -= HideGuide;
            CloseGuidePanel();
        }
        FightTouch._instance.HideSummonHero(key);
    }
Exemplo n.º 16
0
 public void Touch(TOUCH_KEY key) //按下
 {
     Touch(key, ref mKeyValue);
 }
Exemplo n.º 17
0
 public bool IsTouched(TOUCH_KEY key, int compKey)
 {
     return((compKey & (int)key) != 0);
 }
Exemplo n.º 18
0
 public bool IsTouched(TOUCH_KEY key) //是否已按下
 {
     return(IsTouched(key, mKeyValue));
 }
Exemplo n.º 19
0
    public override void InitScene()
    {
        instance = this;

        Globe.fightHero = new int[] { (int)GameLibrary.player, 201000300, 201001900, 201001100, 0, 0 };

        Resource.CreatPrefabs("HeroPosEmbattle", null, new Vector3(10, 1000, 0));

        guidePanel = NextGuidePanel.Single();
        guidePanel.transform.parent     = SceneUIManager.instance.transform;
        guidePanel.transform.localScale = Vector3.one;

        insGuangQuan = Resources.Load(GameLibrary.Effect_UI + "yd_guangq") as GameObject;
        yd_guangq    = NGUITools.AddChild(SceneUIManager.instance.gameObject, insGuangQuan);
        yd_guangq.SetActive(false);
        if (yd_guangq.transform.Find("guangquan"))
        {
            guangquan = yd_guangq.transform.Find("guangquan").gameObject;
        }

        YinDao_GuangQuan = transform.Find("BullockCarts").gameObject;
        insYinDao        = Resource.CreatPrefabs("UI_YinDao_GuangQuan_01", YinDao_GuangQuan, Vector3.zero, GameLibrary.Effect_UI);

        promptArrow1 = Resource.CreatPrefabs("UI_YinDao_XiangQian_01", gameObject, Vector3.zero, GameLibrary.Effect_UI);
        promptArrow2 = Resource.CreatPrefabs("UI_YinDao_XiangQian_01", gameObject, Vector3.zero, GameLibrary.Effect_UI);
        SetArrowState(promptArrow1);
        SetArrowState(promptArrow2);

        fightTouchIns = FightTouch._instance;
        fightTouchIns.HideAllFightBtn();
        fightTouchIns.OnTouchBtn     += HideGuide;
        fightTouchIns.OnBtnTargetNil += SummonTargetNil;

        touchMove         = SceneUIManager.instance.moveTouch;
        touchMove.OnMove += TouchMove;

        touchCollider = SceneUIManager.instance.moveTouch.GetComponent <BoxCollider>();

        EffectBlock[] eb = GetComponentsInChildren <EffectBlock>();
        for (int i = 0; i < eb.Length; i++)
        {
            eb[i].OnCloseWall += (int num) =>
            {
                if (num > 2)
                {
                    SetArrowState(promptArrow2, true, airWallPos.transform.position);
                }
            };

            if (null == block && eb[i].transform.childCount == 2)
            {
                block = eb[i];
            }
        }

        for (int i = 0; i < Globe.fightHero.Length; i++)
        {
            if (Globe.fightHero[i] != 0)
            {
                playerData.GetInstance().RefreshHeroToList(Globe.fightHero[i], 1, i == 0 ? 1 : 20);
            }
        }

        CreateMainHero();

        for (int i = 0; i < Globe.Heros().Length; i++)
        {
            if (null != Globe.Heros()[i] && Globe.Heros()[i].id != 0)
            {
                Globe.Heros()[i].useServerAttr = false;
                Globe.Heros()[i].RefreshAttr();
            }
        }

        defKey = TOUCH_KEY.Run;
        ShowGuide(touchMove.transform, true);
        ShowGuidePanel(1);
        StartSpawn();
        SetArrowState(promptArrow1, true, player.transform.position);

        for (int i = 0; i < spwanList.Count; i++)
        {
            spwanList[i].isKM = false;
            if (spwanList[i].tag == Tag.boss)
            {
                spwanList[i].OnCreatMonster += (GameObject go, CharacterData cd) =>
                {
                    bossCs = go.GetComponent <CharacterState>();
                    TaskBossBlood();
                    go.GetComponent <CharacterState>().OnDead += (CharacterState cs) => { BossDead(); };
                };
            }
        }

        ReadTask(500);
        EnterDungensTask();

        ThirdCamera.instance._flatAngle = FSDataNodeTable <SceneNode> .GetSingleton().FindDataByType(GameLibrary.dungeonId).flat_angle;

        mask = SceneUIManager.instance.transform.Find("GuideMask").gameObject;
    }