Mirror of Svelto.ECS because we're a fan of it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
891B

  1. using System;
  2. namespace Svelto.ECS.Experimental
  3. {
  4. [Serialization.DoNotSerialize]
  5. public struct ECSString:IEquatable<ECSString>
  6. {
  7. uint id;
  8. public ECSString(string newText)
  9. {
  10. id = ResourcesECSDB<string>.ToECS(newText);
  11. }
  12. public static implicit operator string(ECSString ecsString)
  13. {
  14. return ResourcesECSDB<string>.FromECS(ecsString.id);
  15. }
  16. public void Set(string newText)
  17. {
  18. if (id != 0)
  19. ResourcesECSDB<string>.resources(id) = newText;
  20. else
  21. id = ResourcesECSDB<string>.ToECS(newText);
  22. }
  23. public bool Equals(ECSString other)
  24. {
  25. return other.id == id;
  26. }
  27. public override string ToString()
  28. {
  29. return ResourcesECSDB<string>.FromECS(id);
  30. }
  31. }
  32. }