예제 #1
0
    public void checkMapEvent(GameBattleUnit unit, OnEventOver over)
    {
        onEventOver = over;

        GameBattleDTL.Point point = getPoint(unit.PosX, unit.PosY);

        if (!mapEvent.ContainsKey(point.MapEvent))
        {
            onCheckMapEvent();
            return;
        }

        GameBattleMEVT evt = mapEvent[point.MapEvent];

        switch (evt.EventType)
        {
        case GameBattleMapEventType.Event:
        {
            switch (evt.EventParm1)
            {
            // what ghost !?

            case 0:
                break;

            case 1:
                break;

            case 2:
                break;

            case 3:
                onCheckMapEvent();
                return;

            case 4:
                if (GameUserData.instance.Stage == 31)
                {
                    // fix stage 30 bug. so many bugs.

                    if (GameUserData.instance.getGameData(10) == 0)
                    {
                        onCheckMapEvent();
                        return;
                    }

                    if (unit.UnitID > 1)
                    {
                        onCheckMapEvent();
                        return;
                    }

                    if (unit.UnitID == 0 && unit.WeaponID != 14)
                    {
                        onCheckMapEvent();
                        return;
                    }

                    if (unit.UnitID == 0 && GameUserData.instance.Proficiency < 25 - PlayerPrefs.GetInt("review", 0))
                    {
                        onCheckMapEvent();
                        return;
                    }

                    if (unit.UnitID == 1 && unit.BattleAIType == GameBattleAIType.None)
                    {
                        onCheckMapEvent();
                        return;
                    }
                }
                break;

            case 5:
                onCheckMapEvent();
                return;

            case 6:
                break;
            }

            GameUserData.instance.setGameData((int)GameUserDataType.MapEvent6, unit.BattleManID);

            GameBattleEventManager.instance.showEvent(evt.EventParm2, 0, onCheckMapEvent);
        }
        break;

        case GameBattleMapEventType.Item:
        {
            switch (evt.ItemGetType)
            {
            case GameBattleMapEventType.Item:
            {
                if (unit.canAddItem())
                {
                    unit.addItem(evt.ItemGetParm1);
                }
                else
                {
                    GameUserData.instance.addItem(evt.ItemGetParm1);
                }

                GameBattleGetItemUI.instance.show(evt.ItemGetParm1, 0, null);
                onCheckMapEvent();
            }
            break;

            case GameBattleMapEventType.Gold:
            {
                GameUserData.instance.addGold(evt.ItemGetParm1);

                GameBattleGetItemUI.instance.show(GameDefine.INVALID_ID, evt.ItemGetParm1, null);
                onCheckMapEvent();
            }
            break;
            }

            mapEvent.Remove(point.MapEvent);
        }
        break;
        }



        for (int i = 0; i < transTreasures.childCount; ++i)
        {
            if (transTreasures.GetChild(i).gameObject.name == point.MapEvent.ToString())
            {
                Destroy(transTreasures.transform.GetChild(i).gameObject);
            }
        }

        //         clearTreasures();
        //         updateTreasures();
    }