Пример #1
0
        public static Room WithReturnLink(roomType type, Room linkage)
        {
            Room room = Type(type, linkage.Area);

            Build.LinkTwoRooms(room, linkage);
            return(room);
        }
Пример #2
0
    private void SetRoomTypes()
    {
        bool hasTresureRoom = false;
        bool hasBossRoom    = false;

        foreach (GameObject r in allRooms)
        {
            Room     scriptRoom = r.GetComponent <Room>();
            roomType curType    = scriptRoom.type;

            //Is an edge room
            if (curType == roomType.u || curType == roomType.d || curType == roomType.l ||
                curType == roomType.r)
            {
                edgeRooms.Add(r);
            }
        }

        int     rand    = Random.Range(0, edgeRooms.Count);
        Vector2 roomPos = edgeRooms[rand].transform.position;

        edgeRooms[rand].name = "Treasure Room";
        edgeRooms[rand].GetComponent <Room>().treasureRoom(roomPos);
        int rand2 = rand;

        while (rand2 == rand)
        {
            rand2 = Random.Range(0, edgeRooms.Count);
        }
        edgeRooms[rand2].name = "Boss Room";
    }
 public void openR()
 {
     DefaultRoom();
     RightWallReplace();
     directions = 1;
     right      = true;
     type       = roomType.r;
 }
 public void openL()
 {
     DefaultRoom();
     LeftWallReplace();
     directions = 1;
     left       = true;
     type       = roomType.l;
 }
 public void openD()
 {
     DefaultRoom();
     DownWallReplace();
     directions = 1;
     down       = true;
     type       = roomType.d;
 }
 public void openU()
 {
     DefaultRoom();
     UpWallReplace();
     directions = 1;
     up         = true;
     type       = roomType.u;
 }
Пример #7
0
 public Room(int width, int heigth, GameObject[] roomPrefabList, roomType type)
 {
     this.width          = width;
     this.heigth         = heigth;
     this.roomPrefabList = roomPrefabList;
     tiles              = new GameObject[width, heigth];
     myType             = type;
     capacidadTotalRoom = (int)(width * heigth) / 2;
 }
Пример #8
0
        //更新编辑的数据行
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            hotelRoom hr = new hotelRoom(); //酒店客房信息对象
            roomType  t  = new roomType();  //客房类型对象

            GridViewRow row = this.GridView1.Rows[e.RowIndex];

            hr.Rid = e.Keys[0].ToString().Trim();                                                               //酒店客房编号
            hr.Hid = HotelId.Text.Trim();                                                                       //酒店编号

            if (UpdateRoomImg.Value == "")                                                                      //如果没有更改酒店客房图片
            {
                hr.RimageUrl = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text.ToString(); //原先的客房图片
            }
            else
            {
                hr.RimageUrl = UpdateRoomImg.Value.Trim();                                                    //上传的本地图片url
            }
            string oldType = room.searchHotelRoomType(hr.Rid);                                                //修改前的该酒店的客房类型名称
            bool   flag    = false;                                                                           //标志要修改成的客房类型是否存在
            string type    = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text.ToString(); //客房类型

            if (!room.TypeisExisted(type))                                                                    //如果要修改成的客房类型不存在
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('该客房类型不存在,请先去客房类型管理页面添加!');</script>");
                ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text = oldType;//还原原先客房类型
            }
            else//如果要修改成的客房类型存在
            {
                for (int i = 0; i < GridView1.Rows.Count; i++)
                {
                    //要修改成的酒店的该客房类型已存在
                    if (((TextBox)this.GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text.ToString() == GridView1.Rows[i].Cells[3].Text && i != e.RowIndex)
                    {
                        flag = true;                                                                    //要修改的客房类型存在
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('该客房类型已存在,请直接在它的数据行修改!');</script>");
                        ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text = oldType; //还原原先客房类型
                    }
                }
                if (!flag)                                                                              //要修改成的酒店的该客房类型不存在
                {
                    hr.Tid        = room.searchRoomTypeId(type);                                        //根据客房类型查到的客房类型编号
                    hr.Rprice     = Double.Parse(((TextBox)row.Cells[10].Controls[0]).Text.ToString()); //每晚价格
                    hr.Rnumber    = Int32.Parse(((TextBox)row.Cells[11].Controls[0]).Text.ToString());  //总数量
                    hr.Rremark    = ((TextBox)row.Cells[12].Controls[0]).Text.ToString();               //酒店客房备注
                    hr.RvacantNum = Int32.Parse(((TextBox)row.Cells[13].Controls[0]).Text.ToString());  //当前空房数

                    if (room.updateHotelRoomInfo(hr, hr.Rid))                                           //执行修改的方法成功
                    {
                        this.GridView1.EditIndex = -1;                                                  //取消编辑状态
                        RoomImgLabel.Style.Add("display", "none");                                      //标签不可见
                        UpdateRoomImg.Attributes.Add("disabled", "disabled");                           //文件上传控件禁用
                        InitGridView();                                                                 //重新加载一次数据
                    }
                }
            }
        }
 public void openUD()
 {
     DefaultRoom();
     UpWallReplace();
     DownWallReplace();
     directions = 2;
     up         = true;
     down       = true;
     type       = roomType.ud;
 }
 public void openLR()
 {
     DefaultRoom();
     LeftWallReplace();
     RightWallReplace();
     directions = 2;
     left       = true;
     right      = true;
     type       = roomType.lr;
 }
