示例#1
0
    public void damageAllUser(OnEventOver over)
    {
        onEventOver = over;

        List <GameBattleAttackResultSkill> resultSkill = new List <GameBattleAttackResultSkill>();

        for (int i = 0; i < user.Count; i++)
        {
            if (user[i].IsAlive)
            {
                GameBattleAttackResultSkill r = new GameBattleAttackResultSkill();
                r.type = GameSkillResutlType.Damage;
                r.unit = user[i];
                r.HP   = (int)(user[i].HPMax * 0.33f);

                resultSkill.Add(r);
            }
        }

        for (int i = 0; i < npc.Count; i++)
        {
            if (npc[i].IsAlive)
            {
                GameBattleAttackResultSkill r = new GameBattleAttackResultSkill();
                r.type = GameSkillResutlType.Damage;
                r.unit = npc[i];
                r.HP   = (int)(npc[i].HPMax * 0.33f);

                resultSkill.Add(r);
            }
        }

        GameBattleAttackMap.instance.showRes(resultSkill, onDamageAllUserResOver);
    }
示例#2
0
    public void damageUser(int id, OnEventOver over)
    {
        onEventOver = over;

        damageUserID = id;

        List <GameBattleAttackResultSkill> resultSkill = new List <GameBattleAttackResultSkill>();

        for (int i = 0; i < user.Count; i++)
        {
            if (user[i].UnitID == id &&
                user[i].IsAlive)
            {
                GameBattleAttackResultSkill r = new GameBattleAttackResultSkill();
                r.type = GameSkillResutlType.Damage;
                r.unit = user[i];
                r.HP   = (int)(user[i].HPMax * 0.33f);

                resultSkill.Add(r);

                GameBattleCursor.instance.moveTo(user[i].PosX, user[i].PosY, true);
            }
        }

        GameBattleAttackMap.instance.showRes(resultSkill, onDamageUserResOver);
    }
示例#3
0
    public void show(int itemID, int gold, OnEventOver over)
    {
        onEventOver = over;

        show();

        string str;

        if (itemID != GameDefine.INVALID_ID)
        {
            str = GameMessageData.instance.getData(GameMessageType.Get1).message[0][1];

            GameItem item = GameItemData.instance.getData(itemID);

            str = str.Replace("0", item.Name);
        }
        else
        {
            str = GameMessageData.instance.getData(GameMessageType.Get1).message[0][0];

            str = str.Replace("0", GameDefine.getBigInt(gold.ToString()));
        }

        text.text = str;

        time = 0.0f;
    }
示例#4
0
    public void playAnimation(int s = 0, int e = GameDefine.INVALID_ID, bool l = true, OnEventOver over = null)
    {
        if (s < saf1.Length && s >= 0)
        {
            startFrame = s;
            frame      = s;
        }
        else
        {
            startFrame = 0;
            frame      = 0;
        }

        if (e < 0 || e >= safHead.count1)
        {
            endFrame = safHead.count1;
        }
        else if (e < safHead.count1)
        {
            endFrame = e;
        }

        loop        = l;
        onEventOver = over;
        start       = true;

        updateFrame(frame);
    }
示例#5
0
    public void moveTo(int x, int y, int sx, int sy, bool follow, OnEventOver over, bool delay = false)
    {
#if UNITY_EDITOR
        Debug.Log("GameBattleCursor moveTo " + x + " " + y);
#endif

        moveToX = x;
        moveToY = y;

        moveToXReal = GameDefine.getBattleX(x);
        moveToYReal = GameDefine.getBattleY(y);

        posXSpeed = sx;
        posYSpeed = sy;

        isMoving = true;

        isFollow = follow;

        onEventOver = over;

        if (delay && posX == x && posY == y)
        {
            time = -0.5f;
        }
        else
        {
            time = 0.0f;
        }
    }
