Ejemplo n.º 1
0
 void UpdateVisual()
 {
     _selectedMap = _mapSettings[_indexMap];
     _mapThumbnailImage.sprite = _selectedMap._mapThumbnail;
     _indexMapText.text        = "" + (_indexMap + 1) + "/" + _mapSettings.Length;
     _nameMapText.text         = "" + _selectedMap._mapName;
 }
Ejemplo n.º 2
0
    private void SetTraps(RoomNode room, Map map, System.Random seed, int tileType, MapSetting mapSetting, int floor)
    {
        List <Vector2Int> blockPoses = new List <Vector2Int>();

        for (int y = room.bottomLeft.y + 1; y < room.topRight.y; y++)
        {
            for (int x = room.bottomLeft.x + 1; x < room.topRight.x; x++)
            {
                if (map.mapMatrix[x, y] == floor)
                {
                    map.mapMatrix[x, y] = (seed.Next(0, 100) < mapsetting.trapPercentage) ? tileType : map.mapMatrix[x, y];
                }
                if (map.mapMatrix[x, y] == tileType)
                {
                    blockPoses.Add(new Vector2Int(x, y));
                }
            }
        }
        foreach (Vector2Int pos in blockPoses)
        {
            if (GetSurroundingTypeIn4(pos.x, pos.y, map, tileType) < 1)
            {
                map.mapMatrix[pos.x, pos.y] = floor;
            }
        }
    }
Ejemplo n.º 3
0
    private void SetHollows(int type, MapSetting mapSetting, Map map, System.Random seed, RoomNode room)
    {
        int hollowNums = seed.Next(mapsetting.caveNum / 2, mapsetting.caveNum);

        for (int i = 0; i <= hollowNums; i++)
        {
            Vector2Int        pos     = new Vector2Int(seed.Next(room.bottomLeft.x + 2, room.topRight.x), seed.Next(room.bottomLeft.y + 2, room.topRight.y));
            int               sizeX   = seed.Next(mapsetting.minHollowSize.x, mapSetting.maxHollowSize.x);
            int               sizeY   = seed.Next(mapsetting.minHollowSize.y, mapSetting.maxHollowSize.y);
            List <Vector2Int> hollows = new List <Vector2Int>();

            for (int x = pos.x; x < pos.x + sizeX; x++)
            {
                for (int y = pos.y; y < pos.y + sizeY; y++)
                {
                    if (room.ContainsCoordinate(x, y) && !room.Path.Contains(new Vector2Int(x, y)))
                    {
                        map.mapMatrix[x, y] = type;
                        hollows.Add(new Vector2Int(x, y));
                    }
                }
            }
            foreach (Vector2Int hole in hollows)
            {
                if (GetSurroundingSelves(hole.x, hole.y, map) < 2)
                {
                    map.mapMatrix[hole.x, hole.y] = (int)TileType.Floor;
                }
            }
        }
    }
Ejemplo n.º 4
0
        private static void OnMapCheck(NetworkMessage netMsg)
        {
            var msg = netMsg.ReadMessage <CheckMapMsg>();

            if (msg.MapExists == MapState.None)
            {
                Debug.Log("Server wants me to make a map.");
                var mapGen  = new MapGen.MapGen();
                var setting = new MapSetting
                {
                    AsteroidScore = 1,
                    IonScore      = 1,
                    MixedScore    = 2,
                    PlayerCount   = 4,
                    Spiral        = true,
                    XZones        = 4,
                    YZones        = 4,
                    RichnessScore = 0
                };
                mapGen.Launch(setting, () => { Singleton <MonoBehaviour> .Instance.StartCoroutine(SendChunksToServer(Player.Me.Client)); });
            }
            else if (msg.MapExists == MapState.Requested)
            {
                //The server puts you on a list, just chill for a second.
            }
            //Otherwise, it must exist, so ask for it.
            else
            {
                Player.Me.Client.Send(Messages.TransmitMap, new TransmitMapMsg(true));
            }
        }
Ejemplo n.º 5
0
    /// <summary>
    /// NOTE : Map Size Setting Function GUI
    /// </summary>
    private void SetMapSize()
    {
        GUILayout.Space(10);
        GUILayout.Label("Map Size Setting", MapToolWindow.titleFont);
        GUILayout.BeginHorizontal("Box");
        GUILayout.Label("Width");
        mapWidth = EditorGUILayout.IntSlider(mapWidth, 10, 200);
        GUILayout.EndVertical();

        GUILayout.BeginHorizontal("Box");
        GUILayout.Label("Height");
        mapHeight = EditorGUILayout.IntSlider(mapHeight, 10, 200);
        GUILayout.EndVertical();
        GUILayout.Label("Map Type", MapToolWindow.titleFont);
        selectedTypeMap = GUILayout.Toolbar(selectedTypeMap, new string[] { "Type1", "Type2" });
        GUILayout.Space(10);
        GUILayout.Label("BackGround Exist", MapToolWindow.titleFont);
        backgroundOn = GUILayout.Toggle(backgroundOn, backgroundOn ? "ON" : "OFF", "button");

        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Change", GUILayout.Height(35)))
        {
            if (mapsettinginstance == null)
            {
                mapsettinginstance = new MapSetting();
            }

            mapsettinginstance.CreateNormalMap(selectedTypeMap, mapWidth, mapHeight, backgroundOn);
        }

        GUILayout.Space(10);
    }
