Esempio n. 1
0
    public void show(byte f, GameBattleUnit lt, GameBattleUnit rt, GameBattleAttackResultSide s, GameBattleAttackResultPhysical rs, bool o, OnEventOver over)
    {
        clear();

        skill = null;

        onEventOver = over;
        result      = rs;
        resultSkill = null;
        side        = s;
        isShow      = true;
        overUnShow  = false;
        showAdd     = false;
        mapAttack   = false;

        gameObject.SetActive(true);

        leftUnit  = lt;
        rightUnit = rt;

        string path = "Prefab/Stage/Stage" + GameDefine.getString2(GameUserData.instance.Stage) + "/FLOOR_";

        path += GameDefine.getString2(GameUserData.instance.Stage);

        GameObject gameObjectFloor = Instantiate <GameObject>(Resources.Load <GameObject>(path));

        floorAnimation    = gameObjectFloor.GetComponent <GameAnimation>();
        floorAnimation.UI = true;
        floorAnimation.showFrame(f);
        floorAnimation.transform.SetParent(floorTrans);
        floorAnimation.transform.localScale    = Vector3.one;
        floorAnimation.transform.localPosition = Vector3.zero;


        //        string ab = result.type == GameBattleAttackResultType.Block ? "ab" : "a";

        path  = "Prefab/Sprite/man" + GameDefine.getString3(rt.Sprite) + "/";
        path += (GameDefine.getString3(rt.Sprite) + "MISC");

        GameObject obj = Instantiate <GameObject>(Resources.Load <GameObject>(path));

        rightAnimation    = obj.GetComponent <GameAnimation>();
        rightAnimation.UI = true;
        rightAnimation.showFrame(6 + (rightAnimation.safHead.count3[0] == 0 ? 1 : rightAnimation.safHead.count3[0]));
        Transform trans = obj.transform;

        trans.SetParent(right.transform);
        trans.localScale    = Vector3.one;
        trans.localPosition = Vector3.zero;

        rightInfoUI.gameObject.SetActive(true);
        rightInfoUI.setValue(rt.HP, rt.HPMax, rt.Name);



        path  = "Prefab/Sprite/man" + GameDefine.getString3(lt.Sprite) + "/";
        path += (GameDefine.getString3(lt.Sprite) + "MISC");

        obj              = Instantiate <GameObject>(Resources.Load <GameObject>(path));
        leftAnimation    = obj.GetComponent <GameAnimation>();
        leftAnimation.UI = true;
        leftAnimation.showFrame(6 + (leftAnimation.safHead.count3[0] == 0 ? 1 : leftAnimation.safHead.count3[0]));
        trans = obj.transform;
        trans.SetParent(left.transform);
        trans.localScale    = Vector3.one;
        trans.localPosition = Vector3.zero;

        leftInfoUI.gameObject.SetActive(true);
        leftInfoUI.setValue(lt.HP, lt.HPMax, lt.Name);



        if (side == GameBattleAttackResultSide.Left)
        {
            path = "Prefab/Sprite/man" + GameDefine.getString3(lt.Sprite) + "/" +
                   GameDefine.getString3(lt.Sprite);
            path += (result.type == GameBattleAttackResultPhysical.Type.Block ? "ab" : "a");

            GameObject object1 = Resources.Load <GameObject>(path);

            if (object1 == null)
            {
                onShowOver();
                return;
            }

            obj = Instantiate <GameObject>(object1);
            attackerAnimation    = obj.GetComponent <GameAnimation>();
            attackerAnimation.UI = true;
            attackerAnimation.onAnimationEvent = onAnimationEvent;
            trans = obj.transform;
            trans.SetParent(left.transform);
            trans.localScale    = Vector3.one;
            trans.localPosition = Vector3.zero;

            defencerAnimation = rightAnimation;

            RectTransform trans1 = left.GetComponent <RectTransform>();
            trans1.SetSiblingIndex(3);

            rangedAttack = (lt.AttackType == GameUnitAttackType.Ranged);

            if (rangedAttack)
            {
                rightAnimation.clearAnimation();
            }
        }
        else
        {
            path = "Prefab/Sprite/man" + GameDefine.getString3(rt.Sprite) + "/" +
                   GameDefine.getString3(rt.Sprite);
            path += (result.type == GameBattleAttackResultPhysical.Type.Block ? "ab" : "a");

            GameObject object1 = Resources.Load <GameObject>(path);

            if (object1 == null)
            {
                onShowOver();
                return;
            }

            obj = Instantiate <GameObject>(object1);
            attackerAnimation    = obj.GetComponent <GameAnimation>();
            attackerAnimation.UI = true;
            attackerAnimation.onAnimationEvent = onAnimationEvent;
            trans = obj.transform;
            trans.SetParent(right.transform);
            trans.localScale    = Vector3.one;
            trans.localPosition = Vector3.zero;

            defencerAnimation = leftAnimation;

            RectTransform trans1 = right.GetComponent <RectTransform>();
            trans1.SetSiblingIndex(3);

            rangedAttack = (rt.AttackType == GameUnitAttackType.Ranged);

            if (rangedAttack)
            {
                leftAnimation.clearAnimation();
            }
        }

        attackerAnimation.otherGameAnimation = defencerAnimation;

        if (o)
        {
            onShowOver();
        }
        else
        {
            scale     = 2.0f;
            alpha     = 0.1f;
            time      = 0.0f;
            alphaAdd  = true;
            startFade = true;

            updateStage();
        }
    }
