Example #1
0
    void onJumpHPOver3()
    {
        if (side == GameBattleAttackResultSide.Left)
        {
            leftAnimation.stopAnimation();
            leftAnimation.clearAnimation();

            if (rangedAttack)
            {
                rightAnimation.stopAnimation();
                rightAnimation.clearAnimation();
            }
        }
        else
        {
            rightAnimation.stopAnimation();
            rightAnimation.clearAnimation();

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

        attackerAnimation.playAnimation(0, GameDefine.INVALID_ID, false, onAttackOver);
    }
Example #2
0
    public override void onShow()
    {
        gameAnimation.playAnimation(0, GameDefine.INVALID_ID, false, onPlayOver);

        isPlayOver   = false;
        isShowMsgBox = false;
    }
Example #3
0
    public void show(bool b)
    {
        isShow = true;

        isOK = b;

        if (isOK)
        {
            gameAnimation.playAnimation(0, 11);
        }
        else
        {
            gameAnimation.playAnimation(11, 22);
        }
    }
Example #4
0
    public void updateUpDonw()
    {
        upAnimation.stopAnimation();
        upAnimation.clearAnimation();

        downAnimation.stopAnimation();
        downAnimation.clearAnimation();

        if (selectionPos > 0)
        {
            if (!enabled1)
            {
                upAnimation.showFrame(18);
            }
            else
            {
                upAnimation.playAnimation(18, 22);
            }
        }

        if (selectionPos < itemCount - MAX_SLOT)
        {
            if (!enabled1)
            {
                downAnimation.showFrame(22);
            }
            else
            {
                downAnimation.playAnimation(22, 26);
            }
        }
    }
Example #5
0
    public void showEffect(int s1, int s2, int s3)
    {
        for (int j = 0; j < activeBattleStage.Layer.L1.Length; j++)
        {
            if (activeBattleStage.Layer.L1[j].ParmEffect == s1)
            {
                if (objsLayer1[j] == null)
                {
                    continue;
                }

                GameAnimation animation = objsLayer1[j].GetComponent <GameAnimation>();

                if (s2 == 0)
                {
                    animation.stopAnimation();
                    animation.clearAnimation();
                }
                else
                {
                    if (activeBattleStage.Layer.L1[j].Pause == 0)
                    {
                        animation.playAnimation();
                    }
                    else
                    {
                        animation.stopAnimation();
                        animation.showFrame(0);
                    }
                }
            }
        }
    }
Example #6
0
    public void updateAnimations()
    {
        if (bOK)
        {
            okGameAnimation.playAnimation(1, 12);

            cancelGameAnimation.stopAnimation();
            cancelGameAnimation.showFrame(12);

            color.a          = 1.0f;
            okText.color     = color;
            color.a          = 0.2f;
            cancelText.color = color;
        }
        else
        {
            okGameAnimation.stopAnimation();
            okGameAnimation.showFrame(1);

            cancelGameAnimation.playAnimation(12, 23);

            color.a          = 1.0f;
            cancelText.color = color;
            color.a          = 0.2f;
            okText.color     = color;
        }
    }
Example #7
0
    public void show(int i)
    {
        show();

        select(i);

        gameAnimation.playAnimation(1);
    }
Example #8
0
    public void playAnimation(int id, int id2, int frame, int endFrame, OnEventOver over)
    {
        string str = id + " " + id2;

        if (!animations.ContainsKey(str))
        {
            return;
        }

#if UNITY_EDITOR
        Debug.Log("playAnimation " + animations[str].gameObject.name);
#endif

        GameAnimation animation = animations[str];

        Transform trans = animation.transform;
        trans.localPosition = new Vector3(GameRPGSceneMovement.instance.PosXReal,
                                          GameRPGSceneMovement.instance.PosYReal + layerHeight,
                                          -id2 * 20);

        if (frame == GameDefine.INVALID_ID)
        {
            animation.playAnimation(0, GameDefine.INVALID_ID, false, over);
        }
        else
        {
            if (frame == endFrame)
            {
                animation.stopAnimation();
                animation.showFrame(endFrame);

                if (over != null)
                {
                    over();
                }
            }
            else
            {
                animation.playAnimation(frame, endFrame + 1, false, over);
            }

            //                animation.stopAnimation();
            //               animation.showFrame( frame );
        }
    }
Example #9
0
    void updateText()
    {
        showIndex++;

        if (showIndex > text1.Length)
        {
            start  = false;
            text   = text1;
            isOver = true;

            gameAnimation.offsetX = (int)((uiVertex.position.x + 20) / 2.0f);
            gameAnimation.offsetY = (int)((uiVertex.position.y + 20) / 2.0f);
            gameAnimation.playAnimation(27, 41);

            return;
        }

        if (showIndex > 20 &&
            uiVertex.position.y < 20 && uiVertex.position.x > 500)
        {
            line = 4;
            showIndex--;
        }

        text = text1.Substring(0, showIndex);

        if (text[text.Length - 1] == '\n')
        {
            line++;
        }

        if (line > 3)
        {
            isStopLine = true;
            speed      = 0.1f;
            text1      = text1.Remove(0, showIndex);
            showIndex  = 0;
            line       = 0;

            gameAnimation.offsetX = (int)((uiVertex.position.x + 20) / 2.0f);
            gameAnimation.offsetY = (int)((uiVertex.position.y + 20) / 2.0f);
            gameAnimation.playAnimation(27, 41);
        }
    }
Example #10
0
    public void show(int s = 0)
    {
        gameObject.SetActive(true);

        isShow = true;

        size = s;

        gameAnimation.playAnimation(s * 36, s * 36 + 36);
    }
Example #11
0
    public void updateTreasures()
    {
        GameBattleDTL dtl = activeBattleStage.DTL;

        string path = "Prefab/Misc/TREASURE";

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

        bool[] bc = new bool[activeBattleStage.MEVT.Length];
        for (int i = 0; i < bc.Length; i++)
        {
            bc[i] = false;
        }

        int ii = 0;

        for (int i = 0; i < dtl.Height; i++)
        {
            for (int j = 0; j < dtl.Width; j++)
            {
                if (mapEvent.ContainsKey(dtl.Points[ii].MapEvent))
                {
                    bc[dtl.Points[ii].MapEvent] = true;

                    if (mapEvent[dtl.Points[ii].MapEvent].EventType == GameBattleMapEventType.Event)
                    {
                        ii++;
                        continue;
                    }

                    GameObject obj = Instantiate <GameObject>(gameObject, transTreasures);
                    obj.name = dtl.Points[ii].MapEvent.ToString();

                    Transform trans = obj.transform;
                    trans.localPosition = new Vector3(j * GameDefine.TEXTURE_WIDTH,
                                                      -i * GameDefine.TEXTURE_HEIGHT + layerHeight, 0.0f);

                    GameAnimation gameAnimation = obj.GetComponent <GameAnimation>();
                    gameAnimation.playAnimation();
                    gameAnimation.offsetX = GameDefine.BATTLE_OFFSET_X;
                    gameAnimation.offsetY = GameDefine.BATTLE_OFFSET_Y;
                }

                ii++;
            }
        }

        for (int i = 0; i < bc.Length; i++)
        {
            if (!bc[i])
            {
                mapEvent.Remove(i);
            }
        }
    }
Example #12
0
    public void showLevelUp(OnEventOver over)
    {
        if (!isShow)
        {
            over();
            return;
        }

        if (side == GameBattleAttackResultSide.Left)
        {
            if (rangedAttack)
            {
                rightAnimation.stopAnimation();
                rightAnimation.clearAnimation();
            }
        }
        else
        {
            if (rangedAttack)
            {
                leftAnimation.stopAnimation();
                leftAnimation.clearAnimation();
            }
        }

        string path = "Prefab/Misc/Ftlup_r";

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

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

        levelUpAnimation    = obj.GetComponent <GameAnimation>();
        levelUpAnimation.UI = true;
        levelUpAnimation.playAnimation(0, GameDefine.INVALID_ID, false, onLevelShowOver);

        rightAnimation.playAnimation(6, 6 + rightAnimation.safHead.count3[0], false, over);
    }
Example #13
0
    public void showUser(bool b)
    {
        isShowUser = b;

        if (b)
        {
            left.stopAnimation();
            left.clearAnimation();

            right.stopAnimation();
            right.clearAnimation();

            select(0);
        }
        else
        {
            clearSelection();

            left.playAnimation(14, 18);
            right.playAnimation(18, 22);
        }
    }
Example #14
0
    public void playAnimation(int id, int id2)
    {
        if (!animations.ContainsKey(id))
        {
            return;
        }

#if UNITY_EDITOR
        Debug.Log("playAnimation " + animations[id].gameObject.name);
#endif

        GameAnimation animation = animations[id];
        animation.playAnimation(0, GameDefine.INVALID_ID, false);
    }
Example #15
0
    void onShowOver()
    {
        gameAnimation.playAnimation(gameAnimation.safHead.count3[0] + 2,
                                    gameAnimation.safHead.count3[0] + gameAnimation.safHead.count3[1] + 2);

        shopUI.gameObject.SetActive(true);
        bagUI.gameObject.SetActive(true);
        moneyText.gameObject.SetActive(true);
        itemText.gameObject.SetActive(true);
        Background1.gameObject.SetActive(true);
        Background2.gameObject.SetActive(true);

        showFade();
    }
Example #16
0
    public void show(GameItemAskUIType[] t, bool[] e)
    {
        uiType    = t;
        isEnabled = e;

        isShow = true;

        gameAnimation.playAnimation(1);

        gameObject.SetActive(true);

        for (int i = 0; i < MAX_SLOT; i++)
        {
            text[i].text = GameStringData.instance.getString(GameStringType.ItemUI0 + (int)uiType[i]);

            Color c = text[i].color;
            c.a           = isEnabled[i] ? 1.0f : 0.25f;
            text[i].color = c;
        }
    }
Example #17
0
    public void showSkill(GameSkill m, GameBattleUnit u, GameBattleAttackMapDirection dir, List <GameBattleAttackResultSkill> r, OnEventOver over)
    {
        clear();

        skill = m;
        item  = null;

        unit        = u;
        result      = r;
        direction   = dir;
        onEventOver = over;

        GameUserData.instance.LastSkillID = skill.ID;

        string path = "Prefab/Misc/Mag_misc";

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

        gameAnimation.offsetX = GameDefine.BATTLE_OFFSET_X;
        gameAnimation.offsetY = GameDefine.BATTLE_OFFSET_Y - 18;

        unit.playAnimationBattle(GameAnimationType.Skill, u.Direction, null);

        Transform trans = obj.transform;

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

        transform.localPosition = new Vector3(unit.PosBattleX,
                                              unit.PosBattleY + GameBattleManager.instance.LayerHeight,
                                              transform.localPosition.z);

        gameAnimation.playAnimation(1, GameDefine.INVALID_ID, false, onStartOver);
    }
Example #18
0
    public void show(GameCampScript s)
    {
        script = s;

        show();

        string path = "Prefab/Camp/Image/camp" + GameDefine.getString2(script.Camp);

        GameObject gameOjbect = Resources.Load <GameObject>(path);
        GameObject obj        = Instantiate(gameOjbect, transBackground);
        Transform  trans      = obj.transform;

        trans.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
        trans.localScale    = new Vector3(1.0f, 1.0f, 1.0f);

        gameAnimation         = obj.GetComponent <GameAnimation>();
        gameAnimation.UI      = true;
        gameAnimation.offsetX = -(int)(GameCameraManager.instance.sceneWidthHalf - GameCameraManager.instance.xOffset);
        gameAnimation.offsetY = (int)(GameCameraManager.instance.sceneHeightHalf);
        gameAnimation.playAnimation();

        GameCampSelectUI.instance.show(0);
        GameCampSelectUI.instance.showFade();
    }
Example #19
0
    public void show(GameRPGShopInfo i, OnEventOver over)
    {
        info = i;

        onEventOver = over;

        show();

        shopUI.gameObject.SetActive(false);
        bagUI.gameObject.SetActive(false);
        moneyText.gameObject.SetActive(false);
        itemText.gameObject.SetActive(false);
        Background1.gameObject.SetActive(false);
        Background2.gameObject.SetActive(false);


        string path = "Prefab/Shop/Shop" + GameDefine.getString2(info.shop);

        GameObject gameOjbect = Resources.Load <GameObject>(path);
        GameObject obj        = Instantiate(gameOjbect, transBackground);
        Transform  trans      = obj.transform;

        trans.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
        trans.localScale    = new Vector3(1.0f, 1.0f, 1.0f);

        gameAnimation         = obj.GetComponent <GameAnimation>();
        gameAnimation.UI      = true;
        gameAnimation.offsetX = -(int)(GameCameraManager.instance.sceneWidthHalf - GameCameraManager.instance.xOffset);
        gameAnimation.offsetY = (int)(GameCameraManager.instance.sceneHeightHalf);
        gameAnimation.showFrame(0);

        obj   = Instantiate(gameOjbect, transBackground);
        trans = obj.transform;
        trans.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
        trans.localScale    = new Vector3(1.0f, 1.0f, 1.0f);

        gameAnimation         = obj.GetComponent <GameAnimation>();
        gameAnimation.UI      = true;
        gameAnimation.offsetX = -(int)(GameCameraManager.instance.sceneWidthHalf - GameCameraManager.instance.xOffset);
        gameAnimation.offsetY = (int)(GameCameraManager.instance.sceneHeightHalf);
        gameAnimation.playAnimation(0, gameAnimation.safHead.count3[0], false, onShowOver);

        shopUI.setType(GameItemBagUI.GameItemBagUIType.Shop);
        shopUI.setShopType(info.type);

        bagUI.setType(GameItemBagUI.GameItemBagUIType.User);
        bagUI.setUser(0);
        shopUI.setUser(0);

        shopUI.setItems(info.item);

        bagUI.setItems(GameUserData.instance.getUnitBase(0).Items);

        bagUI.select(0);

        shopUI.enable(true);
        bagUI.enable(false);

        shopUI.select(0);

        updateText();
    }
Example #20
0
    public void addEffect(GameBattleUnitEffect e)
    {
        for (int i = 0; i < effects.Count; i++)
        {
            if (effects[i].Effect == e.Effect)
            {
//                 e.gameObject = effects[ i ].gameObject;
//                 effects[ i ] = e;
                return;
            }
        }

        effects.Add(e);

        if (effectsObject == null)
        {
            effectsObject      = new GameObject();
            effectsObject.name = "effects";
            effectsObject.transform.SetParent(gameObject.transform);
            effectsObject.transform.localPosition = Vector3.zero;
        }

        GameObject    obj = Instantiate <GameObject>(Resources.Load <GameObject>("Prefab/Misc/Man_eff"));
        GameAnimation ani = obj.GetComponent <GameAnimation>();

        ani.offsetX = GameDefine.BATTLE_OFFSET_X;
        ani.offsetY = GameDefine.BATTLE_OFFSET_Y;

        Transform trans = obj.transform;

        trans.SetParent(effectsObject.transform);
        trans.localPosition = Vector3.zero;

        e.gameObject = obj;

        switch (e.OtherEffect)
        {
        case GameSkillOtherEffect.AbilityUp:
            ani.playAnimation(23, 45);
            break;
        }

        switch (e.Effect)
        {
        case GameSkillResutlEffect.StrUp:
        case GameSkillResutlEffect.VitUp:
        case GameSkillResutlEffect.IntUp:
        case GameSkillResutlEffect.Violent:
            ani.playAnimation(23, 45);
            break;

        case GameSkillResutlEffect.MoveUp:
            ani.playAnimation(1, 23);
            trans.localPosition = new Vector3(0.0f, 0.0f, 1000.0f);
            break;

        case GameSkillResutlEffect.PhyImmunity:
            ani.playAnimation(129, 154);
            break;

        case GameSkillResutlEffect.MagImmunity:
            ani.playAnimation(109, 129);
            break;

        case GameSkillResutlEffect.Miss:
            ani.playAnimation(87, 109);
            break;

        case GameSkillResutlEffect.Poison:
//                ani.playAnimation( 154 , 187 );
            break;

        case GameSkillResutlEffect.Palsy:
//                ani.playAnimation( 154 , 187 );
            break;

        case GameSkillResutlEffect.Silence:
            ani.playAnimation(45, 87);
            break;

        case GameSkillResutlEffect.Fetter:
            ani.playAnimation(154, 187);
            break;

        case GameSkillResutlEffect.Clear:
            break;

        case GameSkillResutlEffect.SummonKiller:
            break;

        case GameSkillResutlEffect.Summon:
            break;

        case GameSkillResutlEffect.SummonRelive:
            break;

        case GameSkillResutlEffect.Under:
            ani.playAnimation(1, 23);
            trans.localPosition = new Vector3(0.0f, 0.0f, 1000.0f);
            break;
        }

        updateEffects();
    }
Example #21
0
    public void playOnceEffect(int id, int frame, int endFrame, OnEventOver over)
    {
        onEventOver = over;

        bool b = false;

        for (int j = 0; j < activeBattleStage.Layer.L1.Length; j++)
        {
            if (activeBattleStage.Layer.L1[j].Parm == id)
            {
                if (activeBattleStage.Layer.L1[j].ParmEffect != GameDefine.INVALID_ID)
                {
                    if (GameUserData.instance.getGameData(activeBattleStage.Layer.L1[j].ParmEffect) != 1)
                    {
                        continue;
                    }
                }

                lastEffectID = j;
                GameAnimation animation = objsLayer1[j].GetComponent <GameAnimation>();

#if UNITY_EDITOR
                Debug.Log("playOnceEffect " + animation.gameObject.name + " " + j);
#endif

                if (frame == GameDefine.INVALID_ID)
                {
                    if (activeBattleStage.Layer.L1[j].Pause == 0)
                    {
                        animation.stopAnimation();
                        animation.showFrame(endFrame);
                    }
                    else
                    {
                        if (!b)
                        {
                            animation.playAnimation(0, GameDefine.INVALID_ID, false, onEffectPlayOver1);
                        }
                        else
                        {
                            animation.playAnimation(0, GameDefine.INVALID_ID, false, null);
                        }

                        b = true;
                    }
                }
                else
                {
                    if (frame == endFrame)
                    {
                        animation.stopAnimation();
                        animation.showFrame(endFrame);
                    }
                    else
                    {
                        if (!b)
                        {
                            animation.playAnimation(frame, endFrame + 1, false, onEffectPlayOver1);
                        }
                        else
                        {
                            animation.playAnimation(frame, endFrame + 1, false, null);
                        }

                        b = true;
                    }
                }
            }
        }


        if (!b)
        {
            onEffectPlayOver1();
        }
    }
Example #22
0
    public void showLayer(int id)
    {
        string path = GameDefine.getString2(activeID);

        if (objsLayer0 == null ||
            objsLayer0.Length != activeRPGStage.Layer.L0.Length)
        {
            objsLayer0 = new GameObject[activeRPGStage.Layer.L0.Length];
        }

        for (int j = 0; j < activeRPGStage.Layer.L0.Length; j++)
        {
            if (activeRPGStage.Layer.L0[j].ID == id)
            {
                if (objsLayer0[j] != null)
                {
                    continue;
                }

                if (activeRPGStage.Layer.L0[j].Unknow4 == 10 &&
                    activeRPGStage.Layer.L0[j].Unknow5 == 8)
                {
                    layerHeight = id * 5000;
                }

                if (activeRPGStage.Layer.L0[j].Name.Contains(".saf"))
                {
                    string pathDir     = "Prefab/RPG/RPG" + path + "/";
                    string pathTexture = pathDir + activeRPGStage.Layer.L0[j].Name.Replace(".saf", "");

                    GameObject imgObject = Resources.Load <GameObject>(pathTexture);
                    GameObject obj       = Instantiate(imgObject, transBackground);
                    obj.name = activeRPGStage.Layer.L0[j].Name;

                    float z = GameDefine.getZ(activeRPGStage.Layer.L0[j].Unknow0);

                    Transform trans = obj.transform;
                    trans.localPosition = new Vector3(0.0f, layerHeight, z);
                    trans.localScale    = new Vector3(5.0f, 5.0f, 5.0f);

                    GameAnimation animation = obj.GetComponent <GameAnimation>();

                    animation.playAnimation();

                    objsLayer0[j] = obj;
                }
                else
                {
                    string pathDir     = "Texture/RPG/";
                    string pathTexture = pathDir + activeRPGStage.Layer.L0[j].Name;

                    GameObject imgObject = Resources.Load <GameObject>("Prefab/Sprite");
                    GameObject obj       = Instantiate(imgObject, transBackground);
                    obj.name = activeRPGStage.Layer.L0[j].Name;

                    float z = GameDefine.getZ(activeRPGStage.Layer.L0[j].Unknow0);

                    Transform trans = obj.transform;
                    trans.localPosition = new Vector3(0.0f, layerHeight, z);
                    trans.localScale    = new Vector3(1.0f, 1.0f, 1.0f);

                    if (activeRPGStage.Layer.L0[j].Unknow4 != 10 &&
                        activeRPGStage.Layer.L0[j].Unknow5 != 8)
                    {
                        trans.localScale = new Vector3(2.0f, 2.0f, 1.0f);
                    }

                    transUnit.localPosition = new Vector3(0.0f, 0.0f, -1100);

                    SpriteRenderer sprite = obj.GetComponent <SpriteRenderer>();
                    sprite.sprite = Resources.Load <Sprite>(pathTexture);

                    float w = activeRPGStage.DTL.Width * GameDefine.TEXTURE_WIDTH;
                    float h = activeRPGStage.DTL.Height * GameDefine.TEXTURE_HEIGHT;

                    if (w == 4096 || h == 4096)
                    {
                        w = w / activeRPGStage.DTL.Width * GameDefine.TEXTURE_WIDTH;
                        h = w / activeRPGStage.DTL.Height * GameDefine.TEXTURE_HEIGHT;

                        trans.localScale = new Vector3(w, h, 1.0f);
                    }

                    objsLayer0[j] = obj;
                }
            }
        }


        if (objsLayer1 == null ||
            objsLayer1.Length != activeRPGStage.Layer.L1.Length)
        {
            objsLayer1 = new GameObject[activeRPGStage.Layer.L1.Length];
        }

        for (int j = 0; j < activeRPGStage.Layer.L1.Length; j++)
        {
            if (activeRPGStage.Layer.L1[j].ID == id)
            {
                string pathDir     = "Prefab/RPG/RPG" + path + "/";
                string pathTexture = pathDir + activeRPGStage.Layer.L1[j].Name;

                GameObject imgObject = Resources.Load <GameObject>(pathTexture);
                GameObject obj       = Instantiate(imgObject, transBackground);
                obj.name = activeRPGStage.Layer.L1[j].Name;

                Transform trans = obj.transform;
                trans.localPosition = new Vector3(activeRPGStage.Layer.L1[j].OffsetX,
                                                  -activeRPGStage.Layer.L1[j].OffsetY + layerHeight,
                                                  -1000 - j);

                trans.localScale = new Vector3(1.0f, 1.0f, 1.0f);

                GameAnimation animation = obj.GetComponent <GameAnimation>();

                if (activeRPGStage.Layer.L1[j].Unknow5 == 0)
                {
                    if (activeRPGStage.Layer.L1[j].Unknow3 == GameDefine.INVALID_ID)
                    {
                        animation.playAnimation();
                    }
                    else
                    {
                    }
                }
                else
                {
                }

                objsLayer1[j] = obj;
            }
        }



#if UNITY_EDITOR
        if (id == 1)
        {
            GameRPGDTL dtl = activeRPGStage.DTL;
            int        ii  = 0;

            Sprite spriteObject = Resources.Load <Sprite>("White");

            for (int i = 0; i < dtl.Height; i++)
            {
                for (int j = 0; j < dtl.Width; j++)
                {
                    // editor test

                    GameObject imgObject = Resources.Load <GameObject>("Prefab/Sprite");
                    GameObject obj       = Instantiate(imgObject, transCell);
                    obj.name = i + "-" + j;

                    Transform trans = obj.transform;
                    trans.localPosition = new Vector3(j * 30, -i * 24 + layerHeight, 0.0f);
                    //                    trans.localScale = new Vector3( 1.0f , 1.0f , 1.0f );

                    SpriteRenderer sprite = obj.GetComponent <SpriteRenderer>();
                    sprite.color  = new Color(1.0f, 1.0f, 1.0f, (dtl.Points[ii].Move == 1 ? 0.2f : 0.0f));
                    sprite.sprite = spriteObject;

                    GamePointTset test = obj.AddComponent <GamePointTset>();
                    test.Value0 = dtl.Points[ii].Move;
                    test.Value1 = dtl.Points[ii].MapEvent;
                    test.Value2 = dtl.Points[ii].RPGEvent;

                    if (dtl.Points[ii].MapEvent > 0)
                    {
                        sprite.color = new Color(0.0f, 1.0f, 0.0f, 0.25f);
                    }
                    else if (dtl.Points[ii].RPGEvent > 0)
                    {
                        sprite.color = new Color(1.0f, 0.0f, 0.0f, 0.25f);
                    }

                    ii++;
                }
            }
        }
#endif
    }
Example #23
0
    void onAttackOverItem()
    {
        clearJumpHP();

        for (int i = 0; i < resultItem.Count; i++)
        {
            string path = "Prefab/Misc/MAN_RES";

            GameBattleUnit u = resultItem[i].unit;

            if (u == null)
            {
                onMoveOver();
                return;
            }

            GameObject    obj           = Instantiate <GameObject>(Resources.Load <GameObject>(path));
            GameAnimation gameAnimation = obj.GetComponent <GameAnimation>();
            gameAnimation.offsetX = GameDefine.BATTLE_OFFSET_X;
            gameAnimation.offsetY = GameDefine.BATTLE_OFFSET_Y;

            Transform trans = obj.transform;
            trans.SetParent(transform);
            trans.localScale = Vector3.one;
            trans.position   = new Vector3(u.PosBattleX,
                                           u.PosBattleY + GameBattleManager.instance.LayerHeight,
                                           transform.localPosition.z);



            string path1 = "Prefab/JumpHPMap";

            GameObject          obj1   = Instantiate <GameObject>(Resources.Load <GameObject>(path1));
            GameBattleJumpHPMap jumpHP = obj1.GetComponent <GameBattleJumpHPMap>();

            Vector3 screenPos = GameCameraManager.instance.mainCamera.WorldToScreenPoint(trans.position);
            screenPos.z = 0;

            RectTransform trans1 = obj1.GetComponent <RectTransform>();
            trans1.SetParent(GameObject.Find("Canvas/UI/Center/JumpHPMap").transform);
            trans1.localScale       = Vector3.one;
            trans1.position         = screenPos;
            trans1.anchoredPosition = new Vector2(GameDefine.TEXTURE_WIDTH_HALF + trans1.anchoredPosition.x,
                                                  trans1.anchoredPosition.y - GameDefine.TEXTURE_HEIGHT);

            jumpHPlist.Add(jumpHP);

            int animationStart = 2;
            int animationEnd   = 10;

            OnEventOver over = null;

            switch (resultItem[i].type)
            {
            case GameItemUseType.Cure:
                animationStart = 46;
                animationEnd   = 60;
                over           = onResOverItem;
                break;

            case GameItemUseType.Recovery:
                animationStart = 60;
                animationEnd   = 81;
                over           = onJumpHPOver;
                break;

            case GameItemUseType.Limit:
                animationStart = 46;
                animationEnd   = 60;
                over           = onJumpHPOver;
                break;
            }

            if (i == 0)
            {
                gameAnimation.playSound = true;
                gameAnimation.playAnimation(animationStart, animationEnd, false, over);
            }
            else
            {
                gameAnimation.playSound = false;
                gameAnimation.playAnimation(animationStart, animationEnd, false, null);
            }
        }
    }
Example #24
0
    void onAttackOver()
    {
        clear();

        if (skill != null &&
            (skill.BattleType == GameSkillBattleType.Map ||
             skill.BattleType == GameSkillBattleType.Normal))
        {
            unit.playAnimationBattle(GameAnimationType.Stand, unit.Direction, null);
        }

        bool b = false;

        for (int i = 0; i < result.Count; i++)
        {
            string path = "Prefab/Misc/MAN_RES";

            GameBattleUnit u = result[i].unit;

            if (u == null)
            {
                onMoveOver();
                return;
            }

            GameObject    obj           = Instantiate <GameObject>(Resources.Load <GameObject>(path));
            GameAnimation gameAnimation = obj.GetComponent <GameAnimation>();
            gameAnimation.offsetX = GameDefine.BATTLE_OFFSET_X;
            gameAnimation.offsetY = GameDefine.BATTLE_OFFSET_Y;

            Transform trans = obj.transform;
            trans.SetParent(transform);
            trans.localScale = Vector3.one;
            trans.position   = new Vector3(u.PosBattleX,
                                           u.PosBattleY + GameBattleManager.instance.LayerHeight,
                                           transform.localPosition.z);



            string path1 = "Prefab/JumpHPMap";

            GameObject          obj1   = Instantiate <GameObject>(Resources.Load <GameObject>(path1));
            GameBattleJumpHPMap jumpHP = obj1.GetComponent <GameBattleJumpHPMap>();

            Vector3 screenPos = GameCameraManager.instance.mainCamera.WorldToScreenPoint(trans.position);
            screenPos.z = 0;

            RectTransform trans1 = obj1.GetComponent <RectTransform>();
            trans1.SetParent(GameObject.Find("Canvas/UI/Center/JumpHPMap").transform);
            trans1.localScale       = Vector3.one;
            trans1.position         = screenPos;
            trans1.anchoredPosition = new Vector2(GameDefine.TEXTURE_WIDTH_HALF + trans1.anchoredPosition.x,
                                                  trans1.anchoredPosition.y - GameDefine.TEXTURE_HEIGHT);

            jumpHPlist.Add(jumpHP);

            int animationStart = 2;
            int animationEnd   = 10;

            switch (result[i].type)
            {
            case GameSkillResutlType.Damage:
                animationStart = 2;
                animationEnd   = 10;
                break;

            case GameSkillResutlType.Cure:
                animationStart = 46;
                animationEnd   = 60;
                break;

            case GameSkillResutlType.Purge:
                animationStart = 60;
                animationEnd   = 81;
                break;

            case GameSkillResutlType.Blessing:
                animationStart = 18;
                animationEnd   = 32;
                break;

            case GameSkillResutlType.Curse:
                animationStart = 32;
                animationEnd   = 46;
                break;

            case GameSkillResutlType.None:
            case GameSkillResutlType.Special:
            {
                animationStart = 81;
                animationEnd   = 99;

                if (result[i].HP > 0 || result[i].MP > 0)
                {
                    if (skill != null &&
                        (skill.OtherEffect == GameSkillOtherEffect.HealAll ||
                         skill.OtherEffect == GameSkillOtherEffect.MPAdd))
                    {
                        animationStart = 46;
                        animationEnd   = 60;
                    }
                    else
                    {
                        animationStart = 2;
                        animationEnd   = 10;
                    }
                }
            }
            break;
            }

            OnEventOver over = null;

            if (result[i].type == GameSkillResutlType.Damage || result[i].HP != 0 || result[i].MP != 0)
            {
                over = onResOver;
            }
            else
            {
                over = onJumpHPOver;
            }

            b = true;

            gameAnimation.playSound = (i == 0);

            if (i == 0)
            {
                gameAnimation.playAnimation(animationStart, animationEnd, false, over);
            }
            else
            {
                gameAnimation.playAnimation(animationStart, animationEnd, false, null);
            }
        }

        if (!b)
        {
            onJumpHPOver();
        }
    }
Example #25
0
    void onStartMoveOver()
    {
        string path = "";

        int offsetX = 0;
        int offsetY = 0;

        switch (skill.BattleType)
        {
        case GameSkillBattleType.Normal:
        {
            path  = "Prefab/Magic/magic" + GameDefine.getString3(skill.AnimationID) + "/";
            path += "M";
            path += skill.AnimationID;
        }
        break;

        case GameSkillBattleType.UI:
        {
            return;
        }

        case GameSkillBattleType.Map:
        {
            if (skill.AnimationID > 0 && skill.BattleSprite == 0)
            {
                path  = "Prefab/Magic/magic" + GameDefine.getString3(skill.AnimationID) + "/";
                path += "M";
                path += skill.AnimationID;
            }
            else
            {
                unit.stopAnimation();
                unit.clearAnimation();

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

//                         offsetX = GameDefine.TEXTURE_WIDTH_HALF - 5;
//                         offsetY = GameDefine.TEXTURE_HEIGHT_HALF;
            }
        }
        break;

        case GameSkillBattleType.UIMap:
        {
            path = "Prefab/Sprite/man" + GameDefine.getString3(unit.Sprite) + "/" +
                   GameDefine.getString3(unit.Sprite);
            path += (skill.BattleSprite > 0 ? "-" + skill.BattleSprite : "");
            path += "sm";
        }
        break;
        }

        clear();

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

        if (obj1 == null)
        {
            onAttackOver();
            return;
        }

        GameObject    obj = Instantiate <GameObject>(obj1);
        GameAnimation attackerAnimation = obj.GetComponent <GameAnimation>();

        attackerAnimation.offsetX = offsetX;
        attackerAnimation.offsetY = offsetY;

        Transform trans = obj.transform;

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

        GameBattleSceneMovement.instance.updatePositionToCamera();

        transform.localPosition = new Vector3(GameBattleSceneMovement.instance.PosXReal,
                                              GameBattleSceneMovement.instance.PosYReal + GameBattleManager.instance.LayerHeight,
                                              transform.localPosition.z);

        attackerAnimation.transform.localScale = new Vector3(GameCameraManager.instance.sceneWidth / GameDefine.SCENE_WIDTH, 1.0f, 1.0f);

        if (direction != GameBattleAttackMapDirection.Count)
        {
            int c = attackerAnimation.safHead.count3[0];
            int f = c * (int)direction;

            attackerAnimation.playAnimation(f, f + c, false, onAttackOver);
        }
        else
        {
            attackerAnimation.playAnimation(0, GameDefine.INVALID_ID, false, onAttackOver);
        }
    }
Example #26
0
    public void showEffect(int id, int s)
    {
        for (int j = 0; j < activeBattleStage.Layer.L1.Length; j++)
        {
            if (activeBattleStage.Layer.L1[j].Parm == id)
            {
                if (objsLayer1[j] == null)
                {
                    string path        = GameDefine.getString2(GameUserData.instance.Stage);
                    string pathDir     = "Prefab/Stage/Stage" + path + "/";
                    string pathTexture = pathDir + activeBattleStage.Layer.L1[j].Name;

                    GameObject imgObject = Resources.Load <GameObject>(pathTexture);
                    GameObject obj       = Instantiate(imgObject, transBackground);
                    obj.name = activeBattleStage.Layer.L1[j].Name;

                    Transform trans = obj.transform;
                    trans.localPosition = new Vector3(GameBattleSceneMovement.instance.AnimationPosX,
                                                      GameBattleSceneMovement.instance.AnimationPosY + layerHeight, 1.0f);

                    trans.localScale = new Vector3(1.0f, 1.0f, 1.0f);

                    GameAnimation animation = obj.GetComponent <GameAnimation>();

                    objsLayer1[j] = animation.gameObject;

                    if (GameUserData.instance.Stage == 29)
                    {
                        // fix stage 29 bug

                        trans.localPosition = new Vector3(GameBattleSceneMovement.instance.AnimationPosX,
                                                          GameBattleSceneMovement.instance.AnimationPosY + layerHeight, -1005.0f);
                    }

                    if (GameUserData.instance.Stage == 34 && id == 6)
                    {
                        // fix stage 34 bug

                        trans.localPosition = new Vector3(0.0f, layerHeight, 1.0f);
                    }

                    if (activeBattleStage.Layer.L1[j].Pause == 0)
                    {
                        animation.playAnimation();
                    }
                    else
                    {
                        animation.stopAnimation();
                        animation.showFrame(0);
                    }

                    return;
                }

                GameAnimation animation1 = objsLayer1[j].GetComponent <GameAnimation>();

                if (activeBattleStage.Layer.L1[j].Pause == 0)
                {
                    animation1.playAnimation();
                }
                else
                {
                    animation1.stopAnimation();
                    animation1.showFrame(0);
                }
            }
        }
    }
Example #27
0
    void showAnimation()
    {
        clear();

        time      = 0.0f;
        startFade = false;
        alpha     = 0.0f;
        dis       = 0.0f;

        if (type == GameBattleTurnType.User)
        {
            gameAnimation.playAnimation(12, 27, false, null);
        }
        else
        {
            gameAnimation.playAnimation(28, 43, false, null);
        }

        int n1 = turn / 10;
        int n2 = turn % 10;
        int x  = 215;
        int y  = -170;

        GameObject obj = Instantiate <GameObject>(Resources.Load <GameObject>("Prefab/Image"));

        RectTransform trans = obj.GetComponent <RectTransform>();

        trans.SetParent(transNumbers);
        trans.anchoredPosition = new Vector2(x + gameAnimation.saf1[0].saf11[0].textureX,
                                             y - gameAnimation.saf1[0].saf11[0].textureY);
        trans.localScale = new Vector3(1.0f, 1.0f, 1.0f);

        Image image = obj.GetComponent <Image>();

        image.sprite = gameAnimation.sprites[gameAnimation.saf1[0].saf11[0].textureID];

        float scale = 0.5f;

        trans.sizeDelta = new Vector2(image.sprite.rect.width * scale, image.sprite.rect.height * scale);

        if (n1 > 1)
        {
            x  += (int)(trans.sizeDelta.y);
            obj = Instantiate <GameObject>(Resources.Load <GameObject>("Prefab/Image"));

            trans = obj.GetComponent <RectTransform>();
            trans.SetParent(transNumbers);
            trans.anchoredPosition = new Vector2(x + gameAnimation.saf1[n1].saf11[0].textureX,
                                                 y - gameAnimation.saf1[n1].saf11[0].textureY);
            trans.localScale = new Vector3(1.0f, 1.0f, 1.0f);

            image        = obj.GetComponent <Image>();
            image.sprite = gameAnimation.sprites[gameAnimation.saf1[n1].saf11[0].textureID];
            image.color  = new Color(1.0f, 1.0f, 1.0f, 0.0f);

            trans.sizeDelta = new Vector2(image.sprite.rect.width * scale, image.sprite.rect.height * scale);
        }

        if (n1 > 0)
        {
            x  += (int)(trans.sizeDelta.y);
            obj = Instantiate <GameObject>(Resources.Load <GameObject>("Prefab/Image"));

            trans = obj.GetComponent <RectTransform>();
            trans.SetParent(transNumbers);
            trans.anchoredPosition = new Vector2(x + gameAnimation.saf1[10].saf11[0].textureX,
                                                 y - gameAnimation.saf1[10].saf11[0].textureY);
            trans.localScale = new Vector3(1.0f, 1.0f, 1.0f);

            image        = obj.GetComponent <Image>();
            image.sprite = gameAnimation.sprites[gameAnimation.saf1[10].saf11[0].textureID];
            image.color  = new Color(1.0f, 1.0f, 1.0f, 0.0f);

            trans.sizeDelta = new Vector2(image.sprite.rect.width * scale, image.sprite.rect.height * scale);
            x += 1;
        }

        if (n2 > 0)
        {
            x  += (int)(trans.sizeDelta.y);
            obj = Instantiate <GameObject>(Resources.Load <GameObject>("Prefab/Image"));

            trans = obj.GetComponent <RectTransform>();
            trans.SetParent(transNumbers);
            trans.anchoredPosition = new Vector2(x + gameAnimation.saf1[n2].saf11[0].textureX,
                                                 y - gameAnimation.saf1[n2].saf11[0].textureY);
            trans.localScale = new Vector3(1.0f, 1.0f, 1.0f);

            image        = obj.GetComponent <Image>();
            image.sprite = gameAnimation.sprites[gameAnimation.saf1[n2].saf11[0].textureID];
            image.color  = new Color(1.0f, 1.0f, 1.0f, 0.0f);

            trans.sizeDelta = new Vector2(image.sprite.rect.width * scale, image.sprite.rect.height * scale);
        }

        startFade = true;
        transNumbers.anchoredPosition = new Vector2(-15.0f, 0.0f);
        gameObject.SetActive(true);
    }
Example #28
0
    public void playAnimation(int id, int id2, int frame, int endFrame, OnEventOver over)
    {
        if (!animations.ContainsKey(id))
        {
            return;
        }

#if UNITY_EDITOR
        Debug.Log("playAnimation " + animations[id].gameObject.name);
#endif

        onEventOver = over;

        GameAnimation animation = animations[id];

        int height = layerHeight;

        bool bUpdateHeight = false;

        if (id2 >= 10000500 && GameUserData.instance.Stage == 19)
        {
            // fix stage 7 19 bug
            height        = 2 * 5000;
            bUpdateHeight = true;

            GameAnimation ani = objsLayer0[1].GetComponent <GameAnimation>();
            ani.stopAnimation();
            ani.clearAnimation();
        }

        if ((id2 >= 20000000 && GameUserData.instance.Stage == 7) ||
            (id2 >= 20000000 && GameUserData.instance.Stage == 14))
        {
            // fix stage 7 14 bug

            height        = 2 * 5000;
            bUpdateHeight = true;
        }

        float z = GameDefine.getZ(id2);

        if (id2 >= 20000000)
        {
            z -= 3000;
        }

        Transform trans = animation.transform;

        if (animation.lastUnitID != GameDefine.INVALID_ID)
        {
            GameBattleUnit unit = GameBattleUnitManager.instance.getUnit(animation.lastUnitID);

            GameBattleSceneMovement.instance.moveToEvent(unit.PosX - GameCameraManager.instance.xCell,
                                                         unit.PosY - GameCameraManager.instance.yCell);

            trans.localPosition = new Vector3(GameBattleSceneMovement.instance.PosXReal,
                                              GameBattleSceneMovement.instance.PosYReal + height, z);
        }
        else
        {
            trans.localPosition = new Vector3(GameBattleSceneMovement.instance.AnimationPosX,
                                              GameBattleSceneMovement.instance.AnimationPosY + height,
                                              z);
        }


        if (id2 >= 20000000 &&
            GameUserData.instance.Stage == 23)
        {
            // fix stage 23 bug

            trans.localPosition = new Vector3(GameBattleSceneMovement.instance.PosXReal,
                                              GameBattleSceneMovement.instance.PosYReal + height, z);

            trans.localScale = new Vector3(GameCameraManager.instance.sceneWidth / 320.0f, 1.0f, 1.0f);
        }

        if (id2 == 10000500 &&
            GameUserData.instance.Stage == 24)
        {
            // fix stage 24 bug

            trans.localPosition = new Vector3(260.0f,
                                              -620.0f + height, z);
        }

        if (frame == GameDefine.INVALID_ID)
        {
            animation.playAnimation(0, GameDefine.INVALID_ID, false, onEffectPlayOver);
        }
        else
        {
            if (frame == endFrame)
            {
                animation.stopAnimation();
                animation.showFrame(endFrame);

                if (onEventOver != null)
                {
                    onEventOver();
                }
            }
            else
            {
                animation.playAnimation(frame, endFrame + 1, false, onEffectPlayOver);
            }

            //                animation.stopAnimation();
            //               animation.showFrame( frame );
        }

        if (bUpdateHeight)
        {
            GameCameraManager.instance.setPos(GameBattleSceneMovement.instance.PosXReal,
                                              GameBattleSceneMovement.instance.PosYReal + height);
        }
    }
Example #29
0
    public void showLayer(int id, bool b)
    {
//        clearAnimations();

        layerList.Add(id);

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

        if (objsLayer0 == null ||
            objsLayer0.Length != activeBattleStage.Layer.L0.Length)
        {
            objsLayer0 = new GameObject[activeBattleStage.Layer.L0.Length];
        }

        int lastLayer = 0;

        float lastWidth  = 0.0f;
        float lastHeight = 0.0f;

        for (int j = 0; j < activeBattleStage.Layer.L0.Length; j++)
        {
            if (activeBattleStage.Layer.L0[j].ID == id)
            {
                if (objsLayer0[j] != null)
                {
                    continue;
                }

                lastLayer   = activeBattleStage.Layer.L0[j].Lyaer;
                layerHeight = id * 5000;

                if (id > 1 && GameUserData.instance.Stage == 34)
                {
                    // fix stage 34 bug.
                    layerHeight = 5000;
                }

                if (layerList.Count == 1)
                {
                    GameBattleSceneMovement.instance.moveToEvent(0, 0);
                }

                if (activeBattleStage.Layer.L0[j].Name.Contains(".saf"))
                {
                    string pathDir     = "Prefab/Stage/Stage" + path + "/";
                    string pathTexture = pathDir + activeBattleStage.Layer.L0[j].Name.Replace(".saf", "");

                    GameObject imgObject = Resources.Load <GameObject>(pathTexture);
                    GameObject obj       = Instantiate(imgObject, GameCameraManager.instance.transform);
                    obj.name = activeBattleStage.Layer.L0[j].Name;

                    float z = GameDefine.getZ(activeBattleStage.Layer.L0[j].Unknow0);

                    Transform trans = obj.transform;
                    trans.localPosition = new Vector3(-GameCameraManager.instance.sceneWidthHalf,
                                                      GameCameraManager.instance.sceneHeightHalf
                                                      , z + 20);
                    trans.localScale = new Vector3(1.0f, 1.0f, 1.0f);

                    GameAnimation animation = obj.GetComponent <GameAnimation>();

                    animation.playAnimation();

                    objsLayer0[j] = obj;
                }
                else
                {
                    string pathDir     = "Texture/Map/Stage" + path + "/";
                    string pathTexture = pathDir + activeBattleStage.Layer.L0[j].Name;

                    GameObject imgObject = Resources.Load <GameObject>("Prefab/Map");
                    GameObject obj       = Instantiate(imgObject, transBackground);
                    obj.name = activeBattleStage.Layer.L0[j].Name;

                    float z = GameDefine.getZ(activeBattleStage.Layer.L0[j].Unknow0);

                    Transform trans = obj.transform;
                    trans.localPosition = new Vector3(0.0f, layerHeight, z);
                    trans.localScale    = new Vector3(1.0f, 1.0f, 1.0f);

                    SpriteRenderer sprite = obj.GetComponent <SpriteRenderer>();
                    sprite.sprite = Resources.Load <Sprite>(pathTexture);

                    float w = activeBattleStage.Layer.L0[j].Width * GameDefine.TEXTURE_WIDTH;
                    float h = activeBattleStage.Layer.L0[j].Height * GameDefine.TEXTURE_HEIGHT;

                    if (w > 4096 || h > 4096)
                    {
                        w = w / activeBattleStage.DTL.Width * GameDefine.TEXTURE_WIDTH;
                        h = w / activeBattleStage.DTL.Height * GameDefine.TEXTURE_HEIGHT;

                        trans.localScale = new Vector3(w, h, 1.0f);
                    }

                    if (activeBattleStage.Layer.L0[j].Unknow4 != 10 &&
                        activeBattleStage.Layer.L0[j].Unknow5 != 8)
                    {
                        if (GameUserData.instance.Stage == 18)
                        {
                            // fix stage 18 bug
                            trans.localPosition = new Vector3(0.0f, layerHeight, 10.0f);
                        }

                        trans.localScale = new Vector3(lastWidth / w, lastHeight / h, 1.0f);
                    }
                    else
                    {
                        lastWidth  = w;
                        lastHeight = h;
                    }

                    objsLayer0[j] = obj;
                }
            }
        }


        if (objsLayer1 == null ||
            objsLayer1.Length != activeBattleStage.Layer.L1.Length)
        {
            objsLayer1 = new GameObject[activeBattleStage.Layer.L1.Length];
        }

        for (int j = 0; j < activeBattleStage.Layer.L1.Length; j++)
        {
            if (activeBattleStage.Layer.L1[j].ID != id)
            {
                continue;
            }

            string pathDir     = "Prefab/Stage/Stage" + path + "/";
            string pathTexture = pathDir + activeBattleStage.Layer.L1[j].Name;

            GameObject imgObject = Resources.Load <GameObject>(pathTexture);
            GameObject obj       = Instantiate(imgObject, transBackground);
            obj.name = activeBattleStage.Layer.L1[j].Name;

            Transform trans = obj.transform;
            trans.localPosition = new Vector3(activeBattleStage.Layer.L1[j].OffsetX,
                                              -activeBattleStage.Layer.L1[j].OffsetY + layerHeight,
                                              -1000 - j);


            trans.localScale = new Vector3(1.0f, 1.0f, 1.0f);

            GameAnimation animation = obj.GetComponent <GameAnimation>();

            if (activeBattleStage.Layer.L1[j].VisibleBattle == 0)
            {
                bool bVisible = true;

                if (activeBattleStage.Layer.L1[j].ParmEffect != GameDefine.INVALID_ID)
                {
                    bVisible = GameUserData.instance.getGameData(activeBattleStage.Layer.L1[j].ParmEffect) > 0;
                }

                if (bVisible)
                {
                    switch (activeBattleStage.Layer.L1[j].Pause)
                    {
                    case 0:
                        animation.playAnimation();
                        break;

                    case 1:
                        animation.playAnimation();
                        //                                Debug.LogError( "activeBattleStage.Layer.L1[ j ].Pause" + j );
                        break;

                    case 2:
                        animation.playSound = false;
                        animation.showFrame(0);
                        animation.playSound = true;
                        break;
                    }
                }
            }



//             // 夏侯婴加入?
//             if ( GameUserData.instance.Stage == 28 &&
//                 activeBattleStage.Layer.L1[ j ].Parm == 7 ) // 8
//             {
//                 continue;
//             }
//             if ( GameUserData.instance.Stage == 29 &&
//                 activeBattleStage.Layer.L1[ j ].Parm == 1 ) // 3
//             {
//                 continue;
//             }

            objsLayer1[j] = obj;
        }


#if UNITY_EDITOR
        if (id == 1)
        {
            GameBattleDTL dtl = activeBattleStage.DTL;
            int           ii  = 0;

            Sprite spriteObject = Resources.Load <Sprite>("White");

            for (int i = 0; i < dtl.Height; i++)
            {
                for (int j = 0; j < dtl.Width; j++)
                {
                    // editor test

                    //                    return;

                    GameObject imgObject = Resources.Load <GameObject>("Prefab/Sprite");
                    GameObject obj       = Instantiate(imgObject, transCell);
                    obj.name = i + "-" + j;

                    Transform trans = obj.transform;
                    trans.localPosition = new Vector3(j * 30, -i * 24 + layerHeight, 0.0f);
//                    trans.localScale = new Vector3( 1.0f , 1.0f , 1.0f );

                    SpriteRenderer sprite = obj.GetComponent <SpriteRenderer>();
                    float          c      = (dtl.Points[ii].Move * 25) / 255.0f;
                    sprite.color  = new Color(c, c, c, (c > 0.25f ? 0.25f : c));
                    sprite.sprite = spriteObject;

                    if (dtl.Points[ii].MapEvent != -1 &&
                        activeBattleStage.MEVT.Length > dtl.Points[ii].MapEvent)
                    {
                        if (activeBattleStage.MEVT[dtl.Points[ii].MapEvent].EventType == GameBattleMapEventType.Event)
                        {
                            sprite.color = new Color(0.0f, 1.0f, 0.0f, 0.25f);
                        }
                        else if (activeBattleStage.MEVT[dtl.Points[ii].MapEvent].EventType == GameBattleMapEventType.Item)
                        {
                            sprite.color = new Color(1.0f, 1.0f, 0.0f, 0.25f);
                        }
                    }

                    GamePointTset test = obj.AddComponent <GamePointTset>();
                    test.Value0 = dtl.Points[ii].Move;
                    test.Value1 = dtl.Points[ii].Floor;
                    test.Value2 = dtl.Points[ii].MapEvent;

//                     obj = Instantiate( imgObject , transUnit );
//                     obj.name = i + "-" + j;
//
//                     trans = obj.GetComponent<RectTransform>();
//                     trans.localPosition = new Vector3( j * 30 , -i * 24 , 0.0f );
//                     trans.localScale = new Vector3( 1.0f , 1.0f , 1.0f );
//                     trans.sizeDelta = new Vector2( 30 , 24 );
//
//                     image = obj.GetComponent<Image>();
//                     image.enabled = false;

                    ii++;
                }
            }
        }
#endif
    }
Example #30
0
    void onAttackOver2()
    {
        GameBattleJumpHPUI.instance.jump(side, jumpHP, onJumpHPOver2);

        attackerAnimation.stopAnimation();
        attackerAnimation.clearAnimation();

        if (side == GameBattleAttackResultSide.Left)
        {
            int f = 6 + (leftAnimation.safHead.count3[0] == 0 ? 1 : leftAnimation.safHead.count3[0]);

            if (!rangedAttack)
            {
                leftAnimation.playAnimation(f, f + leftAnimation.safHead.count3[1]);
            }

            f = 6 + (rightAnimation.safHead.count3[0] == 0 ? 1 : rightAnimation.safHead.count3[0]);
            rightAnimation.playAnimation(f, f + rightAnimation.safHead.count3[1]);
        }
        else
        {
            int f = 6 + (rightAnimation.safHead.count3[0] == 0 ? 1 : rightAnimation.safHead.count3[0]);

            if (!rangedAttack)
            {
                rightAnimation.playAnimation(f, f + rightAnimation.safHead.count3[1]);
            }

            f = 6 + (leftAnimation.safHead.count3[0] == 0 ? 1 : leftAnimation.safHead.count3[0]);
            leftAnimation.playAnimation(f, f + leftAnimation.safHead.count3[1]);
        }

        int HP = 0;

        if (side == GameBattleAttackResultSide.Left)
        {
            HP = rightUnit.HP;
        }
        else
        {
            HP = leftUnit.HP;
        }

        kill = (HP <= result.HP + result.HP2);

        hitHP.Clear();

        jumpHP = result.HP2;

        hitCount = 0;
        for (int i = 0; i < attackerAnimation.saf1.Length; i++)
        {
            if (attackerAnimation.saf1[i].hit > 0)
            {
                hitCount++;
            }
        }

        int[] hit = new int[hitCount];

        hitCount = 0;
        for (int i = 0; i < attackerAnimation.saf1.Length; i++)
        {
            if (attackerAnimation.saf1[i].hit > 0)
            {
                hit[hitCount] = i;
                hitCount++;
            }
        }

        int hitAll = 0;

        for (int i = 0; i < hitCount; i++)
        {
            hitAll += hit[i];
        }

        float per = 0.0f;

        for (int i = 0; i < hitCount; i++)
        {
            per += hit[i] / (float)hitAll;

            if (i == hitCount - 1)
            {
                hitHP.Add(HP - result.HP - jumpHP);
            }
            else
            {
                hitHP.Add(HP - result.HP - (int)(per * jumpHP));
            }
        }

        hitCount = 0;
    }