PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/WorldView/Structures/Item.cs

#
C# | 94 lines | 84 code | 10 blank | 0 comment | 2 complexity | 0da8a7bd33d2eb6c9c57fa6d820cc729 MD5 | raw file
  1. using System;
  2. namespace MoreTerra.Structures
  3. {
  4. public class Item
  5. {
  6. private string name;
  7. private int count;
  8. private Int32 id;
  9. private Byte prefix;
  10. #region Constructors
  11. public Item(string name, int count, byte prefix)
  12. {
  13. this.name = name;
  14. this.count = count;
  15. this.prefix = prefix;
  16. }
  17. public Item()
  18. {
  19. this.name = null;
  20. this.count = 0;
  21. this.prefix = 0;
  22. }
  23. #endregion
  24. #region GetSet Functions
  25. public string Name
  26. {
  27. get
  28. {
  29. return this.name;
  30. }
  31. set
  32. {
  33. this.name = value;
  34. }
  35. }
  36. public int Count
  37. {
  38. get
  39. {
  40. return this.count;
  41. }
  42. set
  43. {
  44. this.count = value;
  45. }
  46. }
  47. public Int32 Id
  48. {
  49. get
  50. {
  51. return id;
  52. }
  53. set
  54. {
  55. id = value;
  56. }
  57. }
  58. public Byte Prefix
  59. {
  60. get
  61. {
  62. return prefix;
  63. }
  64. set
  65. {
  66. id = value;
  67. }
  68. }
  69. #endregion
  70. #region Overrides
  71. public override string ToString()
  72. {
  73. if(count == 1)
  74. {
  75. return this.name;
  76. }
  77. else
  78. {
  79. return string.Format("{0}, Count: {1}", this.name, this.count);
  80. }
  81. }
  82. #endregion
  83. }
  84. }