Exemple #1
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);
            }
        }
    }
Exemple #2
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);
                    }
                }
            }
        }
    }
Exemple #3
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;
        }
    }
Exemple #4
0
    public void showText(int face, int type, string str)
    {
        clear();

        if (face != -1)
        {
            string path = "Prefab/Face/Face" + (face < 10 ? "0" + face : face.ToString());

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

            if (faceObj == null)
            {
                return;
            }

            GameObject obj = Instantiate <GameObject>(faceObj);

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

            gameAnimation = obj.GetComponent <GameAnimation>();

            for (int i = 0; i < gameAnimation.saf1.Length; i++)
            {
                for (int j = 0; j < gameAnimation.saf1[i].saf11.Length; j++)
                {
                    gameAnimation.saf1[i].saf11[j].textureX = 0;
                    gameAnimation.saf1[i].saf11[j].textureY = 0;
                }
            }

            gameAnimation.UI    = true;
            gameAnimation.pivot = pivot;
            gameAnimation.showFrame(type);

            if (textTrans.sizeDelta.x == 595)
            {
                textTrans.sizeDelta = new Vector2(380, 110);
            }
        }
        else
        {
            if (textTrans.sizeDelta.x == 380)
            {
                textTrans.sizeDelta = new Vector2(595, 110);
            }
        }

        text.showText(str);
    }
Exemple #5
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 );
        }
    }
Exemple #6
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();
    }
Exemple #7
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
    }
Exemple #8
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);
                }
            }
        }
    }
Exemple #9
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();
        }
    }
Exemple #10
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);
        }
    }
Exemple #11
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();
        }
    }
Exemple #12
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();
    }