public List <WallItem> ParseWall(string json) { var wallGet = JsonConvert.DeserializeObject <WallGet>(json); List <WallItem> wallItems = new List <WallItem>(); int index = 1; foreach (var item in wallGet.response.items) { var wi = new WallItem(); wi.ItemId = item.id.ToString(); wi.Text = item.text; wi.LikesCount = item.likes.count; wi.CommentsCount = item.comments.count; if (item.copy_history != null) { wi.HistoryText = item.copy_history[0].text; wi.Type = item.copy_history[0].attachments?[0].type; wi.Url = GetUrlFromAttachment(item.copy_history[0].attachments?[0], wi.Type); } else if (item.attachments != null) { wi.Type = item.attachments[0].type; wi.Url = GetUrlFromAttachment(item.attachments?[0], wi.Type); } wallItems.Add(wi); Debug.WriteLine(index++ + ": " + item.id); } return(wallItems); }
public SerializeWallItemComposer(WallItem item) : base(ServerOpCodes.WALL_ITEM_DATA) { CreateMessage(new List <WallItem> { item }); }
public static void InitializeItem() { Player1Item = new PlayerItem(); Player2Item = new PlayerItem(); Player3Item = new PlayerItem(); Player4Item = new PlayerItem(); DestructibleWallItem = new WallItem { WallType = WallType.Destructible }; UndestructibleWallItem = new WallItem { WallType = WallType.Undestructible }; BombItem = new BombItem(); ExplodedBombItem = new BombItem(); GetSpriteForPlayer(Player1Item, 0); GetSpriteForPlayer(Player2Item, 1); GetSpriteForPlayer(Player3Item, 2); GetSpriteForPlayer(Player4Item, 3); GetSpriteForWall(DestructibleWallItem); GetSpriteForWall(UndestructibleWallItem); GetSpriteForBomb(BombItem); GetSpriteForExplodedBomb(ExplodedBombItem); }
public override void Compose(Yupi.Protocol.ISender session, WallItem item, int pickerId) { using (ServerMessage message = Pool.GetMessageBuffer(Id)) { message.AppendString(item.Id.ToString()); message.AppendInteger(pickerId); session.Send(message); } }
private void onWallItemClicked(object sender, WallItem e) { if (!IsAuthorized) { return; } _sharedWallContext.SelectedWallHolder = e.WallHolder; _eventAggregator.GetEvent <WallSelectorEvents.WallSelected>().Publish(e); }
private void PickWall() { WallItem randomWall = WallList[UnityEngine.Random.Range(0, WallList.Count)]; WallList.Remove(randomWall); if (checkAdjacent(randomWall)) { maze[randomWall.x, randomWall.y] = PATH; AddAdjacentWalls(randomWall.x, randomWall.y); } }
public static void RemoveChild(WallItem Child) { foreach (DrawWall wall in Walls) { if (Child.GetFname() == wall.Fname) { wall.Children.Remove(Child); return; } } }
/// <summary> /// 工人到位后开始拆除 /// </summary> /// <param name="commandType"></param> /// <param name="finish"></param> /// <returns></returns> public IEnumerator Remove(BuildCommandType commandType, Action finish) { switch (commandType) { case BuildCommandType.RemoveGroundwork: if (HaveGroundwork) { yield return(StartCoroutine(mGroundworkItem.Remove())); mGroundworkItem = null; } break; case BuildCommandType.RemoveBuildingMaterials: if (HaveWall) { yield return(StartCoroutine(WallItem.Remove())); WallItem = null; foreach (var item in TilesManager.GetArroundTiles(IndexX, IndexY)) { if (item.HaveWall) { item.WallItem.SetWallImage(false); } } } else if (HaveDoor) { yield return(StartCoroutine(DoorItem.Remove())); DoorItem = null; foreach (var item in TilesManager.GetArroundTiles(IndexX, IndexY)) { if (item.HaveWall) { item.WallItem.SetWallImage(false); } } } break; case BuildCommandType.RemoveRoom: break; case BuildCommandType.RemoveDecorate: break; } finish(); }
public void Add(Status status, IEnumerable <User> users) { foreach (var user in users) { var wallItem = new WallItem { Unread = true, Status = status, User = user, }; db.WallItemSet.AddObject(wallItem); } db.SaveChanges(); }
public static void AddChild(WallItem Child) { foreach (DrawWall wall in Walls) { if (Child.GetFname() == wall.Fname) { wall.AddChild(Child); return; } } DrawWall wall2 = new DrawWall(Child.GetFname()); Walls.AddLast(wall2); wall2.AddChild(Child); }
public override void Compose(Yupi.Protocol.ISender session, WallItem item, UserInfo user) { using (ServerMessage message = Pool.GetMessageBuffer(Id)) { /* * message.AppendString(item.Id); * message.AppendInteger(item.BaseItem.SpriteId); * message.AppendString(item.Position.ToString()); * * message.AppendString(item.GetExtraData()); * message.AppendInteger(-1); * message.AppendInteger(item.BaseItem.Modes > 1 ? 1 : 0); * message.AppendInteger(user.Id); * message.AppendString(user.Name); * session.Send (message); */ throw new NotImplementedException(); } }
private bool checkAdjacent(WallItem randomWall) { if (!onOuterWall(randomWall.x, randomWall.y)) { if (maze[randomWall.x - 1, randomWall.y] == WALL && maze[randomWall.x - 1, randomWall.y - 1] == WALL && maze[randomWall.x, randomWall.y - 1] == WALL && maze[randomWall.x + 1, randomWall.y - 1] == WALL && maze[randomWall.x + 1, randomWall.y] == WALL) { return(true); } if (maze[randomWall.x, randomWall.y - 1] == WALL && maze[randomWall.x + 1, randomWall.y - 1] == WALL && maze[randomWall.x + 1, randomWall.y] == WALL && maze[randomWall.x + 1, randomWall.y + 1] == WALL && maze[randomWall.x, randomWall.y + 1] == WALL) { return(true); } if (maze[randomWall.x - 1, randomWall.y] == WALL && maze[randomWall.x - 1, randomWall.y + 1] == WALL && maze[randomWall.x, randomWall.y + 1] == WALL && maze[randomWall.x + 1, randomWall.y + 1] == WALL && maze[randomWall.x + 1, randomWall.y] == WALL) { return(true); } if (maze[randomWall.x, randomWall.y - 1] == WALL && maze[randomWall.x - 1, randomWall.y - 1] == WALL && maze[randomWall.x - 1, randomWall.y] == WALL && maze[randomWall.x - 1, randomWall.y + 1] == WALL && maze[randomWall.x, randomWall.y + 1] == WALL) { return(true); } } return(false); }
private void ParseWallItems(DataInterceptedEventArgs e) { var ownersCount = e.Packet.ReadInteger(); for (var i = 0; i < ownersCount; i++) { // we don't really care who owns this shit e.Packet.ReadInteger(); e.Packet.ReadString(); } var furniCount = e.Packet.ReadInteger(); for (var i = 0; i < furniCount; i++) { var furniId = e.Packet.ReadString(); var spriteId = e.Packet.ReadInteger(); var wallPos = e.Packet.ReadString(); var extradata = e.Packet.ReadString(); var userId = e.Packet.ReadInteger(); var state = e.Packet.ReadInteger(); var wallItem = new WallItem(); wallItem.SpriteId = spriteId; wallItem.SpriteName = wallData.Where(t => t.Item2 == spriteId).First().Item1; wallItem.Position = wallPos; wallItem.Extradata = extradata; wallItem.UserId = txtOwnerId.Text; wallItem.State = state; room.WallItems.Add(wallItem); e.Packet.ReadInteger(); // ? } LogText(room.ToJson(), true); room = new Room(); }
/// <summary> /// 预建造 /// </summary> /// <param name="commandType"></param> /// <param name="item"></param> /// <param name="contents">建造物所包含的格子(房间等占多个格子)</param> public void PreBuild(BuildCommandType commandType, BuildingItem item, List <TileItem> contents = null) { //生成新的建造物并放置在指定层 switch (commandType) { case BuildCommandType.BuildGroundwork: mGroundworkItem = (GroundworkItem)item; mGroundworkItem.BindTileItem(this); break; case BuildCommandType.BuildWall: WallItem = (WallItem)item; WallItem.BindTileItem(this); if (BelongRoom) //在已有房间内建墙,墙壁不属于房间的一部分 { RoomItem.UnBindTileItem(this); RoomItem = null; } break; case BuildCommandType.BuildDoor: DoorItem = (DoorItem)item; DoorItem.BindTileItem(this); break; case BuildCommandType.BuildRoom: RoomItem = (RoomItem)item; RoomItem.BindTileItem(contents); break; case BuildCommandType.BuildDecorate: break; } mPreBuildingItem = item; mPreBuildingItem.PreBuild(); }
private void onWallItemClicked(WallItem wallItem) { try { //IsBusy = true; //await Wall.PullWithScheduleHightlightAsync(wallItem.WallHolder, CurrentPostTypeFilter.GetFilter(), // CurrentSchedule); _regionManager.RequestNavigate(RegionNames.MainRegion, ViewNames.Content, result => { _eventAggregator.GetEvent <UploaderEvents.Configure>().Publish(new UploaderViewModelConfiguration() { WallId = wallItem.WallHolder.ID, IsEnabled = true, DateOverride = -1 }); }); _eventAggregator.GetEvent <ShellEvents.WallSelectedEvent>().Publish(true); } catch (VkException ex) { MessageBox.Show(ex.Message, "Error occured", MessageBoxButton.OK, MessageBoxImage.Error); } finally { //IsBusy = false; } }
public void AddChild(WallItem Child) { Children.AddLast(Child); }
private static void GetSpriteForWall(WallItem wall) { switch (wall.WallType) { case WallType.Undestructible: wall.ImageInUse = new ImageBrush(new BitmapImage(new Uri(ConfigurationManager.AppSettings["ImagePath"] + @"\Undestructible.png"))); break; case WallType.Destructible: wall.ImageInUse = new ImageBrush(new BitmapImage(new Uri(ConfigurationManager.AppSettings["ImagePath"] + @"\Destructible.png"))); break; } }
public static WallItem CreateWallItem(int wallItemID, int customerID, global::System.DateTime entryDate) { WallItem wallItem = new WallItem(); wallItem.WallItemID = wallItemID; wallItem.CustomerID = customerID; wallItem.EntryDate = entryDate; return wallItem; }
public void AddToCustomerWall(WallItem wallItem) { base.AddObject("CustomerWall", wallItem); }