ProjectGamePanel.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. function ProjectGamePanel::onAdd(%this)
  2. {
  3. %this.init("Project");
  4. }
  5. function ProjectGamePanel::onOpen(%this, %allModules)
  6. {
  7. %appCore = ModuleDatabase.findModule("AppCore", 1);
  8. if(isObject(%appCore))
  9. {
  10. %this.setTitle(%appCore.project);
  11. }
  12. %loadedModules = ModuleDatabase.findModules(true);
  13. %this.clearModules();
  14. for(%i = 0; %i < getWordCount(%allModules); %i++)
  15. {
  16. %mod = getWord(%allModules, %i);
  17. %this.addModule(%mod, %loadedModules);
  18. }
  19. %this.list.sortByText();
  20. if(%this.card.visible)
  21. {
  22. %this.refreshCard();
  23. }
  24. }
  25. function ProjectGamePanel::addModule(%this, %module, %loadedModules)
  26. {
  27. %color = %this.gray;
  28. if(%module.Deprecated)
  29. {
  30. %color = %this.darkRed;
  31. }
  32. for(%i = 0; %i < getWordCount(%loadedModules); %i++)
  33. {
  34. %loadedModule = getWord(%loadedModules, %i);
  35. if(%loadedModule == %module)
  36. {
  37. %color = %this.yellow;
  38. if(%module.Deprecated)
  39. {
  40. %color = %this.darkRed;
  41. }
  42. }
  43. }
  44. %this.list.addItemWithID(%this.getModuleName(%module), %module);
  45. %index = %this.list.findItemID(%module);
  46. %this.list.setItemColor(%index, %color);
  47. }
  48. function ProjectGamePanel::refreshCard(%this)
  49. {
  50. %module = ModuleDatabase.findModule(%this.card.moduleID, %this.card.versionID);
  51. %indexList = %this.list.findItemText(%this.getModuleName(%module));
  52. %index = getWord(%indexList, 0);
  53. if(%index != -1)
  54. {
  55. %this.list.setCurSel(%index);
  56. }
  57. %this.card.show(%module);
  58. }