Esempio n. 2
0
    public void showSkillMap(byte f, GameSkill m, GameBattleUnit lt, GameBattleUnit rt, GameBattleAttackMapDirection dir, GameBattleAttackResultSide s, List <GameBattleAttackResultSkill> r, OnEventOver over)
    {
        if (m.BattleType == GameSkillBattleType.Normal ||
            m.BattleType == GameSkillBattleType.Map)
        {
            return;
        }

        clear();

        skill     = m;
        direction = dir;

        onEventOver = over;
        resultSkill = r;
        result      = null;
        side        = s;
        isShow      = true;
        mapAttack   = true;
        overUnShow  = true;
        showAdd     = false;

        GameUserData.instance.LastSkillID = skill.ID;

        gameObject.SetActive(true);

        leftUnit  = lt;
        rightUnit = rt;


        string path = "Prefab/Stage/Stage" + GameDefine.getString2(GameUserData.instance.Stage) + "/FLOOR_";

        path += GameDefine.getString2(GameUserData.instance.Stage);

        GameObject gameObjectFloor = Instantiate <GameObject>(Resources.Load <GameObject>(path));

        floorAnimation    = gameObjectFloor.GetComponent <GameAnimation>();
        floorAnimation.UI = true;
        floorAnimation.showFrame(f);
        floorAnimation.transform.SetParent(floorTrans);
        floorAnimation.transform.localScale    = Vector3.one;
        floorAnimation.transform.localPosition = Vector3.zero;


        if (side == GameBattleAttackResultSide.Left)
        {
            path  = "Prefab/Sprite/man" + GameDefine.getString3(lt.Sprite) + "/";
            path += (GameDefine.getString3(lt.Sprite) + "MISC");

            GameObject obj = Instantiate <GameObject>(Resources.Load <GameObject>(path));
            leftAnimation    = obj.GetComponent <GameAnimation>();
            leftAnimation.UI = true;
            leftAnimation.showFrame(6 + (leftAnimation.safHead.count3[0] == 0 ? 1 : leftAnimation.safHead.count3[0]));
            Transform trans = obj.transform;
            trans.SetParent(left.transform);
            trans.localScale    = Vector3.one;
            trans.localPosition = Vector3.zero;

            leftInfoUI.gameObject.SetActive(true);
            leftInfoUI.setValue(lt.HP, lt.HPMax, lt.Name);
            rightInfoUI.gameObject.SetActive(false);


            path = "Prefab/Sprite/man" + GameDefine.getString3(lt.Sprite) + "/" +
                   GameDefine.getString3(lt.Sprite);
            path += (m.BattleSprite > 0 ? "-" + m.BattleSprite : "");
            path += "s";

            obj = Instantiate <GameObject>(Resources.Load <GameObject>(path));
            attackerAnimation    = obj.GetComponent <GameAnimation>();
            attackerAnimation.UI = true;
            attackerAnimation.onAnimationEvent = onAnimationEvent;
            trans = obj.transform;
            trans.SetParent(left.transform);
            trans.localScale    = Vector3.one;
            trans.localPosition = Vector3.zero;

            defencerAnimation = null;
        }
        else
        {
            path  = "Prefab/Sprite/man" + GameDefine.getString3(rt.Sprite) + "/";
            path += (GameDefine.getString3(rt.Sprite) + "MISC");

            GameObject obj = Instantiate <GameObject>(Resources.Load <GameObject>(path));
            rightAnimation    = obj.GetComponent <GameAnimation>();
            rightAnimation.UI = true;
            rightAnimation.showFrame(6 + (rightAnimation.safHead.count3[0] == 0 ? 1 : rightAnimation.safHead.count3[0]));
            Transform trans = obj.transform;
            trans.SetParent(right.transform);
            trans.localScale    = Vector3.one;
            trans.localPosition = Vector3.zero;

            rightInfoUI.gameObject.SetActive(true);
            rightInfoUI.setValue(rt.HP, rt.HPMax, rt.Name);
            leftInfoUI.gameObject.SetActive(false);


            path = "Prefab/Sprite/man" + GameDefine.getString3(rt.Sprite) + "/" +
                   GameDefine.getString3(rt.Sprite);
            path += (m.BattleSprite > 0 ? "-" + m.BattleSprite : "");
            path += "s";

            obj = Instantiate <GameObject>(Resources.Load <GameObject>(path));
            attackerAnimation    = obj.GetComponent <GameAnimation>();
            attackerAnimation.UI = true;
            attackerAnimation.onAnimationEvent = onAnimationEvent;
            trans = obj.transform;
            trans.SetParent(right.transform);
            trans.localScale    = Vector3.one;
            trans.localPosition = Vector3.zero;

            defencerAnimation = null;
        }

        scale     = 2.0f;
        alpha     = 0.1f;
        time      = 0.0f;
        alphaAdd  = true;
        startFade = true;

        updateStage();
    }