示例#1
0
        private void Start()
        {
            user = new User();
            try {
                ObjectJSON ID = ParserJSON.getObjectJSONFromAsset("ID");
                userId   = (ulong)ID.getLong("userId");
                userName = ID.getString("userName");
                Debug.Log("Using custom ID loaded from file.");
            } catch (Exception) {
                Debug.Log("Using default ID.");
            }
            user.userId   = userId;
            user.userName = userName;
            InitializeClient();

            // TEMP
            // TODO : REMOVE AND INJECT CLASSIC IDENTIFICATION ROUTINE

            /*GameLogicClient game = new GameLogicClient("M002");
             * game.gameId = 1;
             * game.currentTurn = 0;
             * user.currentGameId = game.gameId;
             * for (int i = 0; i < 2; i++) {
             *  ulong playerId = (ulong)i;
             *  int cellId = DataManager.MAP_DATA["M002"].getSpawns(2)[i];
             *  int entityId = i;
             *  string displayedName = "Player " + i;
             *  float r = 255;
             *  float g = 255 * i;
             *  float b = 255 - 255 * i;
             *
             *  Player temp = CreatePlayer(playerId, cellId, entityId, displayedName, r, g, b);
             *  if (user.userId == playerId) {
             *      user.player = temp;
             *  }
             *  temp.playerEntity.initSpell(new string[4] { "S001", "S002", "S003", "S004" });
             *  temp.playerEntity.teamId = i;
             * }
             * GUIManager.gui.linkWithLocalEntity(game.localEntity);
             * GameLogicClient.game.prepareNewTurn(DateTime.UtcNow.AddSeconds(5).ToFileTimeUtc());*/
            // END TODO : REMOVE
        }
示例#2
0
        public static void loadDataJSON()
        {
            ObjectJSON data      = ParserJSON.getObjectJSONFromAsset("DATA");
            ArrayJSON  buffs     = data.getArrayJSON("buffs");
            ArrayJSON  spells    = data.getArrayJSON("spells");
            ArrayJSON  cellTypes = data.getArrayJSON("cellTypes");
            ArrayJSON  maps      = data.getArrayJSON("maps");

            // parse and save data
            foreach (SpellData s in buildSpells(spells))
            {
                if (s != null)
                {
                    DataManager.registerData(s.id, s);
                }
            }
            foreach (BuffData b in buildBuffs(buffs))
            {
                if (b != null)
                {
                    DataManager.registerData(b.id, b);
                }
            }
            foreach (CellData ct in buildCellTypes(cellTypes))
            {
                if (ct != null)
                {
                    DataManager.registerData(ct.id, ct);
                }
            }
            foreach (MapData m in buildMaps(maps))
            {
                if (m != null)
                {
                    DataManager.registerData(m.id, m);
                }
            }

            // fill description macro
            foreach (SpellData s in DataManager.SPELL_DATA.Values)
            {
                for (int i = 0; i < 2; i++)
                {
                    string macro = StringParsingTool.getNextMacro(s.description[i]);
                    while (macro != "")
                    {
                        s.description[i] = s.description[0].Replace(macro, getMacroContent(StringParsingTool.getBetweenMacro(macro)));
                        macro            = StringParsingTool.getNextMacro(s.description[i]);
                    }
                }
            }
            foreach (BuffData b in DataManager.BUFF_DATA.Values)
            {
                string macro = StringParsingTool.getNextMacro(b.description);
                while (macro != "")
                {
                    b.description = b.description.Replace(macro, getMacroContent(StringParsingTool.getBetweenMacro(macro)));
                    macro         = StringParsingTool.getNextMacro(b.description);
                }
            }
        }