Пример #11
0
    public void SetupRoom(byte number, byte roomWidth, byte roomHeight, Vector2 startPosition, roomType type, int RoomMaxWidth, int RoomMaxHeight)
    {
        start = new Vector2(startPosition.x - 1, startPosition.y - 1);
        end   = new Vector2(startPosition.x + RoomMaxWidth, startPosition.y + RoomMaxHeight);

        roomType       = type;
        enemiesToSpawn = UnityEngine.Random.Range(GameManager.instance.generator.minEnemies, GameManager.instance.generator.maxEnemies);
        this.number    = number;
        width          = roomWidth;
        height         = roomHeight;
    }
 public void openUDR()
 {
     DefaultRoom();
     UpWallReplace();
     DownWallReplace();
     RightWallReplace();
     directions = 3;
     up         = true;
     down       = true;
     right      = true;
     type       = roomType.udr;
 }
 public void openUDL()
 {
     DefaultRoom();
     UpWallReplace();
     DownWallReplace();
     LeftWallReplace();
     directions = 3;
     up         = true;
     down       = true;
     left       = true;
     type       = roomType.udl;
 }
Пример #14
0
        public static Room Type(roomType type, Area area)
        {
            Room room = new Room(area);

            switch (type)
            {
            case roomType.road:
                room.roomType = roomType.road;     // set up possible speed limits, healing rates, leveling restrictions...
                break;

            case roomType.path:
                room.roomType = roomType.path;
                break;

            case roomType.street:
                room.roomType = roomType.street;
                break;

            case roomType.healing:
                room.roomType = roomType.healing;
                break;

            case roomType.home:
                room.roomType = roomType.home;
                break;

            case roomType.leveling:
                room.roomType = roomType.leveling;
                break;

            case roomType.pawn:
                room.roomType = roomType.pawn;
                break;

            case roomType.shop:
                room.roomType = roomType.shop;
                break;

            case roomType.sewer:
                room.roomType = roomType.sewer;
                break;

            case roomType.vault:
                room.roomType = roomType.vault;
                break;

            default:
                room.roomType = roomType.none;
                break;
            }
            return(room);
        }
Пример #15
0
 public roomType getPlayerInRoomWith(int givenRoom)
 {
     if ((givenRoom == pitRooms[0]) || (givenRoom == pitRooms[1]))
     {
         PlayerInRoomWith = roomType.pit;
     }
     else if ((givenRoom == batRooms[0]) || (givenRoom == batRooms[1]))
     {
         PlayerInRoomWith = roomType.bat;
     }
     else if (givenRoom == wumpusRoomInt)
     {
         PlayerInRoomWith = roomType.wumpus;
     }
     else
     {
         PlayerInRoomWith = roomType.none;
     }
     return(PlayerInRoomWith);
 }
Пример #16
0
 public static Room Type(roomType type, Area area)
 {
     Room room = new Room(area);
     switch (type) {
         case roomType.road:
             room.roomType = roomType.road; // set up possible speed limits, healing rates, leveling restrictions...
             break;
         case roomType.path:
             room.roomType = roomType.path;
             break;
         case roomType.street:
             room.roomType = roomType.street;
             break;
         case roomType.healing:
             room.roomType = roomType.healing;
             break;
         case roomType.home:
             room.roomType = roomType.home;
             break;
         case roomType.leveling:
             room.roomType = roomType.leveling;
             break;
         case roomType.pawn:
             room.roomType = roomType.pawn;
             break;
         case roomType.shop:
             room.roomType = roomType.shop;
             break;
         case roomType.sewer:
             room.roomType = roomType.sewer;
             break;
         case roomType.vault:
             room.roomType = roomType.vault;
             break;
         default:
             room.roomType = roomType.none;
             break;
     }
     return room;
 }
