private void ShowDamageEnd(GroundSEController gse)
 {
     gse.gameObject.SetActive(false);
     SEPool.Enqueue(gse);
     gse.CloseSE();
     gse.onRecycle = null;
 }
    private IEnumerator OnShowAllFight(List <DamageData> allDamage)
    {
        for (int i = 0; i < allDamage.Count; i++)
        {
            FightItemButton target = null;
            Vector3         orgPos = allDamage[i].tType[0] == "P" ? playerButtonPos [allDamage [i].orgIdx] : enemyButtonPos [allDamage [i].orgIdx];

            //當TargetIdx重複時會加10,此時需要減去10
            int minusCount = allDamage [i].targetIdx >= 10 ? 10 : 0;

            target = allDamage[i].tType[1] == "P" ? playerButton [allDamage [i].targetIdx - minusCount] : enemyButton [allDamage [i].targetIdx - minusCount];
            Vector3 targetPos = allDamage[i].tType[1] == "P" ? playerButtonPos [allDamage [i].targetIdx - minusCount] : enemyButtonPos [allDamage [i].targetIdx - minusCount];

            GroundSEController gse = SEPool.Dequeue();
            gse.SetAttackShow(orgPos, targetPos, target, allDamage [i]);
            gse.onRecycleDamage = ShowFightEnd;
            gse.gameObject.SetActive(true);
            gse.Run();

            if (i == 0)
            {
                if (allDamage.Count == 1)
                {
                    yield return(new WaitForSeconds(0.5f));            //該名角色最後攻擊所需時間
                }
                yield return(new WaitForSeconds(0.2f));                //該名角色的物理及魔法攻擊的顯示間隔
            }
            else
            {
                yield return(new WaitForSeconds(0.5f));                //該名角色最後攻擊所需時間
            }
        }

        fightController.OnTriggerSkill(allDamage);
    }
    private IEnumerator CheckRatio()
    {
        if (allRatioData.Count > recAllRatioData.Count)
        {
            foreach (var data in allRatioData)
            {
                bool hasNew = true;

                if (recAllRatioData.Count > 0)
                {
                    foreach (var recData in recAllRatioData)
                    {
                        if (data.start == recData.start && data.end == recData.end)
                        {
                            hasNew = false;
                            break;
                        }
                    }
                }

                if (hasNew == true)
                {
                    //Debug.LogWarning (data.ratio);
                    List <Vector3> postions = new List <Vector3> ();
                    for (int i = 0; i < fightController.players.Length; i++)
                    {
                        if (fightController.GetJob("P", i) == data.CharaJob)
                        {
                            postions.Add(playerButtonPos [i] + (Vector3.up * 30) * (ratioCount [i] - 1));

                            ratioCount [i]++;
                        }
                    }
                    if (SEPool.Count <= 0)
                    {
                        CreateSE();
                    }
                    GroundSEController gse = SEPool.Dequeue();

                    gse.SetReverseSE(data.hits, postions);
                    gse.onRecycle = RecycleReverseItem;
                    SEingPool.Enqueue(gse);
                }
            }
        }

        unShowed = SEingPool.Count;
        while (SEingPool.Count > 0)
        {
            GroundSEController gse = SEingPool.Dequeue();
            gse.gameObject.SetActive(true);
            gse.Run();
            yield return(new WaitForSeconds(0.5f * (gse.seGrounds.Count - 1)));
        }
    }
 private void ShowFightEnd(GroundSEController gse, DamageData damageData, FightItemButton target, Vector3 tPos)
 {
     gse.gameObject.SetActive(false);
     target.SetHpBar(damageData.hpRatio);
     SEPool.Enqueue(gse);
     gse.onRecycle = null;
     gse.SetDamageShow(damageData, tPos);
     gse.onRecycle = ShowDamageEnd;
     gse.gameObject.SetActive(true);
     gse.Run();
 }
 private void CreateSE()
 {
     showItemCount += 16;
     for (int i = 0; i < 16; i++)
     {
         GroundSEController showItem = Instantiate(showGrounds) as GroundSEController;
         showItem.GetComponent <RectTransform>().SetParent(showGroup);
         showItem.transform.localPosition = Vector3.zero;
         showItem.gameObject.SetActive(false);
         SEPool.Enqueue(showItem);
     }
 }
    private void RecycleExtraItem(GroundSEController gse)
    {
        unShowed--;
        gse.gameObject.SetActive(false);
        SEPool.Enqueue(gse);
        gse.onRecycle = null;

        if (unShowed == 0)
        {
            gse.onExtraUp = null;
            OnFight();
        }
    }
    private void WndStart()
    {
        lockOrder = new LinkedList <int>();

        for (int i = 0; i < imageItem; i++)
        {
            Image _image = Instantiate(spriteImage) as Image;
            _image.GetComponent <RectTransform>().SetParent(imagePool);
            _image.transform.localPosition = Vector3.zero;
            _image.gameObject.SetActive(false);
            _imagePool.Push(_image);
        }

        for (int i = 0; i < showItemCount; i++)
        {
            GroundSEController showItem = Instantiate(showGrounds) as GroundSEController;
            showItem.GetComponent <RectTransform>().SetParent(showGroup);
            showItem.transform.localPosition = Vector3.zero;
            showItem.transform.localScale    = Vector3.one;
            showItem.gameObject.SetActive(false);
            SEPool.Enqueue(showItem);
        }

        allGcs = groundPool.GetComponentsInChildren <GroundController>();

        resetGroundCount = 0;

        foreach (GroundController gc in allGcs)
        {
            if ((int)gc._groundType != 99)
            {
                gc.plusRatio = OnPlusRatio;
            }
        }

        CreateGround = 3;

        lockCount = 0;


        SetData();

        energe = 3;
        SetEnergy(true);

        SetCenter();
        startShowController.ShowStart(groundPool.transform.GetChild(centerIdx).position);
    }
 private void RecycleReverseItem(GroundSEController gse)
 {
     unShowed--;
     SEPool.Enqueue(gse);
     completeSe.Add(gse);
     gse.onRecycle = null;
     if (unShowed == 0)
     {
         foreach (GroundSEController se in completeSe)
         {
             se.gameObject.SetActive(false);
             se.AllReset();
             se.CloseSE();
         }
         foreach (FightItemButton btn in playerButton)
         {
             btn.NumberShowRun();
         }
     }
 }
    private IEnumerator OnShowExtra()
    {
        foreach (var data in ExtraRatios)
        {
            List <GroundController> org = new List <GroundController> ();
            org.Add(data.gc);
            recJobRatios [data.extraJob] += data.upRatio;
            for (int i = 0; i < recAllRatioData.Count; i++)
            {
                if (recAllRatioData [i].start.name == data.linkData.ElementAt(0).Key.name&& recAllRatioData [i].end.name == data.linkData.ElementAt(0).Value.name)
                {
                    RaycastData raycastdata = new RaycastData();
                    raycastdata         = recAllRatioData [i];
                    raycastdata.ratio  += data.upRatio;
                    recAllRatioData [i] = raycastdata;
                }
            }
            for (int i = 0; i < fightController.players.Length; i++)
            {
                if (fightController.GetJob("P", i) == data.extraJob)
                {
                    GroundSEController gse = SEPool.Dequeue();
                    gse.SetExtraSE(org, playerButtonPos [i], i, data.upRatio);
                    gse.onRecycle = RecycleExtraItem;
                    gse.onExtraUp = ExtraRatioUp;
                    SEingPool.Enqueue(gse);
                    AddCanAttack(i);
                }
            }
        }

        unShowed = SEingPool.Count;
        while (SEingPool.Count > 0)
        {
            GroundSEController gse = SEingPool.Dequeue();
            gse.gameObject.SetActive(true);
            gse.Run();
            yield return(new WaitForSeconds(0.2f));
        }
    }
 private void ExtraRatioUp(GroundSEController gse, int idx, int upRatio)
 {
     gse.gameObject.SetActive(false);
     playerButton [idx].SetExtra(upRatio);
 }