PopupUIDataConfig.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { localDt } from "db://assets/Script/Frames/LocalDt";
  2. export class PopupUIDataConfig {
  3. private _uiName: string = null;
  4. private _typeImg: string = null;
  5. private _typeMoney: string = null;
  6. private _label_1: string = null;
  7. private _label_2: string = null;
  8. private _label_3: string = null;
  9. private _consume: string = null;
  10. private _funcYes: any = null;
  11. //可用军队卡槽数量
  12. private _availableCardSlot: number = 4;
  13. private static _instance: PopupUIDataConfig = null;
  14. private constructor() { };
  15. static get Instance(): PopupUIDataConfig {
  16. if (!this._instance) {
  17. this._instance = new PopupUIDataConfig();
  18. } return this._instance;
  19. }
  20. clearDt() {
  21. this._uiName = null;
  22. this._typeImg = null;
  23. this._typeMoney = null;
  24. this._label_1 = null;
  25. this._label_2 = null;
  26. this._label_3 = null;
  27. this._consume = null;
  28. this._funcYes = null;
  29. }
  30. getUIName(): string { return this._uiName };
  31. getTypeImg(): string { return this._typeImg };
  32. getTypeMoney(): string { return this._typeMoney };
  33. getLabel() {
  34. const label = [this._label_1, this._label_2, this._label_3, this._consume]
  35. return label;
  36. }
  37. getFunction(): Function {
  38. return this._funcYes;
  39. }
  40. getAvailableCardSlot(): number{
  41. return Number(localDt.getData("availableCardSlot"));
  42. //return this._availableCardSlot;
  43. }
  44. setUIName(name: string) { this._uiName = name };
  45. setTypeImg(name: string) { this._typeImg = name };
  46. setTypeMoney(name: string) { this._typeMoney = name };
  47. setLabel(label_1: string, label_2: string, label_3: string, consume: string) {
  48. this._label_1 = label_1;
  49. this._label_2 = label_2;
  50. this._label_3 = label_3;
  51. this._consume = consume;
  52. }
  53. setFunction(func: any) {
  54. this._funcYes = func;
  55. }
  56. setAvailableCardSlot(nextCount: number){
  57. localDt.saveData("availableCardSlot", nextCount)
  58. //this._availableCardSlot = nextCount;
  59. }
  60. }