Пример #17
0
        //更新编辑的数据行
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            roomType    t   = new roomType();//客房类型对象
            GridViewRow row = this.GridView1.Rows[e.RowIndex];

            t.Tid = e.Keys[0].ToString().Trim();         //编号

            string oldType = type.searchRoomType(t.Tid); //修改前的客房类型名称
            bool   flag    = false;                      //标志要修改成的客房类型在不在

            t.Ttype            = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text.ToString();
            t.TbedNum          = Int32.Parse(((TextBox)this.GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text.ToString());
            t.TairConditioning = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text.ToString();
            t.Ttelevision      = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text.ToString();
            t.ThairDrier       = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[5].Controls[0]).Text.ToString();
            t.Tlandline        = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[6].Controls[0]).Text.ToString();
            t.Twifi            = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[7].Controls[0]).Text.ToString();
            t.Tremark          = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[8].Controls[0]).Text.ToString();

            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                if (((TextBox)this.GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text.ToString() == GridView1.Rows[i].Cells[1].Text && i != e.RowIndex) //要修改成的客房类型已存在
                {
                    flag = true;                                                                                                                           //要修改的客房类型存在
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('该客房类型已存在,请直接在它的数据行修改!');</script>");
                    ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text = oldType;                                                        //还原原先客房类型
                }
            }
            if (!flag)                             //要修改的客房类型不存在
            {
                if (type.updateRoomType(t, t.Tid)) //执行修改的方法成功
                {
                    this.GridView1.EditIndex = -1; //取消编辑状态
                    InitGridView();                //重新加载一次数据
                }
            }
        }
Пример #18
0
 public roomType getPlayerInRoomWith(int givenRoom)
 {
     if ((givenRoom == pitRooms[0]) || (givenRoom == pitRooms[1]))
     {
         PlayerInRoomWith = roomType.pit;
     }
     else if ((givenRoom == batRooms[0]) || (givenRoom == batRooms[1]))
     {
         PlayerInRoomWith = roomType.bat;
     }
     else if (givenRoom == wumpusRoomInt)
     {
         PlayerInRoomWith = roomType.wumpus;
     }
     else
     {
         PlayerInRoomWith = roomType.none;
     }
     return PlayerInRoomWith;
 }
Пример #19
0
 public Room(Vector2 _gridPos, roomType _type)
 {
     gridPos = _gridPos;
     type    = _type;
 }
    private void TryCreateRoom(byte number, int prevRoomIndex, byte width, byte height, Direction4D direction, roomType type)
    {
        Room prevRoom = Map.roomObjs[prevRoomIndex].GetComponent <Room>();

        MoveRoomGenerator(prevRoom, direction);  //Сдвигаем в начало новой комнаты

        Vector2 roomstartpos = new Vector2(transform.position.x, transform.position.y);
        Vector2 roomendpos   = new Vector2(transform.position.x + RoomMaxWidth, transform.position.y + RoomMaxHeight);

        bool fixDir = Check_All_Superimpose(roomstartpos, roomendpos);

        //FixDir == true => комнаты пересекаются

        for (int k = 1; k <= 4; k++)
        {
            if (fixDir == true)
            {
                direction = Increase_direction(direction);  //Меняем направление

                prevRoom = Map.roomObjs[prevRoomIndex].GetComponent <Room>();
                MoveRoomGenerator(prevRoom, direction);  //Двигаем в начало следующей комнаты

                roomstartpos = new Vector2(transform.position.x, transform.position.y);
                roomendpos   = new Vector2(transform.position.x + RoomMaxWidth, transform.position.y + RoomMaxHeight);

                fixDir = Check_All_Superimpose(roomstartpos, roomendpos);

                if (fixDir == false)
                {
                    break;
                }

                if (k == 4) // Разветвление если не подошло 4 направления
                {
                    prevRoomIndex -= 1;
                    if (prevRoomIndex == 1)
                    {
                        Debug.Log("GGGGG");
                        return;  //Если дошло до ласт комнаты то GG
                    }
                    prevRoom = Map.roomObjs[prevRoomIndex].GetComponent <Room>();
                    k        = 1;
                }
            }
        }

        GenerateRoom(number, prevRoom, width, height, direction, type);
    }
    void GenerateRoom(byte number, Room prevRoom, byte width, byte height, Direction4D dir, roomType type)      //Дверь входящая в комнату
    {
        GameObject roomObj;

        switch (type)
        {
        case roomType.playerStart:
        {
            roomObj = new GameObject
            {
                name = "Start Room " + number,
                tag  = "Room"
            };
            break;
        }

        case roomType.common:
        {
            roomObj = new GameObject
            {
                name = "Room " + number,
                tag  = "Room"
            };
            break;
        }

        case roomType.shop:
        {
            roomObj = new GameObject
            {
                name = "Shop " + number,
                tag  = "Shop"
            };
            break;
        }

        case roomType.last:
        {
            roomObj = new GameObject
            {
                name = "Last Room",
                tag  = "Room"
            };
            break;
        }

        case roomType.secret:
        {
            roomObj = new GameObject
            {
                name = "Secret Room " + number,
                tag  = "Room"
            };
            break;
        }

        case roomType.nextlevel:
        {
            roomObj = new GameObject
            {
                name = "Next Level Room " + number,
                tag  = "Room"
            };
            break;
        }

        default:
        {
            roomObj = new GameObject
            {
                name = "Room " + number,
                tag  = "Room"
            };
            break;
        }
        }

        Room room = roomObj.AddComponent <Room>();

        Map.roomObjs.Add(room);

        room.SetupRoom(number, width, height, transform.position, prevRoom, type, RoomMaxWidth, RoomMaxHeight);  //room count - roombehind
        room.SetupCorridor(DoorInvert(dir), minCorridorLength, randomGenerator);                                 //Обычно count-1 - пред.комната
                                                                                                                 //Но иногда приходится идти на несколько комнат назад
        CreateRoom(room);
    }
 public Room(roomType _type, bool _enter, bool _exit)
 {
     type  = _type;
     enter = _enter;
     exit  = _exit;
 }
