Example #1
0
    public Box[,] GenerMap(int size, RoomInfoClass _setting)
    {
        size = (size % 2 == 0) ? size + 1 : size;
        map  = new Box[size, size];

        for (int y = 0; y < size; y++)
        {
            for (int x = 0; x < size; x++)
            {
                bool _unbreak = ((x % 2 == 0) && (y % 2 == 0)) || (x == 0) || (x == size - 1) || (y == 0) || (y == size - 1);
                //client.MakeBlock(_unbreak, Random.Range(0, 5) != 0, );
                map[x, y]       = new Box();
                map[x, y].pos   = new Vector2Int(x, y);
                map[x, y].state = _unbreak ? BlockState.unbrekable : Random.value > _setting.boxDensity ? BlockState.destroyer : BlockState.brekable;
                if (map[x, y].state != BlockState.destroyer && (Random.value < _setting.powerDensity))
                {
                    if (Random.value > _setting.mysteryPowerDensity)
                    {
                        map[x, y].PowerUp = (PowerUps)Random.Range(1, 4);
                    }
                    else
                    {
                        map[x, y].PowerUp = PowerUps.mistery;
                    }
                }
                SyncBox(x, y);
            }
        }
        return(map);
    }
Example #2
0
    public void RecevingData(StreamDataType _type, string _dataJson)
    {
        switch (_type)
        {
        //case StreamDataType.Map:
        //    string[,] _mapJson = JsonConvert.DeserializeObject<string[,]>(_dataJson);
        //    map.Maps = new Box[_mapJson.GetLength(0), _mapJson.GetLength(0)];
        //    for (int x = 0; x < _mapJson.GetLength(0); x++)
        //    {
        //        for (int y = 0; y < _mapJson.GetLength(1); y++)
        //        {
        //            map.Maps[x,y] = JsonConvert.DeserializeObject<Box>(_mapJson[x,y]);
        //        }
        //    }
        //    map.UpdateMap();
        //    break;
        case StreamDataType.Players:
            Dictionary <int, string> _plysJson = (Dictionary <int, string>)JsonConvert.DeserializeObject(_dataJson, typeof(Dictionary <int, string>));
            allPlayer.Clear();
            foreach (KeyValuePair <int, string> _v in _plysJson)
            {
                allPlayer.Add(_v.Key, JsonConvert.DeserializeObject <Client>(_v.Value));
                //allPlayer[_v.Key].GetPly().powerUps = (Dictionary<PowerUps, int>)JsonConvert.DeserializeObject(allPlayer[_v.Key].GetPly().powerUpsJson, typeof(Dictionary<PowerUps, int>));
            }
            scoreTable.InitialazePlayerTable();
            break;

        case StreamDataType.Room:
            roomInfo = (RoomInfoClass)JsonConvert.DeserializeObject(_dataJson, typeof(RoomInfoClass));
            break;
        }
    }
Example #3
0
 public void ClearDataRoom()
 {
     RoomManagerCom = this;
     roominfo       = new RoomInfoClass();
     ClearScene(roundInfo.none);
     Debug.Log("<color=red> Room's Data was clear </color>");
 }
Example #4
0
        public Rooms(Generic basecmd)
            : base(basecmd)
        {
            RoomInformation = new List <RoomInfoClass>();

            byte seg = (byte)(GetAddressGeneric() >> 24);

            for (int i = 0; i < GetCountGeneric(); i++)
            {
                RoomInfoClass roomadr = new RoomInfoClass(ROM, basecmd.Parent, i,
                                                          Endian.SwapUInt32(BitConverter.ToUInt32(((byte[])ROM.SegmentMapping[seg]), (int)((GetAddressGeneric() & 0xFFFFFF) + i * 8))),
                                                          Endian.SwapUInt32(BitConverter.ToUInt32(((byte[])ROM.SegmentMapping[seg]), (int)((GetAddressGeneric() & 0xFFFFFF) + i * 8) + 4)));
                RoomInformation.Add(roomadr);
            }
        }
Example #5
0
        public Rooms(Generic basecmd)
            : base(basecmd)
        {
            RoomInformation = new List<RoomInfoClass>();

            byte seg = (byte)(GetAddressGeneric() >> 24);

            for (int i = 0; i < GetCountGeneric(); i++)
            {
                RoomInfoClass roomadr = new RoomInfoClass(ROM, basecmd.Parent, i,
                    Endian.SwapUInt32(BitConverter.ToUInt32(((byte[])ROM.SegmentMapping[seg]), (int)((GetAddressGeneric() & 0xFFFFFF) + i * 8))),
                    Endian.SwapUInt32(BitConverter.ToUInt32(((byte[])ROM.SegmentMapping[seg]), (int)((GetAddressGeneric() & 0xFFFFFF) + i * 8) + 4)));
                RoomInformation.Add(roomadr);
            }
        }