示例#6
0
    public void showItem(GameItem m, GameBattleUnit u, GameBattleAttackMapDirection dir, List <GameBattleAttackResultItem> ri, List <GameBattleAttackResultSkill> r, OnEventOver over)
    {
        clear();

        item  = m;
        skill = null;

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

        resultItem = ri;
        result     = r;

        GameUserData.instance.LastItemID = item.ID;

        if (item.UseSkillID != GameDefine.INVALID_ID)
        {
            skill = GameSkillData.instance.getData(item.UseSkillID);

            showSkill(skill, u, dir, r, over);
        }
        else
        {
            onAttackOverItem();
        }
    }
示例#7
0
    public bool moveToDirection(int x, int y, bool start, bool follow, int speed, OnEventOver over)
    {
        if (x == posX && y == posY)
        {
            return(false);
        }

        if (startMoving)
        {
            return(false);
        }

        moveSpeed = GameDefine.getMoveSpeed(speed);

        sceneFollow        = follow;
        playStartAnimation = start;
        onEventOver        = over;

        moveBuffer.Clear();

        moveToX = x;
        moveToY = y;

        moveToBattleX = GameDefine.getBattleX(x);
        moveToBattleY = GameDefine.getBattleY(y);

        startAnimation();

        startMoving = true;

        return(true);
    }
示例#8
0
    public void playMovie(string str, OnEventOver over)
    {
        RectTransform trans = GetComponent <RectTransform>();

//        trans.anchoredPosition = new Vector2( GameCameraManager.instance.xOffset , 0.0f );

        videoPlayer.Stop();

        onEventOver = over;

        gameObject.SetActive(true);

        VideoClip clip = Resources.Load <VideoClip>(str);

        videoPlayer.clip = clip;
        videoPlayer.Play();

        rawImage.enabled = true;

        isPlaying = true;

#if UNITY_EDITOR
        Debug.Log("playMovie " + str + " " + clip);
#endif
    }
示例#9
0
    public void jump(float t, OnEventOver over)
    {
        onEventOver = over;
        time        = t;
        start       = true;

        pos = trans.anchoredPosition;
    }
示例#10
0
    public void jump(int hp, int mp, GameSkillResutlType type, GameSkillOtherEffect otherType, OnEventOver over)
    {
        clear();

        gameObject.SetActive(true);

        onEventOver = over;

        jumpCount = 0;

        RectTransform trans = GetComponent <RectTransform>();

        position = trans.anchoredPosition;

        string str = GameDefine.getBigInt(hp.ToString());

        if (mp != 0)
        {
            str = GameDefine.getBigInt(mp.ToString());
        }

        float ox = 6.0f * str.Length / 2.0f;

        for (int i = 0; i < str.Length; i++)
        {
            GameObject obj = Instantiate <GameObject>(Resources.Load <GameObject>("Prefab/TextUI"));

            trans = obj.GetComponent <RectTransform>();
            trans.SetParent(transform);
            trans.anchoredPosition = new Vector2(-ox + i * 6.0f, 0.0f);
            trans.localScale       = new Vector3(0.5f, 0.5f, 0.5f);

            GameBattleJumpHPUIText jumpText = obj.GetComponent <GameBattleJumpHPUIText>();
            jumpText.jump(-i * 0.1f, onJumpOver);

            Text text = obj.GetComponent <Text>();
            text.text = str.Substring(i, 1);

            if (type == GameSkillResutlType.Cure ||
                otherType == GameSkillOtherEffect.HealAll)
            {
                text.color = new Color(0.0f, 1.0f, 0.0f);
            }

            if (hp < 0 || mp < 0)
            {
                text.color = new Color(0.0f, 1.0f, 0.0f);
            }

            if (mp > 0)
            {
                text.color = new Color(0.0f, 0.9f, 1.0f);
            }

            objs.Add(obj);
        }
    }
示例#11
0
    public void moveTo(int x, int y, OnEventOver over)
    {
        if (movement.isMoving)
        {
            return;
        }

        movement.moveTo(x, y, false, true, false, 2, over);
    }
