public T GetItem <T>(int index, out MapItemTypes itemType, out int itemId) { var item = _dataFile.GetItem <T>(index, out var typeId, out itemId); itemType = (MapItemTypes)typeId; return(item); }
public T FindItem <T>(MapItemTypes typeId, int id) { GetType(typeId, out var start, out var num); for (var i = 0; i < num; i++) { var item = GetItem <T>(start + i, out _, out var itemId); if (id == itemId) { return(item); } } return(default);
public void GetType(MapItemTypes typeId, out int start, out int num) { for (var i = 0; i < Header.NumItemTypes; i++) { if (ItemTypes[i].TypeId != typeId) { continue; } start = ItemTypes[i].Start; num = ItemTypes[i].Num; return; } start = 0; num = 0; }
public void GetType(MapItemTypes type, out int startItems, out int numItems) { _dataFile.GetType(type, out startItems, out numItems); }
private void Initialize(MapItemTypes type, bool isHomeCover) { if (isHomeCover) { this.m_life = 2; this.m_bmp = new Bitmap[2]; this.m_bmp[0] = this.GetImage(16, 16, 16, 18, 16, 16); this.m_bmp[1] = this.GetImage(16, 16, 32, 18, 16, 16); this.m_image = this.m_bmp[0]; this.m_type = MapItemTypes.brick; } else { this.m_type = type; switch (type) { case MapItemTypes.brick: case MapItemTypes.ferum: this.m_life = 2; this.LoadImage((short)type * 16, 18, 16, 16); break; case MapItemTypes.garden: this.LoadImage((short)type * 16, 18, 16, 16); break; case MapItemTypes.water: { this.m_bmp = new Bitmap[2]; this.m_bmp[0] = this.GetImage(16, 16, 64, 18, 16, 16); this.m_bmp[1] = this.GetImage(16, 16, 80, 18, 16, 16); this.m_image = this.m_bmp[0]; } break; case MapItemTypes.ice: this.LoadImage(((short)type + 1) * 16, 18, 16, 16); break; default: break; } } }
protected override void OnPaint(gPaintEventArgs e) { if ((this.m_isHomeCover) && (this.m_bmp != null) && (this.m_life > 0)) { if (this.m_blocked < 0) { this.m_type = MapItemTypes.ferum; this.m_image = this.m_bmp[1]; } else if (this.m_blocked > 0) { if ((this.m_blocked % 16) < 8) { this.m_type = MapItemTypes.brick; this.m_image = this.m_bmp[0]; } else { this.m_type = MapItemTypes.ferum; this.m_image = this.m_bmp[1]; } this.m_blocked--; } else { this.m_type = MapItemTypes.brick; this.m_image = this.m_bmp[0]; } } if ((this.m_type == MapItemTypes.water) && (this.m_bmp != null)) { this.m_image = (this.m_life <= 20) ? this.m_bmp[0] : this.m_bmp[1]; this.m_life++; if (this.m_life > 40) this.m_life = 1; } else if ((this.m_type == MapItemTypes.brick) && (this.m_life == 1)) { switch (this.m_face) { case FaceDirection.Up: this.m_height = 8; break; case FaceDirection.Down: if (this.m_height != 8) this.m_y += 8; this.m_height = 8; break; case FaceDirection.Left: this.m_width = 8; break; case FaceDirection.Right: if (this.m_width != 8) this.m_x += 8; this.m_width = 8; break; } } base.OnPaint(e); }
public MapItem(gObject owner, MapItemTypes type, bool isHomeCover, int x, int y) : base(owner, x, y, 16, 16) { this.m_saveX = x; this.m_saveY = y; this.m_isHomeCover = isHomeCover; this.Initialize(type, isHomeCover); }