Ejemplo n.º 1
0
    /// <summary>
    /// 初始化地板
    /// </summary>
    public void InitFloor(List <InnResBean> listFloor, int layer)
    {
        if (listFloor == null)
        {
            listFloor = new List <InnResBean>();
        }
        GetInnSize(layer, out int innInitWidth, out int innInitHeight, out int offsetH);

        for (int i = 0; i < innInitWidth; i++)
        {
            for (int f = 0; f < innInitHeight; f++)
            {
                bool hasFloor = false;
                foreach (InnResBean innItem in listFloor)
                {
                    //如果已经有这个点的地板
                    if (innItem.startPosition.x == i && innItem.startPosition.y == f + offsetH)
                    {
                        hasFloor = true;
                        break;
                    }
                }
                if (!hasFloor)
                {
                    InnResBean itemData = new InnResBean(10001, new Vector3(i, f + offsetH), null, Direction2DEnum.Left);
                    listFloor.Add(itemData);
                }
            }
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 修建地板
    /// </summary>
    /// <param name="itemData"></param>
    public void BuildFloor(InnResBean itemData)
    {
        if (itemData == null)
        {
            return;
        }
        BuildItemBean buildItemData = InnBuildHandler.Instance.manager.GetBuildDataById(itemData.id);
        TileBase      floorTile     = InnBuildHandler.Instance.manager.GetFloorTileByName(buildItemData.tile_name);

        Build(buildTilemap, floorTile, new Vector3Int((int)itemData.startPosition.x, (int)itemData.startPosition.y, 0));
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 增加家具
    /// </summary>
    /// <param name="innRes"></param>
    public void AddFurniture(int layer, InnResBean innRes)
    {
        if (innRes == null)
        {
            return;
        }
        List <InnResBean> listData = GetFurnitureList(layer);

        if (listData == null)
        {
            listData = new List <InnResBean>();
        }
        listData.Add(innRes);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 修建建筑
    /// </summary>
    /// <param name="furnitureData"></param>
    /// <returns></returns>
    public GameObject BuildFurniture(InnResBean furnitureData, BuildBedBean buildBedData)
    {
        if (furnitureData == null)
        {
            return(null);
        }
        GameObject buildItemObj = InnBuildHandler.Instance.manager.GetFurnitureObjById(furnitureData, buildContainer.transform, buildBedData);

        buildItemObj.transform.position = TypeConversionUtil.Vector3BeanToVector3(furnitureData.startPosition);
        BaseBuildItemCpt buildItemCpt = buildItemObj.GetComponent <BaseBuildItemCpt>();

        buildItemCpt.SetDirection(furnitureData.direction);
        return(buildItemObj);
    }
Ejemplo n.º 5
0
 /// <summary>
 /// 开始修建墙壁
 /// </summary>
 /// <param name="listData"></param>
 public void BuildWall(List <InnResBean> listData)
 {
     if (listData == null)
     {
         return;
     }
     for (int i = 0; i < listData.Count; i++)
     {
         InnResBean    itemData      = listData[i];
         BuildItemBean buildItemData = InnBuildHandler.Instance.manager.GetBuildDataById(itemData.id);
         TileBase      wallTile      = InnBuildHandler.Instance.manager.GetWallTileByName(buildItemData.tile_name);
         Build(buildTilemap, wallTile, new Vector3Int((int)itemData.startPosition.x, (int)itemData.startPosition.y, 0));
     }
 }
Ejemplo n.º 6
0
    /// <summary>
    /// 获取门
    /// </summary>
    /// <returns></returns>
    public List <InnResBean> GetDoorList()
    {
        List <InnResBean> doorList = new List <InnResBean>();
        List <InnResBean> allData  = GetFurnitureList(1);

        for (int i = 0; i < allData.Count; i++)
        {
            InnResBean    itemData      = allData[i];
            BuildItemBean buildItemData = InnBuildHandler.Instance.manager.GetBuildDataById(itemData.id);
            if (buildItemData.build_type == (int)BuildItemTypeEnum.Door)
            {
                doorList.Add(itemData);
            }
        }
        return(doorList);
    }
Ejemplo n.º 7
0
    /// <summary>
    /// 建造墙壁
    /// </summary>
    /// <param name="buildPosition"></param>
    protected void BuildItemForWall(Vector3 buildPosition)
    {
        if (buildItemCpt == null)
        {
            return;
        }
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        //tile坐标需要从左下角计算 所以需要x-1
        buildPosition -= new Vector3(1, 0, 0);
        //获取该点地板数据
        InnResBean wallData       = gameData.GetInnBuildData().GetWallByPosition(buildLayer, buildPosition);
        Vector3Int changePosition = Vector3Int.zero;

        //如果没有墙壁则直接在建造点上建造
        if (wallData == null)
        {
            changePosition = Vector3Int.RoundToInt(buildPosition);
            wallData       = new InnResBean(buildItemCpt.buildItemData.id, changePosition, null, Direction2DEnum.Left);
            gameData.GetInnBuildData().GetWallList(buildLayer).Add(wallData);
        }
        //如果有墙壁则替换墙壁
        else
        {
            //背包里添加一个
            gameData.AddBuildNumber(wallData.id, 1);
            changePosition = Vector3Int.RoundToInt(wallData.GetStartPosition());
            wallData.id    = buildItemCpt.buildItemData.id;
        }
        InnBuildHandler.Instance.builderForWall.ChangeWall(changePosition, buildItemCpt.buildItemData.tile_name);
        //背包里删除一个
        ItemBean itemData = gameData.AddBuildNumber(buildItemCpt.buildItemData.id, -1);

        //如果没有了,则不能继续建造
        if (itemData.itemNumber <= 0)
        {
            ClearBuildItem();
        }
    }
Ejemplo n.º 8
0
 protected void BuildListFurniture(List <InnResBean> listData)
 {
     for (int i = 0; i < listData.Count; i++)
     {
         InnResBean itemData = listData[i];
         if (CheckUtil.StringIsNull(itemData.remarkId))
         {
             BuildFurniture(itemData, null);
         }
         else
         {
             //如果有备注ID说明是床或者其他建筑
             //是床
             BuildBedBean tempBuildBedData = null;
             //bool hasData = false;
             GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();
             for (int f = 0; f < gameData.listBed.Count; f++)
             {
                 BuildBedBean buildBedData = gameData.listBed[f];
                 if (buildBedData != null && buildBedData.remarkId.Equals(itemData.remarkId))
                 {
                     tempBuildBedData = buildBedData;
                     //hasData = true;
                     break;
                 }
             }
             BuildFurniture(itemData, tempBuildBedData);
             //如果没有找到数据则删除这个建筑
             //if (!hasData)
             //{
             //    listData.Remove(itemData);
             //    i--;
             //}
         }
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 初始化墙壁
 /// </summary>
 public void InitWall(List <InnResBean> listWall, int layer, List <InnResBean> listDoor)
 {
     GetInnSize(layer, out int innInitWidth, out int innInitHeight, out int offsetH);
     //建造墙壁
     for (int i = 0; i < innInitWidth; i++)
     {
         for (int f = 0; f < innInitWidth; f++)
         {
             bool isBuild = false;
             if (i == 0 || i == innInitWidth - 1)
             {
                 isBuild = true;
             }
             else
             {
                 if (f == 0 || f == innInitHeight - 1)
                 {
                     isBuild = true;
                 }
             }
             if (isBuild)
             {
                 bool hasData = false;
                 foreach (InnResBean itemWall in listWall)
                 {
                     Vector3 startPosition = itemWall.GetStartPosition();
                     if (startPosition.x == i && startPosition.y == f + offsetH)
                     {
                         hasData = true;
                         break;
                     }
                 }
                 if (!hasData)
                 {
                     InnResBean itemData = new InnResBean();
                     itemData.startPosition = new Vector3Bean(i, f + offsetH);
                     itemData.id            = 20001;
                     listWall.Add(itemData);
                 }
             }
         }
     }
     if (listDoor != null)
     {
         ///移除门所占墙壁
         for (int i = 0; i < listDoor.Count; i++)
         {
             InnResBean itemData = listDoor[i];
             for (int f = 0; f < itemData.listPosition.Count; f++)
             {
                 Vector3Bean doorPositon = itemData.listPosition[f];
                 for (int h = 0; h < listWall.Count; h++)
                 {
                     Vector3Bean wallPostion = listWall[h].startPosition;
                     if (doorPositon.x == wallPostion.x + 1 && doorPositon.y == wallPostion.y)
                     {
                         listWall.Remove(listWall[h]);
                         h--;
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 10
0
    /// <summary>
    /// 建造家具
    /// </summary>
    /// <param name="listBuildPosition"></param>
    protected void BuildItemForFurniture(List <Vector3> listBuildPosition)
    {
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        //将家具添加到家具容器中
        buildItemCpt.transform.parent = InnBuildHandler.Instance.builderForFurniture.buildContainer.transform;
        //增加一个家具
        InnResBean addData = new InnResBean(buildItemCpt.buildItemData.id, buildItemCpt.transform.position, listBuildPosition, buildItemCpt.direction);

        //如果是门。需要重置一下墙体
        if (buildItemCpt.buildItemData.build_type == (int)BuildItemTypeEnum.Door)
        {
            //gameData.GetInnBuildData().InitWall(innBuildManager);
            //innWallBuilder.StartBuild();
        }
        else if (buildItemCpt.buildItemData.build_type == (int)BuildItemTypeEnum.Bed)
        {
            //如果是床。需要加上备注ID
            BuildBedCpt buildBedCpt = (BuildBedCpt)buildItemCpt;
            buildBedCpt.buildBedData.isSet = true;
            addData.remarkId = buildBedCpt.buildBedData.remarkId;
        }
        else if (buildItemCpt.buildItemData.build_type == (int)BuildItemTypeEnum.Stairs)
        {
            BuildStairsCpt buildStairsCpt = (BuildStairsCpt)buildItemCpt;
            //所有坐标下移
            List <Vector3> listFirstBuildPosition = new List <Vector3>();
            foreach (Vector3 itemPosition in listBuildPosition)
            {
                Vector3 firstPostion = itemPosition + new Vector3(0, -100, 0);
                listFirstBuildPosition.Add(firstPostion);
                //删除当前坐标下的建筑
                BuildItemForDismantle(buildLayer - 1, firstPostion, firstPostion);
            }

            //楼下也要添加同样的数据
            GameObject objFirstStairs = Instantiate(InnBuildHandler.Instance.builderForFurniture.buildContainer, buildItemCpt.gameObject);
            objFirstStairs.transform.position += new Vector3(0, -100, 0);
            BuildStairsCpt firstStairs = objFirstStairs.GetComponent <BuildStairsCpt>();
            firstStairs.SetLayer(buildLayer - 1);
            InnResBean addFirstData = new InnResBean(firstStairs.buildItemData.id, objFirstStairs.transform.position, listFirstBuildPosition, firstStairs.direction);
            //设置相同的备注ID
            addData.remarkId      = SystemUtil.GetUUID(SystemUtil.UUIDTypeEnum.N);
            addData.remark        = "2";
            addFirstData.remarkId = addData.remarkId;
            addFirstData.remark   = "1";
            gameData.GetInnBuildData().AddFurniture(buildLayer - 1, addFirstData);
            firstStairs.SetRemarkId(addData.remarkId);
            buildStairsCpt.SetRemarkId(addData.remarkId);
        }
        gameData.GetInnBuildData().AddFurniture(buildLayer, addData);
        //背包里删除一个
        ItemBean itemData = gameData.AddBuildNumber(buildItemCpt.buildItemData.id, -1);

        //动画
        buildItemCpt.transform
        .DOScale(new Vector3(0.2f, 0.2f, 0.2f), 0.5f)
        .From()
        .SetEase(Ease.OutBack);

        if (buildItemCpt.buildItemData.build_type == (int)BuildItemTypeEnum.Bed || itemData.itemNumber <= 0)
        {
            //如果没有了,则不能继续建造
            ClearSelectBuildItem();
        }
        else
        {
            //如果还有则实例化一个新的
            //物体先在建筑控件上显示
            GameObject objCopy = Instantiate(GameControlHandler.Instance.gameObject, buildItemCpt.gameObject);
            objCopy.transform.localScale = new Vector3(1, 1, 1);
            buildItemCpt = objCopy.GetComponent <BaseBuildItemCpt>();
        }
    }
Ejemplo n.º 11
0
    /// <summary>
    /// 拆除
    /// </summary>
    /// <param name="buildPosition">家具的位置</param>
    /// <param name="sceneFurniturePosition">家具在场景中的位置</param>
    protected void BuildItemForDismantle(int dismantleLayer, Vector3 buildPosition, Vector3 sceneFurniturePosition)
    {
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();
        //获取拆除位置的家具数据
        InnBuildBean buildData         = gameData.GetInnBuildData();
        InnResBean   itemFurnitureData = buildData.GetFurnitureByPosition(dismantleLayer, buildPosition);
        //因为在保存tile时坐标减过1 所以查询是也要-1
        InnResBean itemWallData = buildData.GetWallByPosition(dismantleLayer, buildPosition - new Vector3(1, 0, 0));

        //如果拆除的是家具
        if (itemFurnitureData != null)
        {
            BuildItemBean buildItemData = InnBuildHandler.Instance.manager.GetBuildDataById(itemFurnitureData.id);
            //如果是最后一扇门则不能删除
            if (buildItemData.build_type == (int)BuildItemTypeEnum.Door && buildData.GetDoorList().Count <= 1)
            {
                //只有一次点击时才出提示
                if (Input.GetButtonDown(InputInfo.Confirm))
                {
                    ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1004));
                }
            }
            else
            {
                //移除数据
                buildData.GetFurnitureList(dismantleLayer).Remove(itemFurnitureData);
                //移除场景中的建筑物
                InnBuildHandler.Instance.builderForFurniture.DestroyFurnitureByPosition(sceneFurniturePosition);
                if (buildItemData.build_type == (int)BuildItemTypeEnum.Bed)
                {
                    //如果是床
                    BuildBedBean buildBedData = gameData.GetBedByRemarkId(itemFurnitureData.remarkId);
                    buildBedData.isSet = false;
                }
                else if (buildItemData.build_type == (int)BuildItemTypeEnum.Stairs)
                {
                    //背包里添加一个
                    gameData.AddBuildNumber(itemFurnitureData.id, 1);
                    InnResBean itemStarisData = null;
                    if (dismantleLayer == 1)
                    {
                        itemStarisData = buildData.GetFurnitureByPosition(2, buildPosition + new Vector3(0, 100));
                        buildData.GetFurnitureList(2).Remove(itemStarisData);
                        //移除场景中的建筑物
                        InnBuildHandler.Instance.builderForFurniture.DestroyFurnitureByPosition(sceneFurniturePosition + new Vector3(0, 100));
                    }
                    else if (dismantleLayer == 2)
                    {
                        itemStarisData = buildData.GetFurnitureByPosition(1, buildPosition - new Vector3(0, 100));
                        buildData.GetFurnitureList(1).Remove(itemStarisData);
                        //移除场景中的建筑物
                        InnBuildHandler.Instance.builderForFurniture.DestroyFurnitureByPosition(sceneFurniturePosition - new Vector3(0, 100));
                    }
                }
                else
                {
                    //背包里添加一个
                    gameData.AddBuildNumber(itemFurnitureData.id, 1);
                }
            }
        }
        //如果拆除的是墙壁
        if (itemWallData != null)
        {
            //判断是否是最外的墙壁
            Vector3 startPosition = itemWallData.GetStartPosition();
            gameData.GetInnBuildData().GetInnSize(buildLayer, out int innWidth, out int innHeight, out int offsetHeight);
            bool isOutWall = false;
            if (buildLayer == 1)
            {
                isOutWall = (startPosition.x == 0 || startPosition.x == (innWidth - 1)) || startPosition.y == (innHeight - 1) + offsetHeight;
            }
            else if (buildLayer == 2)
            {
                isOutWall = (startPosition.x == 0 || startPosition.x == (innWidth - 1)) || startPosition.y == 0 + offsetHeight || startPosition.y == (innHeight - 1) + offsetHeight;
            }
            if (isOutWall)
            {
                //只有一次点击时才出提示
                if (Input.GetButtonDown(InputInfo.Confirm))
                {
                    ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(1023));
                }
            }
            else
            {
                //移除数据
                buildData.GetWallList(buildLayer).Remove(itemWallData);
                //移除场景中的建筑物
                InnBuildHandler.Instance.builderForWall.ClearWall(Vector3Int.RoundToInt(startPosition));
                //背包里添加一个
                gameData.AddBuildNumber(itemWallData.id, 1);
            }
        }
        //更新一下数据
        InitBuildingExist();
    }
Ejemplo n.º 12
0
    /// <summary>
    /// 通过ID获取家具Obj
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public GameObject GetFurnitureObjById(InnResBean furnitureData, Transform tfFather, BuildBedBean buildBedData)
    {
        BuildItemBean    buildItemData     = GetBuildDataById(furnitureData.id);
        GameObject       furnitureObjModel = GetModel(dicFurnitureCpt, "model/furniture", buildItemData.model_name);
        GameObject       furnitureObj      = Instantiate(tfFather.gameObject, furnitureObjModel);
        BaseBuildItemCpt buildItemCpt      = furnitureObj.GetComponent <BaseBuildItemCpt>();
        List <string>    listIcon          = buildItemData.GetIconList();

        switch ((BuildItemTypeEnum)buildItemData.build_type)
        {
        case BuildItemTypeEnum.Counter:
            BuildCounterCpt buildCounter   = (BuildCounterCpt)buildItemCpt;
            Sprite          spLeftCounter  = GetFurnitureSpriteByName(listIcon[0] + "_0");
            Sprite          spRightCounter = GetFurnitureSpriteByName(listIcon[0] + "_1");
            Sprite          spDownCounter  = GetFurnitureSpriteByName(listIcon[0] + "_2");
            Sprite          spUpCounter    = GetFurnitureSpriteByName(listIcon[0] + "_3");
            buildCounter.SetData(buildItemData, spLeftCounter, spRightCounter, spDownCounter, spUpCounter);
            break;

        case BuildItemTypeEnum.Stove:
            BuildStoveCpt buildStove   = (BuildStoveCpt)buildItemCpt;
            Sprite        spLeftStove  = GetFurnitureSpriteByName(listIcon[0] + "_0");
            Sprite        spRightStove = GetFurnitureSpriteByName(listIcon[0] + "_1");
            Sprite        spDownStove  = GetFurnitureSpriteByName(listIcon[0] + "_2");
            Sprite        spUpStove    = GetFurnitureSpriteByName(listIcon[0] + "_3");
            buildStove.SetData(buildItemData, spLeftStove, spRightStove, spDownStove, spUpStove);
            break;

        case BuildItemTypeEnum.Table:
            BuildTableCpt buildTable = (BuildTableCpt)buildItemCpt;

            Sprite spLeftChair  = GetFurnitureSpriteByName(listIcon[1] + "_0");
            Sprite spRightChair = GetFurnitureSpriteByName(listIcon[1] + "_1");
            Sprite spDownChair  = GetFurnitureSpriteByName(listIcon[1] + "_2");
            Sprite spUpChair    = GetFurnitureSpriteByName(listIcon[1] + "_3");

            if (buildItemData.model_name.Equals("Table_1"))
            {
                Sprite spTable = GetFurnitureSpriteByName(listIcon[0]);
                buildTable.SetData(buildItemData, spTable, spLeftChair, spRightChair, spDownChair, spUpChair);
            }
            else if (buildItemData.model_name.Equals("Table_2"))
            {
                Sprite spLeftTable  = GetFurnitureSpriteByName(listIcon[0] + "_0");
                Sprite spRightTable = GetFurnitureSpriteByName(listIcon[0] + "_1");
                Sprite spDownTable  = GetFurnitureSpriteByName(listIcon[0] + "_2");
                Sprite spUpTable    = GetFurnitureSpriteByName(listIcon[0] + "_3");
                buildTable.SetData(buildItemData, spLeftTable, spRightTable, spDownTable, spUpTable, spLeftChair, spRightChair, spDownChair, spUpChair);
            }

            break;

        case BuildItemTypeEnum.Decoration:
            BuildDecorationCpt buildDecoration = (BuildDecorationCpt)buildItemCpt;
            Sprite             spDecoration    = GetFurnitureSpriteByName(buildItemData.icon_key);
            buildDecoration.SetData(buildItemData, spDecoration);
            break;

        case BuildItemTypeEnum.Door:
            BuildDoorCpt buildDoor = (BuildDoorCpt)buildItemCpt;
            Sprite       spDoor    = GetFurnitureSpriteByName(listIcon[0]);
            buildDoor.SetData(buildItemData, spDoor);
            break;

        case BuildItemTypeEnum.Floor:
            BuildFloorCpt buildFloor = (BuildFloorCpt)buildItemCpt;
            Sprite        spFloor    = GetFloorSpriteByName(buildItemData.icon_key);
            buildFloor.SetData(buildItemData, spFloor);
            break;

        case BuildItemTypeEnum.Wall:
            BuildWallCpt buildWall = (BuildWallCpt)buildItemCpt;
            Sprite       spWall    = GetWallSpriteByName(buildItemData.icon_key);
            buildWall.SetData(buildItemData, spWall);
            break;

        case BuildItemTypeEnum.Bed:
            BuildBedCpt buildBed = (BuildBedCpt)buildItemCpt;
            buildBed.SetData(buildItemData, buildBedData);
            break;

        case BuildItemTypeEnum.Stairs:
            BuildStairsCpt buildStairs = (BuildStairsCpt)buildItemCpt;
            buildStairs.SetData(buildItemData);
            buildStairs.SetRemarkId(furnitureData.remarkId);
            if (furnitureData.remark != null && furnitureData.remark.Equals("1"))
            {
                buildStairs.SetLayer(1);
            }
            else
            {
                buildStairs.SetLayer(2);
            }
            break;

        default:
            buildItemCpt.SetData(buildItemData);
            break;
        }
        return(furnitureObj);
    }
Ejemplo n.º 13
0
    /// <summary>
    /// 增加一个用户数据
    /// </summary>
    /// <param name="gameData"></param>
    public void AddGameData(GameDataBean gameData)
    {
        string userId = "UserId_" + SystemUtil.GetUUID(SystemUtil.UUIDTypeEnum.N);

        gameData.userCharacter.baseInfo.characterId = userId;
        gameData.userId              = userId;
        gameData.moneyS              = 3000;
        gameData.moneyM              = 0;
        gameData.moneyL              = 0;
        gameData.innBuildData        = new InnBuildBean();
        gameData.listBuild           = new List <ItemBean>();
        gameData.listItems           = new List <ItemBean>();
        gameData.listWorkerCharacter = new List <CharacterBean>();
        gameData.listMenu            = new List <MenuOwnBean>();

        //添加门
        List <Vector3> doorPositionList = new List <Vector3>();

        doorPositionList.Add(new Vector3(4, 0, 0));
        doorPositionList.Add(new Vector3(5, 0, 0));
        doorPositionList.Add(new Vector3(6, 0, 0));
        InnResBean innResDoor = new InnResBean(90001, new Vector3(4.5f, 0.5f, 0), doorPositionList, Direction2DEnum.Left);
        //添加家具
        List <Vector3> counterPositionList = new List <Vector3>();

        counterPositionList.Add(new Vector3(7, 1, 0));
        counterPositionList.Add(new Vector3(6, 1, 0));
        counterPositionList.Add(new Vector3(7, 2, 0));
        counterPositionList.Add(new Vector3(6, 2, 0));
        counterPositionList.Add(new Vector3(7, 3, 0));
        counterPositionList.Add(new Vector3(6, 3, 0));
        counterPositionList.Add(new Vector3(8, 2, 0));
        InnResBean innResCounter = new InnResBean(50001, new Vector3(6.5f, 2.5f, 0), counterPositionList, Direction2DEnum.Right);

        List <Vector3> stovePositionList = new List <Vector3>();

        stovePositionList.Add(new Vector3(3, 6, 0));
        stovePositionList.Add(new Vector3(4, 6, 0));
        stovePositionList.Add(new Vector3(3, 5, 0));
        stovePositionList.Add(new Vector3(4, 5, 0));
        stovePositionList.Add(new Vector3(3, 4, 0));
        stovePositionList.Add(new Vector3(4, 4, 0));
        stovePositionList.Add(new Vector3(2, 5, 0));
        InnResBean innResStove = new InnResBean(40001, new Vector3(2.5f, 5.5f, 0), stovePositionList, Direction2DEnum.Left);

        List <Vector3> tablePositionList = new List <Vector3>();

        tablePositionList.Add(new Vector3(2, 2, 0));
        tablePositionList.Add(new Vector3(3, 2, 0));
        InnResBean innResTable = new InnResBean(30001, new Vector3(1.5f, 2.5f, 0), tablePositionList, Direction2DEnum.Left);

        gameData.innBuildData.AddFurniture(1, innResDoor);
        gameData.innBuildData.AddFurniture(1, innResCounter);
        gameData.innBuildData.AddFurniture(1, innResStove);
        gameData.innBuildData.AddFurniture(1, innResTable);
        //修改客栈大小
        gameData.innBuildData.ChangeInnSize(1, new List <InnResBean>()
        {
            innResDoor
        }, 9, 9);
        //母亲的信
        gameData.listItems.Add(new ItemBean(1500001, 1));
        //添加家具
        gameData.listBuild.Add(new ItemBean(30001, 2));

        //添加菜单
        gameData.listMenu.Add(new MenuOwnBean(1));
        gameData.listMenu.Add(new MenuOwnBean(2));

        //设置时间
        TimeBean gameTime = new TimeBean();

        gameTime.SetTimeForYMD(221, 1, 0);
        gameData.gameTime = gameTime;

        SetGameDataByUserId(userId, gameData);
    }
Ejemplo n.º 14
0
    /// <summary>
    /// 修建建筑
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public GameObject BuildFurniture(long id, BuildBedBean buildBedData)
    {
        InnResBean innResBean = new InnResBean(id, Vector3.zero, new List <Vector3>(), Direction2DEnum.Left);

        return(BuildFurniture(innResBean, buildBedData));
    }