Ejemplo n.º 6
0
 void Start()
 {
     instance   = this;
     PlayerName = PlayerPrefs.GetString("PlayerName");
     CurrentMap = MapList[0];
     DontDestroyOnLoad(gameObject);
 }
Ejemplo n.º 7
0
    private void Awake()
    {
        Application.targetFrameRate = 60;

        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        tutorialMode = false;
        map          = new Map();
        mapSetting   = GetComponent <MapSetting>();
        audioSource  = GetComponent <AudioSource>();

        LoadData();
        if (highscore == 0)
        {
            tutorialMode  = true;
            tutorialPhase = 1;
        }
    }
Ejemplo n.º 8
0
        public MainWindowViewModel()
        {
            MapSetting = new BingRoadMapSetting();

            Friends = new ObservableCollection <FriendViewModel>
            {
                new FriendViewModel {
                    Name = "Banane9", Group = "Me"
                },
                new FriendViewModel {
                    Name = "The", Group = "Joke"
                },
                new FriendViewModel {
                    Name = "Cake", Group = "Joke"
                },
                new FriendViewModel {
                    Name = "is", Group = "Joke"
                },
                new FriendViewModel {
                    Name = "a", Group = "Joke"
                },
                new FriendViewModel {
                    Name = "lie!", Group = "Joke"
                }
            };
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Update map settings
        /// </summary>
        /// <param name="mapSettings"></param>
        internal void UpdateMapSettings(MapSetting mapSettings, string mapFile)
        {
            MapConfig config = readMapConfigFromFile(mapFile);

            config.map = mapSettings;
            this.saveMapConfigToFile(config, mapFile);
        }
Ejemplo n.º 10
0
 public void SceneReload()
 {
     SaveData();
     map        = null;
     mapSetting = null;
     userStatus = null;
     StartCoroutine(Loading());
 }
Ejemplo n.º 11
0
 public void Reset()
 {
     SaveLoadManager.DeletePlayer();
     map        = null;
     mapSetting = null;
     userStatus = null;
     StartCoroutine(Loading());
 }
 private void Awake()
 {
     if (S == null)
     {
         S = this;
     }
     MakingMap();
 }
        public BBSController(IOptions <MapSetting> options, GutsMvcUnitOfWork uf, ILogger <GutsMvcBBS> logger)
        {
            _mapSetting = options.Value;
            _uf         = uf;
            _logger     = new GutsMvcLogger(logger, _uf);

            // 初始化索引
            // JiebaLucene.Instance.InitIndex(_uf);
        }
Ejemplo n.º 14
0
    private void SetLootRoom(RoomNode room, Map map, System.Random seed, MapSetting mapSetting)
    {
        int tool = (int)TileType.Tool;

        SetFloors(room, map, seed);
        for (int y = room.bottomLeft.y + 1; y < room.topRight.y; y++)
        {
            for (int x = room.bottomLeft.x + 1; x < room.topRight.x; x++)
            {
                map.mapMatrix[x, y] = (seed.Next(0, 100) < mapsetting.lootRoomGadgetPercentage)?tool : map.mapMatrix[x, y];
            }
        }
    }
Ejemplo n.º 15
0
    public MapSetting getMap(string mapName)
    {
        MapSetting get = null;

        foreach (MapSetting map in mapList)
        {
            if (map.mapName == mapName)
            {
                get = map;
                break;
            }
        }
        return(get);
    }
Ejemplo n.º 16
0
    public MapSetting GetMap(string name)
    {
        MapSetting get = null;

        foreach (MapSetting st in MapList)
        {
            if (st.MapName == name)
            {
                get = st;
                break;
            }
        }

        return(get);
    }
Ejemplo n.º 17
0
 private void SetCaveRoom(RoomNode room, Map map, MapSetting mapsetting, System.Random seed)
 {
     //SetFloors(room, map, seed, mapsetting, (int)TileType.Obstacle_1);
     //BoxFillFloors(room, map, seed, mapsetting);
     //for(int x =room.bottomLeft.x;x<=room.topRight.x;x++)
     //{
     //    for (int y = room.bottomLeft.y; y <= room.topRight.y; y++)
     //    {
     //        if(map.mapMatrix[x,y].Equals((int)TileType.Border)&&GetSurroundingSelves(x,y,map)<=2)
     //        {
     //            map.mapMatrix[x, y] = (int)TileType.Floor;
     //        }
     //    }
     //}
     SetFloors(room, map, seed);
 }
Ejemplo n.º 18
0
    public void SetEnemies(RoomNode room, Map map, System.Random seed, MapSetting mapSetting)
    {
        int enemy    = (int)TileType.Enemy;
        int counter  = 0;
        int enemyNum = (room.Size * mapsetting.enemyPercentage / 100 >= mapsetting.maxEnemyNum) ? mapsetting.maxEnemyNum :(room.Width - 2) * (room.Height - 2) * mapsetting.enemyPercentage / 100;

        while (counter < enemyNum)
        {
            int x = seed.Next(room.bottomLeft.x + 1, room.topRight.x);
            int y = seed.Next(room.bottomLeft.y + 1, room.topRight.y);
            if (((TileType)map.mapMatrix[x, y]).ToString().Contains("Floor"))
            {
                map.mapMatrix[x, y] = enemy;
                counter++;
            }
        }
    }
Ejemplo n.º 19
0
        void Awake()
        {
            BlueShip = ThisBlueShip;
            RedShip  = ThisRedShip;
            var setting = new MapSetting
            {
                AsteroidScore = AsteroidScore,
                IonScore      = IonScore,
                MixedScore    = MixedScore,
                PlayerCount   = PlayerCount,
                Spiral        = UseSpiral,
                XZones        = XZone,
                YZones        = YZone,
                RichnessScore = Richness
            };

            MapGen = new MapGen.MapGen();

            MapGen.Launch(setting, () => { Debug.Log("Map Done!"); });
        }
Ejemplo n.º 20
0
    public RoomNode InitMapFrameWork(System.Random seed, MapSetting mapSetting)
    {
        GameObject[] temp = Resources.LoadAll <GameObject>("Prefabs/BossTool");
        specialPotions = temp.ToList();
        tilemap.ClearAllTiles();
        map = new Map(mapSetting.width, mapSetting.height);
        TileManager.Instance.LayTiles(map, tilemap, seed);
        bsp   = new BinarySpacePartitioner(mapSetting.width, mapSetting.height, seed, mapSetting.BSPIterationTimes);
        rooms = bsp.SliceMap(mapSetting.minRoomWidth, mapSetting.minRoomHeight, mapSetting.passageWidth, mapSetting.corridorWidth);
        RoomManager.Instance.SetRoomsType(ref rooms, seed);
        RoomNode startRoom = rooms[seed.Next(0, rooms.Count)];

        while (startRoom.type.Equals(RoomType.Boss))
        {
            startRoom = rooms[seed.Next(0, rooms.Count)];
        }
        RoomManager.Instance.SetRoomContent(startRoom.type, startRoom, map, seed, mapSetting);
        TileManager.Instance.LayTilsInRoom(map, startRoom, tilemap, seed);
        return(startRoom);
    }
Ejemplo n.º 21
0
 public void Put(MapSetting settings, string mapFile)
 {
     this.settingsDataContext.UpdateMapSettings(settings, mapFile);
 }
 public MemberController(GutsMvcUnitOfWork uf, IOptions <MapSetting> options, IMemoryCache cache)
 {
     _uf         = uf;
     _mapSetting = options.Value;
     _cache      = cache;
 }
Ejemplo n.º 23
0
    //public static List<RoomNode> SortRoomByArea( List<RoomNode> rooms)
    //{
    //    return rooms.OrderBy();
    //}

    public void SetRoomContent(RoomType roomType, RoomNode room, Map map, System.Random seed, MapSetting mapSetting)
    {
        //SetDoors(doors, map);
        room.FindPath();
        switch (roomType)
        {
        case RoomType.Boss:
            SetBossRoom(room, map, seed);
            break;

        case RoomType.Loot:
            SetLootRoom(room, map, seed, mapsetting);
            break;

        case RoomType.Trap:
            SetTrapRoom(room, map, seed);
            break;

        case RoomType.Normal:
            SetNormalRoom(room, map, seed);
            break;

        //case RoomType.Cave:
        //    SetCaveRoom(room,map, mapsetting, seed);
        //    break;
        default:
            break;
        }
        SetRoomCorridors(room, map);
        foreach (Vector2Int door in room.DoorWays)
        {
            //Debug.Log(door);
        }
        //SetRoomBorder(room, map);
    }
Ejemplo n.º 24
0
    private void BoxFillTiles(RoomNode room, Map map, System.Random seed, TileType tileType, MapSetting mapSetting, Vector2Int pos)
    {
        int type   = (int)tileType;
        int wall   = (int)TileType.Wall;
        int door   = (int)TileType.Door;
        int width  = seed.Next(1, mapsetting.obstacleBlockNums);
        int height = mapsetting.obstacleBlockNums / width;

        for (int x = pos.x; x < pos.x + width && x < room.topRight.x; x++)
        {
            for (int y = pos.y; y < pos.y + height && y < room.topRight.y; y++)
            {
                if (map.mapMatrix[x, y] != door && map.mapMatrix[x, y] != wall)
                {
                    map.mapMatrix[x, y] = type;
                }
            }
        }
    }
Ejemplo n.º 25
0
    private void FloodFillTiles(RoomNode room, Map map, System.Random seed, TileType tileType, Vector2Int pos, MapSetting mapSetting)
    {
        Queue <Vector2Int> tileToEvaluate = new Queue <Vector2Int>();

        tileToEvaluate.Enqueue(pos);
        map.mapMatrix[pos.x, pos.y] = (int)tileType;
        //map.mapMatrix[pos.x, pos.y] = (int)tileType;
        int    curNum      = 1;
        string wall        = TileType.Wall.ToString();
        string floor       = TileType.Floor.ToString();
        int    door        = (int)TileType.Door;
        int    self        = (int)tileType;
        int    maxBlockNum = room.Size * mapSetting.trapPercentage / 100;
        int    totalNum    = seed.Next(1, maxBlockNum + 1);

        while (curNum < totalNum)
        {
            Vector2Int curPos = tileToEvaluate.Dequeue();
            if (map.mapMatrix[curPos.x - 1, curPos.y] != door && ((TileType)map.mapMatrix[curPos.x - 1, curPos.y]).ToString().Contains(floor))
            {
                tileToEvaluate.Enqueue(new Vector2Int(curPos.x - 1, curPos.y));
                map.mapMatrix[curPos.x - 1, curPos.y] = self;
                curNum++;
            }
            if (map.mapMatrix[curPos.x, curPos.y + 1] != door && ((TileType)map.mapMatrix[curPos.x, curPos.y + 1]).ToString().Contains(floor))
            {
                map.mapMatrix[curPos.x, curPos.y + 1] = self;
                curNum++;
                tileToEvaluate.Enqueue(new Vector2Int(curPos.x, curPos.y + 1));
            }
            if (map.mapMatrix[curPos.x + 1, curPos.y] != door && ((TileType)map.mapMatrix[curPos.x + 1, curPos.y]).ToString().Contains(floor))
            {
                map.mapMatrix[curPos.x + 1, curPos.y] = self;
                curNum++;
                tileToEvaluate.Enqueue(new Vector2Int(curPos.x + 1, curPos.y));
            }
            if (map.mapMatrix[curPos.x, curPos.y - 1] != door && ((TileType)map.mapMatrix[curPos.x, curPos.y - 1]).ToString().Contains(floor))
            {
                map.mapMatrix[curPos.x, curPos.y - 1] = self;
                curNum++;
                tileToEvaluate.Enqueue(new Vector2Int(curPos.x, curPos.y - 1));
            }
        }
    }
Ejemplo n.º 26
0
    public void GenerateRoomWithCoordinates(List <Vector2Int> coordinates, Map map, System.Random seed, MapSetting mapSetting, Tilemap tilemap)
    {
        RoomNode room = FindRoomWithCoordinates(coordinates);

        if (room != null && !room.isTiled)
        {
            RoomManager.Instance.SetRoomContent(room.type, room, map, seed, mapSetting);
            TileManager.Instance.LayTilsInRoom(map, room, tilemap, seed);
        }
    }
Ejemplo n.º 27
0
 void Client_GetMultiplayerMatchSettings(string map, string mode, string others)
 {
     CurrentMap = GetMap(map);
 }
Ejemplo n.º 28
0
 public void InitData()
 {
     this.mapsetting = (MapSetting)Resources.Load("Map Setting");
     //Debug.Log(mapsetting == null);
 }
Ejemplo n.º 29
0
 public static MapSetting ConvertMapSetting(int i)
 {
     return(MapSetting.GetMapSetting(i));
 }
Ejemplo n.º 30
0
 void Start()
 {
     instance = this;
     PlayerName = PlayerPrefs.GetString("PlayerName");
     CurrentMap = MapList[0];
     DontDestroyOnLoad(gameObject);
 }
 public SuperAdminController(IOptions <MapSetting> options, GutsMvcUnitOfWork uf, ILogger <GutsMvcBBS> logger)
 {
     _mapSetting = options.Value;
     _uf         = uf;
     _logger     = new GutsMvcLogger(logger, _uf);
 }
Ejemplo n.º 32
0
 // Use this for initialization
 void Start()
 {
     uiManager    = new UIManager(playerdisplay, bossdisplay);
     mapGenerator = this.transform.GetComponent <MapGenerator>();
     mapSetting   = mapGenerator.mapSetting;
 }