示例#12
0
    public void showRes(List <GameBattleAttackResultSkill> r, OnEventOver over)
    {
        skill       = null;
        unit        = null;
        result      = r;
        direction   = GameBattleAttackMapDirection.Count;
        onEventOver = over;

        onAttackOver();
    }
示例#13
0
    public void showSkillMap(GameSkill sk, GameBattleUnit u, GameBattleAttackMapDirection dir, List <GameBattleAttackResultSkill> r, OnEventOver over)
    {
        clear();

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

        GameUserData.instance.LastSkillID = skill.ID;

        //         string path = "Prefab/Sprite/man" + GameDefine.getString3( u.Sprite ) + "/" +
        //     GameDefine.getString3( u.Sprite );
        //         path += ( m.BattleSprite > 0 ? "-" + m.BattleSprite : "" );
        //         path += "sm";
        //
        //         GameObject obj = Instantiate<GameObject>( Resources.Load<GameObject>( path ) );
        //         GameAnimation attackerAnimation = obj.GetComponent<GameAnimation>();
        //         Transform trans = obj.transform;
        //         trans.SetParent( transform );
        //         trans.localScale = Vector3.one;
        //         trans.localPosition = Vector3.zero;
        //
        //         transform.localPosition = new Vector3( GameSceneMovement.instance.posXReal ,
        //             GameSceneMovement.instance.posYReal + GameBattleManager.instance.LayerHeight ,
        //             transform.localPosition.z );
        //
        //         float x = GameCameraManager.instance.sceneWidth / GameDefine.SCENE_WIDTH;
        //         transform.localScale = new Vector3( x , 1.0f , 1.0f );
        //
        //         if ( dir != GameBattleAttackMapDirection.Count )
        //         {
        //             int c = attackerAnimation.safHead.count3[ 0 ];
        //             int f = c * (int)dir;
        //
        //             attackerAnimation.playAnimation( f , f + c , false , onAttackOver );
        //         }
        //         else
        //         {
        //             attackerAnimation.playAnimation( 0 , GameDefine.INVALID_ID , false , onAttackOver );
        //         }

        if (skill.AttackRangeType == GameAttackRangeType.Line)
        {
            GameBattleSceneMovement.instance.moveTo(unit.PosX - GameCameraManager.instance.xCell,
                                                    unit.PosY - GameCameraManager.instance.yCell, 50, 50, onStartMoveOver);
        }
        else
        {
            GameBattleSceneMovement.instance.moveTo(GameBattleCursor.instance.PosX - GameCameraManager.instance.xCell,
                                                    GameBattleCursor.instance.PosY - GameCameraManager.instance.yCell, 50, 50, onStartMoveOver);
        }
    }
示例#14
0
    public bool moveToDirection(int x, int y, bool start, bool follow, int speed, OnEventOver over)
    {
        if (GameUserData.instance.Stage > 15 &&
            UnitID == 8 &&
            GameUserData.instance.getUnitBase(8).InTeam == 0)
        {
            return(false);
        }

        return(gameMovement.moveToDirection(x, y, start, follow, speed, over));
    }
示例#15
0
    public void showText(string str, string os, string cs, bool b, OnEventOver over)
    {
        show();

        text.text       = str;
        okText.text     = os;
        cancelText.text = cs;

        select(b);

        onEventOver = over;
    }
示例#16
0
    public void unShow(OnEventOver over)
    {
        onEventOver = over;

        if (!isShow)
        {
            onEventOver();
            return;
        }

        unShow();
    }
