public void ClearCord() { if (RoomMap.IsCordValid(CurrCord) && RoomMap.Get(CurrCord) == MARK_MOB) { RoomMap.Set(CurrCord, ""); } }
/// <summary> /// 获取未连接的甲板房间 /// </summary> public static List <CanvasCore> GetNoLinkPutDeckRoom() { List <CanvasCore> lNolinkCore = new List <CanvasCore>(); // //获取未连接的节点 List <RoomGrid> lNolink = RoomMap.GetUnLinkDeckRoom(); List <int> lBuild = new List <int>(); foreach (RoomGrid R in lNolink) { if (R != null) { if (lBuild.Contains(R.buildingid) == false) { lBuild.Add(R.buildingid); } } } // foreach (int buildingid in lBuild) { if (buildingid != RoomGrid.EMPTYGRIDID) { lNolinkCore.Add(new CanvasCore(ShipBuildType.BuildRoom, false, buildingid, buildingid, Vector2.zero)); } } return(lNolinkCore); }
void OnDrawGizmos() { if (BattleEnvironmentM.GetBattleEnvironmentMode() == BattleEnvironmentMode.Edit) { List <RoomGrid> list = new List <RoomGrid>(); list = RoomMap.GetAllRoomGrid(); if (list.Count == 0) { return; } foreach (RoomGrid p in list) { p.DrawRoomGridInfo(); } } else { List <MapGrid> lg = new List <MapGrid>(); MapGrid.GetMapGridList(ref lg); foreach (MapGrid m in lg) { DrawMapGrid(m, m.GridPos.Unit); } } //GenerateShip.DrawRejectPolygon (); }
/// <summary> /// 获取移动到目标位置所占领的房间 /// </summary> /// <param name="TargetPos">目的位置</param> public static List <RoomGrid> GetMovetoRoomGrid(CanvasCore core, Int2 TargetPos) { if (core.Data != null) { List <RoomGrid> l = new List <RoomGrid>(); ShapeType shape = core.GetPutRoomShape(); if (shape != null) { Dictionary <Int2, ShapeValue> lshape = shape.GetShapeData(TargetPos); foreach (Int2 Pos in lshape.Keys) { RoomGrid r = RoomMap.FindRoomGrid(Pos, XYSYS.RoomGrid); if (r != null) { l.Add(r); } } } else { RoomGrid r = RoomMap.FindRoomGrid(TargetPos, XYSYS.MapGrid); if (r != null) { l.Add(r); } } return(l); } return(new List <RoomGrid>()); }
/// <summary> /// 加载船上炮弹兵 /// </summary> public static void LoadShipPutSoldier(int ID, int DataID, SoldierInfo Info) { if (Info == null) { return; } Role r = new Role(); r.CreateSkin(GetLifeMBornNode(true), Info.m_modeltype, Info.m_name, AnimatorState.Stand, true); //IGameRole i = GameRoleFactory.Create(GetLifeMBornNode(true), Info.m_modeltype, Info.m_name, AnimatorState.Stand); GameObject go = r.RoleSkinCom.tRoot.gameObject; go.name = Info.m_name; Int2 BornPos = new Int2(Info.CX, Info.CY); go.transform.localPosition = RoomMap.GetShipBuildLocalPos(BornPos, ShipBuildType.Soldier); go.transform.localPosition = U3DUtil.SetZ(go.transform.localPosition, -2.0f); Transform tRole = go.transform.GetChild(0); TouchMove touch = tRole.gameObject.AddComponent <TouchMove>(); CanvasCore Core = new CanvasCore(ShipBuildType.Soldier, false, ID, DataID, Vector2.zero); touch.InitTouchMoveCore(Core, BornPos, null); AddBuildingEditPlugin(touch); if (Info.SoldierTypeID == 100003) //隐藏蹦蹦 //RolePropertyM rpm = i.GetBodyComponent<RolePropertyM>(); { r.RoleSkinCom.ShowLeftHand(false); } TouchMoveManager.JointShipBuild(touch); }
/// <summary> /// 加载船上楼梯 /// </summary> public static void LoadShipPutStairBuild(int ID, int DataID, BuildInfo Info) { if (Info == null) { return; } Transform parentT = GetLifeMBornNode(true); if (parentT == null) { return; } Int2 BornPos = new Int2(Info.m_cx, Info.m_cy); Vector3 local = RoomMap.GetShipBuildLocalPos(BornPos, ShipBuildType.BuildStair); Vector3 world = Local2WorldPos(local); Building buildlife = LifeFactory.CreateBuilding(Info, DataID, parentT, world, LifeEnvironment.Edit); TouchMove touch = buildlife.m_thisT.GetChild(0).gameObject.AddComponent <TouchMove>(); Vector2 size = new Vector2(Info.m_Shape.width, Info.m_Shape.height); CanvasCore Core = new CanvasCore(ShipBuildType.BuildStair, false, ID, DataID, size); touch.InitTouchMoveCore(Core, BornPos, buildlife); AddBuildingEditPlugin(touch); TouchMoveManager.JointShipBuild(touch); }
/// <summary> /// 显示传送点 /// </summary> /// <param name="grid"></param> public void ShowTranGate(Int2 grid) { if (BattleEnvironmentM.GetBattleEnvironmentMode() == BattleEnvironmentMode.Edit) { Vector3 vEndEff = Vector3.zero; if (RoomMap.CheckHaveMap() == true) { vEndEff = RoomMap.GetRoomGridLocalPos(grid); } else { vEndEff = GenerateShip.GetbuildPos(grid); } vEndEff = U3DUtil.AddX(vEndEff, 1.0f); if (go1903041) { go1903041.SetActive(true); go1903041.transform.localPosition = vEndEff; if (go1903041.GetComponent <NdHide>() != null) { go1903041.GetComponent <NdHide>().ResetDuration(3f); } } } }
/// <summary> /// 设置参数(如传送门的传送点) /// </summary> void SetPara() { if (RoomMap.CheckRoomGridInBoat(m_roomGridTouchDown)) { TouchMove tm = TouchMoveManager.GetCurTouchMove(); if (tm) { Int2 paramPos = m_roomGridTouchDown.SoldierPos; CanvasCore buildRoomCoreTouchDown = m_roomGridTouchDown.GetBuildRoom(); tm.SetBuildParam(buildRoomCoreTouchDown, paramPos.Unit, paramPos.Layer); tm.SetBuildParaOver(); //传送门 这里没获取到 BuildProperty lifeobj = tm.GetComponent <BuildProperty>(); if (lifeobj != null && lifeobj.GetModeType() == 1605) { Building1605 b1605 = lifeobj.GetLife() as Building1605; if (b1605 != null) { b1605.SetTransGate(paramPos); } } } } else { NGUIUtil.ShowTipWndByKey("88800013"); } m_roomGridTouchDown = null; }
public static string GetBindingPropertyName() { RoomMap rm = new RoomMap(); // rm.ma return(null); }
public static bool CheckRoomGridInBoat(RoomGrid roomGrid) { if (RoomMap.IsDeckRoom(roomGrid) || RoomMap.IsPutRoom(roomGrid)) { return(true); } return(false); }
private void OnGetMatchListResponse(IncomingMessage <GetMatchListResponse> incoming) { if (RoomMap.ContainsKey(incoming.Data.Id.GUID) == false) { return; } RoomMap[incoming.Data.Id.GUID].HandleGetMatchListResponse(incoming.Data); }
private void OnCreateMatchRequest(IncomingMessage <CreateMatchRequest> incoming) { if (RoomMap.ContainsKey(incoming.Data.Id.GUID) == false) { return; } RoomMap[incoming.Data.Id.GUID].HandleCreateMatchRequest(incoming); }
private void OnStartRoomRequest(IncomingMessage <StartRoomRequest> incoming) { if (RoomMap.ContainsKey(incoming.Data.Id.GUID) == false) { return; } RoomMap[incoming.Data.Id.GUID].HandleStartRoomRequest(incoming.Data); }
private void OnMatchCreatedEvent(IncomingMessage <MatchCreatedEventModel> incoming) { if (RoomMap.ContainsKey(incoming.Data.Id.GUID) == false) { return; } RoomMap[incoming.Data.Id.GUID].HandleMatchCreatedEvent(incoming.Data); }
private void OnUserLeftEvent(IncomingMessage <UserLeftEventModel> incoming) { if (RoomMap.ContainsKey(incoming.Data.Id.GUID) == false) { return; } RoomMap[incoming.Data.Id.GUID].HandleUserLeftEvent(incoming.Data); }
private void OnUserJoinMatchRequest(IncomingMessage <JoinMatchRequest> incoming) { if (RoomMap.ContainsKey(incoming.Data.Id.GUID) == false) { return; } RoomMap[incoming.Data.Id.GUID].HandleUserJoinMatchRequest(incoming.Data, incoming.Sender.GetUserState()); }
public void DisposeEmpty() { MessageBus bus = new MessageBus(); RoomMap map = new RoomMap(bus); Action act = () => map.Dispose(); act.Should().NotThrow(); }
private RoomMap BuildRoomMap(int width, int height, bool useBorder) { var adjWidth = useBorder ? width + 2 : width; var adjHeight = useBorder ? height + 2 : height; var map = new RoomMap { Width = adjWidth, Height = adjHeight, Map = new TileType[adjWidth, adjHeight] }; for (int i = 0; i < adjWidth; i++) { for (int j = 0; j < adjHeight; j++) { map.Map[i, j] = TileType.Room; } } if (useBorder) { map.Map[0, 0] = TileType.Border; map.Map[0, adjHeight - 1] = TileType.Border; map.Map[adjWidth - 1, 0] = TileType.Border; map.Map[adjWidth - 1, adjHeight - 1] = TileType.Border; } var exits = new List <ExitInfo>(); for (int i = 1; i < adjWidth - 1; i++) { if (useBorder) { map.Map[i, 0] = TileType.Border; map.Map[i, adjHeight - 1] = TileType.Border; } exits.Add(new ExitInfo(i, 0)); exits.Add(new ExitInfo(i, adjHeight - 1)); } for (int i = 1; i < adjHeight - 1; i++) { if (useBorder) { map.Map[0, i] = TileType.Border; map.Map[adjWidth - 1, i] = TileType.Border; } exits.Add(new ExitInfo(0, i)); exits.Add(new ExitInfo(adjWidth - 1, i)); } map.Exits = exits; return(map); }
void CANVANS_BUILDING_INFO_RESP(int nErrorCode) { if (nErrorCode == 0) { //加载画布和建筑 RoomMap.CreateCanvansArea(); BattleEnvironmentM.BuildScene(); } }
static void BindStair(Int2 grid) { CanvasCore core = RoomMap.FindCanvasCore(grid, ShipBuildType.BuildRoom); if (core != null) { TouchMove tm = PutCanvasM.GetTouchMoveByCore(core); tm.MoveWithRoom(core); } }
public bool IsContainsRoomGrid(RoomGrid roomGrid) { List <RoomGrid> roomGrids = RoomMap.GetMovetoRoomGrid(m_Core, m_posMapGrid); if (roomGrids == null) { return(false); } return(roomGrids.Contains(roomGrid)); }
/// <summary> /// 获取占领的房间位置 /// </summary> public static Dictionary <RoomGrid, int> GetPutRoomGridPosition(CanvasCore core) { Dictionary <RoomGrid, int> l = new Dictionary <RoomGrid, int>(); if (core.Data != null && core.m_type != ShipBuildType.BuildRoom) { return(RoomMap.GetMovetoRoomGridPosition(core, new Int2(core.Data.cxMapGrid, core.Data.cyMapGrid))); } return(l); }
public RoomVO(string roomID, string roomName, string ownerId, string ownerName, RoomMode roomMode, RoomMap roomMap, int playerNum) { RoomID = roomID ?? throw new ArgumentNullException(nameof(roomID)); RoomName = roomName ?? throw new ArgumentNullException(nameof(roomName)); OwnerId = ownerId ?? throw new ArgumentNullException(nameof(ownerId)); OwnerName = ownerName ?? throw new ArgumentNullException(nameof(ownerName)); RoomMode = roomMode; RoomMap = roomMap; PlayerNum = playerNum; }
/// <summary> /// 加入一个房间。从仓库中加载。或加载方案 /// </summary> /// <param name="Core">核心结构</param> /// <param name="TargetPos">格子坐标</param> public static void AddNewCore(CanvasCore Core, Int2 TargetPos) { if (Core == null) { return; } ShipPlan P = ShipPlanDC.GetCurShipPlan(); if (P == null) { return; } ShipPutInfo Info = P.GetShipBuildInfo(Core); if (Info == null) { return; } if (Core.IsNewCreate) { Info.SetBuildPostion(TargetPos); P.AddShipBuildInfo(Info, Core.m_type); TouchMoveManager.MoveToShip(Core); Core.IsNewCreate = false; } // if (Core.m_type == ShipBuildType.BuildRoom) { if (Core.IsDeckRoom == false) { ShapeType Shape = Info.GetPutRoomShape(); if (Shape == null) { return; } RoomMap.OpenCanvans(Shape.GetShapeData(new Int2(Info.cxMapGrid, Info.cyMapGrid)), Core.m_ID); //设置甲板区域 RoomMap.UpdateDeckRoomGrid(); //更新金库房间 if (Info.IsGoldBuild() == true) { RoomMap.UpdateGoldRoomGrid(Core.GetPutRoomGridPos()); } } else { RoomMap.AddDeckBuild(Core.m_ID, Core.GetPutRoomGridPos()); } } else { RoomMap.AddMapPosition(Core, RoomMap.GetPutRoomGridPosition(Core)); } }
/// <summary> /// 新增士兵 /// </summary> public static void CreateSoldierFromWarehouse(int soldierId) { SoldierInfo infoSoldier = SoldierDC.GetSoldiers(soldierId); if (infoSoldier == null) { return; } CanvasCore Core = new CanvasCore(ShipBuildType.Soldier, true, ShipPutInfo.GetNewShipPutId(), infoSoldier.ID, Vector2.zero); Int2 BornPos = new Int2(0, 0); bool isCanPut = PutCanvasM.GetBornPos(Core, ref BornPos); if (isCanPut == false) { NGUIUtil.ShowTipWndByKey("88800007", 1.0f); return; } Transform t_start = GetLifeMBornNode(true); Role r = new Role(); r.CreateSkin(t_start, infoSoldier.m_modeltype, infoSoldier.m_name, AnimatorState.Stand, true); //IGameRole i = GameRoleFactory.Create(t_start, infoSoldier.m_modeltype, infoSoldier.m_name, AnimatorState.Stand); GameObject go = r.RoleSkinCom.tRoot.gameObject;; go.name = infoSoldier.m_name; Vector3 posMy = t_start.position; Vector3 screenSpace = Camera.main.WorldToScreenPoint(posMy); Vector3 pos = new Vector3(Screen.width / 2, Screen.height / 1.5f); Vector3 posTempmouse = Camera.main.ScreenToWorldPoint(new Vector3(pos.x, pos.y, screenSpace.z)); posTempmouse = U3DUtil.SetZ(posTempmouse, 0f); go.transform.localPosition = Vector3.zero; Transform tRole = go.transform.GetChild(0); TouchMove touch = tRole.gameObject.AddComponent <TouchMove>(); tRole.gameObject.transform.parent.localPosition = RoomMap.GetShipBuildLocalPos(BornPos, ShipBuildType.Soldier); touch.InitTouchMoveCore(Core, BornPos, null); AddBuildingEditPlugin(touch); if (infoSoldier.SoldierTypeID == 100003) //隐藏蹦蹦 //RolePropertyM rpm = i.GetBodyComponent<RolePropertyM>(); { r.RoleSkinCom.ShowLeftHand(false); } TouchMoveManager.JointShipBuild(touch); TouchMoveManager.SetCurTouchMove(touch); touch.WareHouse2Ship(BornPos); }
/// <summary> /// 获取已经占领的房间 /// </summary> public static List <RoomGrid> GetPutRoomGrid(CanvasCore core) { if (core.Data != null) { return(RoomMap.GetMovetoRoomGrid(core, new Int2(core.Data.cxMapGrid, core.Data.cyMapGrid))); } /// <summary> /// 获取占领的房间 /// </summary> return(new List <RoomGrid>()); }
public static void MoveToRoom(string room) { PreviousRoom = CurrentRoom; CurrentRoom = room; if (roomMap == null) { roomMap = GameObject.FindGameObjectWithTag("Room").GetComponent <RoomMap>(); } roomMap.construct(); }
public void AddTwoRooms() { MessageBus bus = new MessageBus(); using (RoomMap map = new RoomMap(bus)) { RoomMap.Point p1 = map.Add(new TestRoom(bus)); RoomMap.Point p2 = map.Add(new TestRoom(bus)); p1.Should().NotBeSameAs(p2); } }
// Start is called before the first frame update void Start() { Debug.Log("Start"); m_roomFactory = new RoomFactory(RoomWidth, RoomHeight); m_map = new RoomMap(FloorWidth, FloorHeight); m_roomFactory.CornerSprite = CornerSprite; m_roomFactory.WallSprite = WallSprite; m_roomFactory.FloorSprite = FloorSprite; CreateFloor(); Debug.Log("Finish"); }
/// <summary> /// 播放烟尘表现 /// </summary> void PlayDuskEffect() { if (m_Core.m_type != ShipBuildType.BuildRoom)//此表现只用于地形和房间 { return; } List <RoomGrid> roomGridList = RoomMap.GetPutRoomGrid(m_Core); foreach (RoomGrid roomGrid in roomGridList) { PlayDuskAtGrid(roomGrid.BuildPos); } }