Пример #23
0
 public static Room WithReturnLink(roomType type, Room linkage)
 {
     Room room = Type(type, linkage.Area);
     Build.LinkTwoRooms(room, linkage);
     return room;
 }
Пример #24
0
        protected void Add_Click(object sender, EventArgs e)
        {
            string id = TypeId.Text.Trim(); //客房类型编号

            if (id == "")                   //客房类型编号为空时
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('请输入客房类型编号!');</script>");
            }
            else if (BedNumber.Text == "")//床位数为空时
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('请输入床位数!');</script>");
            }
            else
            {
                string name   = TypeName.Text.Trim();               //客房类型
                int    bedNum = Int32.Parse(BedNumber.Text.Trim()); //床位数
                string remark = Remark.Value;                       //备注信息

                string[] condition = new string[5];;                //房间配置的有无
                int      i         = 0;
                //遍历所有控件
                foreach (Control ct in form1.Controls)
                {
                    //如果为复选框
                    if (ct.GetType().ToString().Equals("System.Web.UI.WebControls.CheckBox"))
                    {
                        CheckBox cb = (CheckBox)ct;
                        if (cb.Checked == true)
                        {
                            condition[i] = "有";
                        }
                        else
                        {
                            condition[i] = "无";
                        }
                        i++;
                    }
                }

                if (bedNum < 0)//床位数小于0时
                {
                    Response.Write("<script>alert('请输入不小于0的床位数!');</script>");
                }
                else
                {
                    roomType t = new roomType();//客房类型对象
                    //客房类型编号
                    t.Tid = id;
                    //客房类型名称
                    t.Ttype = name;
                    //客房床位数
                    t.TbedNum = bedNum;
                    //空调有无
                    t.TairConditioning = condition[0];
                    //电视机有无
                    t.Ttelevision = condition[1];
                    //电吹风有无
                    t.ThairDrier = condition[2];
                    //座机电话有无
                    t.Tlandline = condition[3];
                    //无线网络有无
                    t.Twifi = condition[4];
                    //备注
                    t.Tremark = remark;

                    if (type.IdisAdded(id))//如果客房类型编号已存在
                    //type.updateRoomType(t, id);//修改记录
                    {
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('该客房类型已存在!');</script>");
                    }
                    else if (type.TypeisAdded(name))//如果客房类型名已存在
                    {
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('该客房类型已存在!');</script>");
                    }
                    else
                    {
                        type.addRoomType(t);//向客房类型信息表插入一条新记录
                        //Response.Write("<script>alert('添加成功!');</script>");
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('添加成功!');</script>");

                        //清空文本框
                        TypeId.Text    = "";
                        TypeName.Text  = "";
                        BedNumber.Text = "";
                        Remark.Value   = "";
                        //遍历所有控件
                        foreach (Control ct in form1.Controls)
                        {
                            //如果为复选框
                            if (ct.GetType().ToString().Equals("System.Web.UI.WebControls.CheckBox"))
                            {
                                CheckBox cb = (CheckBox)ct;
                                cb.Checked = false;//取消选中
                            }
                        }

                        InitGridView();//重新加载表格数据
                    }
                }
            }
        }