示例#17
0
    public int moveTo(int x, int y, byte cb, bool fly, GameUnitCampType camp, bool start, bool follow, int speed, OnEventOver over)
    {
        if (x == posX && y == posY)
        {
            return(GameDefine.INVALID_ID);
        }

        if (startMoving)
        {
            return(GameDefine.INVALID_ID);
        }

        moveBuffer.Clear();

        int count = GameBattlePathFinder.instance.findPath(posX, posY, x, y, cb, fly, camp);

        if (count == 0)
        {
            return(GameDefine.INVALID_ID);
        }

        for (int i = count - 3; i >= 0; i--)
        {
            moveBuffer.Add(GameBattlePathFinder.instance.pathResult[i]);
        }

        int cost = 0;

        for (int i = 0; i < moveBuffer.Count / 2; i++)
        {
            int xx = moveBuffer[i * 2 + 1];
            int yy = moveBuffer[i * 2];

            cost += GameBattleUnitMovement.instance.getCellCost(xx, yy);
        }

        moveSpeed = GameDefine.getMoveSpeed(speed);

        sceneFollow        = follow;
        playStartAnimation = start;
        onEventOver        = over;
        canFollow          = GameCameraManager.instance.canFollow(posBattleX, posBattleY,
                                                                  GameBattleManager.instance.LayerHeight);


        moveNext();

        startAnimation();

        startMoving = true;

        return(cost);
    }
示例#18
0
    public void playAnimationRPG(GameAnimationType type, GameAnimationDirection dir, OnEventOver over)
    {
        animationType      = type;
        animationDirection = dir;

        int index = 0;
        int size  = safHead.count3[(int)type];

        switch (type)
        {
        case GameAnimationType.Stand:
        {
            index     += (int)dir * size;
            startFrame = index;
            endFrame   = index + size;
            loop       = true;
        }
        break;

        case GameAnimationType.Move:
        {
            index += safHead.count3[(int)GameAnimationType.Stand] * 4;

            index     += (int)dir * size;
            startFrame = index;
            endFrame   = index + size;
            loop       = true;
        }
        break;

        default:
            break;
        }


        if (size == 0)
        {
            start = false;
            if (over != null)
            {
                over();
            }
        }
        else
        {
            frame = startFrame;
            updateFrame(frame);

            onEventOver = over;
            start       = true;
        }
    }
示例#19
0
    public bool moveToEvent(int x, int y, bool start, bool follow, int speed, OnEventOver over)
    {
        if (GameUserData.instance.Stage > 15 &&
            UnitID == 8 &&
            GameUserData.instance.getUnitBase(8).InTeam == 0)
        {
            return(false);
        }

        GameUnitMove unitMove = GameUnitMoveTypeData.instance.getData(MoveType);

        return(gameMovement.moveToEvent(x, y, unitMove, start, follow, speed, over));
    }
示例#20
0
    public void jump(GameBattleAttackResultSide side, int hp, OnEventOver over)
    {
        clear();

        gameObject.SetActive(true);

        RectTransform trans = GetComponent <RectTransform>();

        if (side == GameBattleAttackResultSide.Right)
        {
            trans.anchoredPosition = new Vector2(-40.0f, 30.0f);
        }
        else
        {
            trans.anchoredPosition = new Vector2(54.0f, -24.0f);
        }

        position = trans.anchoredPosition;

        onEventOver = over;

        jumpCount = 0;


        string str = GameDefine.getBigInt(hp.ToString());

        float ox = 6.0f * str.Length / 2.0f;

        for (int i = 0; i < str.Length; i++)
        {
            GameObject obj = Instantiate <GameObject>(Resources.Load <GameObject>("Prefab/TextUI"));

            trans = obj.GetComponent <RectTransform>();
            trans.SetParent(transform);
            trans.anchoredPosition = new Vector2(-ox + i * 6.0f, 0.0f);
            trans.localScale       = new Vector3(0.5f, 0.5f, 0.5f);

            GameBattleJumpHPUIText jumpText = obj.GetComponent <GameBattleJumpHPUIText>();
            jumpText.jump(-i * 0.1f, onJumpOver);

            Text text = obj.GetComponent <Text>();
            text.text = str.Substring(i, 1);

            if (hp < 0)
            {
                text.color = new Color(0.0f, 1.0f, 0.0f, 1.0f);
            }

            objs.Add(obj);
        }
    }
