Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum GameType
- {
- None = 0;
- PvP = 2;
- PvE;
- Tutorial;
- }
- class Consumables
- {
- private var path : String;
- public function Consumables(pathToConsumable : String)
- {
- path = pathToConsumable;
- // TODO: add path check
- // TODO: add uint to int wrong cast check
- tag = ExternalInterface.call("DataProvider.GetKeyValue", path + ".Tag");
- cost = parseInt( ExternalInterface.call("DataProvider.GetKeyValue", path + ".Cost") );
- delay = parseFloat( ExternalInterface.call("DataProvider.GetKeyValue", path + ".Delay") );
- gameType = Type.createEnumIndex(GameType, parseInt( ExternalInterface.call("DataProvider.GetKeyValue", path + ".gameType") ));
- }
- // data
- public var tag(default, never) : String;
- public var cost(default, never) : Int;
- public var delay(default, never) : Float;
- public var gameType(default, never) : GameType;
- // for each subtable collection codegen will generate three methods like these:
- public function GetRPGStatsValue(id : String) : RPGStats
- {
- return new RPGStats(path + ".RPGStats." + id);
- }
- public function GetRPGStatsCount() : Int
- {
- return parseInt( ExternalInterface.call("DataProvider.GetSubtablesCount", path + ".RPGStats") );
- }
- public function GetRPGStatsIterator() : Iterator<RPGStats>
- {
- var names : Array = ...; // here some code to get array of subtable name
- return {
- function hasNext() : Bool
- {
- return idx < subtableNames.length-1;
- }
- function next() : RPGStats
- {
- idx++;
- return new RPGStats(path + ".RPGStats." + subtableNames[idx-1]);
- }
- private var subtableNames : Array = names;
- private var idx : Int = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement