christopherreay

Zero-K CommanderModule Configuration Web Interface. JSON fmt

Apr 8th, 2011
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Example of the data spec being used:
  2. This JSON defines a space where draggable CommanderModules can be dropped.
  3. There is a different spec for each Chassis (CommanderClass)
  4. The JSON is expected to be supplied by the server. (easy)
  5. CSS Classes are assigned to Divs such that CSS can be used for the positioning of modules
  6. on an img of the commander, etc.
  7. */
  8.  
  9. var commanderClassDefs =
  10.     {"supportCommander":
  11.         {"name":"Support Commander",
  12.          "moduleSlotDict":
  13.             {"slot1":
  14.                 { "types":  ["weapon"],
  15.                   "levels": ["Basic","Battle","Adv","KrogBasher"],
  16.                 },
  17.          "slot2":
  18.                 { "types":  ["weapon-mod", "stackable", "etc."],
  19.                   "levels": ["Battle","Adv","KrogBasher"],
  20.                 }
  21.             }
  22.         },
  23.       "strikeCommander":
  24.         {"name":"Strike Commander",
  25.          "moduleSlotDict":
  26.             {"slot1":
  27.                 { "types":  ["weapon"],
  28.                   "levels": ["Basic","Battle","Adv","KrogBasher"],
  29.                 }
  30.             }
  31.         }
  32.     };
  33.  
  34. /* Modules use classes the same way. Images are loaded from an url supplied by the server.
  35.    Optionally a sound effect and an overlay image can be supplied.
  36.    Most importantly are the bounds requirements. Id like to get this right, and leave it flexibly to obvious changes in the modules
  37. */
  38. var moduleClassDict = {};
  39.   moduleClassDict.moduleClassDefs =  
  40.     { "62":
  41.       { "name"                          : "Beam Laser",
  42.         "moduleType"                    : "weapon", //grey slightly
  43.         "commanderClassRequiredList"    : ["supportCommander", "strikeCommander"], //!imp
  44.         "slotLevelRequiredList"         : ["Basic"],    //!important
  45.         "maxStackable"                  : 1,        //!important
  46.         "otherModulesRequiredList"      : [],       //!important
  47.         "tooltipKey"                    : "62",     //nicetitles
  48.         "imageURL": "../zklobby_summer/zero-k/trunk/mods/zk/unitpics/commweapon_beamlaser.png",
  49.         //optional
  50.     "equipSoundEffectURL":"",
  51.         "dequipSoundEffectURL":"",
  52.     "overlayImageURL":"",
  53.       },
  54.       "77":
  55.       { "name"                          : "Concussion Shell",
  56.         "moduleType"                    : "weapon",     //slightly shady
  57.         "commanderClassRequiredList"    : ["strikeCommander"],  //!important
  58.         "slotLevelRequiredList"         : ["Battle"],       //!important
  59.         "maxStackable"                  : 1,            //!important
  60.         "otherModulesRequiredList"      : ["62"],       //!important
  61.         "tooltipKey"                    : "77",         //nicetitles
  62.         "imageURL" : "../zklobby_summer/zero-k/trunk/mods/zk/unitpics/commweapon_concussion.png"
  63.     //optional
  64.     "equipSoundEffectURL":"",
  65.         "dequipSoundEffectURL":"",
  66.     "overlayImageURL":"",
  67.       }
  68.     };
  69.  
  70. /* The "moduleType" E.g.="weapon" I think needs extending a little. It would be nice to have little galleries (the red purple and turq boxes with icons in in the mockup) for each module type ("weapon", "weaponmod", "stackables", etc...), which are essentially colour coded. But there, at the moment are only two types of moduleSlot, weapon and other. Should I code so that the module slots accept "weaponmod", "stackble", "etc" all, which will leave room for more specialised moduleSlots later? Seems reasonable.
  71.  
  72. The idea of the interface is that most of the styling is done in css. The javascript handles assigning detailed css classes to everything and managing the constraints as shown in the fields above
  73.  
  74. Please comment
  75. */
Add Comment
Please, Sign In to add comment