示例#21
0
    public void moveTo(int x, int y, int sx, int sy, OnEventOver over)
    {
#if UNITY_EDITOR
        Debug.Log("GameBattleSceneMovement moveTo0 " + x + " " + y + " " + posX + " " + posY + " " + posXReal + " " + posYReal + " " + moveToXReal + " " + moveToYReal);
#endif
        posXReal = GameCameraManager.instance.PosXReal;
        posYReal = GameCameraManager.instance.PosYReal - GameBattleManager.instance.LayerHeight;

        posX = (int)(posXReal / GameDefine.TEXTURE_WIDTH);
        posY = (int)(-posYReal / GameDefine.TEXTURE_HEIGHT);

        if ((int)posXReal % GameDefine.TEXTURE_WIDTH > 0)
        {
            posX++;
        }
        if ((int)-posYReal % GameDefine.TEXTURE_HEIGHT > 0)
        {
            posY++;
        }

        moveToX = x;
        moveToY = y;

        moveToXReal = moveToX * GameDefine.TEXTURE_WIDTH + GameDefine.TEXTURE_WIDTH_HALF;
        moveToYReal = -moveToY * GameDefine.TEXTURE_HEIGHT - GameDefine.TEXTURE_HEIGHT_HALF;

        moveToXReal -= GameCameraManager.instance.xOffsetCell;
        moveToYReal += GameCameraManager.instance.yOffsetCell;

        posXSpeed = GameDefine.getSpeed(sx) + 20;
        posYSpeed = GameDefine.getSpeed(sy) + 20;

        if (posXReal == moveToXReal)
        {
            posX = moveToX;
        }
        if (posYReal == moveToYReal)
        {
            posY = moveToY;
        }

        isMoving  = true;
        moveEvent = true;

        onEventOver = over;

#if UNITY_EDITOR
        Debug.Log("GameBattleSceneMovement moveTo1 " + x + " " + y + " " + posX + " " + posY + " " + posXReal + " " + posYReal + " " + moveToXReal + " " + moveToYReal);
#endif
    }
示例#22
0
    public void fadeOut(OnEventOver over)
    {
        onEventOver = over;

        startFadeOut = true;
        alpha        = 1.0f;
        time         = -0.1f;

        alpha = 0.8f;
        gameAnimation.setColor(new Color(0.0f, 0.0f, 0.0f));
        gameAnimation.setAlpha(alpha);

        gameAnimation.stopAnimation();
    }
示例#23
0
    public bool moveToEvent(int x, int y, GameUnitMove unitMove, bool start, bool follow, int speed, OnEventOver over)
    {
        if (x == posX && y == posY)
        {
            return(false);
        }

        if (startMoving)
        {
            return(false);
        }

        int count = GameBattlePathFinder.instance.findPath(posX, posY, x, y,
                                                           unitMove.block, unitMove.fly, GameUnitCampType.Count);

        if (count == 0)
        {
            // try fly

            count = GameBattlePathFinder.instance.findPath(posX, posY, x, y,
                                                           GameBattlePathFinder.BLOCK_EVENT, true, GameUnitCampType.Count);
        }

        if (count == 0)
        {
            return(false);
        }

        for (int i = count - 3; i >= 0; i--)
        {
            moveBuffer.Add(GameBattlePathFinder.instance.pathResult[i]);
        }

        moveSpeed = GameDefine.getMoveSpeed(speed);

        sceneFollow        = follow;
        playStartAnimation = start;
        onEventOver        = over;
        canFollow          = GameCameraManager.instance.canFollow(posBattleX, posBattleY,
                                                                  GameBattleManager.instance.LayerHeight);

        moveNext();

        startAnimation();

        startMoving = true;

        return(true);
    }
示例#24
0
    public void doActed(OnEventOver over)
    {
        onEventOver = over;

        GameBattleInput.instance.Pause = true;

        if (GameBattleTurn.instance.UserTurn)
        {
            for (int i = 0; i < user.Count; i++)
            {
                if (user[i].IsAlive &&
                    user[i].checkEffect(GameSkillResutlEffect.Poison))
                {
                    GameBattleSceneMovement.instance.moveTo(user[i].PosX - GameCameraManager.instance.xCell,
                                                            user[i].PosY - GameCameraManager.instance.yCell, 50, 50, onDoActedMoveOver);

                    return;
                }
            }

            for (int i = 0; i < npc.Count; i++)
            {
                if (npc[i].IsAlive &&
                    npc[i].checkEffect(GameSkillResutlEffect.Poison))
                {
                    GameBattleSceneMovement.instance.moveTo(npc[i].PosX - GameCameraManager.instance.xCell,
                                                            npc[i].PosY - GameCameraManager.instance.yCell, 50, 50, onDoActedMoveOver);

                    return;
                }
            }
        }
        else
        {
            for (int i = 0; i < enemy.Count; i++)
            {
                if (enemy[i].IsAlive &&
                    enemy[i].checkEffect(GameSkillResutlEffect.Poison))
                {
                    GameBattleSceneMovement.instance.moveTo(enemy[i].PosX - GameCameraManager.instance.xCell,
                                                            enemy[i].PosY - GameCameraManager.instance.yCell, 50, 50, onDoActedMoveOver);

                    return;
                }
            }
        }

        onDoActedOver();
    }
示例#25
0
    public void unShowWhite(int t, Color c, OnEventOver over)
    {
        show();

        timeAll = GameDefine.getTimeWhite(t);
        time    = 0.0f;

        image.color = new Color(0.0f, 0.0f, 0.0f, 1.0f);
        alpha       = 1.0f;

        isShowBlack = true;
        alphaAdd    = false;

        onEventOver = over;
    }
示例#26
0
    public void clear()
    {
        clearAnimations();
        clearTreasures();
        clearStage();

        activeDTL         = null;
        activeBattleStage = null;
        activeBattleStart = null;

        layerHeight = 0;

        lastEffectID = GameDefine.INVALID_ID;
        onEventOver  = null;
    }
示例#27
0
    public void AI(OnEventOver over)
    {
        onEventOverAI = over;

        GameBattleCursor.instance.show();
        GameBattleCursor.instance.moveTo(PosX, PosY,
                                         GameBattleCursor.SpeedX15, GameBattleCursor.SpeedY15,
                                         true,
                                         AIFindNearEnemy);


//         GameBattleSceneMovement.instance.moveTo( PosX - GameCameraManager.instance.xCell ,
//             PosY - GameCameraManager.instance.yCell ,
//             GameBattleCursor.SpeedX , GameBattleCursor.SpeedY , null );
    }
示例#28
0
    public void unShowBlack(float t, OnEventOver over)
    {
        show();

        timeAll = t;
        time    = 0.0f;

        image.color = new Color(0.0f, 0.0f, 0.0f, 1.0f);
        alpha       = 1.0f;

        isShowBlack = true;
        alphaAdd    = false;

        onEventOver = over;
    }
示例#29
0
    public void showBlack(int t, OnEventOver over)
    {
        show();

        timeAll = GameDefine.getTimeBlack(t);
        time    = 0.0f;

        image.color = new Color(0.0f, 0.0f, 0.0f, 0.0f);
        alpha       = 0.0f;

        isShowBlack = true;
        alphaAdd    = true;

        onEventOver = over;
    }
示例#30
0
    public void show(OnEventOver over)
    {
        onEventOver = over;

        show();

        bagUI0.addItems();
        bagUI0.enable(true);
        bagUI0.select(0);

        bagUI1.addItems();
        bagUI1.enable(false);
        bagUI1.gameObject.SetActive(false);

        updateText();
    }